-
Notifications
You must be signed in to change notification settings - Fork 758
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
Issue with features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt in wasm2js and wasm-dis #7228
Comments
That should work. If it does not then something else is going on rather than features. Make sure that you are emitting a wasm file without those features. In general, wasm2js is meant to support very old browsers and runtimes, places without wasm. Those places will not benefit from newer wasm features like sign-ext, so wasm2js does not support them. Note that there are some lowering passes you can run before wasm2js, that can help in some cases: |
What executable has that
I might be running in to that with AssemblyScript to |
|
I get |
This worked for Rust source code, not for AssemblyScript source code
|
When converting a WebAssembly module using
wasm2js
, I encountered an error related to the features section of the module. The module includes advanced WebAssembly features such asmutable-globals
,bulk-memory
, andsign-ext
. Despite attempts to optimize or strip these features usingwasm-opt
, the error persists.The error message is as follows:
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt Fatal: error in validating wasm2js output
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt
in after use wasm-dis in fileSteps to Reproduce
Use the following WebAssembly file (or a similar file with advanced features):
Run the following commands:```bash
wasm-opt input.wasm --strip-debug --strip-producers --disable-mutable-globals --disable-bulk-memory -o optimized.wasm -O2
wasm2js optimized.wasm -o output.js
3.Observe the error related to the features section.
Actual Behavior
The conversion process fails with a validation error, even after attempting to strip or disable advanced WebAssembly features using wasm-opt.
Environment
Tool version: Binaryen 121
Command line used: wasm2js, wasm-opt
OS: win11
Additional Context
I have attempted the following solutions:
Stripping debug and producer sections using wasm-opt.
Disabling specific features like mutable-globals and bulk-memory during optimization.
Re-generating the WebAssembly file with minimal features.
The issue persists even when using the latest version of Binaryen.
Suggested Improvement
Enhance wasm2js to either skip unsupported features or convert as much as possible while issuing warnings.
Provide better documentation or guidance for handling advanced WebAssembly features in wasm2js.
The text was updated successfully, but these errors were encountered: