Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produces code that fails wasm-opt #258

Open
jpochyla opened this issue Jan 3, 2024 · 5 comments
Open

Produces code that fails wasm-opt #258

jpochyla opened this issue Jan 3, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@jpochyla
Copy link

jpochyla commented Jan 3, 2024

Describe the Bug

When the wasm-opt == 116, with -O3 -g flags, is run on Rust crate compiled with the following wasm-bindgen-cli-support == 0.2.89 setup:

Bindgen::new()
            .input_path(...)
            .out_name(...)
            .debug(false)
            .keep_debug(true)
            .web(true)?
            .weak_refs(true)
            .generate(...)?;

...it crashes with the following error:

$ wasm-opt-e61e7b9e41e11ab4/wasm-opt foo.wasm -o foo.wasm -O3 -g
compile unit size was incorrect (this may be an unsupported version of DWARF)
UNREACHABLE executed at /Users/runner/work/binaryen/binaryen/third_party/llvm-project/DWARFEmitter.cpp:201!

I think it's likely that the latest DWARF changes broke this, as it used to work before (or at least result in a working binary.)

Is there anything I can do to help?

@jpochyla jpochyla added the bug Something isn't working label Jan 3, 2024
@guybedford
Copy link
Collaborator

Can you confirm exactly which version of Walrus is being used here, and verify it is the latest version?

Once we've confirmed that getting a good sample output / replication would help to start investigating this further.

@jpochyla
Copy link
Author

jpochyla commented Mar 4, 2024

Sorry about the delay :| The version is indeed the latest:

$ cargo tree -i walrus
walrus v0.20.3
├── wasm-bindgen-cli-support v0.2.92
...

Unfortunately the codebase is quite large (and not open), would you have any ideas about finding the culprit? For example, is it possible to programmatically remove parts of the DWARF from the binary to find the offending module? Do you have any ideas about what the error might mean?

Thanks!

@guybedford
Copy link
Collaborator

It sounds like this is a DWARF encoding issue - so disabling the DWARF output should fix the error.

@jpochyla
Copy link
Author

jpochyla commented Mar 5, 2024

Oh it does fix the error, sorry I should've made that clear. But i'd like to keep the DWARF output :)

@guybedford
Copy link
Collaborator

Yeah I can confirm this is a bug. I'm only really able to manage releases of this project myself, and not do a lot of maintenance work at this point. Will leave this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants