This is the mail archive of the binutils@sources.redhat.com 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: oops, powerpc .plt


At 16:49 08.05.2002, Alan Modra wrote:
>On Wed, May 08, 2002 at 10:55:03AM +0200, Franz Sirl wrote:
> > At 07:12 08.05.2002, Alan Modra wrote:
> > >Additionally, .got should really be marked executable too,
> > >as it contains a "blrl" instruction that is used to find the
> > >.got section.
> >
> > One thing always made me wonder, since gcc actually produces "bl
> > _GLOBAL_OFFSET_TABLE_@local-4" for -fpic, was this blrl initially planned
> > to end up in the section/page preceding .got? Thus avoiding marking the
> > whole .got executable?
>
>Well, the SYSV ABI PPC supplement says:
>
>"A global offset table's format and interpretation are processor
>specific.  For PowerPC, the symbol _GLOBAL_OFFSET_TABLE_ may be used to
>access the table.  The symbol may reside in the middle of the .got
>section, allowing both positive and negative "subscripts" into the
>array of addresses.  Four words in the global offset table are
>reserved: The word at _GLOBAL_OFFSET_TABLE_[-1] shall contain a blrl
>instruction (see the text relating to Figure 3-33, "Prologue and
>Epilogue Sample Code").  The word at _GLOBAL_OFFSET_TABLE_[0] is set
>by the link editor to hold the address of the dynamic structure,
>referenced with the symbol _DYNAMIC.  This allows a program, such as
>the dynamic linker, to find its own dynamic structure without having
>yet processed its relocation entries.  This is especially important for
>the dynamic linker, because it must initialize itself without relying
>on other programs to relocate its memory image.  The word at
>_GLOBAL_OFFSET_TABLE_[1] is reserved for future use.  The word at
>_GLOBAL_OFFSET_TABLE_[2] is reserved for future use.  The global offset
>table resides in the ELF .got section."

Ah, ok, understood.

>That says to me that the intention is that the blrl actually reside in
>the .got section.  The ABI document also says that .got is
>SHF_ALLOC + SHF_WRITE, _not_ SHF_EXECINSTR.  Hmm...

That's bad, the kernel people already complained that they cannot set the 
page flags according to the contents of the object, cause then all -fpic 
compiled libs (including glibc) fail.

Franz.


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