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]

Incorrect GOT section flags on PPC?


On PowerPC, we have a hack that puts a single instruction at the
beginning of the GOT, which can be called with a PC-relative branch,
and will effectively return a pointer to the GOT.  This is very
efficient, yadda yadda.

The problem is, in order to guarantee instruction cache coherency,
this instruction needs to be in an executable program segment, and
therefore in an executable ELF section.  However, the GOT section is
not marked as executable on PowerPC.

Normally this is not an actual problem, because there is almost always
a PLT, and the PLT is executable and ends up in the same program
(PT_LOAD) segment, thereby forcing it to be executable.

However, there is one special case where this is not true -- ld.elf.so
(at least on NetBSD), because it has no external symbol references and
is linked with -Bsymbolic.  In this case, there is no PLT, and
therefore the program segment is not made executable.

Currently we hack around this by using a special linker script that
combines everything into one (implicitly executable) segment.  But
this is a hack.

It seems to me that, since there is in fact code in the GOT, that the
GOT section on PowerPC should always have SEC_CODE said.  I confess
that after some poking I was unable to find a nice way to do this,
though.  Could someone suggest an approach that doesn't touch too much
other code in BFD?


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