[PATCH] D54784: Use --push/pop-state with XRay link deps

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 21 00:46:58 PST 2018


phosek created this revision.
phosek added a reviewer: dberris.
Herald added a subscriber: cfe-commits.

XRay runtime link deps handling passes --no-as-needed, but it never
undoes it and this flag may affect other libraries that come later on
the link line. To avoid this, wrap XRay link deps in --push/pop-state.


Repository:
  rC Clang

https://reviews.llvm.org/D54784

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/XRay/xray-shared-noxray.cpp


Index: clang/test/Driver/XRay/xray-shared-noxray.cpp
===================================================================
--- clang/test/Driver/XRay/xray-shared-noxray.cpp
+++ clang/test/Driver/XRay/xray-shared-noxray.cpp
@@ -7,6 +7,9 @@
 //
 // SHARED-NOT: {{clang_rt\.xray-}}
 // STATIC: {{clang_rt\.xray-}}
+// STATIC: "--push-state"
+// STATIC: "--no-as-needed"
+// STATIC: "--pop-state"
 //
 // REQUIRES: linux, enable_shared
 int foo() { return 42; }
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -788,6 +788,7 @@
 }
 
 void tools::linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) {
+  CmdArgs.push_back("--push-state");
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
   if (TC.getTriple().getOS() != llvm::Triple::OpenBSD)
@@ -798,6 +799,7 @@
       TC.getTriple().getOS() != llvm::Triple::NetBSD &&
       TC.getTriple().getOS() != llvm::Triple::OpenBSD)
     CmdArgs.push_back("-ldl");
+  CmdArgs.push_back("--pop-state");
 }
 
 bool tools::areOptimizationsEnabled(const ArgList &Args) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54784.174880.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181121/37e231b9/attachment-0001.bin>


More information about the cfe-commits mailing list