In https://reviews.llvm.org/D44355 an attempt was made to fold 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] Which unfortunately had to be reverted for ELF because no ELF linker supported the R_AARCH64_TLSLE_LDST8_TPREL_LO12 relocation that is needed for: ldr w0, [x2, :tprel_lo12_nc:local_exec_var]. Existing ELF linkers only implement R_AARCH64_TLSLE_ADD_TPREL_LO12_NC to support add x3, x2, :tprel_lo12_nc:local_exec_var It would be nice to implement this relocation to eventually enable this relaxation to be done for ELF targets. This will take some time as support will need to be added to the binutils linkers as well.
Support for the relocations was added in https://reviews.llvm.org/D46255. Can this issue be closed now?
Yes, my apologies I should have resolved this when committing the fix.