Skip to content

Commit 93b0eae

Browse files
committed
Add {i586,i686,x86_64}-rust9x-windows-msvc targets
1 parent 4d91de4 commit 93b0eae

File tree

7 files changed

+72
-0
lines changed

7 files changed

+72
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,10 +1825,13 @@ supported_targets! {
18251825
("x86_64-pc-windows-msvc", x86_64_pc_windows_msvc),
18261826
("x86_64-uwp-windows-msvc", x86_64_uwp_windows_msvc),
18271827
("x86_64-win7-windows-msvc", x86_64_win7_windows_msvc),
1828+
("x86_64-rust9x-windows-msvc", x86_64_rust9x_windows_msvc),
18281829
("i686-pc-windows-msvc", i686_pc_windows_msvc),
18291830
("i686-uwp-windows-msvc", i686_uwp_windows_msvc),
18301831
("i686-win7-windows-msvc", i686_win7_windows_msvc),
1832+
("i686-rust9x-windows-msvc", i686_rust9x_windows_msvc),
18311833
("i586-pc-windows-msvc", i586_pc_windows_msvc),
1834+
("i586-rust9x-windows-msvc", i586_rust9x_windows_msvc),
18321835
("thumbv7a-pc-windows-msvc", thumbv7a_pc_windows_msvc),
18331836
("thumbv7a-uwp-windows-msvc", thumbv7a_uwp_windows_msvc),
18341837

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use crate::spec::Target;
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = super::i686_rust9x_windows_msvc::target();
5+
base.cpu = "pentium".into();
6+
base.llvm_target = "i586-pc-windows-msvc".into();
7+
base
8+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::spec::{LinkerFlavor, Lld, Target};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = super::i686_pc_windows_msvc::target();
5+
base.vendor = "rust9x".into();
6+
7+
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &[
8+
// "/LARGEADDRESSAWARE",
9+
// "/SAFESEH",
10+
// ↑ these are already added in the base target
11+
12+
// Link to ___CxxFrameHandler (XP and earlier MSVCRT) instead of ___CxxFrameHandler3.
13+
// This cannot be done in the MSVC `eh_personality` handling because LLVM hardcodes SEH
14+
// support based on that name, sadly
15+
"/ALTERNATENAME:___CxxFrameHandler3=___CxxFrameHandler",
16+
]);
17+
18+
base.metadata = crate::spec::TargetMetadata {
19+
description: Some("32-bit MSVC rust9x (Windows 95/NT3.51+)".into()),
20+
tier: Some(4),
21+
host_tools: Some(false),
22+
std: Some(true),
23+
};
24+
25+
base
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::spec::{LinkerFlavor, Lld, Target};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = super::x86_64_pc_windows_msvc::target();
5+
// these aren't available on all x86_64 CPUs
6+
// base.features = "+cx16,+sse3,+sahf".into();
7+
base.plt_by_default = false;
8+
base.max_atomic_width = Some(64);
9+
base.vendor = "rust9x".into();
10+
11+
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &[
12+
// Link to ___CxxFrameHandler (XP and earlier MSVCRT) instead of ___CxxFrameHandler3.
13+
// This cannot be done in the MSVC `eh_personality` handling because LLVM hardcodes SEH
14+
// support based on that name, sadly
15+
"/ALTERNATENAME:___CxxFrameHandler3=___CxxFrameHandler",
16+
]);
17+
18+
base.metadata = crate::spec::TargetMetadata {
19+
description: Some("64-bit MSVC rust9x (Windows XP 64bit+)".into()),
20+
tier: Some(4),
21+
host_tools: Some(false),
22+
std: Some(true),
23+
};
24+
25+
base
26+
}

library/std/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,5 @@ check-cfg = [
144144
# and to the `backtrace` crate which messes-up with Cargo list
145145
# of declared features, we therefor expect any feature cfg
146146
'cfg(feature, values(any()))',
147+
'cfg(target_vendor, values("rust9x"))',
147148
]

library/windows_targets/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ edition = "2021"
88
# Enable using raw-dylib for Windows imports.
99
# This will eventually be the default.
1010
windows_raw_dylib = []
11+
12+
[lints.rust]
13+
unexpected_cfgs = { level = "warn", check-cfg = [
14+
'cfg(target_vendor, values("rust9x"))',
15+
] }

src/bootstrap/src/core/sanity.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub struct Finder {
3434
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
3535
const STAGE0_MISSING_TARGETS: &[&str] = &[
3636
// just a dummy comment so the list doesn't get onelined
37+
"i586-rust9x-windows-msvc",
38+
"i686-rust9x-windows-msvc",
39+
"x86_64-rust9x-windows-msvc",
3740
];
3841

3942
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

0 commit comments

Comments
 (0)