[clang] d7dd7ad - Revert "[ASan] Not linking asan_static library for DSO."
Kirill Stoimenov via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 1 15:58:36 PST 2022
Author: Kirill Stoimenov
Date: 2022-02-01T23:58:04Z
New Revision: d7dd7ad827a0a78314f3c9b55f4778a6059840f3
URL: https://github.com/llvm/llvm-project/commit/d7dd7ad827a0a78314f3c9b55f4778a6059840f3
DIFF: https://github.com/llvm/llvm-project/commit/d7dd7ad827a0a78314f3c9b55f4778a6059840f3.diff
LOG: Revert "[ASan] Not linking asan_static library for DSO."
This reverts commit cf730d8ce1341ba593144df2e2bc8411238e04c3. It turned out that D118184 is causing segfaults in some situations.
Reviewed By: vitalybuka, kda
Differential Revision: https://reviews.llvm.org/D118739
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/sanitizer-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 87f1c8d0c9986..6364cd133e0bf 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -845,16 +845,16 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes())
StaticRuntimes.push_back("stats_client");
+ // Always link the static runtime regardless of DSO or executable.
+ if (SanArgs.needsAsanRt())
+ HelperStaticRuntimes.push_back("asan_static");
+
// Collect static runtimes.
if (Args.hasArg(options::OPT_shared)) {
// Don't link static runtimes into DSOs.
return;
}
- // Always link the static runtime for executable.
- if (SanArgs.needsAsanRt())
- HelperStaticRuntimes.push_back("asan_static");
-
// Each static runtime that has a DSO counterpart above is excluded below,
// but runtimes that exist only as static are not affected by needsSharedRt.
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index d96cddb31d687..966edbd7d038b 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -39,7 +39,7 @@
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-SHARED-LINUX %s
//
-// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan_static-x86_64
+// CHECK-ASAN-SHARED-LINUX: libclang_rt.asan_static-x86_64
// CHECK-ASAN-SHARED-LINUX-NOT: libclang_rt.asan-x86_64
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
More information about the cfe-commits
mailing list