oops, powerpc .plt
Alan Modra
amodra@bigpond.net.au
Wed May 8 07:49:00 GMT 2002
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."
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...
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list