Skip to content

Commit c4651fe

Browse files
committed
Error out on missing EXPORTED_RUNTIME_METHODS.
1 parent 62d4b1c commit c4651fe

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Diff for: ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ See docs/process.md for more on how version tagging works.
4040
example, `-sEXPORTED_RUNTIME_METHODS=HEAP8,HEAPU32` (if you need `HEAP8` and
4141
`HEAPU32`). (#24079)
4242
- libjpeg port updated from 9c to 9f. (#24085)
43+
- Missing exports in EXPORTED_RUNTIME_METHODS will now error instead of warn.
4344

4445
4.0.6 - 03/26/25
4546
----------------

Diff for: src/modules.mjs

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
isJsOnlySymbol,
1414
error,
1515
readFile,
16-
warn,
1716
pushCurrentFile,
1817
popCurrentFile,
1918
printErr,
@@ -512,11 +511,11 @@ function exportRuntimeSymbols() {
512511
}
513512
}
514513

515-
// check all exported things exist, warn about typos
514+
// check all exported things exist, error when missing
516515
runtimeElementsSet = new Set(runtimeElements);
517516
for (const name of EXPORTED_RUNTIME_METHODS) {
518517
if (!runtimeElementsSet.has(name)) {
519-
warn(`invalid item in EXPORTED_RUNTIME_METHODS: ${name}`);
518+
error(`undefined exported symbol: "${name}" in EXPORTED_RUNTIME_METHODS`);
520519
}
521520
}
522521

Diff for: test/test_other.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,11 @@ def test_undefined_exported_function(self, outfile):
27082708
cmd += ['-Wno-undefined']
27092709
self.run_process(cmd)
27102710

2711+
def test_undefined_exported_runtime_method(self):
2712+
# Adding a missing symbol to EXPORTED_RUNTIME_METHODS should cause a failure
2713+
err = self.expect_fail([EMCC, '-sEXPORTED_RUNTIME_METHODS=foobar', test_file('hello_world.c')])
2714+
self.assertContained('undefined exported symbol: "foobar" in EXPORTED_RUNTIME_METHODS', err)
2715+
27112716
@parameterized({
27122717
'': ('out.js',),
27132718
'standalone': ('out.wasm',)
@@ -14424,7 +14429,7 @@ def test_legacy_runtime(self):
1442414429
self.clear_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE')
1442514430
for opt in ('-O0', '-O3'):
1442614431
err = self.expect_fail([EMCC, test_file('other/test_legacy_runtime.c'), opt] + self.get_emcc_args())
14427-
self.assertContained('invalid item in EXPORTED_RUNTIME_METHODS: allocate', err)
14432+
self.assertContained('undefined exported symbol: "allocate" in EXPORTED_RUNTIME_METHODS', err)
1442814433

1442914434
def test_fetch_settings(self):
1443014435
create_file('pre.js', '''

0 commit comments

Comments
 (0)