Skip to content

Commit b846176

Browse files
authored
[compiler-rt] Moved cmake libatomic check to top level config-ix (#99437)
Also add atomic check to rtsan for when the tests are merged (related review #98679)
1 parent b177ac4 commit b846176

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

compiler-rt/cmake/config-ix.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ check_cxx_compiler_flag(-nostdlib++ COMPILER_RT_HAS_NOSTDLIBXX_FLAG)
176176
check_include_files("sys/auxv.h" COMPILER_RT_HAS_AUXV)
177177

178178
# Libraries.
179+
check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC)
179180
check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
180181
check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
181182
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)

compiler-rt/lib/rtsan/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(RTSAN_UNITTEST_LINK_FLAGS
3636
${SANITIZER_TEST_CXX_LIBRARIES}
3737
-no-pie)
3838

39+
append_list_if(COMPILER_RT_HAS_LIBATOMIC -latomic RTSAN_UNITTEST_LINK_FLAGS)
3940
append_list_if(COMPILER_RT_HAS_LIBDL -ldl RTSAN_UNITTEST_LINK_FLAGS)
4041
append_list_if(COMPILER_RT_HAS_LIBRT -lrt RTSAN_UNITTEST_LINK_FLAGS)
4142
append_list_if(COMPILER_RT_HAS_LIBM -lm RTSAN_UNITTEST_LINK_FLAGS)

compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ set(SCUDO_UNITTEST_LINK_FLAGS
4646
${COMPILER_RT_UNWINDER_LINK_LIBS}
4747
${SANITIZER_TEST_CXX_LIBRARIES})
4848
list(APPEND SCUDO_UNITTEST_LINK_FLAGS -pthread -no-pie)
49-
# Linking against libatomic is required with some compilers
50-
check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC)
51-
if (COMPILER_RT_HAS_LIBATOMIC)
52-
list(APPEND SCUDO_UNITTEST_LINK_FLAGS -latomic)
53-
endif()
49+
50+
append_list_if(COMPILER_RT_HAS_LIBATOMIC -latomic SCUDO_UNITTEST_LINK_FLAGS)
5451

5552
set(SCUDO_TEST_HEADERS
5653
scudo_unit_test.h

0 commit comments

Comments
 (0)