@@ -1385,6 +1385,16 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
13851385 if (!* func_ptrs ) {
13861386 const char * module_name = module -> import_funcs [i ].module_name ;
13871387 const char * field_name = module -> import_funcs [i ].func_name ;
1388+
1389+ /* AOT mode: If linking an imported function fails, we only issue
1390+ * a warning here instead of throwing an error. However, during the
1391+ * subsequent `invoke_native` stage, calling this unresolved import
1392+ * will likely crash.
1393+ *
1394+ * See:
1395+ * https://github.com/bytecodealliance/wasm-micro-runtime/issues/4539
1396+ *
1397+ * Debugging: Check if the import is resolved at link time */
13881398 LOG_WARNING ("warning: failed to link import function (%s, %s)" ,
13891399 module_name , field_name );
13901400 }
@@ -2460,6 +2470,14 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
24602470
24612471 wasm_exec_env_push_jmpbuf (exec_env , & jmpbuf_node );
24622472
2473+ /* In AOT mode, this is primarily a design choice for performance reasons.
2474+ * Before invoke_native, we do not check whether every imported caller is
2475+ * NULL, unlike wasm_interp_call_func_import() and
2476+ * wasm_interp_call_func_native().
2477+ *
2478+ * See: https://github.com/bytecodealliance/wasm-micro-runtime/issues/4539
2479+ */
2480+
24632481 if (os_setjmp (jmpbuf_node .jmpbuf ) == 0 ) {
24642482#if WASM_ENABLE_QUICK_AOT_ENTRY != 0
24652483 /* Quick call if the quick aot entry is registered */
0 commit comments