Skip to content

build: emit-C, invariance and embedded-runtime checks run on Windows; rt_file_mode reports a symlink (#811) - #2784

Merged
ehartford merged 13 commits into
fix-2759from
fix-811
Oct 28, 2026
Merged

ehartford merged 13 commits into
fix-2759from
fix-811

Conversation

@ehartford

@ehartford ehartford commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Commits (each message carries its root cause and evidence):

Restacked 2026-10-28 from the handoff's branches onto main 455ff0b; the wip commits are grouped by issue.

@ehartford
ehartford added this pull request to stack #2786 October 28, 2026 18:16
@ehartford ehartford changed the title fix 811 build: emit-C, invariance and embedded-runtime checks run on Windows; rt_file_mode reports a symlink (#811) Oct 28, 2026
Eric Hartford added 13 commits October 28, 2026 14:18
Temporary un-skip to capture the concrete Windows failure; the fix
commit follows on this branch.
The copied compiler and the built hello were named without the host
exe suffix, so neither could be spawned on Windows. bs_exe_suffix,
as the rest of the build layer spells it. Gate removed.
Observed on win10: all 34 emit-C cases failed to spawn (exit -1,
empty stderr) — bs_c_compiler defaulted to cc, which does not exist
on Windows; build/emit_c.w already resolves the pinned SDK clang++
and clang++.exe. bs_c_compiler now resolves the same way, the link
gets lld-link /OPT:REF instead of Mach-O -dead_strip, and the case
binary carries the exe suffix.
…811)

Observed on win10 in order: every case failed to spawn cc (previous
commit); with the SDK clang++ every case died on math.h not found
(no system includes); with with cc the compile reached
runtime/unistd.h, whose POSIX redeclarations conflict with mingw
corecrt.h/io.h exactly as the issue notes.

On Windows the emitted C now compiles through the compiler under
test's own cc driver (sysroot + mingw target, as the real link path
uses), with lld --gc-sections; runtime/unistd.h includes io.h/
process.h/direct.h there and stops redeclaring what mingw declares.
The one remaining Windows case (33 of 34 green) failed only on
clang 22 mingw's C23 default promoting -Wincompatible-pointer-types
to an error in migrated-corpus emitted code. The emitted dialect is
pinned, as the POSIX host default already compiles it.
clang 22 under with cc promotes -Wincompatible-pointer-types to an
error regardless of -std (my gnu17 probe verdict was masked by a
truncated pipe). The emitted conversion itself is filed as #2769
(the cast belongs in CCodegen); until it lands every host judges
the emitted C at the warning level POSIX host cc already uses.
The repo fixture linked lib/ by symlink, which an unelevated Windows
shell cannot create; it now falls back to copying the same tree.
The copied seed carries the host exe suffix. Gate removed.
Found un-skipping on Windows, broken on every host: the fixture
copies src/ into out/test-graph/.../repo without seed.lock, so
Resolve.resolve_dir_is_compiler_checkout judges the copy a user
program and its use rt.rt_core is refused (D30). Verified red on an
untouched main checkout before this change, green after.
On Windows the undeclared read inside the action came back empty
and no marker landed in the fixture (the same code read it fine on
macOS). The lock is what the fixture is made from; declare it.
Root cause of the driver stack overflow (0xC00000FD, minidump +
minimal repro): GetFileAttributesW follows a directory symlink, so
rt_file_mode answered S_IFDIR for it on Windows — every other
backend lstats. The build driver's output fingerprint then
descended: listing the link yields the link itself, judged a
directory again, forever. Any action whose output tree contains a
directory symlink (the invariance fixture's lib link) crashed the
driver after the action succeeded; freshness walks crashed it at
plan time. rt_file_mode now takes the reparse tag from
win_top_entry, as the walks already do.

Regression: test/behavior/behav_811_action_output_symlink.w builds
twice over a symlink-bearing action output.
@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven Mac battery GREEN on the stack top f8ee22e (379 s, run by this stack's no-shell tools/battery.w with the tree's release compiler). The first full Windows battery on win10 (same top, 696 s) ran end to end and is RED on targets outside #809's list; inventory in the tracking issue filed with this merge.

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