code wiki / (root) / nx_dwarf_str_offsets.nx

nx_dwarf_str_offsets.nx

buildroot/runtime/nx_dwarf_str_offsets.nx

5399 B168 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic dwarf
docsdependenciesstructsconstsfunctions

about

nx_dwarf_str_offsets.nx -- DWARF v5 .debug_str_offsets builder. DWARF v5 introduced a level of indirection: instead of every DIE attribute storing a direct file offset into .debug_str (form DW_FORM_strp), per-CU strings are referenced by INDEX into a per-CU offset table that lives in .debug_str_offsets (form DW_FORM_strx). Benefits: - Smaller DIEs in 32-bit DWARF (uleb128 index vs 4-byte offset). - All string offsets concentrate in one section -- better compression by gold/lld split-debug toolchains. - Makes incremental linking cheaper (only patch the offset table, not every DIE that referenced a moved string). Per-CU layout (DWARF v5 7.26): length u32 (excludes itself) version u16 = 5 padding u16 = 0 offsets[] u32 each (file offsets into .debug_str) Caller emits one CU contribution per .debug_info CU and writes one u32 per string the CU references. DIE attributes use form DW_FORM_strx (uleb128 index) which the consumer resolves via (cu_str_offsets_base + idx*4) -> file offset into .debug_str. Pairs with nx_dwarf_str (string pool) + nx_dwarf_info (consumer of strx forms).

dependencies 1 imports · 0 importers

syscalls.nx nx_dwarf_str_offsets.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_dwso_new nx_dwso_cu_begin nx_dwso_u32 nx_dwso_byte nx_dwso_u16 nx_dwso_byte ↻ nx_dwso_cu_base nx_dwso_add nx_dwso_u32 ↻ nx_dwso_cu_end nx_dwso_patch_u32

structs

38struct NxDwSO

consts

36const NX_DWSO_VERSION: i64 = 5
46const NX_DWSO_BYTES: i64 = 40

functions

48func nx_dwso_new(cap: i64) -> *NxDwSO
called by 1: main
59func nx_dwso_byte(s: *NxDwSO, b: i64) -> i64
66func nx_dwso_u16(s: *NxDwSO, v: i64) -> i64
called by 1: nx_dwso_cu_begin calls 1: nx_dwso_byte
71func nx_dwso_u32(s: *NxDwSO, v: i64) -> i64
78func nx_dwso_patch_u32(s: *NxDwSO, off: i64, v: i64) -> i64
called by 1: nx_dwso_cu_end
87func nx_dwso_cu_begin(s: *NxDwSO) -> i64
called by 1: main calls 2: nx_dwso_u32nx_dwso_u16
100func nx_dwso_add(s: *NxDwSO, str_offset: i64) -> i64
called by 1: main calls 1: nx_dwso_u32
111func nx_dwso_cu_base(s: *NxDwSO) -> i64
called by 1: main
117func nx_dwso_cu_end(s: *NxDwSO) -> i64
called by 1: main calls 1: nx_dwso_patch_u32
127func main() -> i64