[lld] [LLD] [MinGW] Implement --dependent-load-flag option (PR #113814)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 13:23:09 PST 2024


mstorsjo wrote:

> > I don't see how that contradicts what I'm saying :-) As long as `libmingwex.a` is involved in the link, LLD will pull the `_load_config_used` symbol from there.
> 
> Due to the late hour, I forgot to write one more thing: it would be useful to distinguish "typical" static libraries from CRT ones. Because I understood this part:
> 
> > Hmm, but isn't `_load_config_used` linked in whenever it is found in any of the static libraries?
> 
> As if any static libraries were allowed to provide it.

Well I don't see a reason why they can't be allowed to do it? It's surely a nontypical setup, but I guess it could be possible for an advanced app to provide it themselves if they expect to run with toolchains that don't provide it.

Anyway, this is all theoretical...

> > Ah, right, I forgot about that detail. I presume that this is what @mati865 was referring to?
> 
> Yeah, I meant to say the typical static libraries should never contain that symbol, and mingw-w64 libs provide it only when CFG is enabled.

Right, indeed - I had forgot about this detail. So it is available as long as mingw-w64 was built with CFG enabled, even if the user app isn't built with CFG enabled (which was what I referred to); user apps can use `--dependent-load-flag` even if they're not using CFG, as long as the toolchain provides `_load_config_used` (which currently is tied to how mingw-w64 was built, but we can consider changing that).

---

Anyway, to sum things up - this patch is fine and I guess there's no unfinished discussion thread that would block merging it - right?

@alvinhochun's great suggestion about warning if `-dependentloadflag:` is used without a load config being available, can be done by either of us as a separate later step.

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


More information about the llvm-commits mailing list