Skip to content
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

load_secondary_module_status not recognized as a global object with emscripten's MAIN_MODULE flag #22487

Open
Mintyboi opened this issue Sep 2, 2024 · 1 comment

Comments

@Mintyboi
Copy link

Mintyboi commented Sep 2, 2024

Please include the following in your bug report:

Version of emscripten/emsdk:
Please include the output emcc -v here
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.61 (67fa4c1)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 7cfffe74eeb68fbb3fb9706ac7071f8caeeb6520)
Target: wasm32-unknown-emscripten
Thread model: posix

Issue
I'm building an application with JSPI, SPLIT_MODULE and after splitting the wasm module, it's working (with some kinks).
However, when I added in the MAIN_MODULE flag, I get an error when trying to load the deferred module.

LinkError: WebAssembly.instantiate(): Import #13 "primary" "load_secondary_module_status": imported mutable global must be a WebAssembly.Global object

I suspect this is because the load_secondary_module_status global variable is not recognized as an export created by wasm-split here, and hence got it's type replaced by a number value.

if (e.startsWith('%')) {

This issue can be reproduced using the existing tests in emscripten by adding a -sMAIN_MODULE=2.

@Mintyboi
Copy link
Author

Mintyboi commented Sep 2, 2024

Hi @brendandahl, I'm tagging you here because I saw that you added load_secondary_module_status in WebAssembly/binaryen#5431.

Should this be fixed by prepending this variable with a '%'?

@Mintyboi Mintyboi changed the title load_secondary_module_status was not relocated with emscripten's MAIN_MODULE flag load_secondary_module_status not recognized as a global object with emscripten's MAIN_MODULE flag Sep 3, 2024
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

No branches or pull requests

1 participant