Commit: objdump --show-all-symbols: show extra symbols matching referenced addresses

Nick Clifton nickc@redhat.com
Wed Apr 3 09:08:01 GMT 2024


Hi Guys,

  Objcopy's --show-all-symbols option displays all the symbols matching
  an address that is being disassembled.  But currently it does not show
  any extra symbols that might match an address that is referenced by an
  instruction.  For example:

    $ objdump --disassemble=abort /lib64/libc.so.6 --show-all-symbols
    [...]
    269bb:	e8 40 6f 0b 00       	call   dd900 <_exit>

  I am applying the attached patch to fix this omission.  Given the
  example above the output now looks like:

    $ objdump --disassemble=abort /lib64/libc.so.6 --show-all-symbols --wide
    [...]
    269bb:	e8 40 6f 0b 00       	call   dd900 <_exit>, <_Exit>, <__GI__exit>

  Without the --wide option, the extra symbols are displayed on a new
  line:
  
    $ objdump --disassemble=abort /lib64/libc.so.6 --show-all-symbols --wide
    [...]
    269bb:	e8 40 6f 0b 00       	call   dd900 <_exit>,
	<_Exit>, <__GI__exit>

  As an addition, if the first symbol that matches the address is an
  absolute location obtained from a relocation, then the patch will
  decode the location and display any symbols that match.  This is
  particularly helpful when displaying branches into the PLT.

  Before patch:

    $ objdump --disassemble=__gconv_alias_compare /lib64/libc.so.6 --show-all-symbols --wide
    [...]
    28f2a:	e9 31 d8 ff ff      jmp    26760 <*ABS*+0xa4450@plt>

  After patch:
  
    $ objdump --disassemble=__gconv_alias_compare /lib64/libc.so.6 --show-all-symbols --wide
    [...]
    28f2a:	e9 31 d8 ff ff     jmp    26760 <*ABS*+0xa4450@plt>, <strcmp_ifunc>, <strcmp>, <__GI_strcmp>

Cheers
  Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: show-all-symbols.patch
Type: text/x-patch
Size: 2771 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240403/0c59f9db/attachment.bin>


More information about the Binutils mailing list