blob: e691d5fb619808f9601f2a2d54fe648a08922a5c [file] [edit]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
table.head, table.foot { width: 100%; }
td.head-rtitle, td.foot-os { text-align: right; }
td.head-vol { text-align: center; }
.Nd, .Bf, .Op { display: inline; }
.Pa, .Ad { font-style: italic; }
.Ms { font-weight: bold; }
.Bl-diag > dt { font-weight: bold; }
code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd { font-weight: bold;
font-family: inherit; }
</style>
<title>WABT(1)</title>
</head>
<body>
<table class="head">
<tr>
<td class="head-ltitle">WABT(1)</td>
<td class="head-vol">General Commands Manual</td>
<td class="head-rtitle">WABT(1)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">wat2wasm</code> &#x2014;
<span class="Nd">translate from WebAssembly text format to the WebAssembly
binary format</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<table class="Nm">
<tr>
<td><code class="Nm">wat2wasm</code></td>
<td>[options] <var class="Ar">filename</var></td>
</tr>
</table>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp"><code class="Nm">wat2wasm</code> read a file in the wasm text
format, check it for errors, and convert it to the wasm binary format.</p>
<p class="Pp">The options are as follows:</p>
<dl class="Bl-tag">
<dt id="help"><a class="permalink" href="#help"><code class="Fl">--help</code></a></dt>
<dd>Print this help message</dd>
<dt id="version"><a class="permalink" href="#version"><code class="Fl">--version</code></a></dt>
<dd>Print version information</dd>
<dt id="v"><a class="permalink" href="#v"><code class="Fl">-v</code></a>,
<code class="Fl">--verbose</code></dt>
<dd>Use multiple times for more info</dd>
<dt id="d"><a class="permalink" href="#d"><code class="Fl">-d</code></a>,
<code class="Fl">--dump-module</code></dt>
<dd>Print a hexdump of the module to stdout</dd>
<dt id="disable-exceptions"><a class="permalink" href="#disable-exceptions"><code class="Fl">--disable-exceptions</code></a></dt>
<dd>Disable Experimental exception handling</dd>
<dt id="disable-mutable-globals"><a class="permalink" href="#disable-mutable-globals"><code class="Fl">--disable-mutable-globals</code></a></dt>
<dd>Disable Import/export mutable globals</dd>
<dt id="disable-saturating-float-to-int"><a class="permalink" href="#disable-saturating-float-to-int"><code class="Fl">--disable-saturating-float-to-int</code></a></dt>
<dd>Disable Saturating float-to-int operators</dd>
<dt id="disable-sign-extension"><a class="permalink" href="#disable-sign-extension"><code class="Fl">--disable-sign-extension</code></a></dt>
<dd>Disable Sign-extension operators</dd>
<dt id="disable-simd"><a class="permalink" href="#disable-simd"><code class="Fl">--disable-simd</code></a></dt>
<dd>Disable SIMD support</dd>
<dt id="enable-threads"><a class="permalink" href="#enable-threads"><code class="Fl">--enable-threads</code></a></dt>
<dd>Enable Threading support</dd>
<dt id="enable-function-references"><a class="permalink" href="#enable-function-references"><code class="Fl">--enable-function-references</code></a></dt>
<dd>Enable Typed function references</dd>
<dt id="disable-multi-value"><a class="permalink" href="#disable-multi-value"><code class="Fl">--disable-multi-value</code></a></dt>
<dd>Disable Multi-value</dd>
<dt id="disable-tail-call"><a class="permalink" href="#disable-tail-call"><code class="Fl">--disable-tail-call</code></a></dt>
<dd>Disable Tail-call support</dd>
<dt id="disable-bulk-memory"><a class="permalink" href="#disable-bulk-memory"><code class="Fl">--disable-bulk-memory</code></a></dt>
<dd>Disable Bulk-memory operations</dd>
<dt id="disable-reference-types"><a class="permalink" href="#disable-reference-types"><code class="Fl">--disable-reference-types</code></a></dt>
<dd>Disable Reference types (externref)</dd>
<dt id="disable-annotations"><a class="permalink" href="#disable-annotations"><code class="Fl">--disable-annotations</code></a></dt>
<dd>Disable Custom annotation syntax</dd>
<dt id="enable-code-metadata"><a class="permalink" href="#enable-code-metadata"><code class="Fl">--enable-code-metadata</code></a></dt>
<dd>Enable Code metadata</dd>
<dt id="enable-gc"><a class="permalink" href="#enable-gc"><code class="Fl">--enable-gc</code></a></dt>
<dd>Enable Garbage collection</dd>
<dt id="disable-memory64"><a class="permalink" href="#disable-memory64"><code class="Fl">--disable-memory64</code></a></dt>
<dd>Disable 64-bit memory</dd>
<dt id="disable-multi-memory"><a class="permalink" href="#disable-multi-memory"><code class="Fl">--disable-multi-memory</code></a></dt>
<dd>Disable Multi-memory</dd>
<dt id="disable-extended-const"><a class="permalink" href="#disable-extended-const"><code class="Fl">--disable-extended-const</code></a></dt>
<dd>Disable Extended constant expressions</dd>
<dt id="disable-relaxed-simd"><a class="permalink" href="#disable-relaxed-simd"><code class="Fl">--disable-relaxed-simd</code></a></dt>
<dd>Disable Relaxed SIMD</dd>
<dt id="enable-custom-page-sizes"><a class="permalink" href="#enable-custom-page-sizes"><code class="Fl">--enable-custom-page-sizes</code></a></dt>
<dd>Enable Custom page sizes</dd>
<dt id="enable-compact-imports"><a class="permalink" href="#enable-compact-imports"><code class="Fl">--enable-compact-imports</code></a></dt>
<dd>Enable Compact import section</dd>
<dt id="enable-wide-arithmetic"><a class="permalink" href="#enable-wide-arithmetic"><code class="Fl">--enable-wide-arithmetic</code></a></dt>
<dd>Enable Wide arithmetic</dd>
<dt id="enable-all"><a class="permalink" href="#enable-all"><code class="Fl">--enable-all</code></a></dt>
<dd>Enable all features</dd>
<dt id="o"><a class="permalink" href="#o"><code class="Fl">-o</code></a>,
<code class="Fl">--output=FILE</code></dt>
<dd>Output wasm binary file. Use &quot;-&quot; to write to stdout.</dd>
<dt id="r"><a class="permalink" href="#r"><code class="Fl">-r</code></a>,
<code class="Fl">--relocatable</code></dt>
<dd>Create a relocatable wasm binary (suitable for linking with e.g. lld)</dd>
<dt id="no-canonicalize-leb128s"><a class="permalink" href="#no-canonicalize-leb128s"><code class="Fl">--no-canonicalize-leb128s</code></a></dt>
<dd>Write all LEB128 sizes as 5-bytes instead of their minimal size</dd>
<dt id="debug-names"><a class="permalink" href="#debug-names"><code class="Fl">--debug-names</code></a></dt>
<dd>Write debug names to the generated binary file</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
<p class="Pp">parse test.wat and write to .wasm binary file with the same
name</p>
<p class="Pp"></p>
<div class="Bd Bd-indent"><code class="Li">$ wat2wasm test.wat</code></div>
parse test.wat and write to binary file test.wasm
<p class="Pp"></p>
<div class="Bd Bd-indent"><code class="Li">$ wat2wasm test.wat -o
test.wasm</code></div>
parse spec-test.wast, and write verbose output to stdout (including the meaning
of every byte)
<p class="Pp"></p>
<div class="Bd Bd-indent"><code class="Li">$ wat2wasm spec-test.wast
-v</code></div>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr" href="wasm-interp.1.html">wasm-interp(1)</a>,
<a class="Xr" href="wasm-objdump.1.html">wasm-objdump(1)</a>,
<a class="Xr" href="wasm-stats.1.html">wasm-stats(1)</a>,
<a class="Xr" href="wasm-strip.1.html">wasm-strip(1)</a>,
<a class="Xr" href="wasm-validate.1.html">wasm-validate(1)</a>,
<a class="Xr" href="wasm2c.1.html">wasm2c(1)</a>,
<a class="Xr" href="wasm2wat.1.html">wasm2wat(1)</a>,
<a class="Xr" href="wast2json.1.html">wast2json(1)</a>,
<a class="Xr" href="wat-desugar.1.html">wat-desugar(1)</a>,
<a class="Xr" href="spectest-interp.1.html">spectest-interp(1)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">If you find a bug, please report it at
<br/>
<a class="Lk" href="https://github.com/WebAssembly/wabt/issues">https://github.com/WebAssembly/wabt/issues</a>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 25, 2026</td>
<td class="foot-os">Debian</td>
</tr>
</table>
</body>
</html>