================ @@ -535,6 +535,21 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, D.getLTOMode() == LTOK_Thin); } + // Forward the DTLTO options to the linker. We add these unconditionally, + // rather than in addLTOOptions() as it is the linker that decides whether to + // do LTO or not dependent upon whether there are any bitcode input files in + // the link. + if (Arg *A = Args.getLastArg(options::OPT_fthinlto_distributor_EQ)) { + CmdArgs.push_back( + Args.MakeArgString("--thinlto-distributor=" + Twine(A->getValue()))); + CmdArgs.push_back( + Args.MakeArgString("--thinlto-remote-opt-tool=" + + Twine(ToolChain.getDriver().getClangProgramPath()))); + + for (auto A : Args.getAllArgValues(options::OPT_Xthinlto_distributor_EQ)) + CmdArgs.push_back(Args.MakeArgString("-mllvm=-thinlto-distributor-arg=" + A)); ---------------- bd1976bris wrote:
Having looked at this again I think your suggestion of making `--thinlto-remote-opt-tool` a `cl::opt` tool makes sense. I have updated the code to match. Please take a look. https://github.com/llvm/llvm-project/pull/126654 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits