llvm-project
c4fe77e1 - [DWARFLinker] Emit DW_AT_addr_base for units that had none (#219357)

Commit
10 days ago
[DWARFLinker] Emit DW_AT_addr_base for units that had none (#219357) Fix DWARFv5 units that reach the linker without DW_AT_addr_base, as GCC emits them at -O2. Both linkers rewrite range and location lists into base_addressx entries, which resolve through DW_AT_addr_base, but they only ever patch an attribute copied from the input. With nothing to patch, the classic linker hits the llvm_unreachable in patchAddrBase(), and the parallel linker writes indices with no base, so the unit's ranges resolve from address 0. Add DW_AT_addr_base to every DWARFv5 unit root that lacks one, whatever its tag, and emit the unit's .debug_addr contribution even when no address was pooled, so the attribute always points at a table. Update mode does not rewrite ranges, so nothing is added there. The tests link a compile unit root and a partial unit root with both linkers and check the attribute, the address table, the range list and --verify. The compile unit test also checks that update mode adds no attribute, and a third test links a unit that pools no address. Fixes #218825. Assisted-by: Claude Code
Author
Parents
Loading