Skip to main content

Overview

The jolt generate command provides utilities for advanced users who need to customize the RISC-V target specification or linker script for their guest programs. This is useful when working with custom memory layouts or non-standard build configurations.

Subcommands

jolt generate target

Generates a custom RISC-V target specification JSON file.
jolt generate target [OPTIONS]
--profile
string
Use a predefined target profile
--target
string
Specify a custom target triple
--output
string
default:"<target-triple>.json"
Output path for the generated target specification (short: -o)
Example:
# Generate target spec from a profile
jolt generate target --profile riscv64imac-unknown-none-elf -o my-target.json

# Generate target spec from a custom triple
jolt generate target --target riscv64imac-unknown-none-elf -o custom.json
The generated JSON file contains the complete target specification including:
  • Architecture settings (data layout, pointer width)
  • ABI configuration
  • Supported features
  • Linker configuration
You can then use this target specification with rustc --target=my-target.json for custom builds.

jolt generate linker

Generates a linker script with custom memory layout.
jolt generate linker [OPTIONS]
--output
string
default:"linker.ld"
Output path for the generated linker script (short: -o)
--ram-start
hex
Starting address for RAM
--ram-size
hex
Size of RAM region
--stack-size
hex
Size of the stack region
--heap-size
hex
Size of the heap region
Example:
# Generate linker script with custom memory layout
jolt generate linker -o custom-linker.ld

# The generated script will include memory regions and sections
# that match your specified layout
The generated linker script defines:
  • Memory regions (RAM, ROM, etc.)
  • Section placements (.text, .data, .bss, .heap, .stack)
  • Entry point and initialization code locations

Use Cases

Custom Memory Layout

When you need a specific memory layout for your guest program:
# Generate custom linker script
jolt generate linker -o custom.ld

# Use it with build
RUSTFLAGS="-C link-arg=-Tcustom.ld" jolt build

Cross-Compilation

When targeting a custom RISC-V variant:
# Generate target specification
jolt generate target --target riscv64gc-unknown-linux-gnu -o riscv64gc.json

# Build with custom target
jolt build --target riscv64gc.json

Debugging Build Issues

Generate the default configuration to understand what Jolt uses:
# See the default target spec
jolt generate target --profile riscv64imac-unknown-none-elf

# See the default linker script
jolt generate linker

Notes

Most users do not need these commands. The default target specification and linker script work for typical zkVM programs.
Custom target specifications must be compatible with RV64IMAC instruction set. Jolt requires specific RISC-V features to function correctly.
  • jolt build - Build guest programs (uses target specs internally)
  • jolt new - Create new projects (includes default configuration)

Build docs developers (and LLMs) love