What's the difference between `-Clink-args` and `-Zpre-link-args`?

-Clink-args vs -Zpre-link-args

Looks like they all accept the same set options/flags, what exactly the pre- version means?

pre- variants put the link args much earlier in the linker commandline I believe. For many linker arguments the order in which they are passed is important. The pre- variants help when you need the linker arguments before what the non-pre- variants do.

1 Like

How to know the link-args order, or which ones should be put at pre- or post- linking stage.

Tried some flags, [pre-]link-args=-f... -m... -g... can be set at both stages and compiles fine. Dig into some LLVM and Rust repo docs, nowhere mentioned what options should be set at pre-/post- linking process.

Very confused for now... is there some guidelines or rules about it?

Most of the time putting it in -Clink-args is fine. Unless you have a case where -Zpre-link-args is needed, you should probably just forget about it.