[PATCH] readelf: Add --plt-contents

Jan Beulich jbeulich@suse.com
Tue Sep 9 10:24:36 GMT 2025


On 04.09.2025 15:41, H.J. Lu wrote:
> Add --plt-contents option to readelf to display contents of PLT sections.
> --plt-contents option requires:
> 
> 1. The DT_JMPREL dynamic section for relocations associated with PLT
> entries.
> 2. Detailed PLT layout information to extract PLT relocation index and
> GOT index from PLT entries.
> 
> When --plt-contents option is used:
> 
> 1. Allocate an array, plt_relocations, to hold PLT relocations from the
> DT_JMPREL dynamic section.
> 2. Allocate an array, all_relocations, to hold all relocations to map
> GOT entries to corresponding symbols.
> 3. Process each PLT entry by extracting PLT relocation index and/or GOT
> index to display symbols or relocation associated with the PLT entry.
> 
> Only i386 and x86-64 PLTs are supported.

Which would need clarifying in doc, NEWS, and command line help.

> $ readelf --plt-contents libfoo.so
> 
> Procedure Linkage Table '.plt' contains 3 entries:
>  Index:  Address GOT Idx GOT Addr Rel Idx Symbol/Reloc
>      0: 00000150
>      1: 00000160      3: 00200250      0: func
>      2: 00000170      4: 00200258      1: bar
> 
> Procedure Linkage Table '.plt.got' contains 1 entry:
>  Index:  Address GOT Idx GOT Addr Symbol/Reloc
>      0: 00000180     -1: 00200230 foo

That's omitting a lot of information. Isn't the disassembly of .plt quite
a bit more meaningful? I question whether the overall more than 3k lines
of new code (incl testcases) are really worth this new representation form.

Jan


More information about the Binutils mailing list