[PATCH] D57303: [ToolChains] [NetBSD] Append -rpath for shared compiler-rt runtimes

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 27 10:01:12 PST 2019


mgorny created this revision.
mgorny added reviewers: krytarowski, joerg, phosek, dlj.
Herald added a subscriber: dberris.

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.


Repository:
  rC Clang

https://reviews.llvm.org/D57303

Files:
  lib/Driver/ToolChains/NetBSD.cpp


Index: lib/Driver/ToolChains/NetBSD.cpp
===================================================================
--- lib/Driver/ToolChains/NetBSD.cpp
+++ lib/Driver/ToolChains/NetBSD.cpp
@@ -255,6 +255,13 @@
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
 
+  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
+  if (SanArgs.needsSharedRt()) {
+    CmdArgs.push_back("-rpath");
+    CmdArgs.push_back(Args.MakeArgString(
+        ToolChain.getCompilerRTPath().c_str()));
+  }
+
   unsigned Major, Minor, Micro;
   ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
   bool useLibgcc = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57303.183758.patch
Type: text/x-patch
Size: 685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190127/92010641/attachment.bin>


More information about the cfe-commits mailing list