Update global initialization process for latest spec cases (#553)
This commit is contained in:
@ -722,6 +722,9 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
|
||||
AOTImportGlobal *import_globals;
|
||||
uint64 size;
|
||||
uint32 i, data_offset = 0;
|
||||
#if WASM_ENABLE_LIBC_BUILTIN != 0
|
||||
WASMGlobalImport tmp_global;
|
||||
#endif
|
||||
|
||||
/* Allocate memory */
|
||||
size = sizeof(AOTImportGlobal) * (uint64)module->import_global_count;
|
||||
@ -738,6 +741,22 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
|
||||
read_string(buf, buf_end, import_globals[i].module_name);
|
||||
read_string(buf, buf_end, import_globals[i].global_name);
|
||||
|
||||
#if WASM_ENABLE_LIBC_BUILTIN != 0
|
||||
if (wasm_native_lookup_libc_builtin_global(
|
||||
import_globals[i].module_name,
|
||||
import_globals[i].global_name,
|
||||
&tmp_global)) {
|
||||
if (tmp_global.type != import_globals[i].type
|
||||
|| tmp_global.is_mutable != import_globals[i].is_mutable) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"incompatible import type");
|
||||
return false;
|
||||
}
|
||||
import_globals[i].global_data_linked =
|
||||
tmp_global.global_data_linked;
|
||||
}
|
||||
#endif
|
||||
|
||||
import_globals[i].size = wasm_value_type_size(import_globals[i].type);
|
||||
import_globals[i].data_offset = data_offset;
|
||||
data_offset += import_globals[i].size;
|
||||
|
||||
Reference in New Issue
Block a user