wasmerio/wasmer · error

Symbol {} in DWARF not recognized

Error message

Symbol {} in DWARF not recognized

What it means

This panic is `unreachable!("Symbol {} in DWARF not recognized", symbol)` in wasmtime's singlepass backend DWARF relocation writer (`write_address`). When emitting debug info, the writer must map each relocation symbol to a known section; an unrecognized symbol means the symbol kind/section the DWARF emitter produced is not covered by the match. It indicates a mismatch between the object writer's symbol table and what singlepass's DWARF support expects.

Source

Thrown at lib/compiler-singlepass/src/dwarf.rs:87

                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");
    }

    fn write_offset_at(
        &mut self,
        _offset: usize,
        _val: usize,
        _section: SectionId,
        _size: u8,
    ) -> Result<()> {
        unimplemented!("write_offset_at not yet implemented");
    }

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Upgrade wasmtime and the `object` crate together so symbol handling matches
  2. Disable DWARF generation: set `debug_info(false)` on the `Config` while using singlepass
  3. Use the Cranelift backend if you need debug info — singlepass's DWARF support is more limited
  4. Check for mismatched versions in your lockfile between wasmtime and object-writing dependencies
  5. Report upstream with the module and config that produced the unknown symbol

Example fix

// before
let mut config = Config::default();
config.strategy(Strategy::Singlepass);
config.debug_info(true);
// after
let mut config = Config::default();
config.strategy(Strategy::Singlepass);
config.debug_info(false); // singlepass DWARF cannot classify this symbol
Defensive patterns

Strategy: validation

Validate before calling

let mut config = wasmtime::Config::default();
config.strategy(wasmtime::Strategy::Singlepass);
config.debug_info(false); // avoid the singlepass DWARF writer entirely
let engine = Engine::new(&config)?;

Try / catch

match build_engine() {
    Ok(e) => e,
    Err(e) if format!("{e}").contains("DWARF not recognized") => {
        // retry without debug info
        let mut cfg = Config::default();
        cfg.debug_info(false);
        Engine::new(&cfg)?
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Generating DWARF debug info from the singlepass backend (`Config::strategy(Strategy::Singlepass)` combined with `debug_info(true)`/`generate_address_map` paths) where a relocation references a symbol (e.g. a custom/external or unrecognized section symbol) that `write_address` has no arm for.

Common situations: Enabling debug info with singlepass on older wasmtime versions; toolchain updates where the `object` crate emits new symbol kinds the pinned wasmtime doesn't recognize; cross-compilation setups with unusual section layouts.

Related errors


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