mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 11:23:43 +01:00
A module may carry its manifest in a `vc_manifest` custom section, with `"abi": 1` in place of the `vc_abi_version` export. When it does, Plugin::load parses the manifest from the section and does not instantiate the module: its start function, data segments, `vc_abi_version` and `vc_manifest` do not run when it is inspected, installed or loaded at startup. The host checks the imports against the manifest's permissions, the exports `memory`, `vc_alloc` and `vc_run` by type, and the initial memory and the tables against the limits a run has (at most 4 tables of 100,000 elements). A module with more than one such section is refused, and so is a section over 64 KiB, before its contents are decoded, and a manifest in the section without `"abi": 1`. The host uses the section and does not call a `vc_manifest` export. Modules without the section load as before. The Desaturate example carries the section and keeps the export, and its fixture is rebuilt with Rust 1.100.0. build.sh clears RUSTFLAGS: .cargo/config.toml sets `+simd128` for wasm32, and the host refuses SIMD instructions. wat::sectioned builds test plug-ins with the section.
12 lines
660 B
Bash
12 lines
660 B
Bash
#!/bin/sh
|
|
# Builds the Desaturate example plug-in and refreshes the test fixture built from it.
|
|
# Needs the wasm32-unknown-unknown target: `rustup target add wasm32-unknown-unknown`.
|
|
set -eu
|
|
cd "$(dirname "$0")"
|
|
# An empty RUSTFLAGS replaces the `+simd128` flag that the repository's .cargo/config.toml sets for
|
|
# the web build: the plug-in host does not accept SIMD instructions.
|
|
RUSTFLAGS= cargo build --release --target wasm32-unknown-unknown
|
|
out=target/wasm32-unknown-unknown/release/vectorcraft_plugin_desaturate.wasm
|
|
cp "$out" ../tests/fixtures/desaturate.wasm
|
|
echo "built $out ($(wc -c < "$out") bytes) -> crates/plugins/tests/fixtures/desaturate.wasm"
|