[clang] [lld] [lld][COFF] Add optimization remarks options to lld-link (PR #205390)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 8 00:13:29 PDT 2026


================
@@ -490,6 +490,9 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     linkPath = TC.GetProgramPath(Linker.str().c_str());
   }
 
+  if (auto LTO = TC.getLTOMode(Args); LTO != LTOK_None)
+    addLTOOptions(TC, Args, CmdArgs, Output, Inputs, LTO == LTOK_Thin);
----------------
mstorsjo wrote:

Wouldn't this pass the options in the exact same form as it is done for the unix linkers, while lld-link takes options normally in a different style?

I see that you in lld-link take the unix style linker options `-plugin-opt=opt-remarks-filename=` and map them to the proper lld-link style options. I'm a little undecided about this, if this is reasonable.

Is there any precedent anywhere, for clang adding lld-link specific options?

(I get that it would require more changes to clang and the `addLTOOptions` function if we want to support two spellings of those options.)

This change needs tests of its own in Clang in any case, to clearly show clang invoking `lld-link` and exactly which options it passes. It might also be better to have this be a separate change on top of the basic one for LLD that adds the new options.

Ideally I'd like acknowledgements from at least someone else familiar with this area too... @rnk, @zmodem?

https://github.com/llvm/llvm-project/pull/205390


More information about the cfe-commits mailing list