Skip to content

Commit 561e0c9

Browse files
authored
Fix MAIN_MODULE=1 + STRICT (#22446)
Fixes: #22435
1 parent b5750f5 commit 561e0c9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

test/test_other.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,9 @@ def test_exclude_file(self):
20302030
self.run_process([EMCC, 'main.c', '--embed-file', 'tst', '--exclude-file', '*.exe'])
20312031
self.assertEqual(self.run_js('a.out.js').strip(), '')
20322032

2033+
def test_dylink_strict(self):
2034+
self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sSTRICT', '-sMAIN_MODULE=1'])
2035+
20332036
def test_dylink_exceptions_and_assetions(self):
20342037
# Linking side modules using the STL and exceptions should not abort with
20352038
# "function in Table but not functionsInTableMap" when using ASSERTIONS=2

tools/link.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,13 @@ def phase_linker_setup(options, state, newargs):
896896
if not settings.MODULARIZE and not settings.EXPORT_ES6:
897897
default_setting('STRICT_JS', 1)
898898
default_setting('DEFAULT_TO_CXX', 0)
899-
default_setting('AUTO_JS_LIBRARIES', 0)
900-
default_setting('AUTO_NATIVE_LIBRARIES', 0)
901899
default_setting('IGNORE_MISSING_MAIN', 0)
902-
default_setting('ALLOW_UNIMPLEMENTED_SYSCALLS', 0)
900+
default_setting('AUTO_NATIVE_LIBRARIES', 0)
901+
if settings.MAIN_MODULE != 1:
902+
# These two settings cannot be disabled with MAIN_MODULE=1 because all symbols
903+
# are needed in this mode.
904+
default_setting('AUTO_JS_LIBRARIES', 0)
905+
default_setting('ALLOW_UNIMPLEMENTED_SYSCALLS', 0)
903906
if options.oformat == OFormat.HTML and options.shell_path == DEFAULT_SHELL_HTML:
904907
# Out default shell.html file has minimal set of INCOMING_MODULE_JS_API elements that it expects
905908
default_setting('INCOMING_MODULE_JS_API', 'canvas,monitorRunDependencies,onAbort,onExit,print,setStatus'.split(','))

0 commit comments

Comments
 (0)