diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index e4fd3e0fc..b1dbe7940 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -12,9 +12,6 @@ #include "../compilation/aot.h" #if WASM_ENABLE_JIT != 0 #include "../compilation/aot_llvm.h" -#endif - -#if (WASM_ENABLE_JIT != 0) || (WASM_ENABLE_LOAD_CUSTOM_SECTION != 0) #include "../interpreter/wasm_loader.h" #endif @@ -3296,7 +3293,7 @@ aot_unload(AOTModule *module) #endif #if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 - wasm_loader_destroy_custom_sections(module->custom_section_list); + wasm_runtime_destroy_custom_sections(module->custom_section_list); #endif wasm_runtime_free(module); diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index efaf842d3..35584319a 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -4905,3 +4905,16 @@ wasm_runtime_show_app_heap_corrupted_prompt() "compiled by asc, please add --exportRuntime to " "export the runtime helpers."); } + +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 +void +wasm_runtime_destroy_custom_sections(WASMCustomSection *section_list) +{ + WASMCustomSection *section = section_list, *next; + while (section) { + next = section->next; + wasm_runtime_free(section); + section = next; + } +} +#endif /* end of WASM_ENABLE_LOAD_CUSTOM_SECTION */ diff --git a/core/iwasm/common/wasm_runtime_common.h b/core/iwasm/common/wasm_runtime_common.h index 0256b0fea..7ef8f69c1 100644 --- a/core/iwasm/common/wasm_runtime_common.h +++ b/core/iwasm/common/wasm_runtime_common.h @@ -884,6 +884,11 @@ wasm_runtime_invoke_c_api_native(WASMModuleInstanceCommon *module_inst, void wasm_runtime_show_app_heap_corrupted_prompt(); +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 +void +wasm_runtime_destroy_custom_sections(WASMCustomSection *section_list); +#endif + #ifdef __cplusplus } #endif diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 335c94695..fecf75773 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -3788,7 +3788,7 @@ wasm_loader_unload(WASMModule *module) #endif #if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 - wasm_loader_destroy_custom_sections(module->custom_section_list); + wasm_runtime_destroy_custom_sections(module->custom_section_list); #endif wasm_runtime_free(module); @@ -6503,18 +6503,7 @@ wasm_loader_get_custom_section(WASMModule *module, const char *name, return false; } - -void -wasm_loader_destroy_custom_sections(WASMCustomSection *section_list) -{ - WASMCustomSection *section = section_list, *next; - while (section) { - next = section->next; - wasm_runtime_free(section); - section = next; - } -} -#endif /* end of WASM_ENABLE_LOAD_CUSTOM_SECTION */ +#endif static bool wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func, diff --git a/core/iwasm/interpreter/wasm_loader.h b/core/iwasm/interpreter/wasm_loader.h index ff6b535b5..8b0dc77d6 100644 --- a/core/iwasm/interpreter/wasm_loader.h +++ b/core/iwasm/interpreter/wasm_loader.h @@ -73,11 +73,6 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache, uint8 block_type, uint8 **p_else_addr, uint8 **p_end_addr); -#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 -void -wasm_loader_destroy_custom_sections(WASMCustomSection *section_list); -#endif - #ifdef __cplusplus } #endif