[PATCH] D61973: [AArch64] Support .reloc *, R_AARCH64_NONE, *

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 08:27:39 PDT 2019


MaskRay added a comment.

In D61973#1504710 <https://reviews.llvm.org/D61973#1504710>, @peter.smith wrote:

> I think the ld -r failure with arm is due to InputSection::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels)  in particular:
>
>   if (RelTy::IsRela)
>           P->r_addend = Sym.getVA(Addend) - Section->getOutputSection()->Addr;
>         else if (Config->Relocatable)
>           Sec->Relocations.push_back({R_ABS, Type, Rel.r_offset, Addend, &Sym});
>
>
> If we add a R_ABS with Type R_ARM_NONE then relocateOne will try to evaluate it and hence we get the unrecognized reloc error. My intuition is to skip adding the R_ABS when the relocation is the None relocation. I'm not going to get a chance to send a patch to fix it today though.


Probably just use

  -      else if (Config->Relocatable)
  +      else if (Config->Relocatable && Type != Target->NoneRel)

After `.reloc *, R_386_NONE, *` is supported, probably change `relocation-none-i686.test` (yaml2obj) to an assembly test and check `ld.lld -r` doesn't crash...


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61973





More information about the llvm-commits mailing list