Linux command
wasm-validate 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Validate
wasm-validate [file.wasm]
Validate
wasm-validate -v [file.wasm]
Validate
wasm-validate --enable-all [file.wasm]
Validate
wasm-validate --enable-threads [file.wasm]
Validate
wasm-validate --enable-gc [file.wasm]
Validate
wasm-validate --ignore-custom-section-errors [file.wasm]
说明
wasm-validate reads a file in the WebAssembly binary format and validates it against the WebAssembly specification. It is part of WABT (WebAssembly Binary Toolkit). The validator checks module structure, type correctness, instruction validity, and other specification requirements. It reports errors for malformed or invalid modules that would fail to load in runtimes. Feature flags enable or disable validation of WebAssembly proposals. Some features like mutable globals and bulk memory are enabled by default, while proposals like threads, GC, and exceptions must be explicitly enabled.
参数
- -v, --verbose
- Use verbose output. Use multiple times for more detail.
- --enable-exceptions
- Enable experimental exception handling.
- --enable-threads
- Enable threading support.
- --enable-function-references
- Enable typed function references.
- --enable-tail-call
- Enable tail-call support.
- --enable-annotations
- Enable custom annotation syntax.
- --enable-code-metadata
- Enable code metadata.
- --enable-gc
- Enable garbage collection.
- --enable-memory64
- Enable 64-bit memory support.
- --enable-multi-memory
- Enable multi-memory support.
- --enable-extended-const
- Enable extended constant expressions.
- --enable-all
- Enable all features.
- --disable-mutable-globals
- Disable import/export mutable globals.
- --disable-saturating-float-to-int
- Disable saturating float-to-int operators.
- --disable-sign-extension
- Disable sign-extension operators.
- --disable-simd
- Disable SIMD support.
- --disable-multi-value
- Disable multi-value support.
- --disable-bulk-memory
- Disable bulk-memory operations.
- --disable-reference-types
- Disable reference types (externref).
- --no-debug-names
- Ignore debug names in the binary file.
- --ignore-custom-section-errors
- Ignore errors in custom sections.
- --help
- Display help message.
- --version
- Display version information.
FAQ
What is the wasm-validate command used for?
wasm-validate reads a file in the WebAssembly binary format and validates it against the WebAssembly specification. It is part of WABT (WebAssembly Binary Toolkit). The validator checks module structure, type correctness, instruction validity, and other specification requirements. It reports errors for malformed or invalid modules that would fail to load in runtimes. Feature flags enable or disable validation of WebAssembly proposals. Some features like mutable globals and bulk memory are enabled by default, while proposals like threads, GC, and exceptions must be explicitly enabled.
How do I run a basic wasm-validate example?
Run `wasm-validate [file.wasm]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -v, --verbose do in wasm-validate?
Use verbose output. Use multiple times for more detail.