WASM Usage

WebAssembly 2.0 is supported except for exceptions and threads. The supported WASM feature set is the same as the features supported by wasm2c 1.0.34 when used with default options (no cmd line switches passed). See WASM features supported by wasm2c in the following table.

From WASI only standard input and standard output are supported.

Use /valida-toolchain/bin/compile-wasm.sh to compile a .wasm program into a Valida executable:

/valida-toolchain/bin/compile-wasm.sh file.wasm -o output_path

file.wasm must export an entrypoint called _start that doesn't take any arguments and returns no value.

The compile-wasm.sh compilation pipeline involves an intermediate step that compiles WASM to C with wasm2c. Then C is compiled to Valida executable with Valida toolchain.

It's assumed that Valida toolchain is installed and is located at the default installation location: /valida-toolchain

It's assumed that wasm2c and wat2wasm in version 1.0.34 are in PATH. On Ubuntu 24.04 these can be installed with a command: apt install wabt.

See WASM examples bundled in the release package or in the toolchain Docker image at /valida-toolchain/examples/wasm.

Last updated