Skip to main content

Module linker

Module linker 

Source
Expand description

Linker-based RISC-V ELF to PVM transpilation.

Unlike the basic transpile_elf, this module processes ELF relocations to correctly handle data references in code. This is required for real-world programs (like k256 crypto) that reference .rodata constants.

Approach:

  1. Parse ELF sections and relocations
  2. Compute PVM memory layout (stack, ro_data, rw_data addresses)
  3. Build a relocation map: code_offset → resolved_address
  4. Translate RISC-V instructions, using relocation info to replace AUIPC+LO12 pairs with direct load_imm of the final PVM address
  5. Emit a v3 javm_cap::image::Image with the code sub-blob, declared endpoints, and standard kernel-ABI slot conventions.

Functions§

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