From 2499e1ec4ba1a6dd222d40ba4a5009c74a328b78 Mon Sep 17 00:00:00 2001 From: Xu Jun <693788454@qq.com> Date: Mon, 14 Sep 2020 15:30:42 +0800 Subject: [PATCH] Fix issue and compilation warnings of new function call APIs (#383) --- core/iwasm/aot/arch/aot_reloc_x86_64.c | 3 ++- core/iwasm/common/wasm_runtime_common.c | 9 +++++---- core/iwasm/compilation/aot_emit_aot_file.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/iwasm/aot/arch/aot_reloc_x86_64.c b/core/iwasm/aot/arch/aot_reloc_x86_64.c index cd45e096a..b19fd9da9 100644 --- a/core/iwasm/aot/arch/aot_reloc_x86_64.c +++ b/core/iwasm/aot/arch/aot_reloc_x86_64.c @@ -11,7 +11,8 @@ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -#define IMAGE_REL_AMD64_REL32 4 /* The 32-bit relative address from the byte following the relocation. */ +#define IMAGE_REL_AMD64_REL32 4 /* The 32-bit relative address from + the byte following the relocation */ void __divdi3(); void __udivdi3(); diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index b729751b8..ee82a6b4a 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -868,7 +868,7 @@ parse_args_to_uint32_array(WASMType *type, uint32 num_args, wasm_val_t *args, uint32 *out_argv) { - int i, p; + uint32 i, p; for (i = 0, p = 0; i < num_args; i++) { switch (args[i].kind) { @@ -911,13 +911,13 @@ parse_uint32_array_to_results(WASMType *type, uint32 argc, uint32 *argv, wasm_val_t *out_results) { - int i, p; + uint32 i, p; for (i = 0, p = 0; i < type->result_count; i++) { switch (type->types[type->param_count + i]) { case VALUE_TYPE_I32: out_results[i].kind = WASM_I32; - out_results[i].of.i32 = *(int32 *)argv[p++]; + out_results[i].of.i32 = (int32)argv[p++]; break; case VALUE_TYPE_I64: { @@ -1008,6 +1008,7 @@ wasm_runtime_call_wasm_a(WASMExecEnv *exec_env, ret_num = parse_uint32_array_to_results(type, type->ret_cell_num, argv, results); bh_assert(ret_num == num_results); + (void)ret_num; fail2: wasm_runtime_free(argv); @@ -1024,7 +1025,7 @@ wasm_runtime_call_wasm_v(WASMExecEnv *exec_env, wasm_val_t *args = NULL; WASMType *type = NULL; bool ret = false; - int i = 0; + uint32 i = 0; va_list vargs; #if WASM_ENABLE_INTERP != 0 diff --git a/core/iwasm/compilation/aot_emit_aot_file.c b/core/iwasm/compilation/aot_emit_aot_file.c index e11efbb4f..98311ec92 100644 --- a/core/iwasm/compilation/aot_emit_aot_file.c +++ b/core/iwasm/compilation/aot_emit_aot_file.c @@ -1540,7 +1540,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data) obj_data->target_info.bin_type = AOT_COFF_BIN_TYPE; } else if (bin_type == LLVMBinaryTypeELF32L - || bin_type == LLVMBinaryTypeELF32B) { + || bin_type == LLVMBinaryTypeELF32B) { struct elf32_ehdr *elf_header; bool is_little_bin = bin_type == LLVMBinaryTypeELF32L;