[PATCH] D65651: [ELF] Move R_*_IRELATIVE from .rel[a].plt to .rel[a].dyn unless --pack-dyn-relocs=android[+relr]

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 18:32:18 PDT 2019


pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

In D65651#1613261 <https://reviews.llvm.org/D65651#1613261>, @MaskRay wrote:

> In D65651#1612576 <https://reviews.llvm.org/D65651#1612576>, @pcc wrote:
>
> > In D65651#1612547 <https://reviews.llvm.org/D65651#1612547>, @MaskRay wrote:
> >
> > > > Have you checked whether we can reasonably expect this to be universal or does this need to be done on a per-architecture basis?
> > >
> > > On non-Android, it is universal to place R_*_IRELATIVE in .rel[a].dyn :)
> >
> >
> > Are you saying that that's the behaviour of an existing linker? If so, this change is fine with me. Otherwise we need to be careful because if there is a dynamic loader out there that only supports `R_*_IRELATIVE` in `.rel[a].plt` and not in `.rel[a].dyn` on some architecture (basically the inverse of the situation that you discovered), your change would break that dynamic loader on that architecture.
>
>
>
>
> - arm (non-Android and Android): no-op
> - i386/x86_64/aarch64: .rela.plt -> .rela.dyn (either works). R_*_IRELATIVE in .rel[a].plt is discouraged by `__glibc_unlikely`... A glibc aarch64 maintainer says on aarch64, R_*_IRELATIVE can appear in both .rela.plt and .rela.dyn, but he wants to *fix the problem* by using .rela.dyn exclusively.
> - powerpc: .rela.plt -> .rela.dyn (fixes a crash)
> - powerpc64:.rela.plt -> .rela.dyn (fixes a crash)
> - mips: binutils/glibc don't support ifunc
>
>   Chatted with @luporl. They are still bringing up FreeBSD powerpc64. Moving from .rela.plt to .rela.dyn will save their rtld-elf trouble..
>
>   (On glibc powerpc/powerpc64, without the change, we can use -z now or `LD_BIND_NOW=1` to fix the crash.)
>
>   Does the summary look good?


Okay, thanks for checking. LGTM


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65651/new/

https://reviews.llvm.org/D65651





More information about the llvm-commits mailing list