Skip to content

Commit a77b559

Browse files
authored
Warn if EXPORTED_FUNCTIONS is used with MAIN_MODULE=1/SIDE_MODULE=1 (#10075)
This doesn't make sense since these imply all symbols are already exported.
1 parent e734871 commit a77b559

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

emcc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,9 @@ def default_setting(name, new_default):
17001700
settings.LINKABLE = 1
17011701
settings.EXPORT_ALL = 1
17021702

1703+
if settings.LINKABLE and settings.USER_EXPORTED_FUNCTIONS:
1704+
diagnostics.warning('unused-command-line-argument', 'EXPORTED_FUNCTIONS is not valid with LINKABLE set (normally due to SIDE_MODULE=1/MAIN_MODULE=1) since all functions are exported this mode. To export only a subset use SIDE_MODULE=2/MAIN_MODULE=2')
1705+
17031706
if settings.MAIN_MODULE:
17041707
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += [
17051708
'$getDylinkMetadata',

tests/test_core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,9 @@ def test_em_asm_direct(self):
19891989
def test_em_js(self, args, force_c):
19901990
if '-sMAIN_MODULE' in args:
19911991
self.check_dylink()
1992-
self.emcc_args += args + ['-sEXPORTED_FUNCTIONS=_main,_malloc']
1992+
self.emcc_args += args
1993+
if '-sMAIN_MODULE' not in args:
1994+
self.emcc_args += ['-sEXPORTED_FUNCTIONS=_main,_malloc']
19931995

19941996
self.do_core_test('test_em_js.cpp', force_c=force_c)
19951997
self.assertContained("no args returning int", read_file('test_em_js.js'))

0 commit comments

Comments
 (0)