[PATCH v3] elf: Don't set its DT_VERSYM entry for unversioned symbol
H.J. Lu
hjl.tools@gmail.com
Thu Oct 30 23:21:37 GMT 2025
On Thu, Oct 30, 2025 at 10:27 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 29.10.2025 03:09, H.J. Lu wrote:
> > On Wed, Oct 29, 2025 at 9:54 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >>
> >> Undefined symbol without version shouldn't have the BASE version in its
> >> DT_VERSYM entry. Instead its DT_VERSYM entry should be all zero to
> >> indicate that the symbol doesn't have a version.
> >>
> >> bfd/
> >>
> >> PR ld/33577
> >> * elflink.c (elf_link_output_extsym): Don't set its DT_VERSYM
> >> entry for unversioned symbol.
> >>
> >> ld/
> >>
> >> PR ld/33577
> >> * testsuite/ld-elf/undefined.d: New file.
> >> * testsuite/ld-elf/undefined.map: Likewise.
> >> * testsuite/ld-elf/undefined.s: Likewise.
> >>
> >> OK for master?
> >
> > Here is the v2 patch to only check undefined symbols.
>
> Just one question: Wouldn't the new testcase be a better fit in ld-elfvers/?
> If you agree, okay with it moved there.
>
> Jan
Here is the v3 patch with updated tests in ld-elfvers. I also updated
elf_link_output_extsym to handle defined symbol without version with
a test.
OK for master?
Thanks.
H.J.
---
1. Referenced symbol without '@' has no version.
2. Defined symbol without the .symver directive has no version if there
is no linker version script.
Symbol without version shouldn't have the base version in its DT_VERSYM
entry. Instead, its DT_VERSYM entry should be all zero to indicate that
the symbol doesn't have a version.
NB: Symbol with the base version has a '@' suffix, like "foo@", defined
with
.symver hide_original_foo, foo@
bfd/
PR ld/33577
* elflink.c (elf_link_output_extsym): Don't set its DT_VERSYM
entry for the symbol without version.
ld/
PR ld/33577
* ld-elfvers/vers16.dsym: Remove the "Base" version on symbols
without version.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-elf-Don-t-set-its-DT_VERSYM-entry-for-unversioned.patch
Type: text/x-patch
Size: 3763 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20251031/94c49617/attachment.bin>
More information about the Binutils
mailing list