The ELF for the Arm 64-bit Architecture document originally specified
R_AARCH64_TLS_DTPREL64 = 0x404 // 1028 R_AARCH64_TLS_DTPMOD64 = 0x405 // 1029
LLVM correctly followed the document. Unfortunately in binutils(1) these two
codes were reversed:
R_AARCH64_TLS_DTPMOD64 = 0x404 // 1028 R_AARCH64_TLS_DTPREL64 = 0x405 // 1029
Given that binaries had shipped this change has become the defacto standard interpretation of these relocation codes for any toolchain that wanted to remain compatible with GNU.
To recognize this the latest version of the ABI document (2) has renamed the relocations to R_AARCH64_TLS_IMPDEF1 and R_AARCH64_TLS_IMPDEF2 permitting a toolchain to choose between the two relocation types, and recommending that toolchains follow the GNU interpretation for maximum compatibility.
Given that upstream llvm has never implemented the standard ELF TLS model for AArch64, we have no binary legacy. Therefore synchronize with GCC so that we don't create incompatible objects in the future. So far the only visible change is in llvm-readobj as it can decode these relocations so this change will mean that llvm-readobj decodes the same way as GNU readelf.