This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can objdump show friendly symbolic function name?


Pan ruochen <panruochen@gmail.com> writes:
> I have taken some time to write a tiny tool to patch the objdump
> outputs since there is no way to display friendly symbolic function
> names.
> I hope the tool will be useful to somebody else in the future.

Thanks for posting the script.  I'm sure people will find it useful.

It would certainly be possible to do the same thing in objdump,
and FWIW, I did wonder about that when adding the readelf -A GOT dump.
The problem is that, in a multi-GOT world, the annotations are only
ever going to be a best guess.  If the disassembler sees:

     lw    $2,-32000(gp)

it doesn't in general know whether gp points to the primary
(ABI-defined) GOT, or to some secondary GOT.  If it guesses
right, the annotation would be useful, but if it guesses wrong,
the annotation would be very misleading.  This is different from
the current <foo> markers, which are always accurate (or at least,
_should_ always be accurate).

A compromise would be to add an option that provides more
"guess"-level annotations.

As Maciej says, the most reliable way is to disassemble objects
that still have relocations in them.  Are you linking the objects
yourself?  If so, it's worth considering linking with -Wl,-q
(aka -Wl,--emit-relocs).  Then objdump -dr will tell you where
each jump went.

If you're not linking the objects yourself, I agree a script
like yours is the best way to go.  Users of scripts are more
likely to be aware that what the script is doing isn't quite
the same as the normal objdump behaviour (but is useful
nonetheless).

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]