diff options
| author | user <user@clank> | 2026-09-12 16:05:54 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-12 16:05:54 +0200 |
| commit | 7617cf20d908386ab3052d53e0c909b4159b7280 (patch) | |
| tree | f2bf661c8ef34d76318c3848bc0ae88b2bae950a /vendor/libghostty-vt/src/simd/codepoint_width.cpp | |
| parent | sidebar: a status colour mixed from the theme, not the chrome's flat grey (diff) | |
| download | slosh-7617cf20d908386ab3052d53e0c909b4159b7280.tar.gz slosh-7617cf20d908386ab3052d53e0c909b4159b7280.tar.xz slosh-7617cf20d908386ab3052d53e0c909b4159b7280.zip | |
vendor: the wuffs calloc stub was hijacking the demo's allocator
The browser demo came up with `slosh: cannot start session main` and
nothing else. The session server was segfaulting before its socket
existed, on the first calloc() of the config parse -- because in that
binary calloc() returned NULL, always.
pkg/wuffs/src/main.zig exports weak `calloc`/`free` stubs whenever
`!builtin.link_libc`, and callocStub returns null unconditionally. They
are there because wuffs' generated `..._alloc()` helpers are the only
code referencing libc's allocator, we never call them, and linker GC
usually strips them; the stubs cover the case where it does not. The
comment reasons that weak linkage means "any real definition wins".
That holds for a shared libc and not for a static archive. Once the
linker pulls this member in for another symbol, the weak calloc here
*satisfies* the reference, so it never searches libc.a for musl's
strong one -- and every allocation in the consuming program returns
NULL while free becomes a no-op.
Only the demo could hit it. It is the one build that must pass
-Dsimd=false (highway emits RVV intrinsics that do not compile for
rv64gc), GhosttyZig.zig sets `link_libc = if (cfg.simd) true else
null`, and the guest links the result statically against musl. The host
build links libc, never exported the stubs, and passed everything --
which is why the whole test suite was green over a demo that could not
start a session.
Patch 0002 adds `and builtin.output_mode == .Exe`. The stubs still do
their job in a final link with no libc; a library stops interposing on
the allocator of the binary that owns that choice. Worth sending
upstream: the assumption is upstream's, not ours.
Diffstat (limited to 'vendor/libghostty-vt/src/simd/codepoint_width.cpp')
0 files changed, 0 insertions, 0 deletions
