cpu: recompile a multi-unit UCRT console program from its PE entry #449

Merged
R0Y00 merged 1 commit from upstream-pr/455 into main 2026-11-22 04:41:31 +00:00
R0Y00 commented 2026-11-22 04:37:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T04:37:43Z.


Refs #317. This exercises the entry-to-exit CPU translation path with a source-built multi-unit Windows console program and an actual UCRT dependency.

The MASM entry reads stdin, calls a separately compiled C++ CRC step, and writes and flushes stdout. The first translation refusal was the indirect getchar import at RVA 0x103d. Bind named UCRT IAT slots with explicit argument and return widths. Unknown providers fail translation.

Windows verification on f1d1492 (MSVC 19.51):

  • ctest --preset dev --no-tests=error -R '^(cpu_aot_direct_calls|cpu_native_(crc_line|exe_image_chain))$' --output-on-failure passed 3/3.
  • ctest --preset release --no-tests=error -R '^cpu_native_crc_line$' --output-on-failure passed 1/1.

Compare stdout bytes, stderr and exit status from native Windows, pe_map on the same image and the generated executable. The standard vector prints CBF43926 with CRLF and exits 0. An empty stream exits 1. A read-only stdout handle exits 2 and leaves the file unchanged. Changing the compiled polynomial changes the expected standard vector to E3069283 on all three runners. Cases also exercise CRLF input, missing newline, an empty line and a 13,000-byte line.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6538509170 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/455). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T04:37:43Z. --- Refs #317. This exercises the entry-to-exit CPU translation path with a source-built multi-unit Windows console program and an actual UCRT dependency. The MASM entry reads stdin, calls a separately compiled C++ CRC step, and writes and flushes stdout. The first translation refusal was the indirect getchar import at RVA 0x103d. Bind named UCRT IAT slots with explicit argument and return widths. Unknown providers fail translation. Windows verification on f1d1492 (MSVC 19.51): - `ctest --preset dev --no-tests=error -R '^(cpu_aot_direct_calls|cpu_native_(crc_line|exe_image_chain))$' --output-on-failure` passed 3/3. - `ctest --preset release --no-tests=error -R '^cpu_native_crc_line$' --output-on-failure` passed 1/1. Compare stdout bytes, stderr and exit status from native Windows, pe_map on the same image and the generated executable. The standard vector prints CBF43926 with CRLF and exits 0. An empty stream exits 1. A read-only stdout handle exits 2 and leaves the file unchanged. Changing the compiled polynomial changes the expected standard vector to E3069283 on all three runners. Cases also exercise CRLF input, missing newline, an empty line and a 13,000-byte line.
upstream-sync closed this pull request 2026-11-24 06:43:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!449
No description provided.