Skip to content

Remove printf usage from emmalloc.s and sbrk.s. NFC#26497

Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:printf_usage
Mar 20, 2026
Merged

Remove printf usage from emmalloc.s and sbrk.s. NFC#26497
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:printf_usage

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented 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 requested review from dschuff, kleisauke and kripken March 20, 2026 00:07
@sbc100 sbc100 changed the title Remove some usage of printf from emmalloc and sbrk. NFC Remove printf usage from emmalloc.s and sbrk.s. NFC 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 enabled auto-merge (squash) March 20, 2026 00:50
@sbc100 sbc100 merged commit b4696ac into emscripten-core:main Mar 20, 2026
38 checks passed
@sbc100 sbc100 deleted the printf_usage branch March 20, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants