|
|
@@ -10,6 +10,9 @@
|
|
|
#include "../common/wasm_native.h"
|
|
|
#include "../common/wasm_loader_common.h"
|
|
|
#include "../compilation/aot.h"
|
|
|
+#if WASM_ENABLE_AOT_VALIDATOR != 0
|
|
|
+#include "aot_validator.h"
|
|
|
+#endif
|
|
|
|
|
|
#if WASM_ENABLE_DEBUG_AOT != 0
|
|
|
#include "debug/elf_parser.h"
|
|
|
@@ -1106,9 +1109,6 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
|
|
const uint8 *buf = *p_buf;
|
|
|
|
|
|
read_uint32(buf, buf_end, module->import_memory_count);
|
|
|
- /* We don't support import_memory_count > 0 currently */
|
|
|
- if (module->import_memory_count > 0)
|
|
|
- return false;
|
|
|
|
|
|
read_uint32(buf, buf_end, module->memory_count);
|
|
|
total_size = sizeof(AOTMemory) * (uint64)module->memory_count;
|
|
|
@@ -4403,6 +4403,13 @@ aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args,
|
|
|
os_thread_jit_write_protect_np(true); /* Make memory executable */
|
|
|
os_icache_flush(module->code, module->code_size);
|
|
|
|
|
|
+#if WASM_ENABLE_AOT_VALIDATOR != 0
|
|
|
+ if (!aot_module_validate(module, error_buf, error_buf_size)) {
|
|
|
+ aot_unload(module);
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+#endif /* WASM_ENABLE_AOT_VALIDATOR != 0 */
|
|
|
+
|
|
|
LOG_VERBOSE("Load module success.\n");
|
|
|
return module;
|
|
|
}
|