binaryen
binaryen copied to clipboard
wasm2js: support multiple tables
Currently wasm2js does not support multiple tables. This is problematic for anyone that has WASM binaries compiled from Rust 1.82+ because the reference-types LLVM feature was enabled by default which results in multiple tables.
See discussion and workarounds on the rust side:
- https://github.com/rustwasm/wasm-bindgen/issues/4211
- https://github.com/rust-lang/rust/issues/128475
Separately, it would be nice to support multiple tables in wasm2js, but those links might help people stuck right now.
Yes thank you! Should have shared that I have read those discussions and some other threads and right now the best solution for me seems to be stripping symbols when building for wasm2js. I did this by adding -C strip=symbols to my RUSTFLAGS when running wasm-pack for wasm2js. Full build script can be seen here. Stripping symbols, however, is a bit opaque to me and I don't have confidence in the stability of this solution going forward, but that's mostly due to my lack of knowledge on how wasm-bindgen and the Rust compiler work.
Alternatively you could rebuild std with reference types disabled, but I do not want to rely on nightly toolchain for a feature that is seemingly not close to standardization.
bump, would be useful for a project i'm working on