Should we use R_ARM_MOVT_PREL for ARM PIC?
Renato Golin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 13:09:41 PDT 2016
Adding Peter & Adhemerval.
cheers,
--renato
On 20 June 2016 at 19:54, Rafael EspĂndola <llvm-commits at lists.llvm.org> wrote:
> While refactoring some code I noticed that
>
> @a = hidden global i32 42
> define i32* @f() {
> ret i32* @a
> }
>
> produces
>
> movw r0, :lower16:(_a-(LPC0_0+8))
> movt r0, :upper16:(_a-(LPC0_0+8))
> LPC0_0:
> add r0, pc, r0
>
> When targeting MachO but
>
>
> ldr r0, .LCPI0_0
> .LPC0_0:
> add r0, pc, r0
> ...
>
> .LCPI0_0:
> .long a-(.LPC0_0+8)
>
> When targeting ELF.
>
> We could use R_ARM_MOVT_PREL on ELF to use a movw/movt pair and an add
> instead of a load and an add. Would that be an improvement? We use
> movw/movt for non PIC code, so I assume so. Should I open a bug?
>
> On a similar note, why there is no movw/movt pc relative relocation
> that points to a got entry? That would be handy for when the variable
> can be preempted.
>
> Cheers,
> Rafael
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list