In a recent change to LLVM (https://reviews.llvm.org/D44355) an attempt was made to fold the add and the ldr in the sequence: mrs x1, TPIDR_EL0 add x2, x1, :tprel_hi12:local_exec_var add x3, x2, :tprel_lo12_nc:local_exec_var ldr w0, [x3] to: mrs x1, TPIDR_EL0 add x2, x1, :tprel_hi12:local_exec_var ldr w0, [x2, :tprel_lo12_nc:local_exec_var] Unfortunately for this to work support is needed for the R_AARCH_TLSLE_LDST8_TPREL_LO12 relocation that ldr w0, [x2, :tprel_lo12_nc:local_exec_var] uses. It looks like only R_AARCH64_TLSLE_ADD_TPREL_LO12 is supported in binutils trunk (gold and bfd right now). It would be nice to add support for that relocation to enable the relaxation.
Created attachment 10918 [details] Patch to add support for new TLSLE relocs
Created attachment 10919 [details] Updated patch to add support for new TLSLE relocs
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e82e6b2b19eb796fed161b1658de6d5f763c18de commit e82e6b2b19eb796fed161b1658de6d5f763c18de Author: Cary Coutant <ccoutant@gmail.com> Date: Tue Mar 27 18:24:48 2018 -0700 Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc. elfcpp/ PR gold/22969 * aarch64.h: Fix spelling of R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC. gold/ PR gold/22969 * aarch64-reloc.def: Add TLSLE_LDST* relocations. * aarch64.cc (Target_aarch64::optimize_tls_reloc): Likewise. (Target_aarch64::Scan::local): Likewise. (Target_aarch64::Scan::global): Likewise. (Target_aarch64::Relocate::relocate): Likewise. (Target_aarch64::Relocate::relocate_tls): Likewise.
Now supported on trunk.