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

Open
opened 2026-11-26 20:17:39 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/319
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/10053


📝 Commits (1)

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

📊 Changes

2 files changed (+55 additions, -4 deletions)

View changed files

📝 runtime/CMakeLists.txt (+9 -4)
➕ tests/test_runtime_incremental_link.py (+46 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/319 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10053` --- ### 📝 Commits (1) - [`ed65e8c`](https://github.com/ubiquitarianism/leonida/commit/ed65e8c977cba2c77d2b2b3f58b7bda9e31d9663) runtime: link the fixtures with no base relocations with /INCREMENTAL:NO (BUILD-1550) ### 📊 Changes **2 files changed** (+55 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+9 -4) ➕ `tests/test_runtime_incremental_link.py` (+46 -0) </details> ### 📄 Description > 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#372
No description provided.