binutils Newspaper
JUNE 15, 2026
alpha Proposed

alpha: Properly handle local weak undefined symbols

Fixes a null pointer dereference in the alpha backend that caused ASan failures when handling local weak undefined symbols.

A patch addresses a null pointer dereference in the alpha backend of binutils when processing local weak undefined symbols. The issue triggered AddressSanitizer (ASan) errors, leading to test failures related to TLS with various configurations (e.g., -fpic -shared). The fix involves checking for a null h pointer before accessing its members, preventing the dereference and resolving the ASan complaint.

In the Thread 1 participant
  1. Alan Modra <amodra@gmail.com> proposer

    Proposes a patch to fix a null pointer dereference in `elf64_alpha_relocate_section` when handling local weak undefined symbols, resolving ASan failures.

    “asan complains "runtime error: member access within null pointer" for &h->root with NULL h, which is annoying since &h->root is the same address as h, causing alpha-linux-gnu +FAIL: TLS -fpic -shared”

In Details

The elf64_alpha_relocate_section function in binutils handles relocations for Alpha architecture ELF files. Local weak undefined symbols require special handling during linking. The patch guards against a null h pointer, which can occur in specific scenarios involving these symbols, preventing a crash detected by ASan.

For Context

When linking programs, the linker needs to resolve references between different parts of the code. Sometimes, a symbol (like a variable or function name) might be declared but not defined in the same file. These are called undefined symbols. Weak symbols are a special type of symbol that can be overridden by a definition in another file. This patch fixes a bug in how the binutils linker handles these undefined weak symbols on Alpha architecture, preventing a crash reported by a memory error detector (ASan).

Filed Under: alphalinkerrelocationasanundefined symbol