Skip to content

Commit 3cb84b6

Browse files
authored
Use upstream name for __post_instantiate (__wasm_call_ctors) (#13904)
This is that nane that llvm exports that function under and we were previously renaming it as part of wasm-emscripten-finalize. See WebAssembly/binaryen#3811 Fixes: #13893
1 parent 6e794e6 commit 3cb84b6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/library_dylink.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ var LibraryDylink = {
500500

501501
// initialize the module
502502
#if USE_PTHREADS
503-
// The main thread does a full __post_instantiate (which includes a call
503+
// The main thread does a full __wasm_call_ctors (which includes a call
504504
// to emscripten_tls_init), but secondary threads should not call static
505505
// constructors in general - emscripten_tls_init is the exception.
506506
if (ENVIRONMENT_IS_PTHREAD) {
@@ -512,7 +512,12 @@ var LibraryDylink = {
512512
PThread.tlsInitFunctions.push(init);
513513
} else {
514514
#endif
515-
var init = moduleExports['__post_instantiate'];
515+
var init = moduleExports['__wasm_call_ctors'];
516+
// TODO(sbc): Remove this once extra check once the binaryen
517+
// change propogates: https://github.com/WebAssembly/binaryen/pull/3811
518+
if (!init) {
519+
init = moduleExports['__post_instantiate'];
520+
}
516521
if (init) {
517522
if (runtimeInitialized) {
518523
init();

0 commit comments

Comments
 (0)