Skip to content

Commit

Permalink
Fix MAIN_MODULE=1 + STRICT (#22446)
Browse files Browse the repository at this point in the history
Fixes: #22435
  • Loading branch information
sbc100 authored Aug 24, 2024
1 parent b5750f5 commit 561e0c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,9 @@ def test_exclude_file(self):
self.run_process([EMCC, 'main.c', '--embed-file', 'tst', '--exclude-file', '*.exe'])
self.assertEqual(self.run_js('a.out.js').strip(), '')

def test_dylink_strict(self):
self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sSTRICT', '-sMAIN_MODULE=1'])

def test_dylink_exceptions_and_assetions(self):
# Linking side modules using the STL and exceptions should not abort with
# "function in Table but not functionsInTableMap" when using ASSERTIONS=2
Expand Down
9 changes: 6 additions & 3 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,13 @@ def phase_linker_setup(options, state, newargs):
if not settings.MODULARIZE and not settings.EXPORT_ES6:
default_setting('STRICT_JS', 1)
default_setting('DEFAULT_TO_CXX', 0)
default_setting('AUTO_JS_LIBRARIES', 0)
default_setting('AUTO_NATIVE_LIBRARIES', 0)
default_setting('IGNORE_MISSING_MAIN', 0)
default_setting('ALLOW_UNIMPLEMENTED_SYSCALLS', 0)
default_setting('AUTO_NATIVE_LIBRARIES', 0)
if settings.MAIN_MODULE != 1:
# These two settings cannot be disabled with MAIN_MODULE=1 because all symbols
# are needed in this mode.
default_setting('AUTO_JS_LIBRARIES', 0)
default_setting('ALLOW_UNIMPLEMENTED_SYSCALLS', 0)
if options.oformat == OFormat.HTML and options.shell_path == DEFAULT_SHELL_HTML:
# Out default shell.html file has minimal set of INCOMING_MODULE_JS_API elements that it expects
default_setting('INCOMING_MODULE_JS_API', 'canvas,monitorRunDependencies,onAbort,onExit,print,setStatus'.split(','))
Expand Down

0 comments on commit 561e0c9

Please sign in to comment.