runtime: own the executable TLS exit callback #2315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2315"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by ZroIsHere on 2026-11-26T13:45:32Z.
During boot, the executable's
_register_thread_local_exe_atexit_callbackimport reached the host UCRT and terminated the process withFAST_FAIL_FATAL_APP_EXITbefore D3D12 initialization.Bind the callback to the runtime. Run it after the executable's TLS thread-detach callbacks and before normal CRT exit parks the game thread.
_Exit,quick_exit,ExitProcessandabortcontinue to skip CRT cleanup.Validation: the Windows/MSVC RelWithDebInfo
gta6rtbuild passed. With the Vulkan backend, translated shaders and a scripted GameInput pad for the no-SDL build, the retail package rendered non-black 3840×2160 frames and reached the Spanish onboarding UI. Captures are in_build/thread-local-shaderboot9/captures(frame_01501andframe_02001). No tests were run.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-26T18:30:10Z.
Merged through the integration PR #2395, together with #2372.
Changed on top, in one maintainer commit:
_tls_callback_type(void (__stdcall*)(void*, unsigned long, void*)in UCRTprocess.h), as(nullptr, DLL_PROCESS_DETACH, nullptr). Before, it was called asvoid (*)(), so the reason argument vcruntime reads was whateverrdxheld.exitand_cexitcall it before the atexit handlers, as the UCRT does: the leaving thread'sthread_localobjects end before the static ones.run_tiny_atexithas two new modes,thread_local_exitandthread_local_cexit. They fail onmainand pass with the change.Thank you for finding the fast-fail on the second registration. It stopped the title at boot on Windows.
AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)