code wiki / (root) / nxasm_main.nx

nxasm_main.nx

buildroot/runtime/nxasm_main.nx

1750 B55 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind tooltopic nxasm
docsdependenciesstructsconstsfunctions

about

nxasm_main.nx -- CLI driver for nxasm_v2 + elf_writer. Usage: nxasm <input.s> > <output.elf> Reads input.s via sys_read_file, assembles to RV64 machine bytes via nxasm_v2.assemble(), wraps in a static Linux ELF via elf_writer.write_elf(), writes to stdout. Single-step asm+link. For programs whose entire link is a single .s file (the common case for nxc.nx output today), this replaces the entire `gcc-as + ld` chain in verify.sh. Exit codes: 0 success 1 no args 2 read failed 3 assemble failed (negative byte count) 4 write failed Together with nxld_main (which handles multi-object link), these two tools cover every gcc-as + ld invocation we need.

dependencies 3 imports · 0 importers

syscalls.nx nxasm_v2.nx elf_writer.nx nxasm_main.nx

imports: syscalls.nxnxasm_v2.nxelf_writer.nx

imported by: nobody (leaf or entry point)

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

main sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close assemble alloc assemble_pass next_tok lex_one is_space asm_is_digit is_hex asm_is_digit ↻ hexv asm_is_alpha skip_to_newline label_define sys_write s_eq5 handle_word expect_int next_tok ↻ emit_u32 next_tok ↻ handle_byte expect_int ↻ emit_byte next_tok ↻ handle_skip expect_int ↻ emit_byte ↻ s_eq6 handle_asciz next_tok ↻ emit_byte ↻ assemble_mnemonic parse_j_label

structs

none

consts

none

functions

27func main(argc: i64, argv: *i64) -> i64 {