binutils Newspaper
NOVEMBER 30, 2026
gas — Proposed

gas: Anchor DWARF subprograms to the definitions

Improves DWARF debug info by anchoring subprograms to their definitions, fixing issues with weak and COMDAT symbols.

This patch series aims to improve DWARF debug information generated by GAS by anchoring subprogram DIEs (Debug Information Entries) to their actual definitions. This addresses issues where tools like addr2line might fail to find function names or source lines due to symbol resolution problems with weak or COMDAT functions, which can lose their original symbols after linking. The series includes specific fixes for ARM Thumb and MIPS architectures to correctly handle ISA modes.

In Details

This series enhances DWARF emission in GAS to correctly associate subprogram Debug Information Entries (DIEs) with their definitions. It addresses inaccuracies caused by symbol resolution mechanisms like weak symbols and COMDAT sections, which can lead to DIEs referencing incorrect addresses after linking. The approach involves generating local start symbols and includes architecture-specific handling for ARM Thumb and MIPS (microMIPS) to preserve ISA mode information, aligning GAS with compiler behavior (GCC, Clang) for weak functions.

For Context
GAS
The GNU Assembler, part of the GNU Binutils project, which translates assembly language code into machine code.
DWARF
A debugging data format used by many compilers and debuggers to store information about variables, functions, and types in compiled programs.
Subprogram DIE
A Debug Information Entry (DIE) within the DWARF format that describes a function or subroutine.
Weak symbol
A type of symbol in object files that allows multiple definitions of the same symbol. The linker typically chooses one definition based on certain rules (e.g., preferring non-weak symbols).
COMDAT
COMDAT (COMDAT section) is a type of section in object files that allows identical sections from multiple object files to be merged into a single section in the final executable. It is often used for things like exception handling tables.
addr2line
A command-line utility that translates addresses in an object file or memory map into line numbers and function names, using DWARF or stabs debugging information.
ISA mode
Instruction Set Architecture mode, referring to different operational modes of a processor, such as ARM's Thumb mode for 16-bit instructions.

Part of a Series

Filed Under: binutilsgasDWARFdebuggingweak symbols