build(victory): export D3D12SDKVersion and D3D12SDKPath from GNU targets #97

Manually merged
github merged 1 commit from gh-pr/97/head into gh-pr/97/base 2026-12-01 20:08:58 +00:00
Owner

@⁠Androtim on GitHub · 2026-11-29 09:54 UTC · original
Androtim:feat/iter98-gnu-d3d12sdk-exports → main · +25 −5 · 1 files · 1 commits · merged 2026-11-29 14:05 UTC

Summary

Adapted from upstream VIctory-NVIDIA (6cb1894f, GPL-3.0), rebased cleanly onto origin/main (c92aa44) with zero overlap against any open PR:

  • Windows-only guard (apps/victory/build.rs): Returns early when CARGO_CFG_TARGET_OS != windows so Linux/macOS targets (gnu or empty env) never pass a .def file to ELF/Mach-O linkers.
  • GNU linker Agility SDK exports (apps/victory/build.rs): Previously build.rs only emitted /EXPORT:D3D12SDKVersion,DATA and /EXPORT:D3D12SDKPath,DATA under msvc, leaving x86_64-pc-windows-gnu binaries with an empty .edata export directory (00000000). Writing victory-exports.def (EXPORTS with D3D12SDKVersion DATA and D3D12SDKPath DATA) into OUT_DIR and passing it via cargo:rustc-link-arg-bins populates .edata on Windows GNU toolchains as well and protects those statics from --gc-sections.

Verification

  • cargo xtask policy: asset policy: 303 files ok
  • cargo test -p victory --bin victory --locked: 28 passed; 0 failed
  • cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warnings
  • cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: 0 warnings
  • cargo build --release --bin victory --locked + objdump -p:
    • Export Directory [.edata]: populated (0x00ee8000) with [0] D3D12SDKPath, [1] D3D12SDKVersion
    • Standard Windows system DLLs only.
