Skip to content

Commit 77be1bf

Browse files
authored
Fix use of undefined asyncifyStubs (#21674)
Fixes: #21104
1 parent a8b489d commit 77be1bf

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/jsifier.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ function(${args}) {
644644
}
645645
if (isStub) {
646646
contentText += `\n${mangled}.stub = true;`;
647-
if (ASYNCIFY) {
647+
if (ASYNCIFY && MAIN_MODULE) {
648648
contentText += `\nasyncifyStubs['${symbol}'] = undefined;`;
649649
}
650650
}

test/common.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def metafunc(self, with_minimal_runtime, *args, **kwargs):
405405
def also_with_wasm_bigint(f):
406406
assert callable(f)
407407

408-
def metafunc(self, with_bigint):
408+
def metafunc(self, with_bigint, *args, **kwargs):
409409
if with_bigint:
410410
if self.is_wasm2js():
411411
self.skipTest('wasm2js does not support WASM_BIGINT')
@@ -414,9 +414,9 @@ def metafunc(self, with_bigint):
414414
self.set_setting('WASM_BIGINT')
415415
nodejs = self.require_node()
416416
self.node_args += shared.node_bigint_flags(nodejs)
417-
f(self)
417+
f(self, *args, **kwargs)
418418
else:
419-
f(self)
419+
f(self, *args, **kwargs)
420420

421421
metafunc._parameterize = {'': (False,),
422422
'bigint': (True,)}
@@ -426,14 +426,14 @@ def metafunc(self, with_bigint):
426426
def also_with_wasm64(f):
427427
assert callable(f)
428428

429-
def metafunc(self, with_wasm64):
429+
def metafunc(self, with_wasm64, *args, **kwargs):
430430
if with_wasm64:
431431
self.require_wasm64()
432432
self.set_setting('MEMORY64')
433433
self.emcc_args.append('-Wno-experimental')
434-
f(self)
434+
f(self, *args, **kwargs)
435435
else:
436-
f(self)
436+
f(self, *args, **kwargs)
437437

438438
metafunc._parameterize = {'': (False,),
439439
'wasm64': (True,)}

test/test_other.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12678,8 +12678,11 @@ def test_check_undefined(self, flag):
1267812678
err = self.expect_fail([EMCC, flag, '-sERROR_ON_UNDEFINED_SYMBOLS', test_file('other/test_check_undefined.c')])
1267912679
self.assertContained('undefined symbol: foo', err)
1268012680

12681+
@parameterized({
12682+
'asyncify': (['-sASYNCIFY'],),
12683+
})
1268112684
@also_with_wasm64
12682-
def test_missing_symbols_at_runtime(self):
12685+
def test_missing_symbols_at_runtime(self, args):
1268312686
# We deliberately pick a symbol there that takes a pointer as an argument.
1268412687
# We had a regression where the pointer-handling wrapper function could
1268512688
# not be created because the "missing functions" stubs don't take any
@@ -12694,7 +12697,7 @@ def test_missing_symbols_at_runtime(self):
1269412697

1269512698
expected = 'Aborted(missing function: glGetTexLevelParameteriv)'
1269612699
self.do_runf('test.c', expected,
12697-
emcc_args=['-sWARN_ON_UNDEFINED_SYMBOLS=0', '-sAUTO_JS_LIBRARIES=0'],
12700+
emcc_args=['-sWARN_ON_UNDEFINED_SYMBOLS=0', '-sAUTO_JS_LIBRARIES=0'] + args,
1269812701
assert_returncode=NON_ZERO)
1269912702

1270012703
@with_env_modify({'EMMAKEN_NO_SDK': '1'})

0 commit comments

Comments
 (0)