{"record":{"id":"b8091bd1be56ac8e","repo":"wasmerio/wasmer","slug":"the-relocation-reloc-is-not-yet-supported","errorCode":null,"errorMessage":"The relocation {reloc} is not yet supported.","messagePattern":"The relocation (.+?) is not yet supported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/compiler-cranelift/src/translator/translation_utils.rs","lineNumber":116,"sourceCode":"        ir::LibCall::TruncF64 => LibCall::TruncF64,\n        ir::LibCall::NearestF32 => LibCall::NearestF32,\n        ir::LibCall::NearestF64 => LibCall::NearestF64,\n        _ => panic!(\"Unsupported libcall\"),\n    }\n}\n\n/// Transform Cranelift Reloc to compiler Relocation\npub fn irreloc_to_relocationkind(reloc: Reloc) -> RelocationKind {\n    match reloc {\n        Reloc::Abs4 => RelocationKind::Abs4,\n        Reloc::Abs8 => RelocationKind::Abs8,\n        Reloc::X86PCRel4 => RelocationKind::PCRel4,\n        Reloc::X86CallPCRel4 => RelocationKind::X86CallPCRel4,\n        Reloc::X86CallPLTRel4 => RelocationKind::X86CallPLTRel4,\n        Reloc::X86GOTPCRel4 => RelocationKind::X86GOTPCRel4,\n        Reloc::Arm64Call => RelocationKind::Arm64Call,\n        Reloc::RiscvCallPlt => RelocationKind::RiscvCall,\n        _ => panic!(\"The relocation {reloc} is not yet supported.\"),\n    }\n}\n\n/// Create a `Block` with the given Wasm parameters.\npub fn block_with_params<'a>(\n    builder: &mut FunctionBuilder,\n    params: impl Iterator<Item = &'a wasmparser::ValType>,\n    environ: &FuncEnvironment<'_>,\n) -> WasmResult<ir::Block> {\n    let block = builder.create_block();\n    for ty in params.into_iter() {\n        match ty {\n            wasmparser::ValType::I32 => {\n                builder.append_block_param(block, ir::types::I32);\n            }\n            wasmparser::ValType::I64 => {\n                builder.append_block_param(block, ir::types::I64);\n            }","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/compiler-cranelift/src/translator/translation_utils.rs#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (translator panics on unmapped reloc)\n_ => panic!(\"The relocation {reloc} is not yet supported.\"),\n// after (after upgrading or adding a mapping)\nReloc::Riscv64PcHi20 => RelocationKind::Abs8, // example newly-supported mapping\nReloc::X86PCRel8 => RelocationKind::X86PCRel8,","handlingStrategy":"validation","validationCode":"// Before compiling, ensure your toolchain emits only supported relocations.\n// Keep wasmtime/cranelift current and pin modules to known reloc kinds:\nfn uses_supported_relocs(relocs: &[wasmparser::Reloc]) -> bool {\n    use wasmparser::Reloc::*;\n    relocs.iter().all(|r| matches!(r,\n        X86PCRel4 | X86CallPCRel4 | X86CallPLTRel4 | X86GOTPCRel4\n        | Arm64Call | RiscvCallPlt))\n}","typeGuard":"fn is_supported_reloc(r: &wasmparser::Reloc) -> bool {\n    use wasmparser::Reloc::*;\n    matches!(r, X86PCRel4 | X86CallPCRel4 | X86CallPLTRel4 | X86GOTPCRel4 | Arm64Call | RiscvCallPlt)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["panic","compiler","relocation","cranelift","unsupported-feature"],"backgroundTag":"unsupported-relocation-kind","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}