build: link the CRT-free startup and lifetime fixtures at /O2 #379
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/385"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by grahamster2 on 2026-11-22T00:02:22Z.
Solves 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.