WASI is a "syscall" interface for WebAssembly, significantly inspired by CloudABI. It is supported in clang 8 and up, but to actually build C programs, it needs clang builtins and the libc/sysroot. And for C++, also libc++ and libcxxabi.
This is used like: clang11 -Os -target wasm32-wasi --sysroot /usr/local/share/wasi-sysroot wasi-demo.c -o wasi-demo.wasm
This is useful not only for development, but also Firefox can now use WASI with lucet / rlbox to sandbox the web font parser.
These ports work but maybe don't look that great yet, feedback welcome.
- our clang does not ship with its OS-independent stdarg.h and stddef.h :( For now I've added them (from llvm 9) as extra files and installed into the WASI sysroot.
- There's probably a better way of doing this?
- I didn't add them as download files because I couldn't figure out how to configure it to avoid trying to extract them as archives but still extract the github archives
- Can they be included in the LLVM port? Why are we using system ones?
- the compiler-rt port shares distfiles and some variables with the LLVM port