Skip to content

Enable stdio locking under Wasm Workers#26489

Open
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
sbc100:wasm_worker_lockfile
Open

Enable stdio locking under Wasm Workers#26489
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
sbc100:wasm_worker_lockfile

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Mar 18, 2026

This change removes the use of pthread_self from musl's internal file locking mechanism, while enabled libc's internal threading state in once the first worker is started. The test changed here come from #18201

This is needed as part of my effort to remove all pthread symbols from the Wasm Workers builds.

@sbc100
Copy link
Collaborator Author

sbc100 commented Mar 19, 2026

@kleisauke PTAL. I took your new test and verified that it fails on main today.

@sbc100 sbc100 force-pushed the wasm_worker_lockfile branch from c552f4a to 941f9da Compare March 19, 2026 23:59
@sbc100 sbc100 requested a review from kripken March 19, 2026 23:59
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 20, 2026
I noticed some code size issues while working on emscripten-core#26489 and gemini
tracked them down to usage of the `printf` symbol.

It turns out that just referencing the printf (even if the referencing
function is not used) in a used object file can lead code bloat due to
the weak symbol mechanism used in musl to track stdio usage (see
__stdout_used, etc).
@sbc100 sbc100 force-pushed the wasm_worker_lockfile branch from 941f9da to 89f6d3d Compare March 20, 2026 00:15
@sbc100 sbc100 requested a review from dschuff March 20, 2026 00:29
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 20, 2026
I noticed some code size issues while working on emscripten-core#26489 and gemini
tracked them down to usage of the `printf` symbol.

It turns out that just referencing the printf (even if the referencing
function is not used) in a used object file can lead code bloat due to
the weak symbol mechanism used in musl to track stdio usage (see
__stdout_used, etc).
sbc100 added a commit that referenced this pull request Mar 20, 2026
I noticed some code size issues while working on #26489 and gemini
tracked them down to usage of the `printf` symbol.

It turns out that just referencing the printf (even if the referencing
function is not used) in a used object file can lead code bloat due to
the weak symbol mechanism used in musl to track stdio usage (see
__stdout_used, etc).
@sbc100 sbc100 force-pushed the wasm_worker_lockfile branch 2 times, most recently from 0fa8755 to 09d36d8 Compare March 20, 2026 04:34
@sbc100 sbc100 requested a review from juj March 20, 2026 04:34
This change removes the use of pthread_self from musl's internal file
locking mechanism.

This is needed as part of my effort to remove all pthread symbols from
the Wasm Workers builds.
@sbc100 sbc100 force-pushed the wasm_worker_lockfile branch from 09d36d8 to a61a1ee Compare March 20, 2026 05:15
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