runtime: compile the shim registry once for compatible Windows targets #973

Open
github-bot wants to merge 1 commit from github-bot/gh-973 into main AGit
Owner

@⁠Kadamitas on GitHub · 2026-11-24 16:07 UTC · original
Kadamitas:build/reuse-registry-object → main · +47 −39 · 1 files · 1 commits · open

Claimed in the coordination issue as: compile the shim registry once for compatible Windows targets (unlisted build work).

What and why

The Windows runtime and 40 possible test/tool targets each listed the same shims/registry.cpp. This change compiles the common implementation in a CMake object library. Each executable links its own copy, so process-local state and static shim registrations keep their original ownership.

39 of the 41 source lists can share this object. The XMem test keeps a private compilation because clang-cl enables asynchronous exception handling there. The loader fuzzer keeps a private compilation for its AddressSanitizer and STL annotation settings. The number of targets enabled depends on the installed libraries and generator options.

Tested

  • Windows x64, Visual Studio 2022 MSVC 19.36, SDK 10.0.26100, RelWithDebInfo. In the generated CPU-only build, 36 executables referenced one shared object. The registry source compiled separately for the object library, XMem test and fuzzer.
  • Built and ran five cases with the static CRT: startup_trace, xmem, process_cmdline, bcrypt_rng, and bcrypt_rng_seeded. All five passed.
  • Generated a second configuration with the default dynamic CRT and LEONIDA_LOADER_FUZZ_ASAN=ON. Built the shared registry object and compiled the fuzzer's private registry source with /fsanitize=address and both STL annotation disables. The complete dynamic-CRT test build on this older toolset stops in main's separate crt_timed_wait.cpp; those full binaries were not tested in that configuration. clang-cl was not run.
  • git diff --check and the repository's no-game-data checker passed.

GPUs tested: N/A, CPU-only build change. No frame-rate claim.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Based on current main.
  • One build-system change.
  • No game files, keys, or decryption content.
**@⁠Kadamitas** on GitHub · 2026-11-24 16:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/973) `Kadamitas:build/reuse-registry-object` → `main` · +47 −39 · 1 files · 1 commits · open Claimed in the coordination issue as: [compile the shim registry once for compatible Windows targets](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) (unlisted build work). ### What and why The Windows runtime and 40 possible test/tool targets each listed the same `shims/registry.cpp`. This change compiles the common implementation in a CMake object library. Each executable links its own copy, so process-local state and static shim registrations keep their original ownership. 39 of the 41 source lists can share this object. The XMem test keeps a private compilation because clang-cl enables asynchronous exception handling there. The loader fuzzer keeps a private compilation for its AddressSanitizer and STL annotation settings. The number of targets enabled depends on the installed libraries and generator options. ### Tested - Windows x64, Visual Studio 2022 MSVC 19.36, SDK 10.0.26100, RelWithDebInfo. In the generated CPU-only build, 36 executables referenced one shared object. The registry source compiled separately for the object library, XMem test and fuzzer. - Built and ran five cases with the static CRT: `startup_trace`, `xmem`, `process_cmdline`, `bcrypt_rng`, and `bcrypt_rng_seeded`. All five passed. - Generated a second configuration with the default dynamic CRT and `LEONIDA_LOADER_FUZZ_ASAN=ON`. Built the shared registry object and compiled the fuzzer's private registry source with `/fsanitize=address` and both STL annotation disables. The complete dynamic-CRT test build on this older toolset stops in main's separate `crt_timed_wait.cpp`; those full binaries were not tested in that configuration. clang-cl was not run. - `git diff --check` and the repository's no-game-data checker passed. GPUs tested: N/A, CPU-only build change. No frame-rate claim. AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Based on current main. - [x] One build-system change. - [x] No game files, keys, or decryption content.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:31:18 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 22:06 UTC · original

Reviewed 24ab90c: 39 targets now share a gta6rt_shim_registry OBJECT library; xmem_test (/EHa under clang-cl) and pe_loader_fuzz (ASan) keep their own copies, now with comments saying why. I ran the 8 stdlib tests that parse runtime/CMakeLists.txt on both trees (identical results; test_runtime_paths fails on both only because git was unavailable here). My probe found no double compilation, no guard leak and no EH/CRT mismatch among converted targets; registry.cpp has no #if gates, so per-target define deltas cannot change the object. One finding: the comments above xgameruntime_test (line 433) and d3d12_xmem_placed_test (line 2080) still say those targets compile their own registry.cpp like xmem_test; on this branch both consume the shared objects. I could not run the Windows build here, so CI is the remaining proof. AI-assisted review.

Recommendation: Fix first

**@⁠PierreEbele** on GitHub · 2026-11-25 22:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/973#issuecomment-7175937698) Reviewed 24ab90c: 39 targets now share a gta6rt_shim_registry OBJECT library; xmem_test (/EHa under clang-cl) and pe_loader_fuzz (ASan) keep their own copies, now with comments saying why. I ran the 8 stdlib tests that parse runtime/CMakeLists.txt on both trees (identical results; test_runtime_paths fails on both only because git was unavailable here). My probe found no double compilation, no guard leak and no EH/CRT mismatch among converted targets; registry.cpp has no #if gates, so per-target define deltas cannot change the object. One finding: the comments above xgameruntime_test (line 433) and d3d12_xmem_placed_test (line 2080) still say those targets compile their own registry.cpp like xmem_test; on this branch both consume the shared objects. I could not run the Windows build here, so CI is the remaining proof. AI-assisted review. **Recommendation:** Fix first
This pull request has changes conflicting with the target branch.
  • runtime/CMakeLists.txt
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/973/head:github-bot/gh-973'
git switch 'github-bot/gh-973'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-973'
git switch 'github-bot/gh-973'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-973'
git switch 'github-bot/gh-973'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-973'
git switch 'main'
git merge --squash 'github-bot/gh-973'
git switch 'main'
git merge --ff-only 'github-bot/gh-973'
git switch 'main'
git merge 'github-bot/gh-973'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.