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

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

@⁠ambroseautomation on GitHub · 2026-11-24 19:12 UTC · original
ambroseautomation:carry/old-10053-incremental-no → main · +55 −4 · 2 files · 1 commits · open

Claimed in the coordination issue as: OLD-10053 (#14)

What and why

Carries forward old-pr/10053 (draft #319, original commit author QemmHD preserved; indexed in #17; BUILD-1550), rebased cleanly onto current main.

Fixes clean Debug / RelWithDebInfo CMake+Ninja builds on Visual Studio 2026 18.6 (MSVC linker 14.51), which crashes with manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs on incremental relinks of images that have no base relocations:

  • Adds /INCREMENTAL:NO to the four relocation-less runtime test fixtures in runtime/CMakeLists.txt (tiny_game_fixed, tiny_tls_cb_only, dll_thread_calls, gameinput_host).
  • Adds tests/test_runtime_incremental_link.py to verify that every /FIXED or /NODEFAULTLIB target in runtime/CMakeLists.txt specifies /INCREMENTAL:NO.

Tested

  • python -I tests/test_runtime_incremental_link.py -v: 2 tests, OK.
  • python -I scripts/check_no_game_data.py runtime/CMakeLists.txt tests/test_runtime_incremental_link.py: exit 0 (no game data).

GPUs tested: n/a (CMake linker configuration + Python stdlib regression test on Windows 11 Pro 64-bit, Python 3.12.10)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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 — CMake runtime build fix)
**@⁠ambroseautomation** on GitHub · 2026-11-24 19:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147) `ambroseautomation:carry/old-10053-incremental-no` → `main` · +55 −4 · 2 files · 1 commits · open Claimed in the coordination issue as: OLD-10053 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Carries forward `old-pr/10053` (draft #319, original commit author `QemmHD` preserved; indexed in #17; BUILD-1550), rebased cleanly onto current `main`. Fixes clean Debug / RelWithDebInfo CMake+Ninja builds on Visual Studio 2026 18.6 (MSVC linker `14.51`), which crashes with `manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs` on incremental relinks of images that have no base relocations: - Adds `/INCREMENTAL:NO` to the four relocation-less runtime test fixtures in `runtime/CMakeLists.txt` (`tiny_game_fixed`, `tiny_tls_cb_only`, `dll_thread_calls`, `gameinput_host`). - Adds `tests/test_runtime_incremental_link.py` to verify that every `/FIXED` or `/NODEFAULTLIB` target in `runtime/CMakeLists.txt` specifies `/INCREMENTAL:NO`. ### Tested - `python -I tests/test_runtime_incremental_link.py -v`: 2 tests, OK. - `python -I scripts/check_no_game_data.py runtime/CMakeLists.txt tests/test_runtime_incremental_link.py`: exit 0 (no game data). GPUs tested: n/a (CMake linker configuration + Python stdlib regression test on Windows 11 Pro 64-bit, Python 3.12.10) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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 — CMake runtime build fix)
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 09:40:16 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:22 UTC · original · approved these changes

Reviewed and verified. Resolves VS 2026 18.6 linker crash (\LNK1000: Internal error during IncrCalcPtrs) by linking fixtures without base relocations (\ iny_game_fixed, \ iny_tls_cb_only, \dll_thread_calls, \gameinput_host) with /INCREMENTAL:NO. Clean regression test in \ ests/test_runtime_incremental_link.py. 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147#pullrequestreview-6045830845) · **approved these changes** Reviewed and verified. Resolves VS 2026 18.6 linker crash (\LNK1000: Internal error during IncrCalcPtrs\) by linking fixtures without base relocations (\ iny_game_fixed\, \ iny_tls_cb_only\, \dll_thread_calls\, \gameinput_host\) with \/INCREMENTAL:NO\. Clean regression test in \ ests/test_runtime_incremental_link.py\. 100% clean-room.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 19:23 UTC · original

I clean-built all four affected targets at 55aaab47 on native Windows using the CMake NMake Makefiles generator, once in Debug and once in RelWithDebInfo. All eight links succeeded. In every verbose link invocation, the target-specific /INCREMENTAL:NO followed the configuration-wide /INCREMENTAL; CMake selected the non-incremental link path. Both Python regression tests also passed. My installed MSVC toolset was 14.50.35717, so this verifies the generated linker behavior; I did not reproduce the original 14.51 linker crash.

— Codex

**@⁠kawaii-shakal** on GitHub · 2026-11-24 19:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147#issuecomment-7142030360) I clean-built all four affected targets at 55aaab47 on native Windows using the CMake NMake Makefiles generator, once in Debug and once in RelWithDebInfo. All eight links succeeded. In every verbose link invocation, the target-specific `/INCREMENTAL:NO` followed the configuration-wide `/INCREMENTAL`; CMake selected the non-incremental link path. Both Python regression tests also passed. My installed MSVC toolset was 14.50.35717, so this verifies the generated linker behavior; I did not reproduce the original 14.51 linker crash. — Codex
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:13 UTC · original

Recommendation: [MERGE]

Reasoning: Carries #319: links the four relocation-less runtime test fixtures with /INCREMENTAL:NO, avoiding the VS 2026 18.6 linker's LNK1000 internal error on incremental relinks. Small build change with a test. Verified by kawaii-shakal on native Windows (Debug and RelWithDebInfo). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147#issuecomment-7143207253) **Recommendation:** [MERGE] **Reasoning:** Carries #319: links the four relocation-less runtime test fixtures with `/INCREMENTAL:NO`, avoiding the VS 2026 18.6 linker's LNK1000 internal error on incremental relinks. Small build change with a test. Verified by kawaii-shakal on native Windows (Debug and RelWithDebInfo). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 22:37 UTC · original

VS 2026 before/after, as promised. This is my original BUILD-1550 fix, so I'll leave the review and merge to others; this is just evidence.

Toolchain: VS 2026 Build Tools, Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36246 for x64, Microsoft (R) Incremental Linker Version 14.51.36246.0. Clean Ninja RelWithDebInfo configure, building the fixture targets tiny_game_fixed, tiny_tls_cb_only, dll_thread_calls and gameinput_host.

Plain main 2a5ff9714: the linker crashes on 3 of the 4 fixtures (gameinput_host.dll, dll_thread_calls.dll, tiny_game_fixed.exe). Each one shows:

  Version 14.51.36246.0
  ExceptionCode            = C0000005
manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs
Access violation

Each failing link line carries /debug /INCREMENTAL, and ninja stops. tiny_tls_cb_only.dll happened to link.

Main + this PR (55aaab479): all 4 fixtures link (build rc 0). Each link line now has /INCREMENTAL:NO after CMake's default /INCREMENTAL, with no LNK warnings. With that VS 2026 build, loader_tls, dll_thread_calls and gameinput_host pass 3/3.

VS 2022 (Windows 11 / RTX 4070 SUPER, VS 2022 Build Tools + Ninja): the full build is fine either way. test_runtime_incremental_link passes 2/2, and the affected ctests pass 14/14 both plain and with LEONIDA_VK_VALIDATION=1. In a cumulative run with 12 other PRs on main 540d5111f, full ctest is 316/317, and the only failure is the pre-existing d3d12_depth_resolve.

Thanks @⁠ambroseautomation for carrying it forward.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 22:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147#issuecomment-7146457390) VS 2026 before/after, as promised. This is my original BUILD-1550 fix, so I'll leave the review and merge to others; this is just evidence. **Toolchain:** VS 2026 Build Tools, `Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36246 for x64`, `Microsoft (R) Incremental Linker Version 14.51.36246.0`. Clean Ninja RelWithDebInfo configure, building the fixture targets `tiny_game_fixed`, `tiny_tls_cb_only`, `dll_thread_calls` and `gameinput_host`. **Plain main 2a5ff9714:** the linker crashes on 3 of the 4 fixtures (`gameinput_host.dll`, `dll_thread_calls.dll`, `tiny_game_fixed.exe`). Each one shows: ``` Version 14.51.36246.0 ExceptionCode = C0000005 manifest.res : fatal error LNK1000: Internal error during IncrCalcPtrs Access violation ``` Each failing link line carries `/debug /INCREMENTAL`, and ninja stops. `tiny_tls_cb_only.dll` happened to link. **Main + this PR (55aaab479):** all 4 fixtures link (build rc 0). Each link line now has `/INCREMENTAL:NO` after CMake's default `/INCREMENTAL`, with no LNK warnings. With that VS 2026 build, `loader_tls`, `dll_thread_calls` and `gameinput_host` pass 3/3. **VS 2022** (Windows 11 / RTX 4070 SUPER, VS 2022 Build Tools + Ninja): the full build is fine either way. `test_runtime_incremental_link` passes 2/2, and the affected ctests pass 14/14 both plain and with `LEONIDA_VK_VALIDATION=1`. In a cumulative run with 12 other PRs on main 540d5111f, full ctest is 316/317, and the only failure is the pre-existing `d3d12_depth_resolve`. Thanks @⁠ambroseautomation for carrying it forward. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 10:01 UTC · original

Data point from a second machine, without this PR: RTX 4060 box, Windows 11 26300.

  • VS 2026 Build Tools 18.6 (MSVC 14.51), main at 626d1281a, scripts\build_runtime.ps1: LNK1000: Internal error during IncrCalcPtrs on tiny_game_fixed.exe, then on gameinput_host.dll and dll_thread_calls.dll on a rerun.
  • After updating to VS 2026 18.12.1 (MSVC 14.52), the same script on main (no /INCREMENTAL:NO on those fixtures) builds cleanly and all three fixtures link.

So this matches the note in the diff that newer VS 2026 releases fix the linker; this PR still helps anyone on 18.6.

AI-assisted (Claude Code); posted by a non-developer tester.

**@⁠potatoe0100** on GitHub · 2026-11-25 10:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1147#issuecomment-7159120953) Data point from a second machine, without this PR: RTX 4060 box, Windows 11 26300. - VS 2026 Build Tools 18.6 (MSVC 14.51), `main` at `626d1281a`, `scripts\build_runtime.ps1`: `LNK1000: Internal error during IncrCalcPtrs` on `tiny_game_fixed.exe`, then on `gameinput_host.dll` and `dll_thread_calls.dll` on a rerun. - After updating to VS 2026 18.12.1 (MSVC 14.52), the same script on `main` (no `/INCREMENTAL:NO` on those fixtures) builds cleanly and all three fixtures link. So this matches the note in the diff that newer VS 2026 releases fix the linker; this PR still helps anyone on 18.6. AI-assisted (Claude Code); posted by a non-developer tester.
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/1147/head:github-bot/gh-1147'
git switch 'github-bot/gh-1147'

Merge

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