Produces code that fails wasm-opt
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?
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.
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!
It sounds like this is a DWARF encoding issue - so disabling the DWARF output should fix the error.
Oh it does fix the error, sorry I should've made that clear. But i'd like to keep the DWARF output :)
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.