diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index 3bf33e1276..2c7df68e69 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -114,6 +114,13 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...) } } +static void +aot_unlinked_import_func_trap(WASMExecEnv *exec_env) +{ + AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst; + aot_set_exception_with_id(module_inst, EXCE_CALL_UNLINKED_IMPORT_FUNC); +} + static void * runtime_malloc(uint64 size, char *error_buf, uint32 error_buf_size) { @@ -1397,6 +1404,7 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module, * Debugging: Check if the import is resolved at link time */ LOG_WARNING("warning: failed to link import function (%s, %s)", module_name, field_name); + *func_ptrs = (void *)aot_unlinked_import_func_trap; } }