This is the mail archive of the
mailing list for the binutils project.
Re: About GOT (and PLT) limitations for PowerPC 32-bit
- From: Alan Modra <amodra at gmail dot com>
- To: yon ar c'hall <yon dot ar dot chall at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 3 Oct 2012 15:57:47 +0930
- Subject: Re: About GOT (and PLT) limitations for PowerPC 32-bit
- References: <CAOJvutNTmL=c=uQcxCYjUSopaYbJdWjZSfkvHbYreEyYn=-gsQ@mail.gmail.com> <20120929042643.GA3176@bubble.grove.modra.org> <CAOJvutOTjgMvUXcc2cU7tY0-FJ_kygONARAE4OfBDuTCQV3r-Q@mail.gmail.com>
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 <firstname.lastname@example.org> 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
> 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
> 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.
Australia Development Lab, IBM