[PATCH] D72197: [MC][ELF] Emit a relocation if target is defined in the same section and is non-local

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 14:06:10 PST 2020


pcc added a comment.

In D72197#1825070 <https://reviews.llvm.org/D72197#1825070>, @MaskRay wrote:

> In D72197#1825012 <https://reviews.llvm.org/D72197#1825012>, @pcc wrote:
>
> > It looks like this change caused us to start rejecting:
> >
> >   .thumb
> >   .thumb_func
> >   .globl foo
> >   .hidden foo
> >   foo:
> >   adr lr, foo + 1
> >
> >
> > with:
> >
> >   test.s:6:1: error: unsupported relocation on symbol
> >   adr lr, foo + 1
> >   ^
> >  
> >
> >
> > This is exposed by this Android ART code: https://cs.android.com/android/platform/superproject/+/master:art/runtime/arch/arm/quick_entrypoints_arm.S;l=1826
> >
> > I see a couple of possible fixes for this:
> >
> > 1. We could go back to the previous behaviour for global hidden symbols.
> > 2. We could teach MC and LLD about the `R_ARM_THM_ALU_PREL_11_0` relocation required to relocate this instruction. Arguably the ART code shouldn't be adding the 1 for Thumb here (because `R_ARM_THM_ALU_PREL_11_0` adds the 1 itself), so ART would then need to be fixed.
>
>
>
>
>   % arm-linux-gnueabi-as /tmp/c/a.s -o /tmp/c/a.o
>   /tmp/c/a.s: Assembler messages:
>   /tmp/c/a.s:6: Error: invalid Hi register with immediate
>   /tmp/c/a.s:6: Error: invalid immediate for address calculation (value = 0xFFFFFFFFFFFFFFFE)
>
>
> How can I make GNU as recognize it?


It looks like you need to add `.syntax unified` to the top.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72197





More information about the llvm-commits mailing list