diff --git a/core/iwasm/aot/aot_reloc.h b/core/iwasm/aot/aot_reloc.h index ff7ce8c2e..27fecf00e 100644 --- a/core/iwasm/aot/aot_reloc.h +++ b/core/iwasm/aot/aot_reloc.h @@ -37,19 +37,6 @@ typedef struct { #define REG_AOT_TRACE_SYM() #endif -#if (defined(_WIN32) || defined(_WIN32_)) && defined(NDEBUG) -#define REG_COMMON_SYMBOLS \ - REG_SYM(aot_set_exception_with_id), \ - REG_SYM(aot_invoke_native), \ - REG_SYM(aot_call_indirect), \ - REG_SYM(wasm_runtime_enlarge_memory), \ - REG_SYM(wasm_runtime_set_exception), \ - {"memset", (void*)aot_memset}, \ - {"memmove", (void*)aot_memmove}, \ - REG_BULK_MEMORY_SYM() \ - REG_ATOMIC_WAIT_SYM() \ - REG_AOT_TRACE_SYM() -#else /* else of (defined(_WIN32) || defined(_WIN32_)) && defined(NDEBUG) */ #define REG_COMMON_SYMBOLS \ REG_SYM(aot_set_exception_with_id), \ REG_SYM(aot_invoke_native), \ @@ -73,7 +60,6 @@ typedef struct { REG_BULK_MEMORY_SYM() \ REG_ATOMIC_WAIT_SYM() \ REG_AOT_TRACE_SYM() -#endif /* end of (defined(_WIN32) || defined(_WIN32_)) && defined(NDEBUG) */ #define CHECK_RELOC_OFFSET(data_size) do { \ if (!check_reloc_offset(target_section_size, reloc_offset, data_size, \ diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index f52e4eb24..55c266e38 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -2264,7 +2264,7 @@ aot_get_module_inst_mem_consumption(const AOTModuleInstance *module_inst, mem_conspn->memories_size += mem_inst->num_bytes_per_page * mem_inst->cur_page_count; mem_conspn->app_heap_size = - mem_inst->heap_data_end.ptr - mem_inst->heap_data.ptr; + (uint8 *) mem_inst->heap_data_end.ptr - (uint8 *) mem_inst->heap_data.ptr; /* size of app heap structure */ mem_conspn->memories_size += mem_allocator_get_heap_struct_size(); diff --git a/core/iwasm/aot/arch/aot_reloc_x86_32.c b/core/iwasm/aot/arch/aot_reloc_x86_32.c index 6cc470e91..2b13b1dab 100644 --- a/core/iwasm/aot/arch/aot_reloc_x86_32.c +++ b/core/iwasm/aot/arch/aot_reloc_x86_32.c @@ -8,20 +8,47 @@ #define R_386_32 1 /* Direct 32 bit */ #define R_386_PC32 2 /* PC relative 32 bit */ +#if !defined(_WIN32) && !defined(_WIN32_) void __divdi3(); void __udivdi3(); void __moddi3(); void __umoddi3(); +#else +#pragma function (floor) +#pragma function (ceil) + +static int64 +__divdi3(int64 a, int64 b) +{ + return a / b; +} + +static uint64 +__udivdi3(uint64 a, uint64 b) +{ + return a / b; +} + +static int64 +__moddi3(int64 a, int64 b) +{ + return a % b; +} + +static uint64 +__umoddi3(uint64 a, uint64 b) +{ + return a % b; +} +#endif static SymbolMap target_sym_map[] = { REG_COMMON_SYMBOLS -#if !defined(_WIN32) && !defined(_WIN32_) /* compiler-rt symbols that come from compiler(e.g. gcc) */ REG_SYM(__divdi3), REG_SYM(__udivdi3), REG_SYM(__moddi3), REG_SYM(__umoddi3) -#endif }; static void diff --git a/core/iwasm/aot/arch/aot_reloc_x86_64.c b/core/iwasm/aot/arch/aot_reloc_x86_64.c index b19fd9da9..676bdd5c9 100644 --- a/core/iwasm/aot/arch/aot_reloc_x86_64.c +++ b/core/iwasm/aot/arch/aot_reloc_x86_64.c @@ -14,10 +14,12 @@ #define IMAGE_REL_AMD64_REL32 4 /* The 32-bit relative address from the byte following the relocation */ -void __divdi3(); -void __udivdi3(); -void __moddi3(); -void __umoddi3(); +#if defined(_WIN64) || defined(_WIN64_) +#pragma function (floor) +#pragma function (ceil) +#pragma function (floorf) +#pragma function (ceilf) +#endif static SymbolMap target_sym_map[] = { REG_COMMON_SYMBOLS diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 5a72bac7a..7b1f7de12 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -1525,9 +1525,9 @@ wasm_runtime_get_app_addr_range(WASMModuleInstanceCommon *module_inst, bool wasm_runtime_get_native_addr_range(WASMModuleInstanceCommon *module_inst, - uint8_t *native_ptr, - uint8_t **p_native_start_addr, - uint8_t **p_native_end_addr) + uint8 *native_ptr, + uint8 **p_native_start_addr, + uint8 **p_native_end_addr) { #if WASM_ENABLE_INTERP != 0 if (module_inst->module_type == Wasm_Module_Bytecode) diff --git a/product-mini/platforms/windows/main.c b/product-mini/platforms/windows/main.c index 8db96b0a7..5cb3415a4 100644 --- a/product-mini/platforms/windows/main.c +++ b/product-mini/platforms/windows/main.c @@ -194,7 +194,7 @@ module_reader_callback(const char *module_name, uint8 **p_buffer, snprintf(wasm_file_name, sz, format, module_search_path, module_name); - *p_buffer = (uint8_t *)bh_read_file_to_buffer(wasm_file_name, p_size); + *p_buffer = (uint8 *)bh_read_file_to_buffer(wasm_file_name, p_size); wasm_runtime_free(wasm_file_name); return *p_buffer != NULL;