[PATCH] D35544: [COFF, ARM64] Force ADRP relocations

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 12:54:28 PDT 2017


mstorsjo added a comment.

In https://reviews.llvm.org/D35544#812979, @t.p.northover wrote:

> > I'd be interested in knowing why this isn't done by default (i.e. why this doesn't need to be done at all for MachO) btw, if someone has got time to explain.
>
> I'm pretty sure that's a bug, I get the wrong answer when I actually try out this function on iOS:
>
>           .text
>           .global _foo
>           .p2align 12
>   _foo:
>           .fill 1023, 4, 0xd503201f
>           adrp x0, Lthere
>   Lthere:
>           ret
>   
>
> I suspect it hasn't come up on MachO because CodeGen never used ADRP to address objects in the __text section so you need assembly to trigger it.
>
> So would you mind putting that function into the base AArch64AsmBackend?


Actually, when I try to move the function from `ELFAArch64AsmBackend` to `AArch64AsmBackend`, I suddenly started getting the following errors when assembling your test snippet:

  test.s:7:9: error: ADR/ADRP relocations must be GOT relative
          adrp x0, Lthere
          ^
  test.s:7:9: error: unknown AArch64 fixup kind!
          adrp x0, Lthere


https://reviews.llvm.org/D35544





More information about the llvm-commits mailing list