code wiki / _hdl_build / nx_build_run.nx
nx_build_run.nx
buildroot/runtime/_hdl_build/nx_build_run.nx
about
nx_build_run.nx -- SOVEREIGN, REUSABLE build runner in pure NishiLang (operator: "stop using sh again").
Generalizes nx_build_orchestrator from one hardcoded target to ANY module passed as argv[1]: it compiles
(compiler stdout -> /tmp/<name>.s) with RECOMPILE-RETRY (the known-good compiler is nondeterministic and
sometimes emits an empty .s), assembles+links (gcc -> /tmp/<name>.elf), runs the ELF, and exits with the
ELF's own exit code. The ORCHESTRATION is sovereign NishiLang via sys_fork/dup3/execve/wait4 -- NO shell,
NO .sh runner. (gcc is still exec'd as the assembler/linker = the next dep to retire with nxasm; bash is
retired here.) Usage: nx_build_run.elf <module-basename-in-runtime/_hdl_build>. license_tier: ORIGINAL
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
| 12 | const BR_OK: i64 = 0 |
| 13 | const BR_USAGE: i64 = 2 |
| 14 | const BR_COMPILE_FAIL: i64 = 3 |
| 15 | const BR_LINK_FAIL: i64 = 4 |
| 17 | const BR_MIN_ASM_BYTES: i64 = 1000 // a real .s is far larger; <= this = the empty-output nondeterminism |
| 18 | const BR_MAX_RETRIES: i64 = 12 // recompile-retry ceiling for the nondeterministic compiler |
functions
| 20 | func brn_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 25 | func brn_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 26 | func brn_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 27 | func brn_fputs(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 32 | func brn_fputn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 35 | func brn_cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 43 | func brn_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64 |
| 57 | func brn_run_status(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64 |
| 71 | func br_bytes_equal(a: *u8, b: *u8, n: i64) -> i64 called by 1: main |
| 77 | func main(argc: i64, argv: *i64) -> i64 |