binutils Newspaper
JULY 29, 2026
aarch64 Proposed Sentiment 7 / 10

aarch64: Fix assembler error for %dtprel relocations

Srinath Parvathaneni proposes a fix for an assembler internal error related to %dtprel relocations on AArch64.

Srinath Parvathaneni submits a patch to fix an internal assembler error on AArch64 when handling %dtprel relocations. The issue occurs because the DTPREL fixup was created before reserving storage for the corresponding ‘.xword’, causing problems with TLS DWARF debug information, particularly when placed at a fragment boundary. The patch corrects the storage order to resolve this corner case.

In the Thread 2 participants
  1. srinath.parvathaneni@arm.com proposer

    Submits a patch to fix an assembler internal error by correcting the order of operations for %dtprel relocations.

    “The current implementation creates the DTPREL fixup before reserving the storage for the corresponding ".xword". GCC's "%dtprel" support for TLS DWARF debug information exposed this during an AArch64 bootstrap, where the libsanitizer/tsan DWARF layout places the DTPREL fixup at a frag boundary. Reserving the storage before creating the fixup avoids this corner case.”
  2. Alan Modra <amodra@gmail.com> reviewer

    Acknowledges the issue and the proposed fix.

In Details

This patch addresses an ordering issue in the AArch64 assembler (gas) related to Thread Local Storage (TLS) and Debugging With Attributed Record Prefix (DWARF) information. Specifically, it corrects the generation order of DTPREL relocations and their associated storage (.xword) to prevent an internal error when these relocations fall on fragment boundaries, a scenario exposed by GCC's %dtprel handling for libsanitizer.

For Context
%dtprel
A directive or syntax used in assembly or by compilers to specify a DTPREL (Descriptor Table Pointer Relative) relocation, typically used for Thread Local Storage (TLS) access.
DTPREL
Descriptor Table Pointer Relative. A type of relocation used in some architectureABIs, often related to accessing thread-local storage (TLS) variables.
TLS
Thread Local Storage. A mechanism that allows variables to have unique instances per thread.
DWARF
Debugging With Attributed Record Prefix. A debugging data format used by many compilers and debuggers to store information about source code.
assembler
A program that translates assembly language code into machine code. In this context, it refers to gas, the GNU Assembler.
relocation
A placeholder in object code that specifies how to modify addresses or other values when the code is linked or loaded into memory. DTPREL is a type of relocation.
fragment boundary
In the context of assemblers like gas, code is often organized into fragments. A fragment boundary is the point where one fragment ends and another begins.
Filed Under: aarch64assemblerrelocationtlsdwarf