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

Manually merged
github merged 3 commits from gh-pr/256/head into gh-pr/256/base 2026-11-26 21:37:58 +00:00
Owner

@⁠RonLogic on GitHub · 2026-11-21 19:29 UTC · original
RonLogic:cpu/exe-two-named-imports → main · +199 −29 · 8 files · 3 commits · merged 2026-11-22 08:20 UTC

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
**@⁠RonLogic** on GitHub · 2026-11-21 19:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/256) `RonLogic:cpu/exe-two-named-imports` → `main` · +199 −29 · 8 files · 3 commits · merged 2026-11-22 08:20 UTC 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 ```
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:37:55 +00:00
github manually merged commit 40bf87d448 into gh-pr/256/base 2026-11-26 21:37:58 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 19:58 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-21 19:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7068406774) 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.
Author
Owner

@⁠RonLogic on GitHub · 2026-11-21 23:32 UTC · original

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.

**@⁠RonLogic** on GitHub · 2026-11-21 23:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7070937925) Addressed the [provider-symbol feedback](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/256) 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.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 06:28 UTC · original

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** on GitHub · 2026-11-22 06:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7075345178) 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.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 08:14 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-22 08:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/256#issuecomment-7076402038) 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.