[compiler-rt] 7b96d13 - [rtsan] Add dl, rt, m, and log libraries as unit test dependencies, get rid of atomic (#98264)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 19:31:31 PDT 2024
Author: Chris Apple
Date: 2024-07-09T19:31:26-07:00
New Revision: 7b96d13341aa94d11c2d9ffe5a9304e3640ad80b
URL: https://github.com/llvm/llvm-project/commit/7b96d13341aa94d11c2d9ffe5a9304e3640ad80b
DIFF: https://github.com/llvm/llvm-project/commit/7b96d13341aa94d11c2d9ffe5a9304e3640ad80b.diff
LOG: [rtsan] Add dl, rt, m, and log libraries as unit test dependencies, get rid of atomic (#98264)
Fixing test failures in #98256
There are two issues being fixed here:
```
ld.lld: error: undefined symbol: dlvsym
ld.lld: error: undefined symbol: dlvsym
```
Fixed by linking dl
```
FAILED: ... -lstdc++ -no-pie -pthread -latomic -m64
/opt/rh/devtoolset-11/root/usr/lib/gcc/ppc64-redhat-linux/11/../../../../bin/ld: cannot find /usr/lib64/libatomic.so.1
```
Fixed by removing atomic from the dependencies, I don't think we were
even using it.
I added in all of the dependencies used by the parent library in the
tests, hopefully getting ahead of any other issues, adding rt and m,
even if we haven't had issues with them yet
Added:
Modified:
compiler-rt/lib/rtsan/tests/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/lib/rtsan/tests/CMakeLists.txt b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
index a379e4029633e..9eda116541ae3 100644
--- a/compiler-rt/lib/rtsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
@@ -36,15 +36,17 @@ set(RTSAN_UNITTEST_LINK_FLAGS
${SANITIZER_TEST_CXX_LIBRARIES}
-no-pie)
+append_list_if(COMPILER_RT_HAS_LIBDL -ldl RTSAN_UNITTEST_LINK_FLAGS)
+append_list_if(COMPILER_RT_HAS_LIBRT -lrt RTSAN_UNITTEST_LINK_FLAGS)
+append_list_if(COMPILER_RT_HAS_LIBM -lm RTSAN_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread RTSAN_UNITTEST_LINK_FLAGS)
+append_list_if(COMPILER_RT_HAS_LIBLOG -llog RTSAN_UNITTEST_LINK_FLAGS)
if (APPLE)
add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
list(APPEND RTSAN_UNITTEST_LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS})
list(APPEND RTSAN_UNITTEST_LINK_FLAGS ${DARWIN_osx_LINK_FLAGS})
list(APPEND RTSAN_UNITTEST_CFLAGS ${DARWIN_osx_CFLAGS})
-else()
- list(APPEND RTSAN_UNITTEST_LINK_FLAGS -latomic)
endif()
set(COMPILER_RT_GOOGLETEST_SOURCES ${COMPILER_RT_GTEST_SOURCE} ${COMPILER_RT_GMOCK_SOURCE})
More information about the llvm-commits
mailing list