[compiler-rt] [rtsan] Add dl, rt, m, and log libraries as unit test dependencies, get rid of atomic (PR #98264)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 19:28:47 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Chris Apple (cjappl)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/98264.diff
1 Files Affected:
- (modified) compiler-rt/lib/rtsan/tests/CMakeLists.txt (+4-2)
``````````diff
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})
``````````
</details>
https://github.com/llvm/llvm-project/pull/98264
More information about the llvm-commits
mailing list