Loader tests: run the delay-load probe with LLVM-MinGW and Wine #2682

Closed
SinisterRob wants to merge 1 commit from upstream-pr/2684 into main
SinisterRob commented 2026-11-25 18:08:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SinisterRob on 2026-11-25T18:08:01Z.


The loader probe builds a synthetic title with normal and delay-load imports. The fixture uses the MSVC linker spelling for delay loading, so an LLVM-MinGW cross-build cannot link it. The test also invokes the host's Cargo from inside the test process, which cannot start Linux Cargo under Wine.

Use the LLVM-MinGW linker's delay-load spelling on the LLVM Windows GNU target. For Wine, accept a prebuilt fixture via VICTORY_HLE_PROBE, the same hook as #1218. Native MSVC tests still build the fixture on demand.

On Linux with Rust 1.98.1, LLVM-MinGW and Wine 11.22, I built the fixture and test binaries for x86_64-pc-windows-gnullvm, then ran all four loader test binaries. 38 passed, 0 failed. This includes ordinary and delay-loaded imports, title DLL binding and thread notifications. The fixture is entirely synthetic. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6610697355 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2684). Originally posted by [SinisterRob](https://github.com/SinisterRob) on 2026-11-25T18:08:01Z. --- The loader probe builds a synthetic title with normal and delay-load imports. The fixture uses the MSVC linker spelling for delay loading, so an LLVM-MinGW cross-build cannot link it. The test also invokes the host's Cargo from inside the test process, which cannot start Linux Cargo under Wine. Use the LLVM-MinGW linker's delay-load spelling on the LLVM Windows GNU target. For Wine, accept a prebuilt fixture via `VICTORY_HLE_PROBE`, the same hook as #1218. Native MSVC tests still build the fixture on demand. On Linux with Rust 1.98.1, LLVM-MinGW and Wine 11.22, I built the fixture and test binaries for `x86_64-pc-windows-gnullvm`, then ran all four loader test binaries. **38 passed, 0 failed.** This includes ordinary and delay-loaded imports, title DLL binding and thread notifications. The fixture is entirely synthetic. AI-assisted.
kotekompotek commented 2026-11-25 19:06:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:38:03Z.


Both parts are right: CARGO_CFG_TARGET_ABI llvm is the correct discriminator for the MinGW delay-load spelling (lld takes --delayload, MSVC /DELAYLOAD), and reusing the VICTORY_HLE_PROBE prebuilt hook keeps Wine runners out of the nested-cargo problem.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171179658 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2684#issuecomment-7171179658). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T18:38:03Z. --- Both parts are right: CARGO_CFG_TARGET_ABI llvm is the correct discriminator for the MinGW delay-load spelling (lld takes --delayload, MSVC /DELAYLOAD), and reusing the VICTORY_HLE_PROBE prebuilt hook keeps Wine runners out of the nested-cargo problem.
fuzeofficlal commented 2026-11-25 20:06:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:19:46Z.


Independent Windows 11 MSVC verification and review of 9e539d84 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-loader --all-targets -- -D warnings: 0 warnings.
  • cargo test --locked -p victory-loader: 34 passed (lib), crash_log (1), load_probe (2), title_dlls (1), 0 failed — confirms native MSVC /DELAYLOAD probe build and execution are unchanged.

Review Notes

  • Switching tests/fixtures/hle-probe/build.rs on CARGO_CFG_TARGET_ABI == "llvm" cleanly keeps MSVC /DELAYLOAD: intact while enabling LLVM-MinGW -Wl,--delayload=, and VICTORY_HLE_PROBE cleanly bypasses nested cargo invocation under Wine.
  • Merge-ordering note: #1631 (already triage: merge candidate) also modifies crates/victory-loader/tests/load_probe.rs and tests/fixtures/hle-probe/build.rs (using VICTORY_HLE_PROBE_DLL), so the two PRs will overlap there if both land.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172144700 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2684#issuecomment-7172144700). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:19:46Z. --- Independent Windows 11 MSVC verification and review of `9e539d84` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo clippy --locked -p victory-loader --all-targets -- -D warnings`: **0 warnings**. - `cargo test --locked -p victory-loader`: **34 passed** (`lib`), `crash_log` (1), `load_probe` (2), `title_dlls` (1), **0 failed** — confirms native MSVC `/DELAYLOAD` probe build and execution are unchanged. ### Review Notes - Switching `tests/fixtures/hle-probe/build.rs` on `CARGO_CFG_TARGET_ABI == "llvm"` cleanly keeps MSVC `/DELAYLOAD:` intact while enabling LLVM-MinGW `-Wl,--delayload=`, and `VICTORY_HLE_PROBE` cleanly bypasses nested `cargo` invocation under Wine. - Merge-ordering note: #1631 (already `triage: merge candidate`) also modifies `crates/victory-loader/tests/load_probe.rs` and `tests/fixtures/hle-probe/build.rs` (using `VICTORY_HLE_PROBE_DLL`), so the two PRs will overlap there if both land.
Kajanos commented 2026-11-25 21:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Kajanos on 2026-11-25T20:43:26Z.


Linux / Wine run of the prebuilt-probe path, head 9e539d8487 merged onto main 13f91caee2.

Setup: Linux (Gentoo) / wine-proton 11.0.3, RTX 5080; cross-built with cargo-xwin for x86_64-pc-windows-msvc, rustc 1.98.1.

  • On main, loads_binds_and_calls_probe fails under Wine with running cargo: Os { code: 6, ... "Invalid handle." } because the test can't start cargo from inside Wine.
  • With this PR and no VICTORY_HLE_PROBE set, it fails the same way, as expected.
  • I built the fixture beforehand with cargo xwin build --target x86_64-pc-windows-msvc --manifest-path tests/fixtures/hle-probe/Cargo.toml and set VICTORY_HLE_PROBE=Z:\...\hle_probe.dll. The load_probe test binary then passes 2/2 under Wine.

Not run: the LLVM-MinGW (-Wl,--delayload) branch of build.rs. I only built the fixture with MSVC (/DELAYLOAD). Not run on Windows.

AI-assisted (Claude Code)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174097361 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2684#issuecomment-7174097361). Originally posted by [Kajanos](https://github.com/Kajanos) on 2026-11-25T20:43:26Z. --- **Linux / Wine run of the prebuilt-probe path**, head `9e539d8487` merged onto `main` `13f91caee2`. Setup: Linux (Gentoo) / wine-proton 11.0.3, RTX 5080; cross-built with cargo-xwin for `x86_64-pc-windows-msvc`, rustc 1.98.1. - On `main`, `loads_binds_and_calls_probe` fails under Wine with `running cargo: Os { code: 6, ... "Invalid handle." }` because the test can't start cargo from inside Wine. - With this PR and no `VICTORY_HLE_PROBE` set, it fails the same way, as expected. - I built the fixture beforehand with `cargo xwin build --target x86_64-pc-windows-msvc --manifest-path tests/fixtures/hle-probe/Cargo.toml` and set `VICTORY_HLE_PROBE=Z:\...\hle_probe.dll`. The `load_probe` test binary then passes 2/2 under Wine. Not run: the LLVM-MinGW (`-Wl,--delayload`) branch of `build.rs`. I only built the fixture with MSVC (`/DELAYLOAD`). Not run on Windows. AI-assisted (Claude Code)
Marvisak commented 2026-11-25 23:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:17:29Z.


Automated triage for the maintainers.

Needs work; needs the maintainer's decision. The change is small and reads correctly: tests/fixtures/hle-probe/build.rs picks -Wl,--delayload= on the LLVM ABI and keeps /DELAYLOAD: otherwise, and build_probe in crates/victory-loader/tests/load_probe.rs takes a prebuilt fixture from VICTORY_HLE_PROBE. Two things stop it from being a plain merge candidate:

  • It edits a build.rs (the fixture's linker arguments) to support a Linux/LLVM-MinGW/Wine test setup. Build-script changes and whether that setup is a supported target are the maintainer's call.
  • The prebuilt-fixture half overlaps #1631 (VICTORY_HLE_PROBE_DLL, already triaged as a merge candidate), which edits the same two files. Two env-var names for the same hook should not both land. Rebasing onto whichever lands first, or reducing this PR to the delay-load spelling only, would settle it.

CI: check passing on this head.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176177548 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2684#issuecomment-7176177548). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:17:29Z. --- <!-- victory-triage v1 head=9e539d848790f005ec2a900f02357bd3834142db verdict=needs-work at=2026-11-25T22:18:30Z --> Automated triage for the maintainers. **Needs work; needs the maintainer's decision.** The change is small and reads correctly: `tests/fixtures/hle-probe/build.rs` picks `-Wl,--delayload=` on the LLVM ABI and keeps `/DELAYLOAD:` otherwise, and `build_probe` in `crates/victory-loader/tests/load_probe.rs` takes a prebuilt fixture from `VICTORY_HLE_PROBE`. Two things stop it from being a plain merge candidate: - It edits a `build.rs` (the fixture's linker arguments) to support a Linux/LLVM-MinGW/Wine test setup. Build-script changes and whether that setup is a supported target are the maintainer's call. - The prebuilt-fixture half overlaps #1631 (`VICTORY_HLE_PROBE_DLL`, already triaged as a merge candidate), which edits the same two files. Two env-var names for the same hook should not both land. Rebasing onto whichever lands first, or reducing this PR to the delay-load spelling only, would settle it. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 06:02:41 +00:00

Pull request closed

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
Marvisak/VIctory!2682
No description provided.