WASM-TOOLS(1)

NAME
wasm-tools validate - Validate a WebAssembly binary

SYNOPSIS
wasm-tools validate [OPTIONS] [INPUT]

DESCRIPTION
Validate a WebAssembly binary

This subcommand will validate a WebAssembly binary to determine if it's valid or not. This implements the validation algorithm of the WebAssembly specification. The process will exit with 0 and no output if the binary is valid, or nonzero and an error message on stderr if the binary is not valid.

  Arguments:

    [INPUT]

    Input file to process.

    If not provided or if this is `-` then stdin is read entirely and processed. Note that for most subcommands this input can either be a binary `*.wasm` file or a textual format `*.wat` file.

OPTIONS

-f, --features <FEATURES>

    Comma-separated list of WebAssembly features to enable during validation.

    If a "-" character is present in front of a feature it will disable that feature. For example "-simd" will disable the simd proposal.

    The placeholder "all" can be used to enable all wasm features and the term "-all" can be used to disable all features.

    The default set of features enabled are all WebAssembly proposals that are at phase 4 or after. This means that the default set of features accepted are relatively bleeding edge. Versions of the WebAssembly specification can also be selected. The "wasm1" or "mvp" feature can select the original WebAssembly specification and "wasm2" can be used to select the 2.0 version.

    Available feature options can be found in the wasmparser crate: <https://github.com/bytecodealliance/wasm-tools/blob/main/crates/wasmparser/src/features.rs>

--generate-dwarf <lines|full>

    Optionally generate DWARF debugging information from WebAssembly text files.

    When the input to this command is a WebAssembly text file, such as `*.wat`, then this option will instruct the text parser to insert DWARF debugging information to map binary locations back to the original source locations in the input `*.wat` file. This option has no effect if the `INPUT` argument is already a WebAssembly binary or if the text format uses `(module binary ...)`.

-g

    Shorthand for `--generate-dwarf full`

-o, --output <OUTPUT>

    Where to place output.

    If not provided then stdout is used.

-v, --verbose...

    Use verbose output (-v info, -vv debug, -vvv trace)

--color <COLOR>

    Configuration over whether terminal colors are used in output.

    Supports one of `auto|never|always|always-ansi`. The default is to detect what to do based on the terminal environment, for example by using `isatty`.

    [default: auto]

-h, --help

    Print help (see a summary with '-h')

EXAMPLES

    # Validate `foo.wasm` with the default Wasm feature proposals. $ wasm-tools validate foo.wasm

    # Validate `foo.wasm` with more verbose output $ wasm-tools validate -vv foo.wasm

    # Validate `fancy.wasm` with all Wasm feature proposals enabled. $ wasm-tools validate --features all fancy.wasm

    # Validate `mvp.wasm` with the original wasm feature set enabled. $ wasm-tools validate --features=wasm1 mvp.wasm $ wasm-tools validate --features=mvp mvp.wasm