Repository navigation
Conversation
ropoctl
force-pushed
the
fix-darwin-stdio-globals-glibc
branch
from
September 4, 2026 04:33
6936b24 to
fa6a8a0
Compare
ropoctl
force-pushed
the
fix-darwin-stdio-globals-glibc
branch
from
September 4, 2026 06:04
fa6a8a0 to
b000cab
Compare
ropoctl
force-pushed
the
fix-darwin-stdio-globals-glibc
branch
from
September 4, 2026 09:10
b000cab to
8e9e267
Compare
…ckends
A .wo corpus harness is migrated once from the host's preprocessed C and
checked in for every platform. pcre2test.w was migrated on darwin, whose
<stdio.h> does `#define stderr __stderrp` (also __stdoutp / __stdinp), so the
checked-in harness references the bare symbols __stdinp / __stdoutp / __stderrp
(91 sites). glibc exports the streams as stdin / stdout / stderr instead, so on
Linux those three symbols were undefined and the pcre2-wo-drift lane failed to
link the harness (against both the stored and the freshly-rebuilt bundle) --
red on every glibc lane, green on darwin only.
Root cause: the Darwin-spelled stdio globals have no producer on a glibc host.
Fix, mirroring the existing __error / __open darwin-compat precedent:
- rt/linux_x86_64.w and rt/linux_aarch64.w define `pub var __stdinp /
__stdoutp / __stderrp` and bind them to the glibc streams stdin / stdout /
stderr in rt_store_args, the guaranteed pre-main entry hook. Darwin's
libSystem provides these directly, so the darwin backend does not define
them and is unaffected.
- src/FnAbi.w adds the three names to codegen_is_runtime_abi_symbol's
whitelist so a runtime-source `pub var` definition keeps its bare link
name in module-object mode (otherwise it mangles to
__with_mod_<hash>__<base> and never satisfies the harness's bare
reference) -- exactly as __error / __open already do.
FnAbi.w is an ABI-defining source, so docs/with-abi.sha256 is re-recorded; the
pcre2 bundle re-keys and rebuilds once into its new slot (byte-identical
object -- the symbol-naming change does not touch pcre2 codegen). The naming
convention is unchanged (a whitelist extension, like the prior __error / __open
entries), so WITH_ABI_VERSION stays 1.
Verified on linux-x86_64: with build + :fixpoint green; pcre2-wo-drift green
with harness-build-stored.stderr clean of undefined-symbol errors; the rt
platform object exports __std{in,out,err}p as bare BSS symbols.
ropoctl
force-pushed
the
fix-darwin-stdio-globals-glibc
branch
from
September 4, 2026 11:04
8e9e267 to
3c1e4e3
Compare
Contributor
|
Landed on main via cherry-pick under a new hash: b0d06da (rt: define Darwin stdio globals __std{in,out,err}p on non-Darwin backends). Closing as merged-by-content; the original SHA differs because it was cherry-picked into the batch, not merged. |
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.
What
Fixes the
pcre2-wo-driftlane failing to link the corpus harness on everyglibc Linux lane (linux-x86_64, linux-aarch64), while it passed on darwin.
Stacked on #997.
Root cause
A
.wocorpus harness is migrated once from the host's preprocessed C andchecked in for all platforms.
lib/std/re/pcre2test.wwas migrated on darwin,whose
<stdio.h>does#define stderr __stderrp(also__stdoutp/__stdinp), so the checked-in harness references the bare symbols__stdinp/__stdoutp/__stderrp(91 sites). glibc exports the streams asstdin/stdout/stderrinstead, so on Linux those three symbols had noproducer — the harness link (against both the stored embedded bundle and the
freshly-rebuilt one) failed with
undefined reference to '__stderrp'etc.Fix
Mirrors the existing
__error/__opendarwin-compat precedent already in thetree:
rt/linux_x86_64.w,rt/linux_aarch64.w: definepub var __stdinp / __stdoutp / __stderrpand bind them to the glibc streamsstdin/stdout/stderrinrt_store_args, the guaranteed pre-mainentry hook. Darwin's libSystem provides these directly, so the darwin backend
does not define them and is unaffected.
src/FnAbi.w: add the three names tocodegen_is_runtime_abi_symbol'swhitelist so a runtime-source
pub vardefinition keeps its bare linkname in module-object mode (it otherwise mangles to
__with_mod_<hash>__<base>and never satisfies the harness's bare reference) — exactly as
__error/__openalready do.docs/with-abi.sha256:FnAbi.wis an ABI-defining source, so its hashis re-recorded. The pcre2 bundle re-keys and rebuilds once into its new slot;
the object is byte-identical (the symbol-naming change does not touch pcre2
codegen). The naming convention is unchanged — a whitelist extension, like the
prior
__error/__openentries — soWITH_ABI_VERSIONstays 1.No platform gate, no skip: the Darwin-spelled globals now resolve on every
target.
Verification
On linux-x86_64 (glibc):
with build+with build :fixpointgreen (stage2 == stage3).with build :pcre2-wo-driftgreen:survey: all targets green;harness-build-stored.stderrclean of undefined-symbol errors (wasundefined reference to '__stderrp'/'__stdoutp'/'__stdinp').nm out/lib/rt_linux_x86_64.oshows__stdinp/__stdoutp/__stderrpas bare BSS symbols.