binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

wasm2js: support multiple tables

Open joe-p opened this issue 8 months ago • 2 comments

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.

joe-p avatar Mar 08 '25 11:03 joe-p

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.

kripken avatar Mar 11 '25 18:03 kripken

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.

joe-p avatar Mar 11 '25 18:03 joe-p

bump, would be useful for a project i'm working on

VillainsRule avatar Oct 18 '25 03:10 VillainsRule