[PATCH] D80496: [ELF] Add -z rel and -z rela

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 12:35:01 PDT 2020


mcgrathr added a comment.

In D80496#2061684 <https://reviews.llvm.org/D80496#2061684>, @MaskRay wrote:

> In D80496#2060948 <https://reviews.llvm.org/D80496#2060948>, @mcgrathr wrote:
>
> > LGTM.  It might be worth mentioning in the doc/comment that REL format cannot pack the full range of addend values for all reloc types, but this only affects reloc types that lld doesn't support emitting as dynamic relocs since they are only used for TEXTRELs.
>
>
> My understanding is that text relocations describes dynamic relocations in non-SHF_WRITE sections. I do not say text relocations because we disallow such dynamic relocations from SHF_WRITE sections as well.


That's right.  My point is that the existing documentation describes it as an unknown mystery while RELA even exists.  The reason that RELA exists for dynamic relocations is because of the non-full-width reloc types.  Since lld doesn't support any such cases, the original rationale for RELA for dynamic relocations never applies in lld.  If lld did support those, then `-z rel` logic would need to check for and diagnose cases where REL format cannot represent the addend for a particular reloc.  Since lld doesn't support TEXTRELs, those never come up and `-z rel` can always work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80496





More information about the llvm-commits mailing list