**@⁠Androtim** on GitHub · 2026-11-29 09:54 UTC · [original](https://github.com/Androtim/MiniVI/pull/97) `Androtim:feat/iter98-gnu-d3d12sdk-exports` → `main` · +25 −5 · 1 files · 1 commits · merged 2026-11-29 14:05 UTC ## Summary Adapted from upstream `VIctory-NVIDIA` (`6cb1894f`, GPL-3.0), rebased cleanly onto `origin/main` (`c92aa44`) with zero overlap against any open PR: - **Windows-only guard (`apps/victory/build.rs`):** Returns early when `CARGO_CFG_TARGET_OS != windows` so Linux/macOS targets (`gnu` or empty env) never pass a `.def` file to ELF/Mach-O linkers. - **GNU linker Agility SDK exports (`apps/victory/build.rs`):** Previously `build.rs` only emitted `/EXPORT:D3D12SDKVersion,DATA` and `/EXPORT:D3D12SDKPath,DATA` under `msvc`, leaving `x86_64-pc-windows-gnu` binaries with an empty `.edata` export directory (`00000000`). Writing `victory-exports.def` (`EXPORTS` with `D3D12SDKVersion DATA` and `D3D12SDKPath DATA`) into `OUT_DIR` and passing it via `cargo:rustc-link-arg-bins` populates `.edata` on Windows GNU toolchains as well and protects those statics from `--gc-sections`. ## Verification - `cargo xtask policy`: `asset policy: 303 files ok` - `cargo test -p victory --bin victory --locked`: **28 passed; 0 failed** - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **0 warnings** - `cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings`: **0 warnings** - `cargo build --release --bin victory --locked` + `objdump -p`: - `Export Directory [.edata]`: populated (`0x00ee8000`) with `[0] D3D12SDKPath`, `[1] D3D12SDKVersion` - Standard Windows system DLLs only.
Adapt VIctory-NVIDIA 6cb1894f (GPL-3.0):
- Return early from build.rs when CARGO_CFG_TARGET_OS != windows so non-Windows
  ELF/Mach-O builds never receive a .def linker flag.
- On Windows non-MSVC targets, generate victory-exports.def in OUT_DIR so GNU
  linkers export D3D12SDKVersion and D3D12SDKPath (DATA) and keep them under
  --gc-sections instead of emitting an empty export directory.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:08:57 +00:00
github manually merged commit 12f546dd25 into gh-pr/97/base 2026-12-01 20:08:58 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-29 10:03 UTC · original · edited 2026-11-29 13:04 UTC

Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Automated Triage Review

Verdict: merge-candidate

Summary

  • apps/victory/build.rs: Cleanly adds an early return when CARGO_CFG_TARGET_OS != "windows" (protecting ELF/Mach-O linkers), preserves the existing msvc linker arguments (/EXPORT:D3D12SDKVersion,DATA, /EXPORT:D3D12SDKPath,DATA, /DELAYLOAD:d3d12.dll, delayimp.lib) unchanged, and for non-MSVC Windows targets (gnu / gnullvm) writes victory-exports.def into OUT_DIR with D3D12SDKVersion DATA and D3D12SDKPath DATA and passes it via cargo:rustc-link-arg-bins.
  • Symbol & build check: Verified against apps/victory/src/main.rs (D3D12SDKVersion and D3D12SDKPath are both #[cfg(windows)] #[unsafe(no_mangle)] #[used] statics) and apps/victory/Cargo.toml (single victory binary target).
  • Security: build.rs only reads standard Cargo env vars and writes a constant .def file into OUT_DIR; no external commands or unsafe operations.
  • CI: Passing; no overlap with other open PRs.

Non-blocking note

  • As documented in the updated apps/victory/build.rs header comment, GNU targets do not delay-load d3d12.dll, so match_d3d12_core() in apps/victory/src/main.rs cannot adjust D3D12SDKVersion before d3d12.dll is loaded (GNU builds will always advertise the initial 614 value). That is a reasonable documented trade-off compared to exporting nothing on GNU targets, and MSVC builds are unaffected.

Note: This is an automated triage review, not formal maintainer approval.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-29 10:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/97#issuecomment-7254181881) · edited 2026-11-29 13:04 UTC <!-- minivi-triage v1 head=12f546dd25ba4791f82a81aef0ec51c6d4811b4b verdict=merge-candidate ci=passing at=2026-11-29T13:04:56Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Automated Triage Review **Verdict:** `merge-candidate` #### Summary - **`apps/victory/build.rs`**: Cleanly adds an early return when `CARGO_CFG_TARGET_OS != "windows"` (protecting ELF/Mach-O linkers), preserves the existing `msvc` linker arguments (`/EXPORT:D3D12SDKVersion,DATA`, `/EXPORT:D3D12SDKPath,DATA`, `/DELAYLOAD:d3d12.dll`, `delayimp.lib`) unchanged, and for non-MSVC Windows targets (`gnu` / `gnullvm`) writes `victory-exports.def` into `OUT_DIR` with `D3D12SDKVersion DATA` and `D3D12SDKPath DATA` and passes it via `cargo:rustc-link-arg-bins`. - **Symbol & build check**: Verified against `apps/victory/src/main.rs` (`D3D12SDKVersion` and `D3D12SDKPath` are both `#[cfg(windows)] #[unsafe(no_mangle)] #[used]` statics) and `apps/victory/Cargo.toml` (single `victory` binary target). - **Security**: `build.rs` only reads standard Cargo env vars and writes a constant `.def` file into `OUT_DIR`; no external commands or unsafe operations. - **CI**: Passing; no overlap with other open PRs. #### Non-blocking note - As documented in the updated `apps/victory/build.rs` header comment, GNU targets do not delay-load `d3d12.dll`, so `match_d3d12_core()` in `apps/victory/src/main.rs` cannot adjust `D3D12SDKVersion` before `d3d12.dll` is loaded (GNU builds will always advertise the initial `614` value). That is a reasonable documented trade-off compared to exporting nothing on GNU targets, and MSVC builds are unaffected. *Note: This is an automated triage review, not formal maintainer approval.* --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

@⁠Androtim on GitHub · 2026-11-29 10:22 UTC · original

Addressed the minivi-triage feedback at 12f546d (rebased onto origin/main c92aa44):

  • Added an early return in apps/victory/build.rs when CARGO_CFG_TARGET_OS != windows, so non-Windows targets (gnu or empty env on Linux/macOS) never receive .def linker flags.

Re-verified locally & on CI:

  • cargo xtask policy: asset policy: 303 files ok
  • cargo test -p victory --bin victory --locked: 28 passed; 0 failed
  • cargo clippy --workspace --all-targets --locked -- -D warnings & --features diagnostics: 0 warnings
  • cargo build --release --bin victory --locked + objdump -p: .edata exports [0] D3D12SDKPath and [1] D3D12SDKVersion cleanly on Windows GNU, with standard Windows system DLLs only.
  • GitHub Actions check: SUCCESS (https://github.com/Androtim/MiniVI/actions/runs/46251132331)
**@⁠Androtim** on GitHub · 2026-11-29 10:22 UTC · [original](https://github.com/Androtim/MiniVI/pull/97#issuecomment-7254388149) Addressed the `minivi-triage` feedback at [`12f546d`](https://github.com/Androtim/MiniVI/commit/12f546dd54a1f88f274c35622974347a73e9e4c8) (rebased onto `origin/main` `c92aa44`): - Added an early return in `apps/victory/build.rs` when `CARGO_CFG_TARGET_OS != windows`, so non-Windows targets (`gnu` or empty env on Linux/macOS) never receive `.def` linker flags. Re-verified locally & on CI: - `cargo xtask policy`: `asset policy: 303 files ok` - `cargo test -p victory --bin victory --locked`: **28 passed; 0 failed** - `cargo clippy --workspace --all-targets --locked -- -D warnings` & `--features diagnostics`: **0 warnings** - `cargo build --release --bin victory --locked` + `objdump -p`: `.edata` exports `[0] D3D12SDKPath` and `[1] D3D12SDKVersion` cleanly on Windows GNU, with standard Windows system DLLs only. - GitHub Actions `check`: **SUCCESS** (https://github.com/Androtim/MiniVI/actions/runs/46251132331)
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!97
No description provided.