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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 18:15:16 PDT 2019


MaskRay added a comment.

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`...
- 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?


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