[clang] [LinkerWrapper] Pass all files to the device linker (PR #97573)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 15:40:24 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))
----------------
Artem-B wrote:
Is `-save-temps` propagated from the top-level compilation?
If so, how do we handle `--save-temps=obj -o /some/other/dir/foo.o` ?
https://github.com/llvm/llvm-project/pull/97573
More information about the cfe-commits
mailing list