Summary:
This code passed the value of `-rpath` directly to the clang invocation.
If we're using the linker then it'll be fine. However, if the linker is
`gcc` as is the case when doing `-fopenmp-targets=x86_64` then this will
cause problems. This patch adds the `-Wl,-rpath,` to feed it to the
linker correctly.
CmdArgs.push_back("-Wl,-Bsymbolic");
CmdArgs.push_back("-shared");
ArgStringList LinkerArgs;
- for (const opt::Arg *Arg :
- Args.filtered(OPT_library, OPT_rpath, OPT_library_path))
+ for (const opt::Arg *Arg : Args.filtered(OPT_library, OPT_library_path))
Arg->render(Args, LinkerArgs);
+ for (const opt::Arg *Arg : Args.filtered(OPT_rpath))
+ LinkerArgs.push_back(
+ Args.MakeArgString("-Wl,-rpath," + StringRef(Arg->getValue())));
llvm::copy(LinkerArgs, std::back_inserter(CmdArgs));
}