@@ -1902,7 +1902,9 @@ def test_em_js(self, args, force_c):
19021902 self .skipTest ('main module support for non-wasm' )
19031903 if '-fsanitize=address' in self .emcc_args :
19041904 self .skipTest ('no dynamic library support in asan yet' )
1905- self .emcc_args += args + ['-s' , 'EXPORTED_FUNCTIONS=_main,_malloc' ]
1905+ self .emcc_args += args
1906+ if 'MAIN_MODULE' not in args :
1907+ self .emcc_args += ['-s' , 'EXPORTED_FUNCTIONS=_main,_malloc' ]
19061908
19071909 self .do_core_test ('test_em_js.cpp' , force_c = force_c )
19081910 self .assertContained ("no args returning int" , read_file ('test_em_js.js' ))
@@ -2720,7 +2722,6 @@ class Bar {
27202722
27212723 @needs_dylink
27222724 def test_dlfcn_qsort (self ):
2723- self .set_setting ('EXPORTED_FUNCTIONS' , ['_get_cmp' ])
27242725 create_file ('liblib.cpp' , '''
27252726 int lib_cmp(const void* left, const void* right) {
27262727 const int* a = (const int*) left;
@@ -2739,7 +2740,6 @@ def test_dlfcn_qsort(self):
27392740 self .build_dlfcn_lib ('liblib.cpp' )
27402741
27412742 self .prep_dlfcn_main ()
2742- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' ])
27432743 src = '''
27442744 #include <stdio.h>
27452745 #include <stdlib.h>
@@ -2824,7 +2824,6 @@ def test_dlfcn_data_and_fptr(self):
28242824 return lib_fptr;
28252825 }
28262826 ''' )
2827- self .set_setting ('EXPORTED_FUNCTIONS' , ['_func' ])
28282827 self .build_dlfcn_lib ('liblib.cpp' )
28292828
28302829 self .prep_dlfcn_main ()
@@ -2881,7 +2880,6 @@ def test_dlfcn_data_and_fptr(self):
28812880 return 0;
28822881 }
28832882 '''
2884- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' ])
28852883 self .do_run (src , '''\
28862884 In func: 13
28872885First calling main_fptr from lib.
@@ -2902,7 +2900,6 @@ def test_dlfcn_varargs(self):
29022900 print_ints(2, 13, 42);
29032901 }
29042902 ''' )
2905- self .set_setting ('EXPORTED_FUNCTIONS' , ['_func' ])
29062903 self .build_dlfcn_lib ('liblib.cpp' )
29072904
29082905 self .prep_dlfcn_main ()
@@ -2935,7 +2932,6 @@ def test_dlfcn_varargs(self):
29352932 return 0;
29362933 }
29372934 '''
2938- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' ])
29392935 self .do_run (src , '100\n 200\n 13\n 42\n ' )
29402936
29412937 @needs_dylink
@@ -3038,7 +3034,6 @@ def test_dlfcn_unique_sig(self):
30383034 return 13;
30393035 }
30403036 ''' )
3041- self .set_setting ('EXPORTED_FUNCTIONS' , ['_myfunc' ])
30423037 self .build_dlfcn_lib ('liblib.c' )
30433038
30443039 self .prep_dlfcn_main ()
@@ -3065,7 +3060,6 @@ def test_dlfcn_unique_sig(self):
30653060 return 0;
30663061 }
30673062 ''' )
3068- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' ])
30693063 self .do_runf ('main.c' , 'success' )
30703064
30713065 @needs_dylink
@@ -3077,7 +3071,6 @@ def test_dlfcn_info(self):
30773071 return 13;
30783072 }
30793073 ''' )
3080- self .set_setting ('EXPORTED_FUNCTIONS' , ['_myfunc' ])
30813074 self .build_dlfcn_lib ('liblib.c' )
30823075
30833076 self .prep_dlfcn_main ()
@@ -3119,7 +3112,6 @@ def test_dlfcn_info(self):
31193112 return 0;
31203113 }
31213114 ''' )
3122- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' ])
31233115 self .do_runf ('main.c' , 'success' )
31243116
31253117 @needs_dylink
@@ -3139,7 +3131,6 @@ def test_dlfcn_stacks(self):
31393131 return strlen(bigstack);
31403132 }
31413133 ''' )
3142- self .set_setting ('EXPORTED_FUNCTIONS' , ['_myfunc' ])
31433134 self .build_dlfcn_lib ('liblib.c' )
31443135
31453136 self .prep_dlfcn_main ()
@@ -3174,7 +3165,6 @@ def test_dlfcn_stacks(self):
31743165 return 0;
31753166 }
31763167 ''' )
3177- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' , '_strcmp' ])
31783168 self .do_runf ('main.c' , 'success' )
31793169
31803170 @needs_dylink
@@ -3210,7 +3200,6 @@ def test_dlfcn_funcs(self):
32103200 }
32113201 }
32123202 ''' )
3213- self .set_setting ('EXPORTED_FUNCTIONS' , ['_callvoid' , '_callint' , '_getvoid' , '_getint' ])
32143203 self .build_dlfcn_lib ('liblib.c' )
32153204
32163205 self .prep_dlfcn_main ()
@@ -3261,7 +3250,6 @@ def test_dlfcn_funcs(self):
32613250 return 0;
32623251 }
32633252 ''' )
3264- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' ])
32653253 self .do_runf ('main.c' , '''go
32663254void_main.
32673255int_main 201
@@ -3286,11 +3274,9 @@ def test_dlfcn_mallocs(self):
32863274 void *mallocproxy(int n) { return malloc(n); }
32873275 void freeproxy(void *p) { free(p); }
32883276 ''' )
3289- self .set_setting ('EXPORTED_FUNCTIONS' , ['_mallocproxy' , '_freeproxy' ])
32903277 self .build_dlfcn_lib ('liblib.c' )
32913278
32923279 self .prep_dlfcn_main ()
3293- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' , '_free' ])
32943280 self .do_runf (test_file ('dlmalloc_proxy.c' ), '*294,153*' )
32953281
32963282 @needs_dylink
@@ -3338,7 +3324,6 @@ def test_dlfcn_longjmp(self):
33383324 return 0;
33393325 }
33403326 ''' )
3341- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' , '_free' ])
33423327 self .do_runf ('main.c' , '''go!
33433328pre 1
33443329pre 2
@@ -3410,7 +3395,6 @@ def zzztest_dlfcn_exceptions(self):
34103395 return 0;
34113396 }
34123397 '''
3413- self .set_setting ('EXPORTED_FUNCTIONS' , ['_main' , '_malloc' , '_free' ])
34143398 self .do_run (src , '''go!
34153399ok: 65
34163400int 123
0 commit comments