[llvm-bugs] [Bug 36555] _GLOBAL_OFFSET_TABLE_ does not point to the beginning of .got.plt
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 7 10:42:33 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36555
Rafael Ávila de Espíndola <rafael at espindo.la> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|WONTFIX |---
Status|RESOLVED |REOPENED
--- Comment #9 from Rafael Ávila de Espíndola <rafael at espindo.la> ---
(In reply to Rafael Ávila de Espíndola from comment #8)
> > With this in mind I think our best course of action is:
> > - Extend writeGotPltHeader() to more targets.
> > - Either adjust the default section sorting to make sure .got.plt follows
> > .got or change _GLOBAL_OFFSET_TABLE_ to the start of the .got.plt.
>
> Interesting. This would mean flipping relro to the start of the RW program
> header since .got is RELRO and .got.plt is not.
>
> I will dig at the history a bit to see why we have the current order.
Found it.
The reason is that we need to have a single RelRO area covering nobits and non
nobits sections. Since bss has to go at the end, so has RelRo:
// We place nobits RelRo sections before plain r/w ones, and non-nobits RelRo
// sections after r/w ones, so that the RelRo sections are contiguous.
bool IsRelRo = isRelroSection(Sec);
if (IsNonTlsNoBits && !IsRelRo)
Rank |= RF_NON_TLS_BSS_RO;
if (!IsNonTlsNoBits && IsRelRo)
Rank |= RF_NON_TLS_BSS_RO;
My understanding is that gnu linker just never use a RelRO nobits sections.
It seems we have to make the section _GLOBAL_OFFSET_TABLE_ points to
architecture dependent or change glibc (not sure how realistic that is).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180307/b8f5ca7b/attachment.html>
More information about the llvm-bugs
mailing list