code wiki / (root) / nx_elf_inspect.nx

nx_elf_inspect.nx

buildroot/runtime/nx_elf_inspect.nx

5389 B109 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic elf
docsdependenciesstructsconstsfunctions

about

nx_elf_inspect.nx -- SOVEREIGN ELF inspector: answers "is this binary truly sovereign?" = statically linked with ZERO dynamic dependencies, WITHOUT the shell tools `file` + `readelf`. Parses the ELF64 program-header table for a PT_INTERP (an interpreter => dynamically linked) and a PT_DYNAMIC segment, then walks the dynamic array for DT_NEEDED (shared-library) entries. This is the crux capability for the bench/gate_nx_sovereign_deps.sh gate (which uses `file | grep "statically linked"` + `readelf -d | grep NEEDED`) and, broadly, the binary-level sovereignty check the ecosystem lacked (source-scan proves no lib REFERENCES; this proves the shipped ELF has no lib DEPENDENCIES). Sovereign (syscalls only). license_tier: ORIGINAL expect_exit: 0 (on a static ELF) Usage: nx_elf_inspect <file> -- exit 0 = STATIC/sovereign (no interpreter, 0 NEEDED); exit 1 = DYNAMIC.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_elf_inspect.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main ei_puts sys_write sys_exit sys_mmap ei_read_file sys_openat_rd sys_read sys_close ei_u64 ei_u16 ei_u32 ei_putn sys_write ↻ sys_mmap ↻

structs

none

consts

12const EI_CAP: i64 = 16777216 // 16 MiB read cap (organ + system binaries are well under this)

functions

14func ei_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
15func ei_putn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
26func ei_read_file(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
40func ei_u16(buf: *u8, o: i64) -> i64 { return (buf[o] as i64) | ((buf[o + 1] as i64) << 8) }
called by 1: main
41func ei_u32(buf: *u8, o: i64) -> i64
called by 1: main
44func ei_u64(buf: *u8, o: i64) -> i64
called by 1: main
50func main(argc: i64, argv: *i64) -> i64