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
This commit is contained in:
Chris Denton 2025-04-19 14:01:39 +00:00 committed by GitHub
commit 67a97bad94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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),