[PATCH] D44355: [AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 05:21:11 PDT 2018


peter.smith added a comment.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D44355





More information about the llvm-commits mailing list