[RFC PATCH v2] readelf: Add -G/--got-contents options
Fangrui Song
maskray@sourceware.org
Thu Aug 28 06:50:18 GMT 2025
On Wed, Aug 27, 2025 at 11:31 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 28.08.2025 04:04, H.J. Lu wrote:
> > On Wed, Aug 27, 2025 at 08:28:27AM +0200, Jan Beulich wrote:
> >> On 27.08.2025 04:45, H.J. Lu wrote:
> >>> On Tue, Aug 26, 2025 at 02:53:40PM -0700, H.J. Lu wrote:
> >>>> Add -G/--got-contents options to readelf, inspired by the similar option
> >>>> on Solaris, to display the contents of GOT sections:
> >>>>
> >>>> $ readelf -G libfoo.so
> >>>>
> >>>> Global Offset Table '.got' contains 5 entries:
> >>>> Index: Address Reloc Sym. Name + Addend/Value
> >>>> 0: 000000002fc8 R_X86_64_GLOB_DAT bar + 0
> >>>> 1: 000000002fd0 R_X86_64_GLOB_DAT __gmon_start__ + 0
> >>>> 2: 000000002fd8 R_X86_64_GLOB_DAT _ITM_registerTMCloneTable + 0
> >>>> 3: 000000002fe0 R_X86_64_GLOB_DAT __cxa_finalize@GLIBC_2.2.5 + 0
> >>>> 4: 000000002fe8 0
> >>>>
> >>>> Global Offset Table '.got.plt' contains 4 entries:
> >>>> Index: Address Reloc Sym. Name + Addend/Value
> >>>> 0: 000000002ff0 2dd0
> >>>> 1: 000000002ff8 0
> >>>> 2: 000000003000 R_X86_64_JUMP_SLO printf@GLIBC_2.2.5 + 2c0
> >>>> 3: 000000003008 0
> >>>>
> >>>> Any comments?
> >
> > Thanks for your feedbacks.
> >
> >>
> >> In principle a good thing to have, yet still a couple of remarks. First:
> >> No matter whether Solaris allows -G, as in a similar recent case I'm
> >> unconvinced we want to use a scarce resource (signed letter options)
> >> for something that's probably not going to be used very often.
> >
> > The most useful readelf features have been implemented. What other
> > unimplemented features which are more useful than dumping GOT sections
> > and may use the -G options? Option compatibility with other readelf
> > implementations help our readelf users.
>
> We simply don't know what is to come. Also see Maciej's reply.
>
> Jan
I agree that single-letter options as a scarce resource should be done
with extreme caution.
My intuition is that this functionality won't be used frequently. In
addition, users who run readelf -a will get the output from the
--got-contents option even without a single-letter alias.
More information about the Binutils
mailing list