Files
Raúl Marín 507527af26 Unify compiler-rt linking between Linux and FreeBSD
Extracts the compiler-rt linking block (builtins/sanitizer/XRay paths,
-fno-sanitize-link-runtime, -fno-xray-link-deps, --whole-archive
wiring into CMAKE_EXE_LINKER_FLAGS) into cmake/compiler_rt_link.cmake
and includes it from both cmake/linux/default_libs.cmake and
cmake/freebsd/default_libs.cmake. Both OSes now consistently link our
in-tree compiler-rt runtimes; previously only Linux did, and FreeBSD
sanitizer builds would have mixed our runtime with clang's auto-injected
system runtime.

The OS-specific bits that don't belong in the shared block — llvm-libc
math dispatch, Android/musl libc variants, glibc-compatibility — stay
in linux/default_libs.cmake.

Addresses bot review comment on PR #102857.
2026-04-29 03:04:41 +00:00

18 lines
556 B
CMake

set (DEFAULT_LIBS "-nodefaultlibs")
# Wire compiler-rt runtimes (builtins/sanitizers/XRay) into the link flags.
include (cmake/compiler_rt_link.cmake)
set (DEFAULT_LIBS "${DEFAULT_LIBS} -lc -lm -lrt -lpthread")
message(STATUS "Default libraries: ${DEFAULT_LIBS}")
set(CMAKE_CXX_STANDARD_LIBRARIES ${DEFAULT_LIBS})
set(CMAKE_C_STANDARD_LIBRARIES ${DEFAULT_LIBS})
add_library(Threads::Threads INTERFACE IMPORTED)
set_target_properties(Threads::Threads PROPERTIES INTERFACE_LINK_LIBRARIES pthread)
include (cmake/unwind.cmake)
include (cmake/cxx.cmake)