This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Multigot mechanism and a related MIPS linker error


On Wed, Oct 14, 2009 at 1:06 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> 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.
>
> Richard
>
>

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
dynamically-linked executable.
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 ? )

                 shankar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]