Skip to content

runtime: link no-relocation fixtures without incremental linking - #2215

Open
whoalin1 wants to merge 2 commits into
ProjectLeonida:mainfrom
whoalin1:runtime-incremental-no-reloc-fixtures
Open

whoalin1 wants to merge 2 commits into
ProjectLeonida:mainfrom
whoalin1:runtime-incremental-no-reloc-fixtures

Conversation

@whoalin1

Copy link
Copy Markdown
Contributor

Summary

  • pass /INCREMENTAL:NO when linking fixture images that have no base relocations (/FIXED or /NODEFAULTLIB)
  • cover tiny_game_fixed, tiny_tls_cb_only, dll_thread_calls, and gameinput_host
  • add a small static regression test so a new fixture of that kind does not regress the workaround

Item: BUILD-INCREMENTAL-NO-RELOC-FIXTURES

This carries forward the still-uncarried fix in old-pr/10053, originally written by wavehs, reapplied and verified on current main. The original report measured MSVC 14.51.35927 crashing with LNK1000 in IncrCalcPtrs on the default incremental relink of images with no base-relocation table; Microsoft fixed the linker itself in Visual Studio 2026 18.6, but non-incremental links are also correct for these fixtures.

Tests

Under the local machine coordination lock:

  • control: the static guard fails on unpatched runtime/CMakeLists.txt, finding all four vulnerable targets
  • fixed: python -I tests/test_runtime_incremental_link.py — 2 tests, OK
  • python -m compileall -q tests/test_runtime_incremental_link.py — pass
  • git diff --cached --check — pass

No game files or GPU.

AI-assisted with Devin.

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent native RelWithDebInfo / Ninja check on MSVC 19.44: both Python tests passed. All four PE fixtures built, then relinked successfully after their object timestamps changed. Each generated link command ends its incremental-link flags with /INCREMENTAL:NO, and none produced an .ilk file. This exercises the actual fixture link rules on 19.44. AI-assisted.

@Tyrannys

Tyrannys commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Independent verification of head e895cca95 merged into current main (ec91d695c); runtime/CMakeLists.txt auto-merges.

Machine: profile M (RTX 4070 SUPER 12 GB desktop, NVIDIA 621.01, Windows 11 Pro 26300, Ryzen 7 9800X3D), MSVC 14.52 (VS 2026, MSBuild generator), RelWithDebInfo, LEONIDA_SDL3_FETCH=ON. No game files.

Tests:

  • python -I tests/test_runtime_incremental_link.py against main's runtime/CMakeLists.txt (via LEONIDA_RUNTIME_CMAKE): fails, listing dll_thread_calls, gameinput_host, tiny_game_fixed, tiny_tls_cb_only. Against the merged file: 2 tests OK. So the guard catches what it should.
  • The four fixtures build and their tests pass: run_tiny_game_fixed, run_tiny_game_fixed_exit_code, loader_tls* (4), dll_thread_calls, gameinput_host.

Limits: my linker is MSVC 14.52 with the MSBuild generator, not 14.51 with Ninja, so I could not reproduce the LNK1000 crash. This run only shows that /INCREMENTAL:NO does no harm here.

Small point: the PR body says the linker was fixed in VS 2026 18.6, but the new CMake comment says 18.6 crashes and it was "Fixed in VS 2026 18.7". One of them should change.

Full suite: this PR was tested together with #2173, #2152, #2170 and #2215 (they touch separate code) merged into main ec91d695c. ctest -j 6: 500/502; the two failures, xbox_present and d3d12_set_descriptor_heaps, fail on plain main here as well (known). Plain main baseline (first run in a fresh build dir): same two, plus xs_proxy_mock, d3d12_queue_handover_two_queues and timeouts in big_compile_gate and api_ref_state that still failed in a serial rerun there but pass on this tree. I take those as first-run noise on main, not as something this PR fixes. No new failure.

AI-assisted (Claude Code).

@zmasi

