r294274 - Driver: Do not link safestack with --whole-archive.
Peter Collingbourne via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 6 19:21:57 PST 2017
Author: pcc
Date: Mon Feb 6 21:21:57 2017
New Revision: 294274
URL: http://llvm.org/viewvc/llvm-project?rev=294274&view=rev
Log:
Driver: Do not link safestack with --whole-archive.
This allows it to be used with the other sanitizers.
Differential Revision: https://reviews.llvm.org/D29545
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/sanitizer-ld.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294274&r1=294273&r2=294274&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Feb 6 21:21:57 2017
@@ -3365,8 +3365,10 @@ collectSanitizerRuntimes(const ToolChain
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("ubsan_standalone_cxx");
}
- if (SanArgs.needsSafeStackRt())
- StaticRuntimes.push_back("safestack");
+ if (SanArgs.needsSafeStackRt()) {
+ NonWholeStaticRuntimes.push_back("safestack");
+ RequiredSymbols.push_back("__safestack_init");
+ }
if (SanArgs.needsCfiRt())
StaticRuntimes.push_back("cfi");
if (SanArgs.needsCfiDiagRt()) {
@@ -3417,7 +3419,7 @@ static bool addSanitizerRuntimes(const T
if (SanArgs.hasCrossDsoCfi() && !AddExportDynamic)
CmdArgs.push_back("-export-dynamic-symbol=__cfi_check");
- return !StaticRuntimes.empty();
+ return !StaticRuntimes.empty() || !NonWholeStaticRuntimes.empty();
}
static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=294274&r1=294273&r2=294274&view=diff
==============================================================================
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Mon Feb 6 21:21:57 2017
@@ -416,7 +416,9 @@
//
// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-SAFESTACK-LINUX-NOT: "-lc"
+// CHECK-SAFESTACK-LINUX-NOT: whole-archive
// CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a"
+// CHECK-SAFESTACK-LINUX: "-u" "__safestack_init"
// CHECK-SAFESTACK-LINUX: "-lpthread"
// CHECK-SAFESTACK-LINUX: "-ldl"
More information about the cfe-commits
mailing list