code wiki / _hdl_build / nx_sov_build_run.nx

nx_sov_build_run.nx

buildroot/runtime/_hdl_build/nx_sov_build_run.nx

36152 B532 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic sov
docsdependenciesstructsconstsfunctions

about

nx_sov_build_run.nx -- FULLY SOVEREIGN, REUSABLE build runner (operator: "no sh and no c build, from the hardware layer up"). Generalizes nx_retire_gcc_orchestrator from hardcoded targets to ANY module passed as argv[1]. The build path is bits-up sovereign end to end: nx_cc_sovereign.elf <module>.nx -> _build/<module>.s (the team's SELF-HOSTED compiler) nxasm_x86_main.elf <module>.s -> _build/<module>.sov.elf (the team's x86-64 assembler+linker) _build/<module>.sov.elf (run it; exit = its exit) ⚠OUTPUT PATH IS _build/, RELATIVE TO CWD -- NOT /tmp/. These three lines said /tmp/ until 2026-07-30, left stale by the flock change that moved artifacts to a per-target _build/<name>.lock+.s+.sov.elf so concurrent sweeps stop overwriting each other mid-build. A doc that disagrees with the code is a defect, not a nit: it is why callers hunt for the artifact, and it hid a REAL brick hazard -- nx_hostctl cmd_buildrun (nx_hostctl.nx:3089) still reads /tmp/<name>.sov.elf, so this runner and that supervisor MUST be shipped as a matched pair or every /api/build in the ecosystem fails "no /tmp/<name>.sov.elf". NO gcc, NO bash, NO .sh anywhere. Orchestration is NishiLang sys_fork/dup3/execve/wait4. Recompile-retry guards the known-good compiler's empty-.s nondeterminism. Usage: nx_sov_build_run.elf <module-basename-in-runtime/_hdl_build> license_tier: ORIGINAL Reuses the _run spine from nx_retire_gcc_orchestrator.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_sov_build_run.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main sbr_puts sys_write sys_exit sys_mmap sbr_cat sys_openat_rd sys_close sys_mkdir sys_openat_wr sys_flock sys_unlinkat sbr_run sys_fork sys_dup3 sys_execve sys_exit ↻ sys_mmap ↻ sys_wait4 sbr_exitcode sbr_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_close ↻ sbr_ceq_at sbr_filesize sys_openat_rd ↻ sys_mmap ↻ sys_read ↻ sys_close ↻ sys_renameat

structs

none

consts

40const SBR_MAGIC_4096: i64 = 4096 // read-chunk size (folded from the buildroot branch's rule-11 sweep, 2026-07-29 merge)
42const SBR_OK: i64 = 0
43const SBR_USAGE: i64 = 2
44const SBR_COMPILE_FAIL: i64 = 3
45const SBR_ASM_FAIL: i64 = 4
46const SBR_ADMIT_REFUSED: i64 = 6 // build admission said no; distinct from a compile/assemble failure
49const SBR_CANON_REFUSED: i64 = 7 // tree-canon divergence: building would compile a FORKED copy
50const SBR_MIN_ASM_BYTES: i64 = 128 // empty/failed .s is ~0-byte header; the smallest real program (_min42) is 540B
51const SBR_MAX_RETRIES: i64 = 12

functions

26func sbr_name_is(a: *u8, b: *u8) -> i64
called by 1: sbr_is_toolchain
32func sbr_is_toolchain(name: *u8) -> i64
called by 1: main calls 1: sbr_name_is
53func sbr_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
58func sbr_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
61func sbr_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
64func sbr_ceq_at(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64
called by 1: main
71func sbr_exitcode(status: i64) -> i64 { return (status >> 8) & 0xff }
called by 1: sbr_run
79func sbr_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
95func sbr_filesize(path: *u8) -> i64
106func main(argc: i64, argv: *i64) -> i64