Skip to content

Commit a150fe8

Browse files
committed
Relax wasi memory export check when wasi-threads is enabled
WebAssembly/wasi-threads#22 WebAssembly/WASI#502
1 parent 903f521 commit a150fe8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

core/iwasm/interpreter/wasm_loader.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -4185,7 +4185,20 @@ check_wasi_abi_compatibility(const WASMModule *module,
41854185

41864186
memory = wasm_loader_find_export(module, "", "memory", EXPORT_KIND_MEMORY,
41874187
error_buf, error_buf_size);
4188-
if (!memory) {
4188+
if (!memory
4189+
#if WASM_ENABLE_LIB_WASI_THREADS != 0
4190+
/*
4191+
* with wasi-threads, it's still an open question if a memory
4192+
* should be exported.
4193+
*
4194+
* https://github.com/WebAssembly/wasi-threads/issues/22
4195+
* https://github.com/WebAssembly/WASI/issues/502
4196+
*
4197+
* Note: this code assumes the number of memories is at most 1.
4198+
*/
4199+
&& module->import_memory_count == 0
4200+
#endif
4201+
) {
41894202
set_error_buf(error_buf, error_buf_size,
41904203
"a module with WASI apis must export memory by default");
41914204
return false;

0 commit comments

Comments
 (0)