Skip to content

Commit 7b96d13

Browse files
authored
[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
1 parent 12239d2 commit 7b96d13

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ set(RTSAN_UNITTEST_LINK_FLAGS
3636
${SANITIZER_TEST_CXX_LIBRARIES}
3737
-no-pie)
3838

39+
append_list_if(COMPILER_RT_HAS_LIBDL -ldl RTSAN_UNITTEST_LINK_FLAGS)
40+
append_list_if(COMPILER_RT_HAS_LIBRT -lrt RTSAN_UNITTEST_LINK_FLAGS)
41+
append_list_if(COMPILER_RT_HAS_LIBM -lm RTSAN_UNITTEST_LINK_FLAGS)
3942
append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread RTSAN_UNITTEST_LINK_FLAGS)
43+
append_list_if(COMPILER_RT_HAS_LIBLOG -llog RTSAN_UNITTEST_LINK_FLAGS)
4044

4145
if (APPLE)
4246
add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
4347
list(APPEND RTSAN_UNITTEST_LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS})
4448
list(APPEND RTSAN_UNITTEST_LINK_FLAGS ${DARWIN_osx_LINK_FLAGS})
4549
list(APPEND RTSAN_UNITTEST_CFLAGS ${DARWIN_osx_CFLAGS})
46-
else()
47-
list(APPEND RTSAN_UNITTEST_LINK_FLAGS -latomic)
4850
endif()
4951

5052
set(COMPILER_RT_GOOGLETEST_SOURCES ${COMPILER_RT_GTEST_SOURCE} ${COMPILER_RT_GMOCK_SOURCE})

0 commit comments

Comments
 (0)