|
10 | 10 | #include "../common/wasm_native.h"
|
11 | 11 | #include "../common/wasm_loader_common.h"
|
12 | 12 | #include "../compilation/aot.h"
|
| 13 | +#if WASM_ENABLE_AOT_VALIDATOR != 0 |
| 14 | +#include "aot_validator.h" |
| 15 | +#endif |
13 | 16 |
|
14 | 17 | #if WASM_ENABLE_DEBUG_AOT != 0
|
15 | 18 | #include "debug/elf_parser.h"
|
@@ -1106,9 +1109,6 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
1106 | 1109 | const uint8 *buf = *p_buf;
|
1107 | 1110 |
|
1108 | 1111 | read_uint32(buf, buf_end, module->import_memory_count);
|
1109 |
| - /* We don't support import_memory_count > 0 currently */ |
1110 |
| - if (module->import_memory_count > 0) |
1111 |
| - return false; |
1112 | 1112 |
|
1113 | 1113 | read_uint32(buf, buf_end, module->memory_count);
|
1114 | 1114 | 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,
|
4403 | 4403 | os_thread_jit_write_protect_np(true); /* Make memory executable */
|
4404 | 4404 | os_icache_flush(module->code, module->code_size);
|
4405 | 4405 |
|
| 4406 | +#if WASM_ENABLE_AOT_VALIDATOR != 0 |
| 4407 | + if (!aot_module_validate(module, error_buf, error_buf_size)) { |
| 4408 | + aot_unload(module); |
| 4409 | + return NULL; |
| 4410 | + } |
| 4411 | +#endif /* WASM_ENABLE_AOT_VALIDATOR != 0 */ |
| 4412 | + |
4406 | 4413 | LOG_VERBOSE("Load module success.\n");
|
4407 | 4414 | return module;
|
4408 | 4415 | }
|
|
0 commit comments