Skip to main content

Crate nub_linker

Crate nub_linker 

Source
Expand description

RISC-V ELF → PVM2 linker.

Converts a linked RV64EMC (+Zbb/Zba/Zbs/Zicond/Zicclsm/custom-0) ELF — as produced by the riscv64emc-pvm2 target — into a [nub_program::ProgramBlob] the interpreter and recompiler can run directly.

This is ISA work, not policy work: section concatenation, AUIPC-pair resolution, ecall-marker rewriting, fallthrough injection and PVM2 validation. Nothing here knows about capabilities, cnodes or content hashing. A personality that wants those wraps the emitted blob — javm-transpiler does exactly that to produce a cap Image.

let elf = std::fs::read("guest.elf").unwrap();
let blob = nub_linker::link_elf(&elf).unwrap();
std::fs::write("guest.nubp", blob.to_bytes()).unwrap();

Modules§

elf
ELF parsing helpers shared by the PVM2 linker.

Enums§

LinkError
Why an ELF could not be linked into a [nub_program::ProgramBlob].

Functions§

link_elf
Link an RV ELF into a PVM2 [ProgramBlob]. [ProgramBlob::code] holds the raw RV+C+custom-0 bytes, mapped read-only at [CODE_BASE] by the runtime.