Skip to content

Commit 37d578f

Browse files
authored
Fix pthreads in -sSTRICT mode (#22436)
`STRICT` has the effect of making `INCOMING_MODULE_JS_API` empty by default, but the pthread runtime relies on overriding `instantiateWasm`. See #21844
1 parent 1af7b61 commit 37d578f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

test/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9111,6 +9111,7 @@ def test_pthread_create(self):
91119111
# works with pthreads (even though we did not specify 'node,worker')
91129112
self.set_setting('ENVIRONMENT', 'node')
91139113
self.set_setting('STRICT_JS')
9114+
self.set_setting('STRICT')
91149115
self.do_run_in_out_file_test('core/pthread/create.c')
91159116

91169117
@node_pthreads

tools/link.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ def setup_pthreads():
490490

491491
default_setting('DEFAULT_PTHREAD_STACK_SIZE', settings.STACK_SIZE)
492492

493+
if not settings.MINIMAL_RUNTIME and 'instantiateWasm' not in settings.INCOMING_MODULE_JS_API:
494+
# pthreads runtime depends on overriding instantiateWasm
495+
settings.INCOMING_MODULE_JS_API.append('instantiateWasm')
496+
493497
# Functions needs by runtime_pthread.js
494498
settings.REQUIRED_EXPORTS += [
495499
'_emscripten_thread_free_data',

0 commit comments

Comments
 (0)