code wiki / (root) / nx_smoke_nxc_pipeline8.nx

nx_smoke_nxc_pipeline8.nx source

↩ module page · 32 lines · 1022 B

1// Same imports as nxc.nx but ONLY call write_elf, skip all the 2// pipeline stages. If this crashes too, the issue is in the 3// import-expanded source itself (e.g. some constructor at top 4// level), not the stages. 5 6// nx_safety_envelope: 7// intended_use: AUTO_APPLIED -- primitive-specific tuning queued 8// sil_target: SIL1 9// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail] 10// verdict: NOT_YET_EVALUATED 11 12import "nx_syscalls.nx" 13import "nx_types.nx" 14import "nx_lex_kinds.nx" 15import "nx_outbuf.nx" 16import "nx_ir.nx" 17import "nx_tokenizer.nx" 18import "nx_parse.nx" 19import "nx_opt.nx" 20import "nx_regalloc.nx" 21import "nx_riscv.nx" 22import "crt0.nx" 23import "nxasm_v2.nx" 24import "elf_writer.nx" 25 26func main() -> i64 { 27 let code: *u8 = sys_mmap(64) 28 code[0] = 0x67; code[1] = 0x80; code[2] = 0x00; code[3] = 0x00 // ret 29 let n: i64 = write_elf(code, 4, 2) 30 if n < 0 { return __syscall(93, 50, 0, 0, 0, 0, 0) } 31 return __syscall(93, 42, 0, 0, 0, 0, 0) 32}