[clang] [LinkerWrapper] Pass all files to the device linker (PR #97573)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 15:42:06 PDT 2024
================
@@ -504,18 +511,23 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
llvm::copy(LinkerArgs, std::back_inserter(CmdArgs));
}
- // Pass on -mllvm options to the clang invocation.
- for (const opt::Arg *Arg : Args.filtered(OPT_mllvm)) {
- CmdArgs.push_back("-mllvm");
- CmdArgs.push_back(Arg->getValue());
- }
+ // Pass on -mllvm options to the linker invocation.
+ for (const opt::Arg *Arg : Args.filtered(OPT_mllvm))
+ CmdArgs.push_back(
+ Args.MakeArgString("-Wl,-mllvm=" + StringRef(Arg->getValue())));
if (Args.hasArg(OPT_debug))
CmdArgs.push_back("-g");
if (SaveTemps)
CmdArgs.push_back("-save-temps");
+ if (SaveTemps && linkerSupportsLTO(Args))
----------------
jhuber6 wrote:
In this logic we only have the link job remaining, so we pass `-Wl,--save-temps` to it.
https://github.com/llvm/llvm-project/pull/97573
More information about the cfe-commits
mailing list