[PATCH] ld: Limit "readelf --got-contents" tests

H.J. Lu hjl.tools@gmail.com
Thu Sep 4 20:00:29 GMT 2025


On Thu, Sep 4, 2025 at 12:18 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Sep 4, 2025 at 8:20 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> >
> > Hi H.J.,
> >
> > >> >>> I want to make sure that --plt-contents displays all relevant
> > >> >>> information correctly.  My tests are emulation specific.   There
> > >> >>> is nothing Linux specific.
> > >> >>
> > >> >> Yet still the question stands - if it's just a few extra symbols, can't
> > >> >> you cater for them using #?REGEXP constructs in the expectations?
> > >> >
> > >> > It sounds wrong.  Are you saying that the same emulation generates
> > >> > extra symbols for Solaris?
> > >>
> > >> I'm not saying that, no, but see what Rainer said. Tests shouldn't be
> > >> artificially restricted - the wider their coverage, the better.
> > >>
> > >
> > > Please see the v2 patch:
> > >
> > > https://patchwork.sourceware.org/project/binutils/list/?series=51595
> >
> > I haven't tried it yet, but am pretty certain that it won't help:
> >
> > $  ./ld/ld-new -V
> > GNU ld (GNU Binutils) 2.45.50.20250904
> >   Supported emulations:
> >    elf_x86_64_sol2
> >    elf_x86_64
> >    elf_i386_sol2
> >    elf_i386_ldso
> >    elf_i386
> >    elf_iamcu
> >
> > Since the match isn't anchored it would also match the elf_*_sol2 lines.
>
> This is
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=33374
>
> > Have you actually looked at my description and patch attached to the PR
> > and the Solaris shared objects attached there for inspection?
>
> Will use
>
> # Tests here need -melf_i386 support.
> set status [catch "exec $LD -V -melf_i386" got]
> if { $status == 0 } {
> ...
> }
>
> in the v3 patch.
>

The "readelf --got-contents" tests check specific addresses to verify
that "readelf --got-contents" works as expected.  Otherwise, we won't
know that it stops working when these addresses are changed by
accident.

-- 
H.J.


More information about the Binutils mailing list