RFC: Add --dump-function to objdump

Cary Coutant ccoutant@google.com
Fri Sep 19 21:12:00 GMT 2014


> I need to find in which section a function is defined as well as what
> relocations are in the function.  I come up with a new --dump-function
>  option to objdump:
>
> [hjl@gnu-6 binutils]$ ./objdump --dump-function  _start /tmp/sort3.o
>
> /tmp/sort3.o:     file format elf64-x86-64
>
> Function `_start' defined in section `.text' with relocations:
>  R_X86_64_64       .text.func2
>  R_X86_64_64       .text.func2
> [hjl@gnu-6 binutils]$
>
> Is this a useful addition?

This is just a suggestion, but I think I'd find it more useful as a
filter that could be applied to other objdump options:

  objdump -r --only-section func filename.o

Where the parameter to --only-section could be either a section name
or a symbol name that would select the section where the symbol is
defined. I've wanted to do something like this quite often.

-cary



More information about the Binutils mailing list