mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #947] [MERGED] BL-1: tests and docs for the /GA index-0 TLS stop that main already clears (no loader change) #985
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#985
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/947
Author: @QemmHD
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142
Base:
main← Head:claude/bl1-tls-index0📝 Commits (5)
b2360deloader_tls: a /GA executable beside a second TLS module, on the loading thread and on a new one (BL-1)119d5b9runtime: run a /GA build of tiny_game under gta6rt (run_tiny_game_ga_tls)ba142e7docs: BL-1, main already clears the /GA index-0 stop; boot.md and the stop table say what it carriesa190d83docs/boot_leads.md: BL-1 Where names the measured commit, Status says answered on main and pending retail8f8b348Merge main into claude/bl1-tls-index0: keep row 4's note and #741's new row 4a📊 Changes
7 files changed (+205 additions, -6 deletions)
View changed files
📝
docs/boot.md(+11 -0)📝
docs/boot_leads.md(+13 -5)📝
docs/retail_boot_chain.md(+1 -1)📝
runtime/CMakeLists.txt(+14 -0)📝
runtime/test/fixtures/tiny_ga_tls.cpp(+3 -0)📝
runtime/test/fixtures/tiny_game.cpp(+2 -0)📝
runtime/test/loader_tls_test.cpp(+161 -0)📄 Description
Claimed in the coordination issue as: BL-1 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135107734)
Conflicts with: #741, trivially. It adds row 4a directly under row 4 of
docs/retail_boot_chain.md, which this PR edits. Keep both rows.What and why
BL-1 asks for the executable's TLS to resolve at module index 0, because "the retail run on main ends in the stop-4 shape". That measurement was taken at main
867d922f. Main has carried a fix sinceb7a3fed28and4710549af, both of which landed after that measurement.load()rewrites a/GAexecutable'smov r64, gs:[58h]reads so they reach a per-thread view with the image's own block at[0], and every other mapped module with a TLS directory gets an index of its own. So this PR adds no loader code. It adds the tests the lead asks for and corrects the three documents, so nobody re-implements a fix main already has.loader_tls: maps a/GAexecutable besidetiny_tls.dll. A new export,ga_tls_address(), reports where the fixture's code looks for its variable. WithLEONIDA_TLS_GA_PATCH=0, that's the process EXE's block at index 0, which is stop 4, shown without touching another module's TLS. By default, it's the fixture's own block, on the loading thread and on a new thread, with the DLL's block at its own index and the process EXE's block still at index 0.run_tiny_game_ga_tls: buildstiny_game.cppwith/GAand runs it throughgta6rt --run, where index 0 isgta6rt.exe's.docs/boot.md(triage step 3),docs/retail_boot_chain.md(row 4) anddocs/boot_leads.md(a BL-1 Status entry) now say what main carries. The integration tree's #4313 (rt::reserve_tls_index0, still in #321/#64) is a second design for the same stop, not a missing fix.Tested
Windows 11, MSVC 19.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, on main
a28927849.loader_tls_test: OK, 118 checks (95 before). WithLEONIDA_TLS_GA_PATCH=0set for the whole process, 8 checks fail, as they should (e.g.FAIL the loading thread reads the /GA fixture's template value 7).run_tiny_game_ga_tlspasses, 30 runs in a row. The same run with the rewrite off fails its thread_local check and exits 1. The non-/GAtiny_gamepasses either way, so the test tells the two shapes apart.d3d12_execute_indirect_validation,d3d12_depth_resolve). Main alone is 304 of 306, and the per-test results differ only by the new test.test_cmake_*,test_shader_stage_resume,test_runtime_paths,test_docs_*,test_make_game_*,test_check_no_game_data*,test_run_semantic_tests): 566 passed, 5 skipped.test_ctest_registrationpasses.--runon current main by someone with their own copy. If it still stops at stop 4, the remaining work is whatever read shape the rewrite doesn't recognize. clang-cl and Wine were not run here.GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 (full ctest; the new tests are CPU-only)
AI-assisted: yes
Possible follow-ups (not in this PR)
initialize_tlsuses one process-wideTlsAlloccell (static const DWORD ga_slot), althoughruntime/README.mdsays there is one per image. Two/GAexecutables mapped at once would share it.gs:[58h]form, not a read throughgs:[30h]+ 58h.Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
🤖 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.