[PATCH] D44355: [AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 14 05:31:36 PDT 2018
mstorsjo added a comment.
In https://reviews.llvm.org/D44355#1036858, @peter.smith wrote:
> Unfortunately this change looks like it is going to be incompatible with binutils and LLD for the ELF targets as the ldr . The new output via llvm-objdump is:
>
> 0: 48 d0 3b d5 mrs x8, TPIDR_EL0
> 4: 08 01 40 91 add x8, x8, #0, lsl #12
> 0000000000000004: R_AARCH64_TLSLE_ADD_TPREL_HI12 tlsVar
> 8: 00 01 40 b9 ldr w0, [x8]
> 0000000000000008: R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC tlsVar
> c: c0 03 5f d6 ret
>
>
> The GNU tools and LLD don't implement R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC yet. For example using aarch64-linux-gnu-objdump:
>
> 0000000000000000 <getVar>:
> 0: d53bd048 mrs x8, tpidr_el0
> 4: 91400108 add x8, x8, #0x0, lsl #12
> 4: R_AARCH64_TLSLE_ADD_TPREL_HI12 tlsVar
> 8: b9400100 ldr w0, [x8]
> 8: *unknown* tlsVar
> c: d65f03c0 ret
>
>
> Whereas the equivalent add relocation R_AARCH64_TLSLE_ADD_TPREL_LO12 is supported.
>
> This is currently manifesting itself as a buildbot failure on AArch64 http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/4609/steps/ninja%20check%202/logs/stdio
>
> I think we'll need to get R_AARCH64_TLSLE_ADD_TPREL_LO12 implemented in binutils and LLD and widely adopted by distributions before we can enable this by default, at least for Linux targets.
Oh, I hadn't realized that this relocation wasn't implemented for ELF even though it did exist in the LLVM object library. When working on TLS for windows, I implemented both the ADD and LDR/STR relocations at the same time, and MSVC uses the LDR/STR form by default.
I'm fine with reverting the ELF part of this change for now - I'll do that in a moment.
Repository:
rL LLVM
https://reviews.llvm.org/D44355
More information about the llvm-commits
mailing list