binutils Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
bfd

PR 34165 Fix aarch64 TLS assertion failure

Aarch64 TLS handling in binutils now returns zero instead of asserting on missing TLS sections.

This commit resolves an assertion failure in the aarch64 backend of the BFD library related to Thread Local Storage (TLS). Instead of asserting when a TLS section is NULL, the code now safely returns zero, preventing crashes and improving robustness for scenarios involving TLS.

In Details

The dtpoff_base and tpoff_base functions in elfnn-aarch64.c previously asserted that tls_sec was non-NULL. This commit changes this behavior to return 0 if tls_sec is NULL. This is a safeguard against potential errors during the TLS symbol resolution and calculation process, preventing crashes when the TLS section is unexpectedly missing.

For Context
aarch64
The 64-bit execution state of the ARM architecture, commonly used in mobile devices and servers.
TLS
Thread Local Storage. A mechanism that allows each thread in a multi-threaded program to have its own private copy of certain variables, ensuring thread safety without explicit locking.
BFD
The Binary File Descriptor library, a part of GNU Binutils. It provides an abstraction layer to manage different object file formats, enabling tools like the linker and assembler to work with various executable and symbolic formats.
Assertion
A statement in a program that must be true at a certain point during execution. If the assertion is false, the program typically terminates with an error, indicating a programming mistake or an unexpected program state.
Filed Under: bugfixaarch64TLS