code wiki / (root) / smoke_nxc_pipeline8.nx

smoke_nxc_pipeline8.nx source

↩ module page · 26 lines · 761 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 6import "syscalls.nx" 7import "types.nx" 8import "lex_kinds.nx" 9import "outbuf.nx" 10import "ir.nx" 11import "lex.nx" 12import "parse.nx" 13import "opt.nx" 14import "regalloc.nx" 15import "riscv.nx" 16import "crt0.nx" 17import "nxasm_v2.nx" 18import "elf_writer.nx" 19 20func main() -> i64 { 21 let code: *u8 = sys_mmap(64) 22 code[0] = 0x67; code[1] = 0x80; code[2] = 0x00; code[3] = 0x00 // ret 23 let n: i64 = write_elf(code, 4, 2) 24 if n < 0 { return __syscall(93, 50, 0, 0, 0, 0, 0) } 25 return __syscall(93, 42, 0, 0, 0, 0, 0) 26}