Skip to main content

link_elf

Function link_elf 

Source
pub fn link_elf(elf_data: &[u8]) -> Result<Image, TranspileError>
Expand description

Transpile an rv64em ELF into a v3 chain [Image].

Output Image:

  • code: CODE sub-blob (jump_table + code + packed bitmask) of the translated user code.
  • endpoints: populated from the .subsoil.endpoints ELF section (entries emitted by #[subsoil::endpoint(N)]). Each descriptor’s fn_ptr points at a per-endpoint trampoline that calls the user fn and halts. Guests must declare at least one endpoint; the transpiler errors if the section is absent or empty. Every endpoint gets initial_regs[1] = stack_top baked in.
  • memory_mappings + pinned_slots + initial_slots: declarative address-space layout. The transpiler emits one mapping per region (stack, ro, rw, heap) backed by a slot. ro_data lives in pinned_slots (RO at runtime); rw_data and the zero-filled stack/heap regions live in initial_slots (RW). The kernel’s chain genesis installs Cap::Data’s for each declared slot.
  • gas_slots, quota_slots, yield_marker_slot: standard kernel-ABI defaults from [javm_cap::abi].