[lld] [LLD][MINGW] Add `--undefined-glob` flag support (PR #109866)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 01:29:17 PDT 2024
mstorsjo wrote:
> > It would be good to have a testcase on the COFF level, to validate this - I should have thought of this during the review of #109721, but I missed to request this.
>
> Not a problem, I can open another PR to add this.
>
> > This change looks fine, but I'd like to have the semantics of these options clarified (i.e. the questions above answered) before I merge this one.
>
> These are the semantics I've observed:
>
> * `--undefined-glob` (for LLD/ELF) does not necessitate a match. In other words, there is no error if there is no match. If a match is found, it treats it as if it was defined with `-u`. This makes sense since it isn't possible to define a strict requirement from the glob pattern.
>
> * This behavior corresponds to the following:
>
> * https://github.com/llvm/llvm-project/blob/aeb18ebbe0a1a2fbce9b432eefed46c1d90968ea/lld/ELF/Driver.cpp#L2198-L2200
> * `/includeglob:` similarly does not necessitate a match for the same reasons (there is no error if there is no match). I modeled the logic based on the logic for ELF. If a match is found, it treats it as if it was defined with `/include`.
>
> * https://github.com/llvm/llvm-project/blob/aeb18ebbe0a1a2fbce9b432eefed46c1d90968ea/lld/COFF/Driver.cpp#L716-L720
>
> I haven't taken a look to see if GNU ld is any different yet. However, let me know if the above makes sense.
Yeah, this makes sense. Thanks!
A separate PR to add a testcase to clarify that patterns that don't match any symbols would indeed be welcome too!
https://github.com/llvm/llvm-project/pull/109866
More information about the llvm-commits
mailing list