Fix the error of AOT mode on the "i386-windows-msvc" platform (#4183)
* Fix errors on the "i386-windows-msvc" platform * Refactor symbol name handling for AOT COFF32 binary format * Fix preprocessor directive placement for Windows compatibility in aot_reloc_x86_32.c --------- Co-authored-by: liang.he@intel.com <liang.he@intel.com>
This commit is contained in:
@ -3285,8 +3285,25 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
|
||||
cell_num += wasm_value_type_cell_num(ext_ret_types[i]);
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
||||
void *prev_frame = get_top_frame(exec_env);
|
||||
if (!is_frame_per_function(exec_env)
|
||||
&& !aot_alloc_frame(exec_env, func_idx)) {
|
||||
if (argv1 != argv1_buf)
|
||||
wasm_runtime_free(argv1);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
ret = invoke_native_internal(exec_env, func_ptr, func_type, signature,
|
||||
attachment, argv1, argc, argv);
|
||||
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
||||
/* Free all frames allocated, note that some frames
|
||||
may be allocated in AOT code and haven't been
|
||||
freed if exception occurred */
|
||||
while (get_top_frame(exec_env) != prev_frame)
|
||||
aot_free_frame(exec_env);
|
||||
#endif
|
||||
|
||||
if (!ret) {
|
||||
if (argv1 != argv1_buf)
|
||||
wasm_runtime_free(argv1);
|
||||
@ -3327,8 +3344,25 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
||||
void *prev_frame = get_top_frame(exec_env);
|
||||
/* Only allocate frame for frame-per-call mode; in the
|
||||
frame-per-function mode the frame is allocated at the
|
||||
beginning of the function. */
|
||||
if (!is_frame_per_function(exec_env)
|
||||
&& !aot_alloc_frame(exec_env, func_idx)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
ret = invoke_native_internal(exec_env, func_ptr, func_type, signature,
|
||||
attachment, argv, argc, argv);
|
||||
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
||||
/* Free all frames allocated, note that some frames
|
||||
may be allocated in AOT code and haven't been
|
||||
freed if exception occurred */
|
||||
while (get_top_frame(exec_env) != prev_frame)
|
||||
aot_free_frame(exec_env);
|
||||
#endif
|
||||
if (!ret)
|
||||
goto fail;
|
||||
|
||||
|
||||
@ -30,36 +30,39 @@ void __umoddi3();
|
||||
#pragma function(floor)
|
||||
#pragma function(ceil)
|
||||
|
||||
static int64
|
||||
__divdi3(int64 a, int64 b)
|
||||
static int64 __stdcall __divdi3(int64 a, int64 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
static uint64
|
||||
__udivdi3(uint64 a, uint64 b)
|
||||
static uint64 __stdcall __udivdi3(uint64 a, uint64 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
static int64
|
||||
__moddi3(int64 a, int64 b)
|
||||
static int64 __stdcall __moddi3(int64 a, int64 b)
|
||||
{
|
||||
return a % b;
|
||||
}
|
||||
|
||||
static uint64
|
||||
__umoddi3(uint64 a, uint64 b)
|
||||
static uint64 __stdcall __umoddi3(uint64 a, uint64 b)
|
||||
{
|
||||
return a % b;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint64
|
||||
__aulldiv(uint64 a, uint64 b)
|
||||
static uint64 __stdcall __aulldiv(uint64 a, uint64 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
static int64 __stdcall __alldiv(int64 a, int64 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
static int64 __stdcall __allrem(int64 a, int64 b)
|
||||
{
|
||||
return a % b;
|
||||
}
|
||||
#endif /* !defined(_WIN32) && !defined(_WIN32_) */
|
||||
|
||||
/* clang-format off */
|
||||
static SymbolMap target_sym_map[] = {
|
||||
@ -69,7 +72,11 @@ static SymbolMap target_sym_map[] = {
|
||||
REG_SYM(__udivdi3),
|
||||
REG_SYM(__moddi3),
|
||||
REG_SYM(__umoddi3),
|
||||
REG_SYM(__aulldiv)
|
||||
#if defined(_WIN32) || defined(_WIN32_)
|
||||
REG_SYM(__aulldiv),
|
||||
REG_SYM(__alldiv),
|
||||
REG_SYM(__allrem)
|
||||
#endif /* defined(_WIN32) || defined(_WIN32_) */
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user