Kernel/LibC: Add crt* files to LibC and remove crt0 from kernel
There was no reason for libc get crt0 from kernel.
This commit is contained in:
@@ -162,17 +162,6 @@ endif()
|
||||
|
||||
target_link_options(kernel PUBLIC -ffreestanding -nostdlib)
|
||||
|
||||
add_custom_target(crt0
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crt0.S -o ${CMAKE_CURRENT_BINARY_DIR}/crt0.o
|
||||
DEPENDS headers
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
TARGET crt0
|
||||
POST_BUILD
|
||||
COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${BANAN_LIB}/
|
||||
)
|
||||
|
||||
add_custom_target(kernel-headers
|
||||
COMMAND sudo rsync -a ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
COMMAND sudo rsync -a ${CMAKE_CURRENT_SOURCE_DIR}/lai/include/ ${BANAN_INCLUDE}/
|
||||
@@ -193,8 +182,8 @@ add_custom_command(
|
||||
TARGET kernel PRE_LINK
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -MD -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crti.S ${COMPILE_OPTIONS}
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -MD -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crtn.S ${COMPILE_OPTIONS}
|
||||
COMMAND cp ${CRTBEGIN} .
|
||||
COMMAND cp ${CRTEND} .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CRTBEGIN} .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CRTEND} .
|
||||
)
|
||||
|
||||
#add_custom_command(
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
.section .text
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
# Set up end of the stack frame linked list.
|
||||
movq $0, %rbp
|
||||
pushq %rbp # rip=0
|
||||
pushq %rbp # rbp=0
|
||||
movq %rsp, %rbp
|
||||
|
||||
# We need those in a moment when we call main.
|
||||
pushq %rdx
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
|
||||
# Prepare signals, memory allocation, stdio and such.
|
||||
movq %rdx, %rdi
|
||||
call _init_libc
|
||||
|
||||
# Run the global constructors.
|
||||
call _init
|
||||
|
||||
# Restore argc and argv.
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
popq %rdx
|
||||
|
||||
# Run main
|
||||
call main
|
||||
|
||||
# Terminate the process with the exit code.
|
||||
movl %eax, %edi
|
||||
call exit
|
||||
.size _start, . - _start
|
||||
Reference in New Issue
Block a user