@@ -210,13 +210,22 @@ def set_memory(static_bump):
210
210
settings .HEAP_BASE = align_memory (stack_high )
211
211
212
212
213
- def report_missing_symbols (js_symbols ):
214
- # Report any symbol that was explicitly exported but is present neither
215
- # as a native function nor as a JS library function.
216
- defined_symbols = set (asmjs_mangle (e ) for e in settings .WASM_EXPORTS ).union (js_symbols )
217
- missing = set (settings .USER_EXPORTED_FUNCTIONS ) - defined_symbols
218
- for symbol in sorted (missing ):
219
- diagnostics .warning ('undefined' , f'undefined exported symbol: "{ symbol } "' )
213
+ def report_missing_exports_wasm_only (metadata ):
214
+ if diagnostics .is_enabled ('undefined' ):
215
+ defined_symbols = set (asmjs_mangle (e ) for e in metadata .all_exports )
216
+ missing = set (settings .USER_EXPORTED_FUNCTIONS ) - defined_symbols
217
+ for symbol in sorted (missing ):
218
+ diagnostics .warning ('undefined' , f'undefined exported symbol: "{ symbol } "' )
219
+
220
+
221
+ def report_missing_exports (js_symbols ):
222
+ if diagnostics .is_enabled ('undefined' ):
223
+ # Report any symbol that was explicitly exported but is present neither
224
+ # as a native function nor as a JS library function.
225
+ defined_symbols = set (asmjs_mangle (e ) for e in settings .WASM_EXPORTS ).union (js_symbols )
226
+ missing = set (settings .USER_EXPORTED_FUNCTIONS ) - defined_symbols
227
+ for symbol in sorted (missing ):
228
+ diagnostics .warning ('undefined' , f'undefined exported symbol: "{ symbol } "' )
220
229
221
230
# Special hanlding for the `_main` symbol
222
231
@@ -359,7 +368,9 @@ def emscript(in_wasm, out_wasm, outfile_js, js_syms, finalize=True):
359
368
if proc .returncode :
360
369
exit_with_error (f'EM_JS function validation failed (node returned { proc .returncode } )' )
361
370
362
- logger .debug ('emscript: skipping remaining js glue generation' )
371
+ if not outfile_js :
372
+ report_missing_exports_wasm_only (metadata )
373
+ logger .debug ('emscript: skipping js glue generation' )
363
374
return
364
375
365
376
# memory and global initializers
@@ -398,11 +409,7 @@ def emscript(in_wasm, out_wasm, outfile_js, js_syms, finalize=True):
398
409
pre += f" ignoredModuleProp('{ sym } ');\n "
399
410
pre += "}\n "
400
411
401
- report_missing_symbols (forwarded_json ['librarySymbols' ])
402
-
403
- if not outfile_js :
404
- logger .debug ('emscript: skipping remaining js glue generation' )
405
- return
412
+ report_missing_exports (forwarded_json ['librarySymbols' ])
406
413
407
414
if settings .MINIMAL_RUNTIME :
408
415
# In MINIMAL_RUNTIME, atinit exists in the postamble part
0 commit comments