code wiki / _hdl_build / nx_build_run.nx

nx_build_run.nx

buildroot/runtime/_hdl_build/nx_build_run.nx

9129 B152 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic build
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_itoa_lib.nx nx_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 brn_puts sys_write sys_exit sys_mmap brn_cat sys_openat_wr brn_run sys_fork sys_dup3 sys_execve sys_exit ↻ sys_mmap ↻ sys_wait4 sys_close sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ br_bytes_equal brn_run_status sys_fork ↻ sys_dup3 ↻ sys_execve ↻ sys_exit ↻ sys_mmap ↻ sys_wait4 ↻ sys_openat_append brn_fputs sys_write ↻ brn_fputn nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap brn_putn nxi_out

structs

none

consts

12const BR_OK: i64 = 0
13const BR_USAGE: i64 = 2
14const BR_COMPILE_FAIL: i64 = 3
15const BR_LINK_FAIL: i64 = 4
17const BR_MIN_ASM_BYTES: i64 = 1000 // a real .s is far larger; <= this = the empty-output nondeterminism
18const BR_MAX_RETRIES: i64 = 12 // recompile-retry ceiling for the nondeterministic compiler

functions

20func 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 }
called by 1: main calls 1: sys_write
25func brn_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
26func brn_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
27func 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 }
called by 1: main calls 1: sys_write
32func brn_fputn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
35func brn_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
43func brn_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
57func brn_run_status(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
71func br_bytes_equal(a: *u8, b: *u8, n: i64) -> i64
called by 1: main
77func main(argc: i64, argv: *i64) -> i64