rustc_target/spec/targets/
i686_win7_windows_msvc.rs

1use crate::spec::{LinkerFlavor, Lld, RustcAbi, SanitizerSet, Target, TargetMetadata, base};
2
3pub(crate) fn target() -> Target {
4    let mut base = base::windows_msvc::opts();
5    base.vendor = "win7".into();
6    base.rustc_abi = Some(RustcAbi::X86Sse2);
7    base.cpu = "pentium4".into();
8    base.max_atomic_width = Some(64);
9    base.supported_sanitizers = SanitizerSet::ADDRESS;
10    // On Windows 7 32-bit, the alignment characteristic of the TLS Directory
11    // don't appear to be respected by the PE Loader, leading to crashes. As
12    // a result, let's disable has_thread_local to make sure TLS goes through
13    // the emulation layer.
14    // See https://github.com/rust-lang/rust/issues/138903
15    base.has_thread_local = false;
16
17    base.add_pre_link_args(
18        LinkerFlavor::Msvc(Lld::No),
19        &[
20            // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
21            // space available to x86 Windows binaries on x86_64.
22            "/LARGEADDRESSAWARE",
23            // Ensure the linker will only produce an image if it can also produce a table of
24            // the image's safe exception handlers.
25            // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
26            "/SAFESEH",
27        ],
28    );
29
30    Target {
31        llvm_target: "i686-pc-windows-msvc".into(),
32        metadata: TargetMetadata {
33            description: Some("32-bit MSVC (Windows 7+)".into()),
34            tier: Some(3),
35            host_tools: Some(false),
36            std: Some(true),
37        },
38        pointer_width: 32,
39        data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
40            i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
41            .into(),
42        arch: "x86".into(),
43        options: base,
44    }
45}