[PATCH v3] elf: Don't set its DT_VERSYM entry for unversioned symbol

H.J. Lu hjl.tools@gmail.com
Fri Oct 31 08:33:20 GMT 2025


On Fri, Oct 31, 2025 at 4:25 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 31.10.2025 09:20, H.J. Lu wrote:
> > On Fri, Oct 31, 2025 at 3:48 PM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 31.10.2025 00:21, H.J. Lu wrote:
> >>> 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.
> >>>
> >>> 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.
> >>
> >> I'm irritated by you now altering an existing test, but there being no
> >> new test anymore. Can you clarify this for me, please?
> >
> > My patch changes the linker behavior which results in the output  change
> > of
> >
> > # objdump --dynamic-syms tmpdir/vers16
> >
> > since the "Base" version is no longer added to show_bar and show_foo
> > which are unversioned symbols.   I have to change ld-elfvers/vers16.dsym.
>
> Right, but why did the earlier new testcase disappear?
>
> Jan

The new behavior has been verified by the updated ld-elfvers/vers16.dsym.
show_bar is a defined symbol without version and show_foo is an undefined
symbol without version.   These are 2 cases which my updated patch covers
No need for new tests.

-- 
H.J.


More information about the Binutils mailing list