Skip to content

feat(wasm): LABELLE_WASM_LINK_OPT in the in-tree emcc hooks (labelle-bgfx#208) - #821

Merged
apotema merged 1 commit into
mainfrom
perf/wasm-link-opt
Oct 31, 2026
Merged

apotema merged 1 commit into
mainfrom
perf/wasm-link-opt

Conversation

@apotema

@apotema apotema commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of labelle-toolkit/labelle-cli#528 (WP3). Companions: labelle-toolkit/labelle-bgfx#209 (labelle-toolkit/labelle-bgfx#208) and labelle-toolkit/labelle-web#28.

What

The in-tree emcc hooks (the shipped backends/sokol, plus the bgfx_v2 and raylib_v2 v2 fixtures) take the same link-level setting as labelle-bgfx's hook:

  • LABELLE_WASM_LINK_OPT = default | O0 | O1 | O2 | O3 | Os | Oz. -Dwasm_link_opt on a direct zig build wins over it.
  • Only the emcc -O flag changes. ReleaseSafe keeps -sASSERTIONS=1, Debug keeps -sSAFE_HEAP=1 -sSTACK_OVERFLOW_CHECK=1, and sokol's release -flto/--closure handling and every backend arg are untouched.
  • Unset or default is unchanged. It produces the previous argv in the same order. A test in each hook pins this for all four modes.
  • No codegen change. Generated build.zig files and the HookContext ABI are unchanged, because the hook reads the variable (and declares the option) itself in post_wire.

Tests

  • zig test backend.hook.zig in each of backends/sokol (16/16), backends/bgfx_v2 (14/14) and backends/raylib_v2 (5/5): all passed.
  • zig build test -j2 (full suite): 96/96 steps succeeded; 3825/3872 tests passed (47 skipped) on the rerun. The first run had 2 out-of-memory failures (LLVM ERROR: out of memory compiling test/plugin_build_steps_tests.zig, and unable to load 'wasm.zig': OutOfMemory in the #691 lib-test fan-out e2e) while the shared machine was at its commit limit. They did not recur.

https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS

…bgfx#208)

The sokol backend hook and the bgfx_v2/raylib_v2 v2 fixtures derived the
emcc -O level from -Doptimize alone. They now take the same setting as
labelle-bgfx's hook: LABELLE_WASM_LINK_OPT (or -Dwasm_link_opt, which wins)
= default | O0 | O1 | O2 | O3 | Os | Oz.

Only the -O flag changes. ReleaseSafe keeps -sASSERTIONS=1, Debug keeps
SAFE_HEAP/STACK_OVERFLOW_CHECK, sokol keeps its release LTO/closure args.
Unset/default reproduces the previous argv in the same order, so generated
build.zig files and production links are unchanged; no codegen or
HookContext change is needed because the hook reads the variable itself.

Part of labelle-toolkit/labelle-cli#528 (WP3).

Claude-Session: https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@apotema
apotema marked this pull request as ready for review October 31, 2026 02:17
@apotema
apotema merged commit 5e6bd51 into main Oct 31, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T02:18:33.769212Z 4e26daf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

apotema added a commit that referenced this pull request Oct 31, 2026
…825)

Version-only release of #821: LABELLE_WASM_LINK_OPT in the in-tree
sokol/raylib_v2/bgfx_v2 emcc hooks (labelle-bgfx#208,
labelle-toolkit/labelle-cli#528).

Claude-Session: https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
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