code wiki / (root) / nx_nxasm_main.nx

nx_nxasm_main.nx

buildroot/runtime/nx_nxasm_main.nx

1949 B61 linesdepth 3pulls 4 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

nx_syscalls.nx nxasm_v2.nx elf_writer.nx nx_nxasm_main.nx

imports: nx_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_mmap 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

structs

none

consts

none

functions

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