Can objdump show friendly symbolic function name?
David Daney
david.s.daney@gmail.com
Thu Jul 22 17:16:00 GMT 2010
On 07/22/2010 04:57 AM, Maciej W. Rozycki wrote:
> On Wed, 21 Jul 2010, Richard Sandiford wrote:
>
>>>> 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).
>>>
>>> Can the GOT pointer switch between GOTs within a single function?
>>
>> No.
>
> I suppose it should be moderately easy to decode the prologue of each
> function then to see which GOT $gp refers to.
>
Modern GCCs will not generate a fixed function prologue layout, and for
leaf functions the GP will not necessarily be in $28. Add in the
difference caused by -mshared and -mplt, and there can be quite a bit of
variability.
I think it is still technically feasible, but it could be a rather large
piece of code. I would note that this problem is similar to the problem
of generating a stack trace by using code inspection. It is possible,
but using real debugging info is far better.
David Daney
More information about the Binutils
mailing list