[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 16:26:59 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:
My question is the origin of that option. E.g. is the user uses `--save-temps=obj -o /some/other/dir/foo.o` at the top-level clang invocation, what do we get if the offloading w/ the new driver and this patch are in effect?
Will the intermediate files end up in the current directory? In the object file directory? Both? E.g clang's files end up in the object file directory, but linker's intermediate files end up in the current dir? Or, perhaps not even created, if clangs--save-temps are not propagated to the linker-wrapper.
https://github.com/llvm/llvm-project/pull/97573
More information about the cfe-commits
mailing list