@@ -662,18 +662,18 @@ def create_tsd(metadata, embind_tsd):
662662 out += create_tsd_exported_runtime_methods (metadata )
663663 # Manually generate defintions for any Wasm function exports.
664664 out += 'interface WasmModule {\n '
665- for name , types in metadata .function_exports .items ():
665+ for name , functype in metadata .function_exports .items ():
666666 mangled = asmjs_mangle (name )
667667 should_export = settings .EXPORT_KEEPALIVE and mangled in settings .EXPORTED_FUNCTIONS
668668 if not should_export :
669669 continue
670670 arguments = []
671- for index , type in enumerate (types .params ):
671+ for index , type in enumerate (functype .params ):
672672 arguments .append (f"_{ index } : { type_to_ts_type (type )} " )
673673 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 ])} '
677677 else :
678678 out += 'void'
679679 out += ';\n '
@@ -791,6 +791,8 @@ def add_standard_wasm_imports(send_items_map):
791791
792792 if settings .RELOCATABLE :
793793 send_items_map ['__indirect_function_table' ] = 'wasmTable'
794+ if settings .MEMORY64 :
795+ send_items_map ['__table_base32' ] = '___table_base32'
794796
795797 if settings .AUTODEBUG :
796798 extra_sent_items += [
@@ -1100,7 +1102,17 @@ def create_pointer_conversion_wrappers(metadata):
11001102
11011103 sigs_seen = set ()
11021104 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
11041116 sig = mapping .get (symbol )
11051117 if sig :
11061118 if settings .MEMORY64 :
0 commit comments