Add WASI ABI compatibility check for multi-module (#913)
Refer to https://github.com/WebAssembly/WASI/blob/main/design/application-abi.md to check the WASI ABI compatibility: - Command (main module) may export _start function with signature "()" - Reactor (sub module) may export _initialize function with signature "()" - _start and _initialize can not be exported at the same time - Reactor cannot export _start function - Command and Reactor must export memory And - Rename module->is_wasi_module to module->import_wasi_api - Refactor wasm_loader_find_export() - Remove MULTI_MODULE related codes from mini_loader - Update multi-module samples - Fix a "use-after-free" issue. Since we reuse the memory instance of sub module, just to protect it from freeing an imported memory instance
This commit is contained in:
@ -1284,7 +1284,7 @@ load_import_funcs(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
||||
#if WASM_ENABLE_LIBC_WASI != 0
|
||||
if (!strcmp(import_funcs[i].module_name, "wasi_unstable")
|
||||
|| !strcmp(import_funcs[i].module_name, "wasi_snapshot_preview1"))
|
||||
module->is_wasi_module = true;
|
||||
module->import_wasi_api = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2925,7 +2925,7 @@ aot_load_from_comp_data(AOTCompData *comp_data, AOTCompContext *comp_ctx,
|
||||
module->comp_data = comp_data;
|
||||
|
||||
#if WASM_ENABLE_LIBC_WASI != 0
|
||||
module->is_wasi_module = comp_data->wasm_module->is_wasi_module;
|
||||
module->import_wasi_api = comp_data->wasm_module->import_wasi_api;
|
||||
#endif
|
||||
|
||||
return module;
|
||||
|
||||
Reference in New Issue
Block a user