wasmerio/wasmer · critical
The relocation {reloc} is not yet supported.
Error message
The relocation {reloc} is not yet supported. What it means
irreloc_to_relocationkind converts a wasmparser Reloc into cranelift's RelocationKind. Any relocation kind outside the explicitly mapped set (X86 PCRel/Call/GOT, Arm64Call, RiscvCallPlt) hits the catch-all `_` arm and panics. This is a deliberately unimplemented-feature guard: the compiler backend does not (yet) support that relocation type, so compilation aborts loudly instead of emitting wrong code.
Source
Thrown at lib/compiler-cranelift/src/translator/translation_utils.rs:116
ir::LibCall::TruncF64 => LibCall::TruncF64,
ir::LibCall::NearestF32 => LibCall::NearestF32,
ir::LibCall::NearestF64 => LibCall::NearestF64,
_ => panic!("Unsupported libcall"),
}
}
/// Transform Cranelift Reloc to compiler Relocation
pub fn irreloc_to_relocationkind(reloc: Reloc) -> RelocationKind {
match reloc {
Reloc::Abs4 => RelocationKind::Abs4,
Reloc::Abs8 => RelocationKind::Abs8,
Reloc::X86PCRel4 => RelocationKind::PCRel4,
Reloc::X86CallPCRel4 => RelocationKind::X86CallPCRel4,
Reloc::X86CallPLTRel4 => RelocationKind::X86CallPLTRel4,
Reloc::X86GOTPCRel4 => RelocationKind::X86GOTPCRel4,
Reloc::Arm64Call => RelocationKind::Arm64Call,
Reloc::RiscvCallPlt => RelocationKind::RiscvCall,
_ => panic!("The relocation {reloc} is not yet supported."),
}
}
/// Create a `Block` with the given Wasm parameters.
pub fn block_with_params<'a>(
builder: &mut FunctionBuilder,
params: impl Iterator<Item = &'a wasmparser::ValType>,
environ: &FuncEnvironment<'_>,
) -> WasmResult<ir::Block> {
let block = builder.create_block();
for ty in params.into_iter() {
match ty {
wasmparser::ValType::I32 => {
builder.append_block_param(block, ir::types::I32);
}
wasmparser::ValType::I64 => {
builder.append_block_param(block, ir::types::I64);
}View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Upgrade wasmtime/cranelift to a version where the relocation kind is mapped in irreloc_to_relocationkind.
- Check which relocation the panic message names and avoid producing it: rebuild the source module with a toolchain/configuration that uses supported relocation kinds.
- If you need it now, add a `Reloc::<KIND> => RelocationKind::...` arm in lib/compiler-cranelift/src/translator/translation_utils.rs and file/upstream the change.
- Fall back to a backend that supports the relocation (e.g. LLVM backend) for that module.
Example fix
// before (translator panics on unmapped reloc)
_ => panic!("The relocation {reloc} is not yet supported."),
// after (after upgrading or adding a mapping)
Reloc::Riscv64PcHi20 => RelocationKind::Abs8, // example newly-supported mapping
Reloc::X86PCRel8 => RelocationKind::X86PCRel8, Defensive patterns
Strategy: validation
Validate before calling
// Before compiling, ensure your toolchain emits only supported relocations.
// Keep wasmtime/cranelift current and pin modules to known reloc kinds:
fn uses_supported_relocs(relocs: &[wasmparser::Reloc]) -> bool {
use wasmparser::Reloc::*;
relocs.iter().all(|r| matches!(r,
X86PCRel4 | X86CallPCRel4 | X86CallPLTRel4 | X86GOTPCRel4
| Arm64Call | RiscvCallPlt))
} Type guard
fn is_supported_reloc(r: &wasmparser::Reloc) -> bool {
use wasmparser::Reloc::*;
matches!(r, X86PCRel4 | X86CallPCRel4 | X86CallPLTRel4 | X86GOTPCRel4 | Arm64Call | RiscvCallPlt)
} Prevention
- Keep wasmtime/cranelift upgraded so newly supported relocations are mapped.
- Build Wasm modules with toolchains/targets that emit supported relocation kinds.
- Pre-scan module relocations before compiling with the Cranelift backend.
- Route modules needing exotic relocations to a different backend.
When it happens
Trigger: Compiling a Wasm module that references an exotic relocation kind — e.g. Reloc::X86PCRel8/16, Arm64Call26 variants, Riscv64PcHi20/Lo12I, or any relocation added to wasmparser's Reloc enum that translator/translation_utils.rs has not mapped.
Common situations: Using a very new or experimental Wasm extension that emits relocations the Cranelift translator lacks support for; compiling modules produced by toolchains targeting RISC-V or AArch64 relocation subtypes; running a wasmtime version older than the relocation kind's support was added.
Related errors
- Unsupported libcall
- cannot create debug directory: {}
- x86 support requires SSE2
- global #{} is a constant
- unable to make memory readonly and executable
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/b8091bd1be56ac8e.
Report an issue: GitHub.