File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -4876,7 +4876,11 @@ def test_dylink_raii_exceptions(self):
48764876
48774877 @with_all_eh_sjlj
48784878 @with_dylink_reversed
4879- def test_dylink_exceptions_try_catch (self ):
4879+ @parameterized ({
4880+ '' : ([],),
4881+ 'dyncalls' : (['-sDYNCALLS' ],),
4882+ })
4883+ def test_dylink_exceptions_try_catch (self , args ):
48804884 self .dylink_test (main = r'''
48814885 #include <stdio.h>
48824886 extern void side();
@@ -4898,7 +4902,7 @@ def test_dylink_exceptions_try_catch(self):
48984902 printf("side: caught %.1f\n", f);
48994903 }
49004904 }
4901- ''' , expected = ['main: caught 3\n side: caught 5.3\n ' ])
4905+ ''' , expected = ['main: caught 3\n side: caught 5.3\n ' ], cflags = args )
49024906
49034907 @with_all_eh_sjlj
49044908 @with_dylink_reversed
Original file line number Diff line number Diff line change @@ -107,18 +107,19 @@ def isidentifier(name):
107107
108108
109109def make_dynCall (sig , args ):
110- # wasm2c and asyncify are not yet compatible with direct wasm table calls
111110 if settings .MEMORY64 :
112111 args = list (args )
113112 args [0 ] = f'Number({ args [0 ]} )'
113+ # wasm2c and asyncify are not yet compatible with direct wasm table calls so use
114+ # the legacy DYNCALLS mechanism.
114115 if settings .DYNCALLS or not is_legal_sig (sig ):
115116 args = ',' .join (args )
116- if not settings .MAIN_MODULE and not settings .SIDE_MODULE :
117- # Optimize dynCall accesses in the case when not building with dynamic
118- # linking enabled .
119- return 'dynCall_%s(%s)' % ( sig , args )
120- else :
121- return 'Module[" dynCall_%s"] (%s)' % (sig , args )
117+ if settings .MAIN_MODULE or settings .SIDE_MODULE :
118+ # In dynamic linking mode not all of the dynCall_xxx function are defined
119+ # in the main module so might not be available as global symbols .
120+ # See `registerDynCallSymbols` in `libdylink.js`.
121+ return "dynCalls['%s'](%s)" % ( sig , args )
122+ return 'dynCall_%s(%s)' % (sig , args )
122123 else :
123124 call_args = "," .join (args [1 :])
124125 return f'getWasmTableEntry({ args [0 ]} )({ call_args } )'
You can’t perform that action at this time.
0 commit comments