GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
aarch64

aarch64: Fix TLS debuginfo missing location info [PR97344]

Debug info for Thread-Local Storage (TLS) variables on AArch64 now includes location information.

This patch resolves an issue where debug information for Thread-Local Storage (TLS) variables on AArch64 was missing location details. It introduces the assembler directive “.xword %dtprel(symbol)” to emit the necessary DW_AT_location information. To ensure compatibility with older assemblers, a configure check is added to conditionally apply this fix only if the assembler supports the new directive.

In Details

This commit addresses a debug info generation bug for TLS variables on AArch64 by emitting DW_AT_location using the .dtprel relocation mechanism. Toolchain developers who maintain GCC's AArch64 backend and DWARF generation logic, as well as those who build GCC with older binutils versions, would be interested. A new assembler check in configure prevents errors when building with unsupported binutils.

For Context
TLS
Thread-Local Storage. A memory allocation mechanism that provides each thread in a process with its own private copy of a variable. Accessing TLS variables typically involves special relocation types.
DWARF
A standardized debugging data format used by compilers to store information about source code constructs (variables, types, functions, etc.) within an executable or library. Debuggers use this information to allow source-level debugging.
DW_AT_location
A DWARF attribute tag that specifies the location of a variable or expression within the program's memory or registers. This is crucial for debuggers to find and display variable values.
dtprel
Data Thread-Local Storage relative relocation. A type of relocation used on some architectures (like AArch64) to address Thread-Local Storage variables.
aarch64
The 64-bit execution state of the ARMv8-A architecture and subsequent versions. It is the primary architecture for modern high-performance ARM processors.
assembler directive
An instruction to the assembler program itself, rather than a machine code instruction to be executed. Examples include specifying data formats, symbol types, or debugging information.
Filed Under: aarch64debuggingtls