aarch64: Add support for %dtprel(var) and R_AARCH64_TLS_DTPREL64
This patch allows R_AARCH64_TLS_DTPREL64 relocations in non-allocated
sections, which is required for DWARF debug information when using
Thread Local Storage. This matches the behavior in LLD.
Also a new syntax to parse dtprel operator use to describe tls
location in debug information. Please see the reference 3 below.
References:
- https://github.com/llvm/llvm-project/pull/146572
[AArch64] Support TLS variables in debug info
- https://github.com/llvm/llvm-project/pull/183962
[LLD][AArch64] Handle R_AARCH64_TLS_DTPREL64 in non-alloc sections
- https://github.com/ARM-software/abi-aa/pull/330
[AAELF64] Allow R_AARCH64_TLS_DTPREL to be used statically.
bfd/
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Handle
BFD_RELOC_AARCH64_TLS_DTPREL.
gas/
* config/tc-aarch64.c (s_aarch64_cons): Parse %dtprel(var) syntax.
* testsuite/gas/aarch64/tls-debug.s: New test.
* testsuite/gas/aarch64/tls-debug.d: Run the test.
ld/
* testsuite/ld-aarch64/tls-debug.s: New test.
* testsuite/ld-aarch64/tls-debug.d: Run the test.
Bug: https://sourceware.org/PR28351
Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>
7 files changed