Skip to content

[RFC] Support more WASI proposals(beyond wasi-libc p2) #3685

Open
@lum1n0us

Description

@lum1n0us

The goal of raising this issue is to enhance support for more WASI capabilities.

wasm32-wasi-p2-module, or wasm32-wasi-t2, is a new concept highlighted in a slide in Wasm CG June 2024. The initial idea can be found in a discussion.

P2-module is expected to enhance core modules by integrating advanced features of the WASI-p2, such as networking and encryption capabilities, which are anticipated to be highly appealing to users.

While there hasn't been an official release yet, developers can create wasm-wasi-p2-modules using the latest versions of wasi-sdk(22 and 23). This is done by compiling with the options --target=wasm32-wasip2 -fuse-ld=lld. The output has a mixed version of imports, wasi_snapshost_preview1 and wasi:[email protected]:

Import[15]:
 - func[0] sig=2 <__imported_wasi_snapshot_preview1_args_get> <- wasi_snapshot_preview1.args_get
 - func[1] sig=2 <__imported_wasi_snapshot_preview1_args_sizes_get> <- wasi_snapshot_preview1.args_sizes_get
 - func[2] sig=3 <__imported_wasi_snapshot_preview1_fd_close> <- wasi_snapshot_preview1.fd_close
 - func[3] sig=2 <__imported_wasi_snapshot_preview1_fd_fdstat_get> <- wasi_snapshot_preview1.fd_fdstat_get
 - func[4] sig=4 <__imported_wasi_snapshot_preview1_fd_seek> <- wasi_snapshot_preview1.fd_seek
 - func[5] sig=5 <__imported_wasi_snapshot_preview1_fd_write> <- wasi_snapshot_preview1.fd_write
 - func[6] sig=6 <__imported_wasi_snapshot_preview1_proc_exit> <- wasi_snapshot_preview1.proc_exit
 - func[7] sig=6 <__wasm_import_poll_pollable_drop> <- wasi:io/[email protected].[resource-drop]pollable
 - func[8] sig=6 <__wasm_import_streams_input_stream_drop> <- wasi:io/[email protected].[resource-drop]input-stream
 - func[9] sig=6 <__wasm_import_streams_output_stream_drop> <- wasi:io/[email protected].[resource-drop]output-stream
 - func[10] sig=6 <__wasm_import_udp_udp_socket_drop> <- wasi:sockets/[email protected].[resource-drop]udp-socket
 - func[11] sig=6 <__wasm_import_udp_incoming_datagram_stream_drop> <- wasi:sockets/[email protected].[resource-drop]incoming-datagram-stream
 - func[12] sig=6 <__wasm_import_udp_outgoing_datagram_stream_drop> <- wasi:sockets/[email protected].[resource-drop]outgoing-datagram-stream
 - func[13] sig=6 <__wasm_import_tcp_tcp_socket_drop> <- wasi:sockets/[email protected].[resource-drop]tcp-socket
 - func[14] sig=3 <__wasi_preview1_adapter_close_badfd> <- wasi_snapshot_preview1.adapter_close_badfd

The imports are same with wasm32-wasi-p2.

When implementing, the original wasi library at core/iwas/libraries/libc-wasi won't be touched. The new stuff will be stored at core/iwasm/libraries/libc-wasi-p2-module. If later, it is found to be able to shared with wasm32-wasi-p2, might be renamed to libc-wasi-p2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions