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, 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.

> Could please someone clarify this point ?
> Are there the same limitations for newer versions of gcc ?


> Are there some limitations also on PLT size ?


> In the gory details, I understand that the 64K bytes limitation comes
> from the 16-bit signed integer <offset> operand in instructions like
> "lwz <dest>,<offset>(<ptr>)", where <ptr> is the pointer to the GOT
> base. Is that right ?
> What I don't get here is why does it make a difference between -fpic and -fPIC ?
> In a few words, what are the gory details that explain why -fpic only
> has a single GOT for the entire executable ?

That's the way the ABI was designed.  A single GOT results in a
smaller overall GOT size, since there will be only one entry for a
given symbol.  With -fPIC you'll get an entry per function that
references any given symbol.

ppc64 is different again.  Recent versions of gcc support
-mcmodel=small/medium/large with the medium/large models generating
32-bit signed offset addressing into the GOT/TOC.

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]