Skip to content

fix: support VC6 precompiled header creation and reuse - #146

Open
banteg wants to merge 1 commit into
decompals:mainfrom
banteg:feat/movefileex-pch
Open

fix: support VC6 precompiled header creation and reuse#146
banteg wants to merge 1 commit into
decompals:mainfrom
banteg:feat/movefileex-pch

Conversation

@banteg

@banteg banteg commented Sep 9, 2026

Copy link
Copy Markdown

VC6 (CL.EXE 6.0 SP5) aborts while creating an automatic precompiled header with /YX /Fprepro.pch: it calls the missing MoveFileExW export with MOVEFILE_COPY_ALLOWED to move its temporary PCH into place. Once that move succeeds, reusing the PCH exposes a second failure: a fixed-address MapViewOfFileEx view is absent from the allocator's address-space bookkeeping, so the next top-down VirtualAlloc can overwrite it. On macOS this reproduced as SIGBUS.

This change implements MoveFileExA/W with atomic no-replace renames, replacement checks, and cross-volume copy/delete fallback, including flushing copied data for MOVEFILE_WRITE_THROUGH. Reboot scheduling and link-tracking flags explicitly return ERROR_NOT_SUPPORTED; invalid flag combinations return ERROR_INVALID_PARAMETER. Fixed-address views now reserve, register, and release their ranges through the existing allocator bookkeeping, rejecting overlaps in both directions.

Adds self-checking file-move and fixed-view collision regressions, plus a small manual VC6 reproducer in test/vc6_pch (compiler supplied by the user).

Validation:

  • New/expanded fixtures passed Wine 11.0 first; the fixed-view test reproduced the original overlap before the mapping fix.
  • All 49 CTests pass in both macOS debug and release builds.
  • ANSI/wide cross-volume moves, replacement, write-through, and directory rejection passed under Wine and both wibo builds using a separate HFS+ test volume.
  • VC6 plain compilation, automatic PCH creation, and PCH reuse pass under Wine and both wibo builds. Reuse preserves PCH contents and mtime; all nine object files match after excluding only the COFF timestamp.
  • Two full Crimson compiler workloads (statistics_update_check_worker and highscore_sync_worker) also passed Wine/fork × plain/create/reuse: all six objects per function match after COFF timestamp normalization, with unchanged matching metrics.
  • Both changed C++ translation units also compile to Linux x86-64 objects with Zig's C++ toolchain. Linux runtime testing remains for CI.
  • clang-format and git diff --check pass; clang-tidy reports only existing warnings outside the added code.

The full Wine baseline has four existing fixture expectation failures (shlwapi, gettempfilename, heap, rtl); both native wibo suites are green.

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