wasmerio/wasmer · error
dwarf relocation size not yet supported: {}
Error message
dwarf relocation size not yet supported: {} What it means
The singlepass backend's DWARF writer only implements 8-byte absolute relocations (Abs8) when emitting eh_frame pointers to local functions (the addend encodes the function index); any other size panics with unimplemented!().
Source
Thrown at lib/compiler-singlepass/src/dwarf.rs:76
}
fn write_at(&mut self, offset: usize, bytes: &[u8]) -> Result<()> {
self.writer.write_at(offset, bytes)
}
fn write_address(&mut self, address: Address, size: u8) -> Result<()> {
match address {
Address::Constant(val) => self.write_udata(val, size),
Address::Symbol { symbol, addend } => {
// Is a function relocation
if symbol == Self::FUNCTION_SYMBOL {
// We use the addend to detect the function index
let function_index = LocalFunctionIndex::new(addend as _);
let reloc_target = RelocationTarget::LocalFunc(function_index);
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 u64, size)
} else {
unreachable!("Symbol {} in DWARF not recognized", symbol);
}
}
}
}
fn write_offset(&mut self, _val: usize, _section: SectionId, _size: u8) -> Result<()> {
unimplemented!("write_offset not yet implemented");View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Compile with singlepass on 64-bit targets (x86_64/aarch64) where 8-byte pointers are used
- Use the cranelift or LLVM backend if you need broader DWARF/eh-frame support
- Disable unwind-info/EH generation for singlepass
- Update Wasmer in case the size support has been extended
Example fix
// before
let kind = match size {
8 => RelocationKind::Abs8,
_ => unimplemented!("dwarf relocation size not yet supported: {}", size),
};
// after
let kind = match size {
8 => RelocationKind::Abs8,
4 => RelocationKind::Abs4,
other => return Err(CompileError::Codegen(format!("unsupported dwarf reloc size: {}", other))),
}; Defensive patterns
Strategy: validation
Validate before calling
// singlepass DWARF relocations require 8-byte (64-bit) targets
fn singlepass_dwarf_supported(triple: &Triple) -> bool {
matches!(triple.architecture,
Architecture::X86_64 | Architecture::Aarch64(_))
} Type guard
fn is_size8(size: u8) -> bool { size == 8 } Prevention
- Use singlepass only on 64-bit mainstream targets when generating unwind info
- Prefer cranelift/LLVM elsewhere
- Disable debug/EH generation with singlepass on unsupported hosts
- Keep singlepass and target combinations covered by CI
When it happens
Trigger: Generating unwind/DWARF info with the singlepass compiler when write_address is called with a size other than 8 for a local-function symbol pointer.
Common situations: Compiling with singlepass on a 32-bit target or with an eh-frame encoding that requests 4-byte pointers; generating debug info with singlepass on unusual hosts.
Related errors
- write_offset not yet implemented
- write_offset_at not yet implemented
- dwarf relocation size for personality not supported: {}
- dwarf relocation size for LSDA not supported: {}
- eh pointer encoding {eh_pe:?} not supported for symbol targe
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/01e0195247071e3e.
Report an issue: GitHub.