Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 24 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,41 +209,30 @@ disabled in a configure step before building with WASI SDK.

## Notable Limitations

This repository does not yet support __C++ exceptions__. C++ code is supported
only with -fno-exceptions for now.
Work on support for [exception handling] is underway at the
language level which will support the features.

[exception handling]: https://github.com/WebAssembly/exception-handling/

See [C setjmp/longjmp support] about setjmp/longjmp support.

[C setjmp/longjmp support]: SetjmpLongjmp.md

This repository experimentally supports __threads__ with
`--target=wasm32-wasip1-threads`. It uses WebAssembly's [threads] primitives
(atomics, `wait`/`notify`, shared memory) and [wasi-threads] for spawning
threads. Note: this is experimental — do not expect long-term stability!

Note that the `pthread_*` family of functions, as well as C++ threading primitives
such as `<atomic>`, `<mutex>`, and `<thread>` are available on all targets.
Any attempt to spawn a thread will fail on `--target=wasm32-wasip1` or
`--target=wasm32-wasip2`, but other functionality, such as locks, still works.
This makes it easier to port C++ codebases, as only a fraction of code needs
to be modified to build for the single-threaded targets.

Defining a macro `_WASI_STRICT_PTHREAD` will make `pthread_create`,
`pthread_detach`, `pthread_join`, `pthread_tryjoin_np`, and `pthread_timedjoin_np`
fail with a compile time error when building for single-threaded targets.
* C++ exceptions are disabled by default. For more information see
[CppExceptions.md].
* C `setjmp`/`longjmp` require some extra configuration to get working, see
[SetjmpLongjmp.md].
* Most targets do not support spawning a thread. Experimental support for
spawning threads is available with the `wasm32-wasip1-threads` target which
uses [wasi-threads]. Note that the `pthread_*` family of functions, as well as
C++ threading primitives such as `<atomic>`, `<mutex>`, and `<thread>` are
available on all targets. Defining a macro `_WASI_STRICT_PTHREAD` will make
`pthread_create`, `pthread_detach`, `pthread_join`, `pthread_tryjoin_np`, and
`pthread_timedjoin_np` fail with a compile time error when building for
single-threaded targets.
* Dynamic linking [is supported][dylink] but not as fully baked as static
linking. There might be obscure bugs in some situations related to dynamic
linking.
* The WASIp1 targets do not support networking, but WASIp2/WASIp3 support
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true? I think we support some networking for p1 via host-pre-opened sockets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll probably leave this in insofar as these aren't really implemented much in wasi-libc, it's untested, and it's non-standard in the subset that it implements. Effectively for any breadth of "implements networking" I don't think that WASIp1 clears the bar.

networking.
* 64-bit linear memories (a "wasm64" target) are not supported at this time.
Supporting this will require resolving [WebAssembly/component-model#22] first
at which point it will be possible to add a `wasm64-wasip2` target. There are
no plans to add support for `wasm64-wasi{,-threads,p1,p1-threads}` at this
time.

[threads]: https://github.com/WebAssembly/threads
[wasi-threads]: https://github.com/WebAssembly/wasi-threads

This repository does not yet support __dynamic libraries__. While there are
[some efforts] to design a system for dynamic libraries in wasm, it is still in
development and not yet generally usable.

[some efforts]: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md

There is no support for __networking__. It is a goal of WASI to support
networking in the future though.
[dylink]: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
[WebAssembly/component-model#22]: https://github.com/WebAssembly/component-model/issues/22
Loading