runtime: link the fixtures with no base relocations with /INCREMENTAL:NO (BUILD-1550) #319

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

@⁠Andretuta on GitHub · 2026-11-24 03:08 UTC · original
ubiquitarianism:old-pr/10053 → main · +55 −4 · 2 files · 1 commits · draft

Carried over from old PR 10053 by QemmHD in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10053, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
QemmHD: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as BUILD-1550: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117121019 (the earlier PR for it, #5073, was closed unmerged during the PR cleanup with no check of its head)

What and why

With Visual Studio 2026 18.6 (link 14.51.36246), every clean scripts\build_runtime.ps1 build of main 5d74c27 stops with manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs, an access violation in link.exe. It fails on tiny_game_fixed.exe, dll_thread_calls.dll and gameinput_host.dll: the same three in two fresh build folders.

CMake links Debug and RelWithDebInfo with /debug /INCREMENTAL by default. Its Ninja and Makefile generators then relink every target incrementally, with only manifest.res changed, to embed the manifest. The 14.51 linker crashes on that relink when the image has no base relocations: /FIXED strips tiny_game_fixed's, and the two DLLs built without the CRT have nothing to relocate.

A standalone repro shows the same split: images without relocation entries crash and images with them relink, while 14.44 relinks both. The Visual Studio generator also crashes on tiny_game_fixed once tiny_game.cpp changes. The crash is listed as fixed in VS 2026 18.7 (release notes, Developer Community 11090307). That fits the #5073 tester on cl 19.51.36260 who could not reproduce it, but 18.6 is still what a fresh Build Tools install can give.

The four fixtures linked with /FIXED or /NODEFAULTLIB now link with /INCREMENTAL:NO. tiny_tls_cb_only has relocations and did not crash, but it is the same kind of fixture. tiny_game_fixed keeps /FIXED, /DYNAMICBASE:NO, its 0x140000000 base and stripped relocations, and every other target links as before. The new tests/test_runtime_incremental_link.py fails for such a fixture without /INCREMENTAL:NO. #5073 covered only the two DLLs; tiny_game_fixed came later with RT-22.

Tested

Windows 11, RTX 4070 SUPER; VS 2026 18.6 (MSVC 19.51.36246, CMake 4.2.3, Ninja 1.13.2) and VS 2022 17.14 (MSVC 19.44.35227); Windows SDK 10.0.26100; -DLEONIDA_SDL3_FETCH=ON.

  • Before, on main 5d74c27 (VS 2026): 2 of 2 clean builds fail with LNK1000 on the same three fixtures, and a Debug build fails on tiny_game_fixed.
  • After, on 5d74c27 (VS 2026): 3 of 3 clean builds pass (one through build_runtime.ps1), ctest gives 113/113, and the Debug build and the VS-generator relink pass.
  • After, on 5d74c27 (VS 2022): the clean build passes and ctest gives 113/113.
  • Rebased onto main 2d53a8055: pytest on test_runtime_incremental_link.py and test_build_runtime_cmake.py passes, and tiny_game_fixed.exe links with VS 2026. A full build of 2d53a8055 currently stops on compile errors in files this PR does not touch (runtime/shims/acphal.cpp static_asserts on SHAPE_XMA_CONTEXT/SHAPE_PCM_CONTEXT sizes, and d3d12_xs_device.cpp:1606 rt::d3d12::create_console_descriptor_heap), so ctest was not run on that base.
  • crt_timed_wait fails about 1 run in 20 with both toolsets (wait_for(200 ms) wakes at 199 ms). This change does not touch it.

AI-assisted: yes (Claude Code)

Discord: bigpeppa.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf

**@⁠Andretuta** on GitHub · 2026-11-24 03:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/319) `ubiquitarianism:old-pr/10053` → `main` · +55 −4 · 2 files · 1 commits · draft > Carried over from **old PR 10053** by `QemmHD` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10053`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `QemmHD`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as BUILD-1550: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117121019 (the earlier PR for it, `#5073`, was closed unmerged during the PR cleanup with no check of its head) ### What and why With Visual Studio 2026 18.6 (link 14.51.36246), every clean `scripts\build_runtime.ps1` build of main 5d74c27 stops with `manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs`, an access violation in link.exe. It fails on tiny_game_fixed.exe, dll_thread_calls.dll and gameinput_host.dll: the same three in two fresh build folders. CMake links Debug and RelWithDebInfo with `/debug /INCREMENTAL` by default. Its Ninja and Makefile generators then relink every target incrementally, with only manifest.res changed, to embed the manifest. The 14.51 linker crashes on that relink when the image has no base relocations: /FIXED strips tiny_game_fixed's, and the two DLLs built without the CRT have nothing to relocate. A standalone repro shows the same split: images without relocation entries crash and images with them relink, while 14.44 relinks both. The Visual Studio generator also crashes on tiny_game_fixed once tiny_game.cpp changes. The crash is listed as fixed in VS 2026 18.7 ([release notes](https://learn.microsoft.com/en-us/visualstudio/releases/2026/release-notes), [Developer Community 11090307](https://developercommunity.visualstudio.com/t/MSVC-v1451-Linker-Crash-in-IncrCalcPtrs/11090307)). That fits the `#5073` tester on cl 19.51.36260 who could not reproduce it, but 18.6 is still what a fresh Build Tools install can give. The four fixtures linked with /FIXED or /NODEFAULTLIB now link with `/INCREMENTAL:NO`. tiny_tls_cb_only has relocations and did not crash, but it is the same kind of fixture. tiny_game_fixed keeps /FIXED, /DYNAMICBASE:NO, its 0x140000000 base and stripped relocations, and every other target links as before. The new `tests/test_runtime_incremental_link.py` fails for such a fixture without `/INCREMENTAL:NO`. `#5073` covered only the two DLLs; tiny_game_fixed came later with RT-22. ### Tested Windows 11, RTX 4070 SUPER; VS 2026 18.6 (MSVC 19.51.36246, CMake 4.2.3, Ninja 1.13.2) and VS 2022 17.14 (MSVC 19.44.35227); Windows SDK 10.0.26100; -DLEONIDA_SDL3_FETCH=ON. - Before, on main 5d74c27 (VS 2026): 2 of 2 clean builds fail with LNK1000 on the same three fixtures, and a Debug build fails on tiny_game_fixed. - After, on 5d74c27 (VS 2026): 3 of 3 clean builds pass (one through build_runtime.ps1), ctest gives 113/113, and the Debug build and the VS-generator relink pass. - After, on 5d74c27 (VS 2022): the clean build passes and ctest gives 113/113. - Rebased onto main 2d53a8055: pytest on test_runtime_incremental_link.py and test_build_runtime_cmake.py passes, and tiny_game_fixed.exe links with VS 2026. A full build of 2d53a8055 currently stops on compile errors in files this PR does not touch (runtime/shims/acphal.cpp static_asserts on SHAPE_XMA_CONTEXT/SHAPE_PCM_CONTEXT sizes, and d3d12_xs_device.cpp:1606 `rt::d3d12::create_console_descriptor_heap`), so ctest was not run on that base. - `crt_timed_wait` fails about 1 run in 20 with both toolsets (wait_for(200 ms) wakes at 199 ms). This change does not touch it. AI-assisted: yes (Claude Code) Discord: bigpeppa. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
With Visual Studio 2026 18.6 (link 14.51.36246) every clean build from
scripts\build_runtime.ps1 stops with "manifest.res : fatal error LNK1000:
Internal error during IncrCalcPtrs", an access violation in link.exe, on
tiny_game_fixed.exe, dll_thread_calls.dll and gameinput_host.dll: the same
three in two fresh build folders. VS 2022 (14.44) builds the same tree.

CMake links Debug and RelWithDebInfo with /debug /INCREMENTAL by default,
and its Ninja and Makefile generators embed the manifest in two passes:
link, mt, then an incremental relink in which only manifest.res changed.
The 14.51 linker crashes on that relink when the image has no base
relocations: /FIXED strips tiny_game_fixed's, and the two CRT-free DLLs
have no absolute address to relocate. A small repro outside the repository
shows the same split (an image without relocation entries crashes, one
with them relinks; 14.44 relinks both), and the Visual Studio generator
crashes the same way on tiny_game_fixed once tiny_game.cpp changes. The
crash is listed as fixed in VS 2026 18.7 (Developer Community 11090307).

The four fixtures linked with /FIXED or /NODEFAULTLIB now link with
/INCREMENTAL:NO; tiny_tls_cb_only has relocations and did not crash, but
is the same kind of fixture. tiny_game_fixed keeps /FIXED, /DYNAMICBASE:NO
and its 0x140000000 base with relocations stripped, and every other target
links as before. tests/test_runtime_incremental_link.py fails for a
fixture linked with /FIXED or /NODEFAULTLIB without /INCREMENTAL:NO:
#5073 covered the two DLLs, and tiny_game_fixed (RT-22) came after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:53:11 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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