Repository navigation
worker-build: keep the producers section in emscripten builds - #1104
Merged
guybedford merged 1 commit intoOct 19, 2026
Merged
Conversation
emcc strips the producers custom section unless EMIT_PRODUCERS_SECTION is set, so --emscripten builds only carried the sdk entry worker-build adds afterwards. Set it at link so they keep the language and processed-by entries that wasm32-unknown-unknown builds already have.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
worker-build --emscriptenoutput carries almost none of the WebAssemblyproducerscustom section. The examples/emscripten build ends up with only thesdk: workers-rsentry, while wasm32-unknown-unknown builds also record the source languages and the tools that processed the module. That section is how we tell which toolchain built a Wasm file, and we also use it for internal metrics (see #1091).The cause is emcc's default:
EMIT_PRODUCERS_SECTIONis off, and the final link stripsproducersto save size and avoid leaking toolchain details on websites (WebAssembly/tool-conventions#93). worker-build then re-adds just itssdkentry, so detection still works, but the compiler and tool entries are lost.This adds
-sEMIT_PRODUCERS_SECTION=1to the emcc link settings. With emsdk 6.0.10, examples/emscripten goes fromto
That's 227 bytes raw (173 gzipped). Only the
producerssection changes: with custom sections stripped the modules are byte-identical, andindex.jsis unchanged. Recording Emscripten itself underprocessed-bywould be a possible follow-up, and is left out of this PR.Testing: built examples/emscripten before and after the change and compared the two modules with
wasm-tools metadata showandwasm-tools strip -a. Ran the CIwrangler devsmoke test against the new build, pluscargo test -p worker-build, clippy,cargo fmt --checkandcargo check --locked.