@@ -662,18 +662,18 @@ def create_tsd(metadata, embind_tsd):
662
662
out += create_tsd_exported_runtime_methods (metadata )
663
663
# Manually generate defintions for any Wasm function exports.
664
664
out += 'interface WasmModule {\n '
665
- for name , types in metadata .function_exports .items ():
665
+ for name , functype in metadata .function_exports .items ():
666
666
mangled = asmjs_mangle (name )
667
667
should_export = settings .EXPORT_KEEPALIVE and mangled in settings .EXPORTED_FUNCTIONS
668
668
if not should_export :
669
669
continue
670
670
arguments = []
671
- for index , type in enumerate (types .params ):
671
+ for index , type in enumerate (functype .params ):
672
672
arguments .append (f"_{ index } : { type_to_ts_type (type )} " )
673
673
out += f' { mangled } ({ ", " .join (arguments )} ): '
674
- assert len (types .returns ) <= 1 , 'One return type only supported'
675
- if types .returns :
676
- out += f'{ type_to_ts_type (types .returns [0 ])} '
674
+ assert len (functype .returns ) <= 1 , 'One return type only supported'
675
+ if functype .returns :
676
+ out += f'{ type_to_ts_type (functype .returns [0 ])} '
677
677
else :
678
678
out += 'void'
679
679
out += ';\n '
@@ -791,6 +791,8 @@ def add_standard_wasm_imports(send_items_map):
791
791
792
792
if settings .RELOCATABLE :
793
793
send_items_map ['__indirect_function_table' ] = 'wasmTable'
794
+ if settings .MEMORY64 :
795
+ send_items_map ['__table_base32' ] = '___table_base32'
794
796
795
797
if settings .AUTODEBUG :
796
798
extra_sent_items += [
@@ -1100,7 +1102,17 @@ def create_pointer_conversion_wrappers(metadata):
1100
1102
1101
1103
sigs_seen = set ()
1102
1104
wrap_functions = []
1103
- for symbol in metadata .function_exports :
1105
+ for symbol , functype in metadata .function_exports .items ():
1106
+ # dynCall_ functions are generated by binaryen. They all take a
1107
+ # function pointer as their first argument.
1108
+ # The second part of this check can be removed once the table64
1109
+ # llvm changs lands.
1110
+ if symbol .startswith ('dynCall_' ) and functype .params [0 ] == webassembly .Type .I64 :
1111
+ sig = symbol .split ('_' )[- 1 ]
1112
+ sig = ['p' if t == 'p' else '_' for t in sig ]
1113
+ sig .insert (1 , 'p' )
1114
+ sig = '' .join (sig )
1115
+ mapping [symbol ] = sig
1104
1116
sig = mapping .get (symbol )
1105
1117
if sig :
1106
1118
if settings .MEMORY64 :
0 commit comments