Skip to content

Commit

Permalink
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Browse files Browse the repository at this point in the history
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

llvm-svn: 352610
  • Loading branch information
mgorny committed Jan 30, 2019
1 parent 11133d2 commit 3a901b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clang/lib/Driver/ToolChains/NetBSD.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 3a901b4

Please sign in to comment.