Commit: readelf: Improve display of RELR relocations

Nick Clifton nickc@redhat.com
Thu Apr 11 15:56:46 GMT 2024


Hi Guys,

  Currently readelf's display of RELR relocations is woefully lacking in
  information.  So I am going to apply the attached patch in order to
  improve this.  For example:

    readelf -r /lib64/libc.so.6

  Before patch:

    Relocation section '.relr.dyn' at offset 0x259c0 contains 32 entries:
      1067 offsets
    00000000001d4ca0
    00000000001d4cb0
    00000000001d4cb8
    00000000001d4cc0
    00000000001d4ce0
    00000000001d4d00
    ...
    
  After patch:
  
    Relocation section '.relr.dyn' at offset 0x259c0 contains 32 entries:
    Index: Entry:           Address relocated Symbolic Address
    0000:  00000000001d4ca0 00000000001d4ca0  __FRAME_END__ + 0x1ddc
    0001:  ffffdff8ee15911d 00000000001d4cb0  __FRAME_END__ + 0x1dec
                            00000000001d4cb8  __FRAME_END__ + 0x1df4
                            00000000001d4cc0  __dso_handle
                            00000000001d4ce0  _nl_C_LC_CTYPE
                            00000000001d4d00  _nl_C_LC_CTYPE + 0x20
    ...

  In particular this new format shows the actual values held in the RELR
  section - allowing a user to potentially spot problems - as well as
  providing an address to symbol mapping for ease in understanding what
  is being relocated.

  The patch also checks for malformed RELR entries (such as an entry
  with a value of just 1).

  The patch includes a new binutils test and updates to linker tests
  that were checking the RELR relocations.
  
Cheers
  Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: readelf.relr.patch
Type: text/x-patch
Size: 25211 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240411/c09869d1/attachment-0001.bin>


More information about the Binutils mailing list