Skip to content

SIGSEGV (Address boundary error) in dumpDebugLoc(llvm::DWARFContext&, llvm::DWARFYAML::Data&) ()  #6879

Closed

Description

@Ddystopia

Hello, when I'm trying this command

 wasm-opt -Oz iot-config-web-dx_bg.wasm --zero-filled-memory -o out.wasm

I'm getting this:

fish: Job 1, '~/code/binaryen/bin/wasm-opt -O…' terminated by signal SIGSEGV (Address boundary error)

It fails on version_118 and on latest master (e2ceaa5)

binary.tar.gz

Activity

  1. kripken commented on Aug 28, 2024

    @kripken
    Member

    Looks like a problem with our DWARF support, which is experimental. It is recommended to use source maps instead for debugging.

    To avoid this problem you can strip debug info, by adding --strip-debug to that command.

  2. ArkadySkv commented on Oct 9, 2026

    @ArkadySkv
    Contributor

    Fixed by PR #7910 (commit 3f3ed7f6f, "[DWARF] Fix segfault with empty
    dwarf .debug_loc").

    The fix adds a null-CU guard at the top of dumpDebugLoc in
    third_party/llvm-project/dwarf2yaml.cpp:

    auto CUS = DCtx.normal_units();
    if (CUS.empty()) {
      return;
    }
    

    Before this guard, a module whose .debug_loc section contained
    location lists with no associated compile unit would dereference a
    null DWARFCompileUnit* during base-address resolution, producing
    the SIGSEGV reported here.

    Verified on current main: the attached reproducer
    (iot-config-web-dx_bg.wasm) optimizes successfully with

    wasm-opt -Oz iot-config-web-dx_bg.wasm --zero-filled-memory -o out.wasm
    echo "exit: $?"
    

    exits with status 0, and does not crash under gdb. Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions