[llvm-branch-commits] [compiler-rt] cf035ca - [scudo][standalone] Link tests against libatomic if libatomic exists
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 23 13:42:04 PDT 2021
Author: Amy Kwan
Date: 2021-08-23T13:41:46-07:00
New Revision: cf035cac186b57b51fc89b5bf59f043e1b61fc8c
URL: https://github.com/llvm/llvm-project/commit/cf035cac186b57b51fc89b5bf59f043e1b61fc8c
DIFF: https://github.com/llvm/llvm-project/commit/cf035cac186b57b51fc89b5bf59f043e1b61fc8c.diff
LOG: [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 4cd8dd3fe05e099792e1494dedd074eb5ba289b6)
Added:
Modified:
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
index f4186eba16881..eaa47a04a179a 100644
--- a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -39,7 +39,10 @@ foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
endforeach()
list(APPEND LINK_FLAGS -pthread)
# Linking against libatomic is required with some compilers
-list(APPEND LINK_FLAGS -latomic)
+check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC)
+if (COMPILER_RT_HAS_LIBATOMIC)
+ list(APPEND LINK_FLAGS -latomic)
+endif()
set(SCUDO_TEST_HEADERS
scudo_unit_test.h
More information about the llvm-branch-commits
mailing list