wasmerio/wasmer · error

Not supported yet

Error message

Not supported yet

What it means

During object-file emission for AOT/engines that produce a native object, `RelocationTarget::DynamicTrampoline` relocations are simply not handled: emit_compilation hits `todo!("Not supported yet")`. The serializer can write LibCall and function-local relocations but has no strategy for dynamic trampolines yet.

Source

Thrown at lib/compiler/src/object/module.rs:485

                                symbol: hi_symbol,
                                addend: 0,
                            },
                        )
                        .map_err(ObjectError::Write)?;
                    } else {
                        obj.add_relocation(
                            section_id,
                            Relocation {
                                offset: relocation_address,
                                flags: relocation_flags,
                                symbol: *target_symbol,
                                addend: r.addend,
                            },
                        )
                        .map_err(ObjectError::Write)?;
                    }
                }
                RelocationTarget::DynamicTrampoline(_) => todo!("Not supported yet"),
                RelocationTarget::LibCall(libcall) => {
                    let mut libcall_fn_name = libcall.to_function_name().to_string();
                    if matches!(triple.binary_format, BinaryFormat::Macho) {
                        libcall_fn_name = format!("_{libcall_fn_name}");
                    }

                    let libcall_fn_name = libcall_fn_name.as_bytes();

                    // We add the symbols lazily as we see them
                    let target_symbol = obj.symbol_id(libcall_fn_name).unwrap_or_else(|| {
                        obj.add_symbol(ObjSymbol {
                            name: libcall_fn_name.to_vec(),
                            value: 0,
                            size: 0,
                            kind: SymbolKind::Unknown,
                            scope: SymbolScope::Unknown,
                            weak: false,
                            section: SymbolSection::Undefined,

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Avoid serializing artifacts whose relocations include DynamicTrampoline targets; compile/serialize with settings that keep calls as LibCall relocations
  2. Use an engine combination (e.g. Dylib/Universal without dynamic trampolines) supported by the object emitter
  3. Upgrade wasmer — check whether DynamicTrampoline object emission has been implemented
  4. For maintainers: implement the arm by emitting a relocation against the trampoline symbol

Example fix

// before
RelocationTarget::DynamicTrampoline(_) => todo!("Not supported yet"),
// after
RelocationTarget::DynamicTrampoline(idx) => {
    let sym = format!("__trampoline_{idx}");
    self.emit_reloc(obj, reloc, &sym, r.addend).map_err(ObjectError::Write)?;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// inspect artifact relocations before serializing
fn has_dynamic_trampoline_relocs(relocs: &[Relocation]) -> bool {
    relocs.iter().any(|r| matches!(r.target, RelocationTarget::DynamicTrampoline(_)))
}

Type guard

fn reloc_is_serializable(r: &Relocation) -> bool {
    !matches!(r.target, RelocationTarget::DynamicTrampoline(_))
}

Try / catch

match serialize_result {
    Err(serde_err) if format!("{:?}", serde_err).contains("Not supported yet") =>
        // recompile with settings that avoid dynamic trampolines or fall back to in-memory artifact
        fallback_to_universal_artifact(),
    Err(e) => return Err(e),
    Ok(a) => Ok(a),
}

Prevention

When it happens

Trigger: Calling generate_object/serialize an Artifact with a compilation whose relocation set contains a DynamicTrampoline target — i.e. serializing a compiled module that references dynamically-registered trampolines, on lib/compiler/src/object/module.rs emit_compilation.

Common situations: Using wasmer's object serialization (wasmer serialize / AOT artifact generation) with engine features that install dynamic trampolines (e.g. imported-function trampolines, host-extern stubs); switching engines or features so compiled code acquires such relocations.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/41fa5abc9b80a969. Report an issue: GitHub.