1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00
serenity/Userland/Libraries/LibSanitizer/CMakeLists.txt
Tim Schumacher 678db534ff 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.
2022-11-01 14:49:09 +00:00

14 lines
486 B
CMake

set(SOURCES
UBSanitizer.cpp
../LibC/ssp.cpp
../LibC/ssp_nonshared.cpp
)
set_source_files_properties(../LibC/ssp.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
set_source_files_properties(../LibC/ssp_nonshared.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib")
serenity_libc(LibUBSanitizer ubsan)
add_library(LibUBSanitizerStatic STATIC ${SOURCES})
target_link_libraries(LibUBSanitizerStatic PRIVATE NoCoverage)