Skip to content

tools: WASI release programs carry no debug information - #27

Merged
pinhopro merged 1 commit into
mainfrom
tools/wasi-release-strip
Nov 17, 2026
Merged

pinhopro merged 1 commit into
mainfrom
tools/wasi-release-strip

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Owner decision (2026-11-17): WASI programs built at variant=release carry no debug information; debug builds keep theirs.

Change

  • Jamroot: <target-os>wasi,<debug-symbols>off:<linkflags>-Wl,--strip-debug (region wasi-strip-debug). wasm-component-ld passes it to wasm-ld, so the core module of a wasip2 or wasip3 component has no .debug* section. Keyed on <debug-symbols>off, which variant=release sets, so a release that asks for debug-symbols=on keeps its DWARF, as a debug build does. No other target is touched.
  • tools/test/webcpp_jam_test.py: test_a_wasi_release_program_carries_no_debug_information reads every custom section of the demo's catches.wasm, recursing into the core modules and components a component nests, for release, debug and release with debug-symbols=on, on wasip2 and wasip3. Seen failing before the change (the release component had .debug_info, .debug_line, .debug_str and others).
  • AGENTS.md, CODING-GUIDELINES.md (decision bullet), doc/releases/0.1.0.adoc (one line).

Size effect (release, wasm-component-ld output)

Program Target Before After
xactor xactor_quick_start wasip2 3,489,365 397,678
hash sha256 wasip2 3,463,386 375,207
pratt pratt_calculator wasip3 3,668,143 492,123
document document_quick_start wasip2 4,250,025 896,272
wasi boost_json_command wasip3 4,021,713 592,675

Over 120 release examples (document, hash, idna, pratt, wasi, xactor, both targets): 455,280,120 bytes to 69,615,792 (-84.7%); every one had .debug* sections before, none after.

Emscripten release links (-O3) keep no custom section at all: 47 release programs of pratt, hash and asio's size-table variants checked.

Size tables

  • webcpp.size-table (asio's asio.sizes.md) is Emscripten only, a build output, not committed data: no change.
  • hash's doc/measurements*.json stays as measured on 2026-11-16, per the owner; its measure lane already linked WASI with --strip-debug.
  • cobalt's doc/release-measurements.adoc (dated 2026-11-07, built by bench/build.py with variant=release through this Jamroot) reports WASI payloads that included this DWARF; not regenerated here.

Verification (macOS arm64)

  • python3 tools/test/webcpp_jam_test.py: all 47 cases ok; python3 tools/test/jamroot_test.py: ok.
  • tools/lint/lint.sh: lint: clean.
  • wasip2 and wasip3 lanes of every library with WASI tests (asio, beast, cobalt, config, crypto, document, hash, idna, lexical, pratt, wasi, xactor, xstate; test and example), debug as CI runs them: 593 and 635 passed, no failure.
  • The same lanes at variant=release: 590 and 632 passed; the only failures are crypto's secp256k1_allocation and secp256k1_allocation_no_exceptions, which fail identically on main without this change (the test's control delete new int(1) is elided at -O3, so the allocation counter does not move).
  • Native lane of the same libraries: 654 passed, no failure.

🤖 Generated with Claude Code

wasi-sdk's prebuilt libc++, libc++abi and libunwind carry DWARF, which
wasm-ld copied into every wasip2 and wasip3 program, a release one too:
most of its bytes. The Jamroot now links a WASI program built without
debug symbols, as a release is, with -Wl,--strip-debug (its region
wasi-strip-debug), which wasm-component-ld passes to wasm-ld. A debug
build, or a release with debug-symbols=on, keeps its DWARF.

tools/test/webcpp_jam_test.py reads every custom section of the demo's
catches.wasm, nested core modules of the component included, at release,
debug and release with debug-symbols=on on both targets; it failed before
the change.
@pinhopro
pinhopro merged commit bbc8006 into main Nov 17, 2026
172 of 179 checks passed
@pinhopro
pinhopro deleted the tools/wasi-release-strip branch November 19, 2026 02:42
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.

1 participant