about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2025-04-19 14:01:39 +0000
committerGitHub <noreply@github.com>2025-04-19 14:01:39 +0000
commit67a97bad94500285e5bfb02d9aea1dcb72defc73 (patch)
treee5732d59ad280e06db18532f16521e873d4cefab
parent3c5aef3625a931c73bbbfff6e66d9c8576a6b6ee (diff)
parent1b393025718ca9c75d67e82b55a390e3506e536c (diff)
downloadrust-67a97bad94500285e5bfb02d9aea1dcb72defc73.tar.gz
rust-67a97bad94500285e5bfb02d9aea1dcb72defc73.zip
Rollup merge of #140007 - roblabla:fix-win7, r=ChrisDenton
Disable has_thread_local on i686-win7-windows-msvc

On Windows 7 32-bit, the alignment characteristic of the TLS Directory don't appear to be respected by the PE Loader, leading to crashes. As a result, let's disable has_thread_local to make sure TLS goes through the emulation layer.

Fixes #138903
-rw-r--r--compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
index 233a1c4fd7a..91ab3111097 100644
--- a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
@@ -7,6 +7,12 @@ pub(crate) fn target() -> Target {
     base.cpu = "pentium4".into();
     base.max_atomic_width = Some(64);
     base.supported_sanitizers = SanitizerSet::ADDRESS;
+    // On Windows 7 32-bit, the alignment characteristic of the TLS Directory
+    // don't appear to be respected by the PE Loader, leading to crashes. As
+    // a result, let's disable has_thread_local to make sure TLS goes through
+    // the emulation layer.
+    // See https://github.com/rust-lang/rust/issues/138903
+    base.has_thread_local = false;
 
     base.add_pre_link_args(
         LinkerFlavor::Msvc(Lld::No),