TLS: xcl.exe built with MinGW and lld keeps its TLS directory #464
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!464
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-464"
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?
@pablogonz12 on GitHub · 2026-11-24 00:36 UTC · original
pablogonz12:gnu-tls-directory→main· +16 −0 · 1 files · 1 commits · openXCL's TLS callback (
.CRT$XLYinmain.rs) and the title's slot 0 needxcl.exe's TLS directory. MSVC's linker always emits one. With MinGW the directory is_tls_usedin the CRT'stlssup.o, which LLVM's lld (llvm-mingw) leaves out when nothing refers to it. Anx86_64-pc-windows-gnubuild linked that way had no TLS directory (llvm-readobj --coff-tls-directoryprinted nothing), the log saidTLS: <title>.exe keeps slot 4 (xcl.exe has no TLS directory) – code built with /GA reads slot 0, and a retail title faulted on its second thread about 0.7 s in. The existing testpe::tests::parses_own_test_binary_tlsfails onmainthe same way.Related: #257 (Linux docs and scripts, which build for
x86_64-pc-windows-gnu).What is in it
crates/xcl/src/tls.rs: ontarget_env = "gnu",own_tls_index()refers to_tls_used, which keeps the directory. MSVC builds are unchanged (the code iscfg'd out).tls::tests::the_executable_has_a_tls_directory.Tested
x86_64-pc-windows-gnu, run under Wine.cargo test -p xcl --lib --release --target x86_64-pc-windows-gnu, test binary run under Wine with--test-threads=4:4a1f727): 633 passed, 4 failed, 21 ignored;main(a6f5f7a): 631 passed, 5 failed, 21 ignored. The fifth ispe::tests::parses_own_test_binary_tls, which this PR fixes; the other four fail the same way on both (gpu_f64_roots,gpu_f64_math_random,gpu_nonfused_mad_and_mac_prevent_fma_contraction,xma2_source_voice_decodes_and_manages_lifetime) and are not touched here.cargo xwin test --workspace --release --locked --target x86_64-pc-windows-msvc --no-run, then each of the 15 test binaries from its package folder under Wine (GE-Proton11-14, Mesa 26.3.1, DXC 1.9.2609.5, Rust 1.100.0, static CRT) with--test-threads=4; no filters, 0SKIPPEDlines on the head, 0 on the base:4a1f727): 670 passed, 7 failed, 41 ignored;main(a6f5f7a): 669 passed, 7 failed, 41 ignored.disk_free_space_ex_reports_pls_quota,gpu::recomp::tests::gpu_f64_math_random,gpu::recomp::tests::gpu_f64_roots,gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction,hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime,set_predication_buffer_state_and_kickoff,test_title_runs_and_game_folder_is_untouched._tls_usedreference removed: FAILED; with it: ok.XCL_RUN_SECONDSwith exit code 0 (GNU build).Regression run
Both blocks are the output of each commit's own unmodified
scripts/smoke.ps1, written to a file by PowerShell and pasted as is. It ran in Windows PowerShell 7.7.0 (pwsh.exe) under Wine (GE-Proton11-14, Linux), not on native Windows, with MinGit 2.56.1 forgit; host workarounds outside the script: a pseudo-terminal,DOTNET_SYSTEM_GLOBALIZATION_USENLS=1, and importing PowerShell's Utility and Management modules first.xcl.exeis an MSVC release build (cargo xwin, static CRT), where this change is compiled out, so this is only a regression check;mainis this PR's base commit.The title is flaky on this host with either commit, so here is every run (alternating, in this order); the pasted pair is run 2, the first where both finished cleanly:
The GNU/lld build, which this PR fixes, was run earlier with the bash script from #257 (not
smoke.ps1):mainfaulted before its first frame and this head presented frames and exited 0.main:This PR's head:
Not tested
tlssup.oalready; there this is a no-op).cargo test --workspaceon the GNU target: the whole-workspace run above is MSVC; on GNU only thexcllibrary tests were run.AI use
smoke.ps1runs and updated those two parts of this description.mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@JoaoPauluu on GitHub · 2026-11-24 03:09 UTC · original
Test report: #464 with GNU ld (mingw-w64-gcc) on NVIDIA
This complements the PR's llvm-mingw / lld run on AMD with the other common MinGW toolchain: mingw-w64-gcc with GNU ld (binutils), on an NVIDIA GPU. With GNU ld the bug doesn't occur, and the PR changes nothing there: same test results apart from its new test, same TLS layout, same game run.
Setup
x86_64-pc-windows-gnu; mingw-w64-gcc 16.2.0 (posix), GNU ld 2.47 (CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc)experimental-11.0-20261112(wine-11.0); vkd3d-proton v3.1 + the patch from #257; DXVK from Proton; DXC 1.9.2609;DXVK_CONFIG="dxgi.hideNvidiaGpu = False"4a1f727and its base,maina6f5f7aTLS directory (
llvm-readobj --coff-tls-directory xcl.exe)AddressOfIndex: 0x1406D09ECon both). GNU ld keeps_tls_usedwithout the reference.Tests (debug build, lib test binary under Wine)
tlsfilter,--test-threads=1: 7 passed, 0 failed, 1 ignored on the PR. That includestls::tests::the_executable_has_a_tls_directoryandpe::tests::parses_own_test_binary_tls.a6f5f7awith only the PR's new test added locally: 7 passed, 0 failed, 1 ignored. So with GNU ld the new test passes without the fix as well; it only catches the bug on lld builds.--test-threads=1 --skip gpu_more_atomics_sub_dword_scratch_valu(that test hangs NVIDIA under vkd3d-proton: dxil-spirv#372, #175):4a1f727: 635 passed, 1 failed, 21 ignoredmaina6f5f7a: 634 passed, 1 failed, 21 ignoredhle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime. It fails under Proton Experimental's Wine and passes under Arch'swine11.21 (see my report on #257).SKIPPEDon both:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64). No device loss.Regression run (GTA VI 1.0.2.1, my own dump;
scripts/linux/smoke.shfrom #257 under Wine, release builds of both commits)game_scarlett_master.exe: template 5248 B, block 5248 B, index 8, threads initialized: 3), and neither hasxcl.exe has no TLS directory.peak commit: 0 MBcomes from XCL logging0 MB committedunder Wine, not from this PR (noted on #257).Not tested
AI use: Claude Code (Claude Opus 5.5) built both commits, ran every command above on the machine above and wrote this report. The counts and blocks are pasted from those runs. I reviewed the report before posting.
@ClosetPie107 on GitHub · 2026-11-25 12:19 UTC · original
Linux / MinGW (
x86_64-pc-windows-gnu) + AMD RDNA4 (RADV) test report for head4a1f727merged locally ontomain1a0bbe3(clean merge).Environment
experimental-11.0-20261112), vkd3d-proton v3.1 (#257+dxil-spirv53aac418), DXVKv3.1.1-209, DXC1.9.2609.5,x86_64-pc-windows-gnucross-compile (MinGW-w64 gcc)Tested (debug test binary under Wine,
--test-threads=1 --nocapture)tls::tests: 5 passed, 0 failed, 1 ignored (carrier_variants_probe), 0 skipped (0.01 s), includingthe_executable_has_a_tls_directory.Not tested: full workspace suite, llvm-mingw / lld linker specifically, retail title run, native Windows.
AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
@DavidM1911 on GitHub · 2026-11-25 14:15 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@towiice on GitHub · 2026-11-24 01:06 UTC · original · reviewed
Tested PR head
4a1f727with Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm, llvm-mingw 23.1.6 UCRT +lld) on Windows 11 build 10.0.26300 (26H2), NVIDIA GeForce GTX 1650 SUPER (driver 610.88), DXCv1.9.2609:cargo build --workspace: succeeded.cargo test -p xcl --lib tls -- --test-threads=4: 7 passed, 0 failed, 1 ignored (includingtls::tests::the_executable_has_a_tls_directoryandpe::tests::parses_own_test_binary_tls).cargo test -p xcl --test e2e: 3 passed, 0 failed (30.79 s).Builds and passes cleanly under
llvm-mingw+lld.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.