Skip to content

Document that modules must be WASI modules (#329)#402

Open
bushidocodes wants to merge 1 commit into
masterfrom
fix/329-document-validate-wasi-module
Open

Document that modules must be WASI modules (#329)#402
bushidocodes wants to merge 1 commit into
masterfrom
fix/329-document-validate-wasi-module

Conversation

@bushidocodes

@bushidocodes bushidocodes commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Closes #329.

Background

aWsm can emit WebAssembly outside the WASI spec (e.g. modules that don't use linear memory), but SLEdge is opinionated around WASI. That assumption was undocumented.

The "validate during dlopen" half of the issue is already satisfied by existing code: sledge_abi_symbols_init resolves the aWsm-generated symbols and fails the load when the mandatory linear-memory symbols (sledge_abi__init_mem, sledge_abi__wasm_memory_starting_pages/_max_pages) are absent, which is exactly the non-WASI / no-linear-memory case. So this PR is docs-only.

Changes

docs/WASI.md — new "Module Requirements and Assumptions" section:

  • Modules must be WASI modules compiled by aWsm and linked against libsledge; non-WASI aWsm output is unsupported.
  • Linear memory is mandatory — SLEdge's stdin/stdout I/O model lives in linear memory, so a module without it is rejected at load time when its aWsm memory symbols don't resolve.
  • Explains why wasi_snapshot_preview1_* symbol presence is not a usable WASI signal: those shims come from libsledge and are unconditionally exported from every .so via --whole-archive --export-dynamic.
  • Records the unresolved --runtime-globals question (previously only an inline code comment).

No runtime code changes.

🤖 Generated with Claude Code

SLEdge assumes every module it loads is a WASI module that uses linear
memory, but this assumption was undocumented. The runtime already
validates it during dlopen: a non-WASI / no-linear-memory module fails
because its aWsm-generated memory symbols (sledge_abi__init_mem,
sledge_abi__wasm_memory_starting_pages/_max_pages) don't resolve.

Document the requirement in docs/WASI.md: modules must be WASI modules
compiled by aWsm and linked against libsledge, linear memory is
mandatory, why wasi_snapshot_preview1_* symbol presence is not a useful
WASI signal (whole-archive exports), and the --runtime-globals situation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bushidocodes bushidocodes force-pushed the fix/329-document-validate-wasi-module branch from 675fd66 to 0f51179 Compare June 23, 2026 02:07
@bushidocodes

Copy link
Copy Markdown
Contributor Author

runtime/include/sledge_abi_symbols.h already had the checks this issue discussed, so this is a doc-only change.

@bushidocodes bushidocodes requested a review from emil916 June 23, 2026 02:08
@bushidocodes bushidocodes changed the title Document and validate that modules are WASI modules (#329) Document that modules must be WASI modules (#329) Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document and validate that aWSM generated *.bc is a WASI module

1 participant