cpu: translate two named DLL imports from an EXE caller #253

Merged
RonLogic merged 3 commits from upstream-pr/256 into main 2026-11-22 08:20:57 +00:00
RonLogic commented 2026-11-21 19:29:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T19:29:44Z.


Extends #249 with a source-built EXE whose internal caller passes the result of cpu_import_provider.dll!mix_args to cpu_exe_second_provider.dll!accumulate_args. The AOT entry point accepts the second DLL and symbol through an explicit --provider DLL SYMBOL binding and verifies the import against that DLL. The existing DLL caller entry point keeps its single-slot policy.

On both selector bytes, the native Windows process, pe_map_run child, and translated process match an independent reference for both providers' arguments, both output words, and the exit code. Removing the mapping for the second DLL stops before entry. The AOT test checks both an omitted binding and a binding to the wrong DLL. Both report the missing DLL and symbol.

This change uses lift_body and the EXE fixture shared with #247 and #253. It is based directly on #249 and does not depend on those PRs.

Before this change, the source-built EXE ran on Windows and the translator stopped at call to a second IAT slot at RVA 0x1096. At 72c5a79 on 7233cec, all 34 CPU tests passed locally on Windows x64 with no skips.

ctest --test-dir out/build/followup --no-tests=error -R '^cpu_' -V
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6533415467 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/256). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-21T19:29:44Z. --- Extends #249 with a source-built EXE whose internal caller passes the result of `cpu_import_provider.dll!mix_args` to `cpu_exe_second_provider.dll!accumulate_args`. The AOT entry point accepts the second DLL and symbol through an explicit `--provider DLL SYMBOL` binding and verifies the import against that DLL. The existing DLL caller entry point keeps its single-slot policy. On both selector bytes, the native Windows process, `pe_map_run` child, and translated process match an independent reference for both providers' arguments, both output words, and the exit code. Removing the mapping for the second DLL stops before entry. The AOT test checks both an omitted binding and a binding to the wrong DLL. Both report the missing DLL and symbol. This change uses `lift_body` and the EXE fixture shared with #247 and #253. It is based directly on #249 and does not depend on those PRs. Before this change, the source-built EXE ran on Windows and the translator stopped at `call to a second IAT slot at RVA 0x1096`. At `72c5a79` on `7233cec`, all 34 CPU tests passed locally on Windows x64 with no skips. ```powershell ctest --test-dir out/build/followup --no-tests=error -R '^cpu_' -V ```
upstream-sync closed this pull request 2026-11-24 06:42:04 +00:00
R0Y00 commented 2026-11-24 06:47:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:58:03Z.


The new --provider DLL SYMBOL path copies the accepted export name directly into the generated C++ declaration and call. PE export names can contain punctuation or be C++ keywords; a matching export such as trace-value would produce uncompilable output after translation reported success. Please reject unsupported symbol spellings before emission (including keywords and collisions with generated names), or assign a separate valid binding. Add a focused rejection control alongside the two-provider comparison.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068406774 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7068406774). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T19:58:03Z. --- The new `--provider DLL SYMBOL` path copies the accepted export name directly into the generated C++ declaration and call. PE export names can contain punctuation or be C++ keywords; a matching export such as `trace-value` would produce uncompilable output after translation reported success. Please reject unsupported symbol spellings before emission (including keywords and collisions with generated names), or assign a separate valid binding. Add a focused rejection control alongside the two-provider comparison.
RonLogic commented 2026-11-24 06:48:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T23:32:15Z.


Addressed the provider-symbol feedback in 2d7323c, included in 40bf87d. The translator now rejects unsupported --provider symbol spellings before emitting C++, including trace-value, keywords, reserved names, names that collide with generated identifiers, and duplicate bindings. I added 12 rejection cases alongside the native Windows, pe_map_run, and AOT two-provider comparison.

All 43 CPU tests passed locally on Windows x64. All three CI jobs for 40bf87d passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7070937925 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7070937925). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-21T23:32:15Z. --- Addressed the [provider-symbol feedback](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7068406774) in `2d7323c`, included in `40bf87d`. The translator now rejects unsupported `--provider` symbol spellings before emitting C++, including `trace-value`, keywords, reserved names, names that collide with generated identifiers, and duplicate bindings. I added 12 rejection cases alongside the native Windows, `pe_map_run`, and AOT two-provider comparison. All 43 CPU tests passed locally on Windows x64. All three [CI jobs for `40bf87d`](https://github.com/R0Y00/Xbox2Windows/actions/runs/44960832059) passed.
R0Y00 commented 2026-11-24 06:48:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T06:28:19Z.


Thanks for addressing the provider names. I test-merged 40bf87d against current main. The remaining conflicts are in CMakeLists.txt, tests/cpu/exe_entry.asm, tests/cpu/mapped_exe_chain_check.py, tools/cpu_call_aot.py and tools/cpu_exe_aot.py. This branch has maintainer edits disabled. Please enable edits if you would like us to integrate it, or reconcile the two-provider fixture with the current EXE path and keep both provider-symbol rejection and the existing three-way comparisons.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7075345178 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7075345178). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T06:28:19Z. --- Thanks for addressing the provider names. I test-merged 40bf87d against current main. The remaining conflicts are in CMakeLists.txt, tests/cpu/exe_entry.asm, tests/cpu/mapped_exe_chain_check.py, tools/cpu_call_aot.py and tools/cpu_exe_aot.py. This branch has maintainer edits disabled. Please enable edits if you would like us to integrate it, or reconcile the two-provider fixture with the current EXE path and keep both provider-symbol rejection and the existing three-way comparisons.
R0Y00 commented 2026-11-24 06:48:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T08:14:58Z.


I integrated your original commits on the maintainer branch in #502. The two-provider comparison and the four existing EXE comparisons all passed locally on Windows. The integration PR retains the original commit history and is waiting for the required checks.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7076402038 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7076402038). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T08:14:58Z. --- I integrated your original commits on the maintainer branch in #502. The two-provider comparison and the four existing EXE comparisons all passed locally on Windows. The integration PR retains the original commit history and is waiting for the required checks.
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!253
No description provided.