@@ -976,6 +976,26 @@ execute_memory_init_function(AOTModuleInstance *module_inst)
976976}
977977#endif
978978
979+ static bool
980+ check_linked_symbol (AOTModule * module , char * error_buf , uint32 error_buf_size )
981+ {
982+ uint32 i ;
983+
984+ /* init_func_ptrs() will go through import functions */
985+
986+ for (i = 0 ; i < module -> import_global_count ; i ++ ) {
987+ AOTImportGlobal * global = module -> import_globals + i ;
988+ if (!global -> is_linked ) {
989+ set_error_buf_v (error_buf , error_buf_size ,
990+ "warning: failed to link import global (%s, %s)" ,
991+ global -> module_name , global -> global_name );
992+ return false;
993+ }
994+ }
995+
996+ return true;
997+ }
998+
979999AOTModuleInstance *
9801000aot_instantiate (AOTModule * module , bool is_sub_inst , uint32 stack_size ,
9811001 uint32 heap_size , char * error_buf , uint32 error_buf_size )
@@ -1059,6 +1079,9 @@ aot_instantiate(AOTModule *module, bool is_sub_inst, uint32 stack_size,
10591079 if (!init_func_type_indexes (module_inst , module , error_buf , error_buf_size ))
10601080 goto fail ;
10611081
1082+ if (!check_linked_symbol (module , error_buf , error_buf_size ))
1083+ goto fail ;
1084+
10621085 if (!create_exports (module_inst , module , error_buf , error_buf_size ))
10631086 goto fail ;
10641087
0 commit comments