Skip to content

Commit cf035ca

Browse files
amy-kwantstellar
authored andcommitted
[scudo][standalone] Link tests against libatomic if libatomic exists
It is possible that libatomic does not exist on some systems. This patch updates the scudo standalone tests to link against libatomic if the library exists. This is an update to the original patch: https://reviews.llvm.org/D64134 and aims to resolve https://bugs.llvm.org/show_bug.cgi?id=51431. Differential Revision: https://reviews.llvm.org/D108503 (cherry picked from commit 4cd8dd3)
1 parent 1f0b043 commit cf035ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
3939
endforeach()
4040
list(APPEND LINK_FLAGS -pthread)
4141
# Linking against libatomic is required with some compilers
42-
list(APPEND LINK_FLAGS -latomic)
42+
check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC)
43+
if (COMPILER_RT_HAS_LIBATOMIC)
44+
list(APPEND LINK_FLAGS -latomic)
45+
endif()
4346

4447
set(SCUDO_TEST_HEADERS
4548
scudo_unit_test.h

0 commit comments

Comments
 (0)