This is the mail archive of the
mailing list for the binutils project.
Re: Multigot mechanism and a related MIPS linker error
- From: Uma shankar <shankar dot vk at gmail dot com>
- To: binutils at sourceware dot org, gcc-help at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Tue, 10 Nov 2009 00:25:42 +0530
- Subject: Re: Multigot mechanism and a related MIPS linker error
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
On Wed, Oct 14, 2009 at 1:06 AM, Richard Sandiford
> The primary GOT lives at the start of the ABI-defined GOT, and is
> managed in the usual relocation-free way. ?The secondary GOTs are
> instead just blobs of data that are relocated in the same way as
> ordinary data, using the R_MIPS_REL32s that you saw.
> Of course, every global symbol involved in a relocation must also
> be in the ABI-defined GOT, so that GOT is often bigger than 64k.
> However, the primary GOT lives at the beginning of the ABI-defined
> GOT and is always <64k in size.
> We could try to optimise the case where input objects (or groups
> of input objects) have GOTs that don't overlap at all, but that's
> so rare that I don't think it's worth bothering in practice.
Thanks for the reply.
What qualifies a symbol to be put in primary GOT ? Is this just on
"as seen" basis during linking ?
Suppose i am linking 3 files a.o , b.o and c.o into a
Also, assume that each of these 3 files access 16 K globals ( local
+ extern ). Out of this, let
4K be common symbols , such as from libc.
The simple way of creating GOT of the exe will be to put entries for
all globals of a.o in primary GOT .
And the entries for b.o and c.o will be "blobs of data" you mention -
to be relocated dynamically.
But I assume it will not be done this way. The common symbols may
get a preferential place in primary GOT. If so,
I have not understood the reason.
I do not understand how the functions inside a.o, b.o and c.o can
access the common symbols without duplicating those
symbols in primary and secondary GOTs . ( I did look at .rel section
of an exe and did find multiple
entries for some common symbols like printf )
Also, how is the best multigot layout found - the one with least
duplicated entries ?
Sorry, if my questions are silly. I am new to MIPS and linker concepts.
( What is a forced-local symbol ? Is this same as static variables in
C language ? )