code wiki / _hdl_build / nx_sov_build_run.nx
nx_sov_build_run.nx
buildroot/runtime/_hdl_build/nx_sov_build_run.nx
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
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
structs
| none |
consts
| 40 | const SBR_MAGIC_4096: i64 = 4096 // read-chunk size (folded from the buildroot branch's rule-11 sweep, 2026-07-29 merge) |
| 42 | const SBR_OK: i64 = 0 |
| 43 | const SBR_USAGE: i64 = 2 |
| 44 | const SBR_COMPILE_FAIL: i64 = 3 |
| 45 | const SBR_ASM_FAIL: i64 = 4 |
| 46 | const SBR_ADMIT_REFUSED: i64 = 6 // build admission said no; distinct from a compile/assemble failure |
| 49 | const SBR_CANON_REFUSED: i64 = 7 // tree-canon divergence: building would compile a FORKED copy |
| 50 | const SBR_MIN_ASM_BYTES: i64 = 128 // empty/failed .s is ~0-byte header; the smallest real program (_min42) is 540B |
| 51 | const SBR_MAX_RETRIES: i64 = 12 |
functions
| 26 | func sbr_name_is(a: *u8, b: *u8) -> i64 called by 1: sbr_is_toolchain |
| 32 | func sbr_is_toolchain(name: *u8) -> i64 |
| 53 | func 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 } |
| 58 | func sbr_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 61 | func 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 |
| 64 | func sbr_ceq_at(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64 called by 1: main |
| 71 | func sbr_exitcode(status: i64) -> i64 { return (status >> 8) & 0xff } called by 1: sbr_run |
| 79 | func sbr_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64 |
| 95 | func sbr_filesize(path: *u8) -> i64 |
| 106 | func main(argc: i64, argv: *i64) -> i64 |