* separate initialization routines into _start and do_start for all architectures. * lift do_start as a separate object library to avoid code duplication. * (addtionally) address the problem of building hermetic libc with -fstack-pointer-* The `crt1.o` is now a merged result of three components: ``` ___ |___ x86_64 | |_______ start.cpp.o <- _start (loads process initial stack and aligns stack pointer) | |_______ tls.cpp.o <- init_tls, cleanup_tls, set_thread_pointer (TLS related routines) |___ do_start.cpp.o <- do_start (sets up global variables and invokes the main function) ```
26 lines
566 B
CMake
26 lines
566 B
CMake
add_startup_object(
|
|
tls
|
|
SRC
|
|
tls.cpp
|
|
DEPENDS
|
|
libc.config.linux.app_h
|
|
libc.include.sys_mman
|
|
libc.include.sys_syscall
|
|
libc.src.__support.OSUtil.osutil
|
|
libc.src.string.memory_utils.inline_memcpy
|
|
COMPILE_OPTIONS
|
|
-fno-omit-frame-pointer
|
|
-ffreestanding # To avoid compiler warnings about calling the main function.
|
|
)
|
|
|
|
add_startup_object(
|
|
start
|
|
SRC
|
|
start.cpp
|
|
DEPENDS
|
|
libc.config.linux.app_h
|
|
COMPILE_OPTIONS
|
|
-fno-omit-frame-pointer
|
|
-ffreestanding # To avoid compiler warnings about calling the main function.
|
|
)
|