[PATCH] D20024: [ELF] - Protect first entries of got.plt with RelRo.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 10:39:40 PDT 2016


I think my take is that as this is clearly documented in the x86-64 psABI,
we should keep it even if it seems redundant/useless.

On Mon, May 9, 2016 at 8:54 AM, H.J. Lu <hjl.tools at gmail.com> wrote:

> On Mon, May 9, 2016 at 8:51 AM, H.J. Lu <hjl.tools at gmail.com> wrote:
> > On Mon, May 9, 2016 at 8:46 AM, Rafael EspĂ­ndola
> > <rafael.espindola at gmail.com> wrote:
> >> I was able to link and run the musl  dynamic linker with the patch that
> >> stops setting got[0].
> >>
> >> So, Rui, what is your take on this? Should we leave that out of tree
> until
> >> it is time to try to link glibc's dynamic linker?
> >>
> >
> > If you do so, please state clearly that your linker doesn't follow
> > x86-64 psABI which says:
> >
> > The tables first entry (number zero) is reserved to hold the address of
> the dy-
> > namic 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 re-
> > locate its memory image.
>
> BTW, you also need to change the first entry of PLT to use
> GOT[0] and GOT[1] instead of GOT[1] and GOT[2].
>
> --
> H.J.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160509/af75928e/attachment.html>


More information about the llvm-commits mailing list