{"record":{"id":"690947ceb1512a47","repo":"wasmerio/wasmer","slug":"unsupported-libcall","errorCode":null,"errorMessage":"Unsupported libcall","messagePattern":"Unsupported libcall","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/compiler-cranelift/src/translator/translation_utils.rs","lineNumber":101,"sourceCode":"        Type::ExternRef | Type::FuncRef => reference_type(target_config),\n        Type::ExceptionRef => Ok(EXN_REF_TYPE),\n        // ty => Err(wasm_unsupported!(\"type_to_type: wasm type {:?}\", ty)),\n    }\n}\n\n/// Transform Cranelift LibCall into runtime LibCall\npub fn irlibcall_to_libcall(libcall: ir::LibCall) -> LibCall {\n    match libcall {\n        ir::LibCall::Probestack => LibCall::Probestack,\n        ir::LibCall::CeilF32 => LibCall::CeilF32,\n        ir::LibCall::CeilF64 => LibCall::CeilF64,\n        ir::LibCall::FloorF32 => LibCall::FloorF32,\n        ir::LibCall::FloorF64 => LibCall::FloorF64,\n        ir::LibCall::TruncF32 => LibCall::TruncF32,\n        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","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/compiler-cranelift/src/translator/translation_utils.rs#L83-L119","documentation":"irlibcall_to_libcall converts Cranelift's internal ir::LibCall values into the compiler-agnostic LibCall representation used for relocations. Any LibCall not explicitly mapped (mostly float intrinsics beyond floor/trunc/nearest) hits the `_ => panic!(\"Unsupported libcall\")` arm. It runs during relocation processing (mach_reloc_to_reloc), so it surfaces at the end of compilation when externalized calls are being resolved.","triggerScenarios":"Compilation where the Cranelift backend emits a machine relocation referencing an ir::LibCall variant with no mapping in irlibcall_to_libcall (called from mach_reloc_to_reloc) — e.g. an unmapped math intrinsic like powi, memset, or sqrt variant on a target that lowered an operation to a libcall.","commonSituations":"Soft-float targets (no native FP instructions) that lower float ops to libcalls not covered by the mapping; newer Cranelift versions adding LibCall variants before Wasmer's mapping is updated; unusual compiler flag combinations enabling float ops on targets lacking them.","solutions":["Upgrade Wasmer (and its cranelift dependency) so newly added LibCall variants are mapped.","Compile with a target CPU that has native float instructions (enable SSE2/softfloat disabled) to avoid libcalls.","Change compiler flags/backends so the failing operation is lowered inline rather than to a libcall.","If reproducible, file an issue including the target triple and the operation that triggers the missing libcall."],"exampleFix":"// before\nlet target = Target::new(triple, EnumSet::new()); // soft-float-ish, no FP features\n// after\nlet mut feats = EnumSet::new();\nfeats.insert(CpuFeature::SSE2);\nlet target = Target::new(triple, feats); // float ops lowered inline, no libcall reloc","handlingStrategy":"fallback","validationCode":"// Avoid soft-float targets that force unmapped libcalls:\nfn target_needs_native_float(feats: &EnumSet<CpuFeature>, triple: &Triple) -> bool {\n    matches!(triple.architecture, Architecture::X86_64) && !feats.contains(CpuFeature::SSE2)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the wasmer/cranelift dependency pair in sync (upgrade together).","Prefer CPU features enabling native float lowering over soft-float paths.","Test compilation for each target triple in CI to catch unmapped libcalls early."],"tags":["rust","panic","cranelift","libcall","relocation","compiler"],"backgroundTag":"unsupported-libcall","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}