-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Incorrect STACKTOP in asm side modules #8433
Comments
I think for side modules in general, not just asm.js ones, we can't know their stack location at compile time. So yes, I think the fix is to change that condition to not happen for any side module. |
I came up with a set of changes that seem to be consistent with the surrounding code. The distinction wasn't side modules but "relocatable" modules. Unfortunately two tests are failing, so I'm still investigating that but if you can, let me know if I'm on the right track. |
When emitting an ASM side module, emscripten sets
STACKTOP
in the shell:emscripten/src/shell_sharedlib.js
Line 15 in 20602ef
But this STACKTOP variable is overridden when emitting the asm variables in emscripten.py:
emscripten/emscripten.py
Line 489 in 4ce1300
This causes the side module to corrupt memory because its
STACKTOP
is not the dynamically allocatedSTACKTOP
obtained from the side module shell, and is a lowerSTACKTOP
taken from considering only the globals in the side module.My fix would be to change the condition in emscripten.py:
emscripten/emscripten.py
Line 487 in 4ce1300
But I'm not sure if that is the correct change.
The text was updated successfully, but these errors were encountered: