From: Michal Gorny Date: Wed, 30 Jan 2019 08:20:24 +0000 (+0000) Subject: [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=339f71a59807d64c4749d498d34a74ffdde516c2;p=clang [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes 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. Differential Revision: https://reviews.llvm.org/D57303 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352610 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/NetBSD.cpp b/lib/Driver/ToolChains/NetBSD.cpp index ecc7c9dc1b..ae9564b817 100644 --- a/lib/Driver/ToolChains/NetBSD.cpp +++ b/lib/Driver/ToolChains/NetBSD.cpp @@ -255,6 +255,13 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, 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;