WEDNESDAY, JULY 8, 2026
gas/aarch64
AArch64 assembler enforces 8-byte DTPREL relocations.
AArch64 assembler rejects DTPREL relocations that are not 8 bytes wide, enforcing ABI compliance.
The AArch64 ELF ABI mandates that DTPREL (Dynamic Thread Pointer Relative) relocations must be 8 bytes wide. This commit updates the AArch64 assembler to check the size of %dtprel relocations and reject them if they are not used with .xword or .dword, thereby enforcing the ABI requirement.
In Details
The aarch64 assembler's relocation handling now enforces the ABI requirement that DTPREL relocations are 8 bytes. Previously, it would accept incorrect sizes, potentially leading to runtime issues in TLS dynamic thread operations. This change adds a check for nbytes != 8 within the s_aarch64_cons function when processing %%dtprel.
For Context
- DTPREL relocation
- A type of ELF relocation used for accessing thread-local storage at runtime. DTPREL specifically refers to offsets relative to the thread pointer.
- AArch64 ELF ABI
- The Application Binary Interface for the AArch64 architecture using the ELF object file format. It defines conventions for how software should interact at the binary level, including data type sizes and relocation handling.
- TLS
- Thread-Local Storage. A memory management feature that provides each thread in a multi-threaded program with its own copy of certain variables.
- .xword
- An assembler directive that specifies a 8-byte (64-bit) data size, equivalent to '.quad' or '.dword' on some architectures. In the context of AArch64, it's the standard size for 64-bit quantities.
- gas
- The GNU Assembler, part of the GNU Binutils project. It translates assembly language code into machine code.