nx_dwarf_str_offsets.nx
buildroot/runtime/nx_dwarf_str_offsets.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 38 | struct NxDwSO |
consts
| 36 | const NX_DWSO_VERSION: i64 = 5 |
| 46 | const NX_DWSO_BYTES: i64 = 40 |
functions
| 48 | func nx_dwso_new(cap: i64) -> *NxDwSO called by 1: main |
| 59 | func nx_dwso_byte(s: *NxDwSO, b: i64) -> i64 |
| 66 | func nx_dwso_u16(s: *NxDwSO, v: i64) -> i64 |
| 71 | func nx_dwso_u32(s: *NxDwSO, v: i64) -> i64 |
| 78 | func nx_dwso_patch_u32(s: *NxDwSO, off: i64, v: i64) -> i64 called by 1: nx_dwso_cu_end |
| 87 | func nx_dwso_cu_begin(s: *NxDwSO) -> i64 |
| 100 | func nx_dwso_add(s: *NxDwSO, str_offset: i64) -> i64 |
| 111 | func nx_dwso_cu_base(s: *NxDwSO) -> i64 called by 1: main |
| 117 | func nx_dwso_cu_end(s: *NxDwSO) -> i64 |
| 127 | func main() -> i64 |