On 2024-03-20, Cary Coutant wrote:

Over on the generic-abi mailing list, Fang-Rui Song recently proposed a
new compressed relocation format for ELF, motivated in part by the number
of relocations for string in the .debug_names tables.

Yes, .debug_names relocations are part of the motivations.

Regardless of the
resolution of that proposal, some simple changes to the DWARF spec could
help eliminate a substantial number of those relocations. In fact, parts of
the split DWARF series of proposals in DWARF 5 were all about minimizing
the quantity of relocations (e.g., DW_FORM_addrx and DW_FORM_strx).

This proposal adds an indirect string form to the name table (for use when
a non-split DWARF compilation is already using .debug_str_offsets), and a
local string pool in the name table (for use in a split-DWARF compilation).


This is proposal 240320.1 <https://dwarfstd.org/issues/240320.1.html>.

-cary

Thanks for the proposal! The proposed changes look good to me.

* str_format==DW_FORM_strp
  + local_str_pool_size==0: index into `.debug_str` (current LLVM 
implementation): needs relocations, suitable for non-split DWARF
  + local_str_pool_size!=0: index into the local string pool, suitable for 
split DWARF
* str_format==DW_FORM_strx4: index into the CU's contribution (header 
`str_offsets`) to `.debug_str_offsets`, alternative for non-split DWARF

DW_FORM_strp8, 64-bit string section in DWARF32, is for theoretical possibility 
I guess.

There is a ld.lld --debug-names proposal to merge per-CU .debug_names sections 
like --gdb-index.
The string offset relocations lead to some complexity and slight efficiency 
issues.
A local string pool will simplify that.

The downside of a local string pool inside the .debug_names section is that 
linkers' SHF_MERGE|SHF_STRINGS deduplication is lost (primarily for non-inlined 
inline functions).
--
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss

Reply via email to