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

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 01:08:25 PST 2024


https://github.com/alvinhochun approved this pull request.

> > 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.

Users can supply their own `_load_config_used` symbol. Even when using MSVC it is sometimes (rarely) done to customize certain fields in the load config dir. For mingw-w64 users, if they urgently need to have DependentLoadFlag set they can build their own `loadcfg.o` and link it. Though it would be a bad move for an unrelated 3rd-party library to supply it, because it would override the default `_load_config_used` from the CRT (if there is one) without the user asking for it.

A user-supplied `_load_config_used` may get outdated and miss fields, so it may be better to change the fields afterwards using some PE editing tools instead. But I digress.


> 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.

Yeah, LGTM (with one minor inline comment). Though it doesn't seem like there is an urgent need for it to be in main right now, so I feel maybe it is beneficial to wait until a PR to add the warning is ready, so both changes can be merged together. Wdyt?

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


More information about the llvm-commits mailing list