[lld] [llvm] ELF: Use index 0 for unversioned undefined symbols (PR #168189)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 07:38:37 PST 2025
https://github.com/smithp35 commented:
Trying to summarise https://sourceware.org/bugzilla/show_bug.cgi?id=33577
* `VER_NDX_LOCAL` for a defined symbol should be used for symbols with STB_LOCAL_BINDING, should these be in the dynamic symbol table for any reason.
* While not clear from the specification, the intent for undefined symbols is to use `VER_NDX_LOCAL` as if it were called `VER_NDX_NONE` meaning no version.
* GNU ld, while starting at `VER_NDX_LOCAL` switched to `VER_NDX_GLOBAL` and is now switching back to `VER_NDX_GLOBAL`.
* Mold currently rejects undefined symbols with `VER_NDX_LOCAL` and would like more time to update.
* GNU ld.so is able to handle `VER_NDX_LOCAL` and `VER_NDX_GLOBAL`.
Pragmatically [1] I think it would be best to bring ourselves in line with the GNU tools, which would mean merging this. Before I approve can I check a few things:
* Are we confident that other dynamic linkers that handle symbol versions (bionic, BSD rtld) can handle this change? At a brief glance at the source they look OK, but I haven't thought about it too hard.
* Are we confident that the GNU ld change will stick given Rui's comment. https://sourceware.org/bugzilla/show_bug.cgi?id=33577#c23 ? I guess we could revert if necessary.
[1] My reading of the spec was that `VER_NDX_GLOBAL` made more sense given the description of `VERN_NDX_LOCAL` as private.
https://github.com/llvm/llvm-project/pull/168189
More information about the llvm-commits
mailing list