LibC: Fix compile and link flags
We were linking with -nostdlib and manually linked against libgcc. This does not link with crtbegin and crtend which provides __dso_handle preventing use of some global C++ constructors inside libc. Now we just don't link against libc fixing this issue
This commit is contained in:
parent
acebe68dfa
commit
e1c337a483
|
|
@ -76,7 +76,7 @@ set(LIBC_SOURCES
|
||||||
add_library(objlibc OBJECT ${LIBC_SOURCES})
|
add_library(objlibc OBJECT ${LIBC_SOURCES})
|
||||||
target_compile_definitions(objlibc PRIVATE __arch=${BANAN_ARCH})
|
target_compile_definitions(objlibc PRIVATE __arch=${BANAN_ARCH})
|
||||||
|
|
||||||
target_compile_options(objlibc PRIVATE -O2 -g -Wstack-usage=512 -fno-exceptions -fpic -nolibc)
|
target_compile_options(objlibc PRIVATE -O2 -g -Wstack-usage=512 -fno-exceptions -fno-rtti -fpic)
|
||||||
target_compile_options(objlibc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
|
target_compile_options(objlibc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
|
||||||
|
|
||||||
function(add_crtx crtx)
|
function(add_crtx crtx)
|
||||||
|
|
@ -99,11 +99,8 @@ banan_install_headers(objlibc)
|
||||||
add_library(libc-static STATIC $<TARGET_OBJECTS:objlibc>)
|
add_library(libc-static STATIC $<TARGET_OBJECTS:objlibc>)
|
||||||
add_library(libc-shared SHARED $<TARGET_OBJECTS:objlibc>)
|
add_library(libc-shared SHARED $<TARGET_OBJECTS:objlibc>)
|
||||||
|
|
||||||
target_link_options(libc-static PRIVATE -nostdlib)
|
target_link_options(libc-static PRIVATE -nolibc)
|
||||||
target_link_libraries(libc-static PRIVATE -lgcc)
|
target_link_options(libc-shared PRIVATE -nolibc)
|
||||||
|
|
||||||
target_link_options(libc-shared PRIVATE -nostdlib)
|
|
||||||
target_link_libraries(libc-shared PRIVATE -lgcc)
|
|
||||||
|
|
||||||
install(TARGETS libc-static OPTIONAL)
|
install(TARGETS libc-static OPTIONAL)
|
||||||
install(TARGETS libc-shared OPTIONAL)
|
install(TARGETS libc-shared OPTIONAL)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue