Revert "[ASan] Not linking asan_static library for DSO."

This reverts commit cf730d8ce1. It turned out that D118184 is causing segfaults in some situations.

Reviewed By: vitalybuka, kda

Differential Revision: https://reviews.llvm.org/D118739
This commit is contained in:
Kirill Stoimenov 2022-02-01 20:39:29 +00:00
parent ae7ee655a9
commit d7dd7ad827
2 changed files with 5 additions and 5 deletions

View File

@ -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.

View File

@ -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 \