code wiki / (root) / nxasm_x86_main.nx

nxasm_x86_main.nx

buildroot/runtime/nxasm_x86_main.nx

12606 B244 linesdepth 4pulls 10 transitivereach 0 importersview sourcekind orphan librarytopic nxasm
docsdependenciesstructsconstsfunctions

about

RECOVERED + ADAPTED into buildroot/runtime/ 2026-08-07 (debts 1786109488 / 1786109910). This driver was ABSENT from the NAS build tree: buildroot/nxasm/ does not exist and no *x86_main*.nx existed under buildroot, so the x86 assembler -- half the sovereign toolchain -- had a LIVE binary and no source to rebuild it from. Sole copy was nxc2/nxasm/ on the laptop. TWO ADAPTATIONS, both forced by consolidations this tree has had since the copy was taken: (1) import "../runtime/nx_syscalls_x86_64.nx" -> "nx_syscalls_x86_64.nx". The relative path only resolves from a sibling dir; buildroot/nxasm/ could not be created (nx_fs_write does not make parents -- silent exit 4 -- and nx_mkdirp is allowlisted to knowledge/|sites/|/tmp/). (2) sys_read_file_x86_64 -> sys_read_file. THIS ONE NEARLY WENT THE WRONG WAY. The symbol is defined NOWHERE in buildroot, and three laptop copies (.build/runtime, .tmp-rv64/inputs, bench/ir_diff_corpus) hold an 11,763 B nx_syscalls_x86_64.nx that DOES define it -- so the obvious read was "buildroot's 1,388 B copy is truncated, restore the big one". THAT READ IS WRONG. buildroot's copy is a DELIBERATE ALIAS STUB (2026-07-31, debt 1785528831) forwarding to nx_syscalls.nx, which now owns the wrapper set once. It exists to FIX a measured defect: 37 translation units reached BOTH layers, held every wrapper twice, and resolved silently by definition order. Restoring the 11,763 B file would have reverted that fix and re-armed the double-definition bug. READING THE FILE'S OWN HEADER IS WHAT STOPPED IT. ★A SMALLER FILE IS NOT EVIDENCE OF TRUNCATION -- IT CAN BE THE RESULT OF A CONSOLIDATION THAT MOVED THE CONTENT SOMEWHERE BETTER. ASK THE FILE BEFORE YOU RESTORE OVER IT. ⚠NOT YET PROVEN AUTHENTIC: a successful build does NOT establish that this is the source the live nxasm_x86_main.elf was built from. buildroot/_build/nxasm_x86_main.s survives from a prior build -- rebuild-and-compare against it (or against the live ELF) is the real authenticity test.// nxasm_x86_main.nx -- CLI front-end for the sovereign x86_64 assembler. Usage: nxasm_x86 <input.s> <output.elf> Reads an nxc2 --target x86_64 AT&T .s file, assembles it to machine code via nxasm_x86_assemble, wraps it in a static ELF (entry at the _start label), and writes a runnable binary. This single tool replaces BOTH `gcc-as` and `ld` on the x86_64 output path -- the whole-program model nxld uses (no intermediate .o). gcc/as/ld are retained ONLY as one-time Wheeler bootstrap + byte-exact oracle. license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nxasm_x86.nx nx_dwarf_line.nx nx_dwarf_info.nx nx_dwarf_abbrev.nx nx_syscalls_x86_64.nx nx_crash.nx nxasm_x86_main.nx

imports: nxasm_x86.nxnx_dwarf_line.nxnx_dwarf_info.nxnx_dwarf_abbrev.nxnx_syscalls_x86_64.nxnx_crash.nx

imported by: nobody (leaf or entry point)

structs

none

consts

54const NXASM_BUF: i64 = 16777216
55const NXASM_PATH_MAX: i64 = 4096

functions

60func nxm_clen(s: *u8) -> i64
70func nxm_puts(fd: i64, s: *u8) -> i64
77func nxm_putn(fd: i64, v: i64) -> i64
90func main(argc: i64, argv: *i64) -> i64