build: link the CRT-free startup and lifetime fixtures at /O2 #385
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!385
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/385/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@grahamster2 on GitHub · 2026-11-22 00:02 UTC · original
grahamster2:build/crt-free-byte-copies→main· +22 −4 · 3 files · 1 commits · merged 2026-11-22 00:25 UTCSolves an independent problem: a Release (
/O2) build of the repository does not link.Problem
cpu_startup_a,cpu_startup_a_alt,cpu_life_sink,cpu_startup_exe,cpu_startup_exe_createandcpu_startup_exe_timeoutare CRT-free (/Zl,/NODEFAULTLIB). At/O2, MSVC's loop idiom recognition replaces their byte-copy loops with calls tomemcpy, which nothing provides:The
devpreset is Debug (/Od), so CI never sees it. The three EXEs only show up once the DLLs they link against are fixed.Change
The four fixed-length copy loops (
a_snapshot,sink_log,sink_snapshot,write_line) now copy with the__movsbintrinsic, which always emitsrep movsbinline and never calls a library function. A zero or negative count still copies nothing, as before. The NUL-terminated prefix loop inwrite_lineis left as it is, since MSVC does not turn it into a call. No CMake or test changes.Evidence
Windows 11 Pro build 26200, VS Build Tools 2026 18.3 (MSVC 19.50.35725), Windows SDK 10.0.26100, Python 3.12, at
6c0c52eon4f6c39d.cpu_native_startup,cpu_native_exe_start,cpu_native_lifetimeandcpu_native_crt_lifecycle. The same 143 pass in the Debugdevpreset.A Release job in CI would catch this class of failure. I've left that for a separate change.