1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibC: Properly implement stack protectors

The shared parts are now firmly compiled into LibC instead of being
defined as a static library and then being copied over manually.
The non-shared ("local") parts are kept as a static library that is
linked into each binary on demand.

This finally allows us to support linking with the -fstack-protector
flag, which now replaces the `ssp` target being linked into each binary
accidentally via CMake.
This commit is contained in:
Tim Schumacher 2022-10-25 23:53:07 +02:00 committed by Linus Groh
parent 7834e26ddb
commit 678db534ff
7 changed files with 45 additions and 21 deletions

View file

@ -9,6 +9,15 @@ function(serenity_set_implicit_links target_name)
# slightly outdated stub in the sysroot, but have not yet installed the freshly
# built LibC.
target_link_libraries(${target_name} LibC)
# Same goes for -lssp_nonshared, which is required during build time but is not
# yet installed in the sysroot. However, we just want to add the link directory
# and a dependency here, since actually linking the library is decided on by
# passing one of the -fstack-protector options.
# -lssp is contained inside LibC, so that case is handled by the above and a linker
# script.
target_link_directories(${target_name} PRIVATE "$<TARGET_FILE_DIR:ssp_nonshared>")
add_dependencies(${target_name} ssp_nonshared)
endfunction()
function(serenity_install_headers target_name)