Multigot mechanism and a related MIPS linker error

Richard Sandiford rdsandiford@googlemail.com
Tue Oct 13 20:13:00 GMT 2009


Richard Sandiford <rdsandiford@googlemail.com> writes:
> MIPS multigots are a trick.  The ABI only defines a single GOT,
> which I'll call the "ABI-defined" GOT.  As you say, this GOT needs
> no relocations.  The information is instead provided in two ways:
>
>   (a) Dymamic tags give the limits of the local and global parts
>       of the GOT.
>
>   (b) The global part of the GOT is directly mapped to the end
>       of the dynamic symbol table.
>
> But what do you do if you need multiple GOTs, and several GOTs
> need to refer to the same symbol S?  S appears only once in the
> dynamic symbol table, so it can only appear once in the ABI-defined GOT.
>
> Multigots could only share GOT entries like this if you were able to
> sort the symbols in such a way that every multigot represented a 64k
> (or smaller) window into the ABI-defined GOT.  And that isn't possible
> in the general case.  Objects often refer to both common symbols (like
> stdio routines) and object-specific symbols.  Once you get >128k of
> object-specific symbols, it isn't possible for all of them to be in
> a 64k window that also contains the ABI GOT entries for the stdio
> routines.

I forgot an even more important restriction: the local part of the
ABI-defined GOT has to come before the global part.  In practice,
almost all GOTs have some local entries, so this would restrict
the windows even further.

Richard



More information about the Binutils mailing list