This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Multigot mechanism and a related MIPS linker error
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "Umashankar V.K." <shankar dot vk at gmail dot com>
- Cc: binutils at sourceware dot org, gcc-help at gcc dot gnu dot org
- Date: Tue, 13 Oct 2009 21:13:18 +0100
- Subject: Re: Multigot mechanism and a related MIPS linker error
- References: <448a67a0910122243r56bf078di7b715c28ee145ea5@mail.gmail.com> <448a67a0910122331i2cd3c0bfu7476f932f265d03b__22986.326859291$1255415526$gmane$org@mail.gmail.com> <878wffjdbg.fsf@firetop.home>
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