[compiler-rt] [rtsan] Explicitly link pthread in the tests and dynamic libraries (PR #98256)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 18:52:31 PDT 2024
https://github.com/cjappl updated https://github.com/llvm/llvm-project/pull/98256
>From 6a03fd21d686f2bf2b8c9c4ab3e322a21de73b7e Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Tue, 9 Jul 2024 17:32:33 -0700
Subject: [PATCH 1/3] Explicitly link pthread library for unit tests
---
compiler-rt/lib/rtsan/CMakeLists.txt | 1 +
compiler-rt/lib/rtsan/tests/CMakeLists.txt | 2 ++
2 files changed, 3 insertions(+)
diff --git a/compiler-rt/lib/rtsan/CMakeLists.txt b/compiler-rt/lib/rtsan/CMakeLists.txt
index bd7358e86e59b..e434a1d11bb64 100644
--- a/compiler-rt/lib/rtsan/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/CMakeLists.txt
@@ -84,6 +84,7 @@ else()
${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
LINK_FLAGS ${RTSAN_LINK_FLAGS}
CFLAGS ${RTSAN_CFLAGS}
+ LINK_LIBS ${RTSAN_LINK_LIBS}
PARENT_TARGET rtsan)
endif()
diff --git a/compiler-rt/lib/rtsan/tests/CMakeLists.txt b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
index e539ebc387e0a..a379e4029633e 100644
--- a/compiler-rt/lib/rtsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
@@ -36,6 +36,8 @@ set(RTSAN_UNITTEST_LINK_FLAGS
${SANITIZER_TEST_CXX_LIBRARIES}
-no-pie)
+append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread 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})
>From 1a8fbc9547d2753964ede425631fdf6aed7fe29c Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Tue, 9 Jul 2024 17:34:17 -0700
Subject: [PATCH 2/3] Revert "[rtsan] Temporarily disable runtime to fix bots
after #98219 (#98250)"
This reverts commit 14f745074d05fb42f5c8a625c79bf557bb980ebb.
---
compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index c8bec41db36e9..bc152e304aaaf 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -32,9 +32,9 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${LOONGARCH64})
set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
-#set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
-# ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
-# ${LOONGARCH64})
+set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
+ ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
+ ${LOONGARCH64})
if(ANDROID)
set(OS_NAME "Android")
>From 0ee8ff1e209c812b038d159866c95635140de191 Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Tue, 9 Jul 2024 18:52:18 -0700
Subject: [PATCH 3/3] PR: Remove pthread from static library
---
compiler-rt/lib/rtsan/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/compiler-rt/lib/rtsan/CMakeLists.txt b/compiler-rt/lib/rtsan/CMakeLists.txt
index e434a1d11bb64..bd7358e86e59b 100644
--- a/compiler-rt/lib/rtsan/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/CMakeLists.txt
@@ -84,7 +84,6 @@ else()
${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
LINK_FLAGS ${RTSAN_LINK_FLAGS}
CFLAGS ${RTSAN_CFLAGS}
- LINK_LIBS ${RTSAN_LINK_LIBS}
PARENT_TARGET rtsan)
endif()
More information about the llvm-commits
mailing list