This is the mail archive of the 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: About GOT (and PLT) limitations for PowerPC 32-bit

On Tue, Oct 02, 2012 at 11:56:45AM +0200, yon ar c'hall wrote:
> Thanks for answering, Alan.
> On Sat, Sep 29, 2012 at 6:26 AM, Alan Modra <> wrote:
> > On Tue, Sep 25, 2012 at 09:01:33PM +0200, yon ar c'hall wrote:
> >> In "per functions", I don't actually understand what "function" refers
> >> to. I mean it would sound odd to me that it refers to some C function.
> >
> > It does.  ppc32 sets up the got pointer reg on entry to a function.
> > With -fPIC code you get a separate GOT for each function, so each
> > function can have up to 64k of GOT entries.  With -fpic code, a single
> > GOT is used per executable.
> Don't you mean 16K of GOT entries (and 64KB of GOT size) ?

Yes, I meant the size of GOT is 64k bytes maximum.

> I tried to compile with gcc-4.4.1 (-c -fPIC -O2) a dummy .cc with 20k
> of global integers (int data00000 to int data20000), and two functions
> accessing each a half of them (simply ++dataxxxx) : it failed with
> many "Error: operand out of range (0x000000000000xxxx is not between
> 0xffffffffffff8000 and 0x0000000000007fff)" messages. Also, it's
> binutils-2.19.
> Did I misread your "GOT per function" explanation, and used a wrong
> code example ?

No, I just plain had it wrong.  I don't know why I thought it was that
way, but the truth is that -fPIC on ppc32 gives you a 64k GOT per
object file.

> Another thing : I also noticed that strings literal (puts(__FILE__);
> puts("foo bar");...) are accessed via the GOT. is it normal ?

Yes.  BTW, newer gcc's with -fsection-anchors should help in reducing
the number of GOT entries.

Alan Modra
Australia Development Lab, IBM

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