code wiki / (root) / nxld_main.nx

nxld_main.nx

buildroot/runtime/nxld_main.nx

1502 B50 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic nxld
docsdependenciesstructsconstsfunctions

about

nxld_main.nx -- CLI driver for the sovereign linker. Usage: nxld <input.o> > <output.elf> Reads input.o via sys_read_file, opens it as an Elf object, runs nxld_link() to produce a statically-linked RV64 Linux ELF executable, writes the bytes to stdout. Exit codes: 0 success 1 no args 2 read failed 3 open failed (bad ELF magic / not RV64 / etc.) 4 link failed Eventual goal: replace `riscv64-linux-gnu-ld` in verify.sh and bootstrap_proof.sh with `nxld`. Removes one of the two remaining gcc dependencies in the verify chain (the other being gcc-as, which the next sovereign tool nxasm-cli replaces).

dependencies 2 imports · 0 importers

syscalls.nx nxld.nx nxld_main.nx

imports: syscalls.nxnxld.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 nxld_open read_u16_le read_u64_le read_u32_le sec_name_eq nxld_link nxld_symbol_count nxld_read_symbol nxld_symbol_count ↻ read_u32_le ↻ read_u16_le ↻ read_u64_le ↻ nxld_layout nxld_reloc_count nxld_read_reloc nxld_reloc_count ↻ read_u64_le ↻ nxld_apply_one patch_b_imm write_u32_le patch_j_imm split_hi20 split_lo12 split_hi20 ↻ patch_u_imm patch_i_imm patch_s_imm write_elf sys_mmap ↻ build_elf_image put_u64_le sys_write

structs

none

consts

none

functions

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