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