diff options
| author | QemmHD <290605352+QemmHD@users.noreply.github.com> | 2026-11-24 10:16:49 -0500 |
|---|---|---|
| committer | QemmHD <290605352+QemmHD@users.noreply.github.com> | 2026-11-24 10:24:51 -0500 |
| commit | b2360deeb61e5c7bb355c624e49d9461bc4a419c (patch) | |
| tree | ab65f724cb863fff8a2084ada96cb2de35c3f50d /runtime/opus_decoder/src | |
| parent | a28927849adb4e40dfdec8c32fb6758dcd205a37 (diff) | |
loader_tls: a /GA executable beside a second TLS module, on the loading thread and on a new one (BL-1)
BL-1 (docs/boot_leads.md) says code built with /GA reads its TLS at module index 0 and that main stops there.
main already carries a fix (b7a3fed28 and 4710549af: load() rewrites the executable's gs:[58h] reads to a
per-thread view with the image's block at [0]), but no test maps a /GA executable and a second TLS module at
the same time, and no test shows that the fixture's code really has the index-0 shape: the CRT objects linked
into it read gs:[58h] through _tls_index, so "some reads were rewritten" holds for a non-/GA build too.
tiny_ga_tls gets ga_tls_address(), which returns where its code looks for its variable without touching it.
The new case uses it three ways. With LEONIDA_TLS_GA_PATCH=0 the address lies in this test EXE's own block at
index 0: the stop-4 shape, shown without reading or writing another module's TLS. By default it lies in the
fixture's own block, on the loading thread and on a thread started after load(), while tiny_tls.dll mapped
beside it keeps a block at its own index, gets its thread attach and detach, and this EXE's block and value
stay at index 0 of each thread's real TLS array. ~Loader takes the view out again.
No loader change: the case passes on main as it is, which is the finding. pe_loader.cpp and tls_host.cpp are
untouched.
Tested on Windows 11, MSVC 19.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, at main 8f05e09e2:
loader_tls_test OK (118 checks, 95 before), 40 runs in a row; with LEONIDA_TLS_GA_PATCH=0 set for the whole
process, 8 checks fail, as they should (7 existing ones and "by default load() rewrites the EXE's index-0
TLS reads"). MSVC emits the index-0 read for ga_tls_address at /Od and at /O2 (checked in the listing). Full
ctest: 304 of 306, the same two failures as main (d3d12_execute_indirect_validation, d3d12_depth_resolve).
Not run on the retail executable: that needs game files.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
Diffstat (limited to 'runtime/opus_decoder/src')
0 files changed, 0 insertions, 0 deletions