zmasi commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Independent verification on Windows 11 (10.0.26200, x64) of e895cca952 merged onto current origin/main (59e65849b0, 0 git text conflicts), tested under both Python 3.12.10 and Python 3.14.5:

  • Post-base failure caught by the new static guard (PR + origin/main):
    • Against origin/main's runtime/CMakeLists.txt alone, python -I -B tests/test_runtime_incremental_link.py fails (rc=1) listing 5 targets: ['dll_thread_calls', 'fixed_base_probe', 'gameinput_host', 'tiny_game_fixed', 'tiny_tls_cb_only'].
    • With e895cca952 merged onto origin/main (59e65849b0), python -I -B tests/test_runtime_incremental_link.py still fails (rc=1) on both Python 3.12.10 and Python 3.14.5:
      ['fixed_base_probe'] : linked with /FIXED or /NODEFAULTLIB but not /INCREMENTAL:NO.
    • Cause & 1-line fix: since #2215's base, main added fixed_base_probe at runtime/CMakeLists.txt:1461-1464 with /NODEFAULTLIB and /FIXED (target_link_options(fixed_base_probe PRIVATE /NODEFAULTLIB /ENTRY:fixed_base_probe_main /FIXED /DYNAMICBASE:NO ...)), without /INCREMENTAL:NO. Adding /INCREMENTAL:NO to fixed_base_probe resolves both the LNK1000 exposure on that new fixture and the test failure.
  • Hygiene: git diff --check, python -I -m compileall -q tests/test_runtime_incremental_link.py, python -I scripts/check_no_game_data.py runtime/CMakeLists.txt tests/test_runtime_incremental_link.py, python -I tests/test_ctest_registration.py, and python -I tests/test_ci_registration.py (18/18) all exited 0.

AI-assisted.

@TheGeogeo

Copy link
Copy Markdown
Contributor

Tested e895cca95 merged (no commit) with main 53b77df14. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo; Python 3.12.4. check_no_game_data.py is clean.

Blocker: its own test fails once merged with current main. tests/test_runtime_incremental_link.py reports ['fixed_base_probe'] != []. fixed_base_probe, a /NODEFAULTLIB fixture added by #2525 since this branch, links without /INCREMENTAL:NO. The test does its job; the PR needs that fixture added. With the CMake change back to main, the same test lists 4 targets, so it is red without the fix and goes green once the new fixture is covered.

  • C++: the merge builds. The fixture tests (run_tiny_game_fixed, run_tiny_game_fixed_exit_code, dll_thread_calls, run_tiny_tls_ga) pass, and so do the 20 other tests of the 5 relinked executables. The LNK1000 itself needs a VS 2026 18.6 incremental relink, which I did not reproduce here.
  • LINK: gta6rt.exe links without ws2_32.lib with nothing new over main.

AI-assisted (Claude Code).

@timbot103 timbot103 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static audit of e895cca95 against main b6bf3aa0b. No builds, tests, or GPU runs were performed.

Merge blocker. Main added fixed_base_probe at runtime/CMakeLists.txt:1484 with /FIXED /DYNAMICBASE:NO and /NODEFAULTLIB. The four edits leave that call without /INCREMENTAL:NO, so the new source check at tests/test_runtime_incremental_link.py:36 will fail with ['fixed_base_probe'] when the standard-library CI sweep runs on the merged tree. Please add /INCREMENTAL:NO to the existing fixed_base_probe link options.

The four edited calls in runtime/CMakeLists.txt add the switch unconditionally, overriding the MSVC Debug and RelWithDebInfo incremental defaults and matching the Release default. The existing Windows runtime guard covers the clang-cl/lld-link Windows cross-build and excludes native Linux, native macOS, and the documented MinGW tools-only build.

AI-assisted.

whoalin1 and others added 2 commits November 29, 2026 06:04
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@whoalin1
whoalin1 force-pushed the runtime-incremental-no-reloc-fixtures branch from e895cca to 867eb16 Compare November 29, 2026 06:05
@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

TAKEN by OreoFR (Windows, RTX 4070 8 GB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants