Can objdump show friendly symbolic function name?
David Daney
ddaney@caviumnetworks.com
Tue Jul 20 16:20:00 GMT 2010
On 07/20/2010 08:19 AM, John Reiser wrote:
>>>> Can the GOT pointer switch between GOTs within a single function?
>
>>> A function which references more than ((1<<16) / sizeof(void *))
>>> external symbols must use more than one GOT.
>
>> That's a corner case that I wouldn't be surprised if it wasn't handled at
>> all -- ... switching GOTs in the middle of a function is complicated -- ...
>> alternatively the current GOT pointer can be used to offset against.
>> Either way rather painful. Then you need to track
>> backward branches to switch back as appropriate, etc., etc.
>
> One way to handle the overflow is to put a vector of pointers to every GOT_i
> at some fixed offset in each GOT:
>
> GOT0: .addr GOT0, GOT1, GOT2, GOT3
> ...
> GOT1: .addr GOT0, GOT1, GOT2, GOT3
> ...
> GOT2: .addr GOT0, GOT1, GOT2, GOT3
> ...
> GOT3: .addr GOT0, GOT1, GOT2, GOT3
> ...
> Then you don't need to _switch_, you just suffer an indirection
> (another load with delay slot) for outlanders. For a FETCH to GPR
> the indirection can use the same register as the destination,
> else use $AT as for a STORE. Yes, the compiler must be told
> to generate such code.
>
I would note that GCC/Binutils has for quite some time had the -mxgot
option (or a variant thereof), which lifts the got size restriction at
the expense of less efficient code. I would be inclined to recommend
using it instead of cooking up a solution for multiple GOTs within a
single function. It has the advantage that it exists and works today.
It might be nice to add a function attribute that lets us turn -mxgot on
and off on a per function basis, instead of the current per compilation
unit basis of today.
David Daney
More information about the Binutils
mailing list