wasmerio/wasmer · error

dwarf relocation size for personality not supported: {}

Error message

dwarf relocation size for personality not supported: {}

What it means

Wasmer's cranelift compiler DWARF writer (an unwinding/WASM_EXCEPTION/EH-frame writer) only supports 4- and 8-byte absolute relocations when emitting a pointer to the personality routine (__gxx_personality_v0). Any other pointer size requested by the gimli/write dwarf writer hits this unimplemented!() panic. It signals an unsupported DWARF relocation size, not a user bug in normal use.

Source

Thrown at lib/compiler-cranelift/src/dwarf.rs:103

                    let offset = self.len() as u32;
                    let kind = match size {
                        8 => RelocationKind::Abs8,
                        _ => unimplemented!("dwarf relocation size not yet supported: {}", size),
                    };
                    let addend = 0;
                    self.relocs.push(Relocation {
                        kind,
                        reloc_target,
                        offset,
                        addend,
                    });
                    self.write_udata(addend as _, size)
                } else if symbol == Self::PERSONALITY_SYMBOL {
                    let offset = self.len() as u32;
                    let kind = match size {
                        4 => RelocationKind::Abs4,
                        8 => RelocationKind::Abs8,
                        other => unimplemented!(
                            "dwarf relocation size for personality not supported: {}",
                            other
                        ),
                    };
                    self.relocs.push(Relocation {
                        kind,
                        reloc_target: RelocationTarget::LibCall(LibCall::EHPersonality),
                        offset,
                        addend,
                    });
                    self.write_udata(0, size)
                } else if let Some((target, base)) = self.lsda_symbols.get(&symbol) {
                    let offset = self.len() as u32;
                    let kind = match size {
                        4 => RelocationKind::Abs4,
                        8 => RelocationKind::Abs8,
                        other => unimplemented!(
                            "dwarf relocation size for LSDA not supported: {}",

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Update Wasmer to the latest version, as DWARF/EH support is actively extended
  2. Compile for a mainstream target (x86_64 or aarch64) where 4/8-byte pointer sizes are used
  3. Disable exception-handling features in the Wasm module (strip wasm EH sections) or disable unwind-info generation in the compiler config
  4. Switch compilers (e.g. use singlepass or llvm) if EH support is required

Example fix

// before
let kind = match size {
    4 => RelocationKind::Abs4,
    8 => RelocationKind::Abs8,
    other => unimplemented!("dwarf relocation size for personality not supported: {}", other),
};
// after
let kind = match size {
    4 => RelocationKind::Abs4,
    8 => RelocationKind::Abs8,
    2 => RelocationKind::Abs2, // implement the missing size instead of panicking
    other => return Err(CompileError::Codegen(format!("unsupported personality reloc size: {}", other))),
};
Defensive patterns

Strategy: validation

Validate before calling

// Before compiling with cranelift + EH, restrict to mainstream 64-bit targets
fn supports_cranelift_eh(triple: &wasmer::Target) -> bool {
    matches!(triple.triple().architecture(),
        wasmer_types::Architecture::X86_64 | wasmer_types::Architecture::Aarch64(_))
}
if !supports_cranelift_eh(&target) { /* switch backend or disable EH */ }

Type guard

fn is_supported_ptr_size(size: u8) -> bool { size == 4 || size == 8 }

Prevention

When it happens

Trigger: Writing .eh_frame sections where the personality symbol pointer is requested with a size other than 4 or 8 bytes (e.g. a DW_EH_PE encoding with an unusual byte width) during module compilation with the cranelift compiler and exception/unwind info generation enabled.

Common situations: Compiling Wasm that uses exception handling (wasm EH / legacy EH) on a target with unusual pointer widths; enabling debug/unwind-info generation on experimental targets; hitting a genuinely unimplemented code path in a non-x86_64/aarch64 host target.

Related errors


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