[PATCH] D29545: Driver: Do not link safestack with --whole-archive.

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 19:33:22 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294274: Driver: Do not link safestack with --whole-archive. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D29545?vs=87106&id=87358#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29545

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/sanitizer-ld.c


Index: cfe/trunk/test/Driver/sanitizer-ld.c
===================================================================
--- cfe/trunk/test/Driver/sanitizer-ld.c
+++ cfe/trunk/test/Driver/sanitizer-ld.c
@@ -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"
 
Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -3365,8 +3365,10 @@
     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 @@
   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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29545.87358.patch
Type: text/x-patch
Size: 1496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170207/eee7a9b7/attachment.bin>


More information about the cfe-commits mailing list