This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Can objdump show friendly symbolic function name?
On Tue, 20 Jul 2010, 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 -- that's a *huge* lot of global symbols to refer to from a single
function (where good programming rules mandate limiting the use of global
variables to the absolutely necessary minimum). And switching GOTs in the
middle of a function is complicated -- $t9 is not available anymore and
the only way to retrieve the PC is one of the branch-and-link
instructions. Or 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.
A common case where a single 16-bit GOT doesn't suffice is the whole
binary object, either an executable or a shared module, where it's only
each function's prologue that you have to pick the right GOT pointer. I
can't recall seeing code in binutils to handle GOT switches within
functions and hence my question.
Maciej