Skip to content

Support mangled wasm-bindgen intrinsics#285

Open
timweri wants to merge 5 commits intomainfrom
support-mangled-wasm-bindgen-intrinsics
Open

Support mangled wasm-bindgen intrinsics#285
timweri wants to merge 5 commits intomainfrom
support-mangled-wasm-bindgen-intrinsics

Conversation

@timweri
Copy link
Collaborator

@timweri timweri commented Mar 18, 2026

Problem

wasm-bindgen ≥ 0.2.102 has a breaking change for how import names for some intrinsics, including __wbindgen_throw, are generated: wasm-bindgen/wasm-bindgen#4636.

Plaid only export __wbindgen_throw for the place holder module so WASM binaries compiled with wasm-bindgen ≥ 0.2.102 will not be able to resolve their mangled __wbindgen_throw.

__wbindgen_externref_table_grow, __wbindgen_externref_table_set_null, __wbindgen_describe are not affected as they are still declared as raw extern imports:

Note that the mangled names for these intrinsics are not necessarily stable ≥ 0.2.102:

  • wasm-bindgen ≤ 0.2.101: __wbindgen_throw
  • 0.2.102 ≤ wasm-bindgen ≤ 0.2.104: __wbg_wbindgenthrow_{hash}
  • wasm-bindgen ≥ 0.2.105: __wbg___wbindgen_throw_{hash}

One can check the current mangling format by looking at test files, such as https://github.com/wasm-bindgen/wasm-bindgen/blob/main/crates/cli/tests/reference/anyref-import-catch.wat and https://github.com/wasm-bindgen/wasm-bindgen/blob/main/crates/cli/tests/reference/anyref-import-catch.bg.js.

Fix

  • link_functions_to_module now also skips function names matching new mangled name formats of intrinsic functions.
  • For the placeholder module, create_bindgen_placeholder now export fake_wbindgen_throw if it detects new names for __wbindgen_throw.

@timweri timweri marked this pull request as ready for review March 18, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant