OS Manuals

/usr/bin/wizer

The WebAssembly Pre-Initializer

From wizer 11.0.3-r21 (os), captured 2026-11-05 by running wizer --help (exit 0). permalink

Wizer: the WebAssembly pre-initializer!

Don't wait for your Wasm module to initialize itself, pre-initialize it! Wizer instantiates your WebAssembly module, executes its initialization function, and then serializes the instance's initialized state out into a new WebAssembly module. Now you can use this new, pre-initialized WebAssembly module to hit the ground running, without making your users wait for that first-time set up code to complete.

## Caveats

* The initialization function may not call any imported functions. Doing so will trigger a trap and `wizer` will exit.

* The Wasm module may not import globals, tables, or memories.

* Reference types are not supported yet. This is tricky because it would allow the Wasm module to mutate tables, and we would need to be able to snapshot the new table state, but funcrefs and externrefs don't have identity and aren't comparable in the Wasm spec, which makes snapshotting difficult.

Usage: wizer [OPTIONS] [INPUT]

Arguments:
  [INPUT]
          The input Wasm module's file path.

          If not specified, then `stdin` is used.

Options:
  -o <OUTPUT>
          The file path to write the output Wasm module to.

          If not specified, then `stdout` is used.

  -f, --init-func <INIT_FUNC>
          The Wasm export name of the function that should be executed to initialize the Wasm module

          [default: wizer-initialize]

  -r, --rename-func <dst=src>
          Any function renamings to perform.

          A renaming specification `dst=src` renames a function export `src` to `dst`, overwriting any previous `dst` export.

          Multiple renamings can be specified. It is an error to specify more than one source to rename to a destination name, or to specify more than one renaming destination for one source.

          This option can be used, for example, to replace a `_start` entry point in an initialized module with an alternate entry point.

          When module linking is enabled, these renames are only applied to the outermost module.

      --keep-init-func[=<true|false>]
          After initialization, should the Wasm module still export the initialization function?

          This is `false` by default, meaning that the initialization function is no longer exported from the Wasm module.

          [possible values: true, false]

      --allow-wasi
          Allow WASI imports to be called during initialization.

          This can introduce diverging semantics because the initialization can observe nondeterminism that might have gone a different way at runtime than it did at initialization time.

          If your Wasm module uses WASI's `get_random` to add randomness to something as a security mitigation (e.g. something akin to ASLR or the way Rust's hash maps incorporate a random nonce) then note that, if the randomization is added during initialization time and you don't ever re-randomize at runtime, then that randomization will become per-module rather than per-instance.

      --relaxed-simd-deterministic[=<true|false>]
          Use deterministic behavior for relaxed SIMD instructions.

          The relaxed SIMD instructions in Wasm are instructions which are permitted to have different results when run on different host CPU architectures. This flag tells wizer to instead execute relaxed SIMD instructions according to the [deterministic profile], which ensures that they're deterministic and platform-independent.

          [deterministic profile]: https://webassembly.github.io/spec/core/appendix/profiles.html#deterministic-profile-small-mathrm-det

          [possible values: true, false]

      --preload <PRELOAD>
          Provide an additional preloaded module that is available to the main module.

          This allows running a module that depends on imports from another module. Note that the additional module's state is *not* snapshotted, nor is its code included in the Wasm snapshot; rather, it is assumed that the resulting snapshot Wasm will also be executed with the same imports available.

          The main purpose of this option is to allow "stubs" for certain intrinsics to be included, when these will be provided with different implementations when running or further processing the snapshot.

          The format of this option is `name=file.{wasm,wat}`; e.g., `intrinsics=stubs.wat`. Multiple instances of the option may appear.

      --inherit-stdio [<true|false>]
          When using WASI during initialization, should `stdin`, `stderr`, and `stdout` be inherited?

          This is true by default.

          [possible values: true, false]

      --inherit-env [<true|false>]
          When using WASI during initialization, should environment variables be inherited?

          This is false by default.

          [possible values: true, false]

      --dir <directory>
          When using WASI during initialization, which file system directories should be made available?

          None are available by default.

      --mapdir <GUEST_DIR::HOST_DIR>
          When using WASI during initialization, which guest directories should be mapped to a host directory?

          The `--mapdir` option differs from `--dir` in that it allows giving a custom guest name to the directory that is different from its name in the host.

          None are mapped by default.

      --wasm-multi-memory [<true|false>]
          Enable or disable Wasm multi-memory proposal.

          Enabled by default.

          [possible values: true, false]

      --wasm-multi-value [<true|false>]
          Enable or disable the Wasm multi-value proposal.

          Enabled by default.

          [possible values: true, false]

      --wasm-bulk-memory [<true|false>]
          Enable or disable Wasm bulk memory operations.

          Note that only `memory.copy`, `memory.fill`, and `memory.init` operations are currently supported.  Modules which use other instructions, such as `table.copy` will be rejected.

          Enabled by default.

          [possible values: true, false]

      --wasm-simd [<true|false>]
          Enable or disable the Wasm SIMD128 proposal.

          Enabled by default.

          [possible values: true, false]

      --wasm-relaxed-simd [<true|false>]
          Enable or disable the Wasm relaxed SIMD proposal.

          Disabled by default. When enabled, by default relaxed SIMD instructions will produce different results on different platforms. For deterministic results, additionally enable the `--relaxed-simd-deterministic` flag.

          [possible values: true, false]

      --wasm-reference-types [<true|false>]
          Enable or disable the Wasm reference-types proposal.

          Currently does not implement snapshotting or the use of references, but enables initializing Wasm modules that use encodings introduced in the reference-types proposal.

          Enabled by default.

          [possible values: true, false]

  -h, --help
          Print help (see a summary with '-h')
Options (18)
OptionDescriptionSource
-o OUTPUTThe file path to write the output Wasm module to.help
-f, --init-func INIT_FUNCThe Wasm export name of the function that should be executed to initialize the Wasm modulehelp
-r, --rename-func dst=srcAny function renamings to perform.help
--keep-init-func true|falseAfter initialization, should the Wasm module still export the initialization function?help
--allow-wasiAllow WASI imports to be called during initialization.help
--relaxed-simd-deterministic true|falseUse deterministic behavior for relaxed SIMD instructions.help
--preload PRELOADProvide an additional preloaded module that is available to the main module.help
--inherit-stdio true|falseWhen using WASI during initialization, should `stdin`, `stderr`, and `stdout` be inherited?help
--inherit-env true|falseWhen using WASI during initialization, should environment variables be inherited?help
--dir directoryWhen using WASI during initialization, which file system directories should be made available?help
--mapdir GUEST_DIR::HOST_DIRWhen using WASI during initialization, which guest directories should be mapped to a host directory?help
--wasm-multi-memory true|falseEnable or disable Wasm multi-memory proposal.help
--wasm-multi-value true|falseEnable or disable the Wasm multi-value proposal.help
--wasm-bulk-memory true|falseEnable or disable Wasm bulk memory operations.help
--wasm-simd true|falseEnable or disable the Wasm SIMD128 proposal.help
--wasm-relaxed-simd true|falseEnable or disable the Wasm relaxed SIMD proposal.help
--wasm-reference-types true|falseEnable or disable the Wasm reference-types proposal.help
-h, --helpPrint help (see a summary with '-h')help

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.