mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #2225] tests: fail when gta6rt.exe has TLS callbacks (TEST-GTA6RT-NO-TLS-CALLBACKS) #2229
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2229
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2225
Author: @MoonEyes
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:test/gta6rt-no-tls-callbacks📝 Commits (4)
74bab76tests: fail when gta6rt.exe has TLS callbacks (TEST-GTA6RT-NO-TLS-CALLBACKS)812d5cftests: register gta6rt_no_tls_callbacks for cross-compiled builds too61c681eMerge remote-tracking branch 'origin/main' into test/gta6rt-no-tls-callbacks8e3f4c6test: name gta6rt's TLS callbacks from the linker map📊 Changes
3 files changed (+423 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+16 -1)➕
runtime/test/check_pe_tls_callbacks.py(+242 -0)➕
tests/test_check_pe_tls_callbacks.py(+165 -0)📄 Description
Claimed in the coordination issue as: TEST-GTA6RT-NO-TLS-CALLBACKS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7185302665)
Depends on: #2195 (this test fails on current main by design and passes once #2195 is merged)
What and why
A thread_local with a destructor in gta6rt gives gta6rt.exe two TLS callbacks (
__dyn_tls_init,__dyn_tls_dtor). The UCRT accepts only one_register_thread_local_exe_atexit_callbackper process and the title registers its own, so the game exits at startup with 0xC0000409 (#2195, RT-XMEM-STARTUP-FASTFAIL). Nothing stopped that from coming back; this is the guard I suggested in my test report on #2195.runtime/test/check_pe_tls_callbacks.pyreads the PE32+ TLS directory of the file it is given, walksAddressOfCallBacksto its zero terminator, and exits 1 if any callback is listed. Standard library only.runtime/CMakeLists.txtregisters it as the CTestgta6rt_no_tls_callbackson$<TARGET_FILE:gta6rt>(next torun_module_names).tests/test_check_pe_tls_callbacks.py(stdlib, run by ci.yml aspython -I) checks the parser on two in-memory PE32+ images, one with callbacks and one without, plus the exit codes for a non-PE and a missing file. It needs no MSVC and no game data.Trivially destructible thread_local data adds no callback and stays allowed. The check is stricter than strictly needed: any future TLS callback in gta6rt.exe will fail it and have to be discussed.
CI note: this pull request's CI will be red on
gta6rt_no_tls_callbacksuntil #2195 is merged, because main still has the two callbacks. I think it should wait for #2195 rather than land withWILL_FAIL, which someone has to remove by hand afterwards and which would hide the very regression it guards against. I will merge main in once #2195 lands.Tested
gta6rtonly.ctest -R gta6rt_no_tls_callbacks:a73a57e13: Failed, "gta6rt.exe has 2 TLS callback(s)".eaf0b8d0c): Passed.python -I tests/test_check_pe_tls_callbacks.py: ok; pytest on the same file: 3 passed.tests/test_runner_calls_all_tests.pyandtests/test_ci_registration.py: OK.scripts/check_no_game_data.pyon the three changed files: clean.git diff --check: clean.GPUs tested: n/a (the test reads the executable file and uses no GPU)
AI-assisted: yes (Claude Code, Claude Fable 5.2, wrote the test and ran it; a second agent reviewed it)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.