Skip to content

runtime: a Debug build compiles (/bigobj) and catches C++ exceptions in a Debug image - #4086

Open
Maraco91 wants to merge 2 commits into
ItsNotRexed:mainfrom
Maraco91:build/debug-bigobj
Open

Maraco91 wants to merge 2 commits into
ItsNotRexed:mainfrom
Maraco91:build/debug-bigobj

Conversation

@Maraco91

@Maraco91 Maraco91 commented Nov 22, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: new BUILD/RT item, claim in #3918 (no ID yet).

Depends on: #3680, for a fully green Debug run only. That PR fixes the two no-CRT fixtures that fail to link in Debug; this one doesn't touch them and compiles and passes its own tests without it.

What and why

CI builds the runtime as RelWithDebInfo. A Debug build (-DCMAKE_BUILD_TYPE=Debug, or scripts\build_runtime.ps1 -Debug) had two problems of its own. Two commits, one each.

1. It doesn't compile (f53e22e, runtime/CMakeLists.txt). The compiler's message, in its English wording (this machine prints it in Italian):

runtime\shims\d3d12_vulkan_device.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj

Without optimisation every inline function keeps its own COMDAT section, and that file has more than a COFF object holds by default. gta6rt_d3d12_com then doesn't build and 74 of the 145 tests have nothing to run. The target gets /bigobj. It changes the object format only, not the code.

2. run_tiny_game_eh fails with 0xE06D7363 (174b87c, runtime/src/pe_loader.cpp):

prefer_host_copy() lists the release names of the MSVC runtime DLLs, and that list is also what decides where the loader redirects RtlPcToFileHeader (lines ~1087-1124). A Debug build of the stand-in game imports MSVCP140D.dll, VCRUNTIME140D.dll and VCRUNTIME140_1D.dll (dumpbin /dependents), which were not in it. So _CxxThrowException asked Windows for the throwing image, got nothing for a mapped one, and the exception thrown and caught inside the image was never matched to its catch. The Debug names of the same ten DLLs are added. The process shim already serves ucrtbased.dll for the same Debug build of that fixture.

The retail executable links the release runtime, so this is about the project's own Debug builds and their tests, not about the game.

Tested

Windows 11 26200, MSVC 19.42 (VS 2022 Build Tools), Ninja, Windows SDK 10.0.28000.0, Vulkan headers from SDK 1.4.363.0, NVIDIA RTX 3080 Ti, driver 616.56. No game files.

Build State Result
Debug main aa2988c C1128 in d3d12_vulkan_device.cpp, LNK2001/LNK1120 in the two fixtures; 74 of 145 tests fail (not built)
Debug commit 1 + #3680's two fixtures builds; 144/145, run_tiny_game_eh fails, exit 0xE06D7363 after tiny_game: SKIP thread_local
Debug commits 1 and 2 + #3680's two fixtures builds; 145/145
RelWithDebInfo commits 1 and 2 builds; 145/145, the same 9 skipped and 1 disabled as on main here

The two fixtures were borrowed from #3680 in the working tree for the Debug runs and are not in these commits. gta6rt_d3d12_com and run_tiny_game_eh don't depend on them.

Not tested: the Visual Studio generator (Ninja only), clang-cl (it accepts /bigobj, but I didn't run the cross-build), and the seven tests that need llvm-mc, which aren't built here in either configuration.

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. (Not applicable.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

Maraco91 and others added 2 commits November 23, 2026 00:21
A Debug build stopped at shims/d3d12_vulkan_device.cpp with fatal error
C1128: the object has more sections than a COFF object holds by default,
because without optimisation every inline function keeps its own COMDAT.
CI builds RelWithDebInfo only, so nothing showed it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
prefer_host_copy() listed the release names of the MSVC runtime DLLs
only. A Debug build of a stand-in image imports VCRUNTIME140D.dll,
VCRUNTIME140_1D.dll and MSVCP140D.dll, so the loader did not redirect
their RtlPcToFileHeader import, _CxxThrowException could not find the
throwing image, and a C++ exception thrown and caught inside the image
ended the run with 0xE06D7363 (run_tiny_game_eh in a Debug build).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@MKmajster

Copy link
Copy Markdown

Tested 174b87c with an MSVC Debug build: VS 2022 Build Tools, MSVC 19.44, Ninja, -DCMAKE_BUILD_TYPE=Debug, Windows 11 24H2 (26100), SDK 10.0.26100. Both commits do what they say.

main aa2988c this branch
gta6rt_d3d12_com in Debug fails: d3d12_vulkan_device.cpp : fatal error C1128 (number of sections exceeded the object format limit; compile with /bigobj) builds
run_tiny_game, run_tiny_game_tls, run_tiny_game_eh in Debug (library doesn't build) 3/3 pass
run_tiny_game_eh in Debug, this branch with main's pe_loader.cpp (only /bigobj applied) fails

So the /bigobj change is needed to compile, and the prefer_host_copy Debug-DLL names are what makes the Debug tiny_game's C++ exception catch inside the image. Only these targets were built in Debug (gta6rt_d3d12_com, gta6rt, tiny_game and the three tests), not the whole suite. The no-CRT fixtures are #3680's.

No game files. AI-assisted (Claude).

@Hanioe2

Hanioe2 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independent Debug comparison using the Visual Studio 17 2022 generator on Windows 11 build 26200, x64, MSVC 19.44.35227, Windows SDK 10.0.26100.0.

Check main aa2988cc PR head 174b87c7
Build gta6rt_d3d12_com with Vulkan headers 1.4.363 d3d12_vulkan_device.cpp fails C1128 Builds successfully, and the generated .vcxproj contains /bigobj
run_tiny_game in Debug Pass Pass
run_tiny_game_eh in Debug Fail Pass

The two CPU CTests used freshly built Debug executables and synthetic fixtures. The D3D12 COM check was a separate compile.

AI-assisted.

@sh1shu1

sh1shu1 commented Nov 22, 2026

Copy link
Copy Markdown

Tested 174b87c on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: pass, no regression against main aa2988c.

  • ctest: 153/153 passed, same 9 skips as main aa2988c
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 164/210 native, 195/210 with LEONIDA_W64_EMULATE=1, 0 failed; identical to main aa2988c
    AI-assisted (Claude Code, Claude Fable 5.1).

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.

4 participants