diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b61fc8..fc5f3fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ file(GLOB photon_libc_crt ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/machine/${machine}/crt*.s) add_library(crt OBJECT ${photon_libc_crt}) -target_compile_options(crt PRIVATE -c) +target_compile_options(crt PRIVATE -c -ffreestanding -nostdlib) file(GLOB platform_sources ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/*.c diff --git a/photon/libc/sys/magenta/machine/x86_64/crt0.s b/photon/libc/sys/magenta/machine/x86_64/crt0.s index 90e0b6d..375b84c 100644 --- a/photon/libc/sys/magenta/machine/x86_64/crt0.s +++ b/photon/libc/sys/magenta/machine/x86_64/crt0.s @@ -11,7 +11,8 @@ _start: mov %rsp, %rsi andq $-16, %rsp call __crt_init - movq %rax, %rsi - movq $1, %rdi /* MX_EXIT_ALL_THREADS */ - movq $1, %rax /* mx_exit() */ + movq %rax, %rdx + movq $1, %rsi /* MX_EXIT_ALL_THREADS */ + movq $0, %rdi /* MX_NULL_HANDLE */ + movq $23, %rax /* mx_process_kill() */ syscall