-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix i64-using function pointers in upstream dynamic linking #9810
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
Conversation
|
The dependencies have all rolled, and looks like tests all pass. |
src/support.js
Outdated
| assert(parts.length == 3) | ||
| var name = parts[1]; | ||
| var sig = parts[2]; | ||
| var legalized = sig.indexOf('j') >= 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume 'j' means i64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, j is i64. I'll add a comment.
| sym = 'orig$' + sym; | ||
| } | ||
| #if WASM_BACKEND | ||
| sym = '_' + sym; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use asmjs_mangle here? Also does the mangling happen before the orig$ .. i.e. is it _orig$foo or orig$foo. Above it looks like your remove the mangled before pretending orig$.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pre-existing code, but I think asm_mangle in python makes sense (where it checks if the _ is needed or not, which it isn't for dynCall etc.) while here, all we have are exported symbols at the C level, which does not include things like dynCall etc. that are only for JS.
|
Thanks, I pushed updates for the feedback. |
…en-core#9810) The dynamic loader needs to place the original wasm functions in the table, so that other modules can call them. The JS-legalized versions will have the wrong types for indirect calls. To implement this, binaryen's legalization pass exports illegal functions twice, once legalized for JS, and once as orig$ plus the original name. This PR makes the loader use those. Fixes emscripten-core#9562
…-core#9855) emscripten-core#9810 mostly fixed i64 pointers in MAIN_MODULE, but it turns out that a corner case was a function that is illegal only due to its return value. fixes emscripten-core#9850
The dynamic loader needs to place the original wasm functions in the table, so that other modules can call them. The JS-legalized versions will have the wrong types for indirect calls.
To implement this, binaryen's legalization pass exports illegal functions twice, once legalized for JS, and once as
orig$plus the original name. This PR makes the loader use those.Fixes #9562
Depends on WebAssembly/binaryen#2427 to roll first.