wasmerio/wasmer · error

dwarf relocation size for LSDA not supported: {}

Error message

dwarf relocation size for LSDA not supported: {}

What it means

Same DWARF writer as error 190, but for the LSDA (Language Specific Data Area) symbol: when writing an .eh_frame pointer to an LSDA target, only Abs4/Abs8 relocations are implemented; any other size panics with unimplemented!().

Source

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

                        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: {}",
                            other
                        ),
                    };
                    self.relocs.push(Relocation {
                        kind,
                        reloc_target: *target,
                        offset,
                        addend: *base as i64 + addend,
                    });
                    self.write_udata(0, size)
                } else {
                    unreachable!("Symbol {} in DWARF not recognized", symbol);
                }
            }
        }
    }

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Update Wasmer to a newer release
  2. Use a mainstream target (x86_64/aarch64) where 4/8-byte LSDA pointers are standard
  3. Disable wasm exception handling or unwind-info generation in the compile pipeline
  4. Switch to the LLVM compiler backend which has fuller DWARF support

Example fix

// before
let kind = match size {
    4 => RelocationKind::Abs4,
    8 => RelocationKind::Abs8,
    other => unimplemented!("dwarf relocation size for LSDA not supported: {}", other),
};
// after
let kind = match size {
    4 => RelocationKind::Abs4,
    8 => RelocationKind::Abs8,
    other => return Err(CompileError::Codegen(format!("unsupported LSDA reloc size: {}", other))),
};
Defensive patterns

Strategy: validation

Validate before calling

// Guard: only attempt LSDA-emitting EH compilation on 64-bit mainstream targets
let arch = target.triple().architecture;
assert!(matches!(arch, Architecture::X86_64 | Architecture::Aarch64(_)), "cranelift LSDA reloc only supports 4/8-byte sizes");

Type guard

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

Prevention

When it happens

Trigger: Writing .eh_frame LSDA pointers during cranelift compilation of modules with exception handling, when the requested relocation size is not 4 or 8 bytes.

Common situations: Compiling wasm-EH modules on unusual targets; experimental DWARF encodings with non-standard pointer sizes; building custom targets where the eh-frame writer requests smaller/larger widths.

Related errors


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