Skip to content

Commit 619a2a9

Browse files
committed
Remove -msys2 variant
1 parent 8b0a4ef commit 619a2a9

File tree

9 files changed

+41
-87
lines changed

9 files changed

+41
-87
lines changed
Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
use std::borrow::Cow;
22

3-
use crate::spec::{
4-
Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, Target, TargetOptions, cvs,
5-
};
3+
use crate::spec::{Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions, cvs};
64

7-
#[derive(Clone, Copy)]
8-
pub(crate) enum CygwinVariant {
9-
Cygwin,
10-
MSYS2,
11-
}
12-
13-
fn opts(env: CygwinVariant) -> TargetOptions {
5+
pub(crate) fn opts() -> TargetOptions {
146
let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
157
// FIXME: Disable ASLR for now to fix relocation error
168
"--disable-dynamicbase",
@@ -23,27 +15,17 @@ fn opts(env: CygwinVariant) -> TargetOptions {
2315
"-Wl,--disable-dynamicbase",
2416
"-Wl,--enable-auto-image-base",
2517
]);
26-
// cygwin runtime lib
27-
let clib = match env {
28-
CygwinVariant::Cygwin => "-lcygwin",
29-
CygwinVariant::MSYS2 => "-lmsys-2.0",
30-
};
31-
let cygwin_libs = &[clib, "-lgcc", clib, "-luser32", "-lkernel32", "-lgcc_s"];
18+
let cygwin_libs = &["-lcygwin", "-lgcc", "-lcygwin", "-luser32", "-lkernel32", "-lgcc_s"];
3219
let mut late_link_args =
3320
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), cygwin_libs);
3421
crate::spec::add_link_args(
3522
&mut late_link_args,
3623
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
3724
cygwin_libs,
3825
);
39-
let target_env = match env {
40-
CygwinVariant::Cygwin => "",
41-
CygwinVariant::MSYS2 => "msys2",
42-
};
4326
TargetOptions {
4427
os: "cygwin".into(),
4528
vendor: "pc".into(),
46-
env: target_env.into(),
4729
// FIXME(#13846) this should be enabled for cygwin
4830
function_sections: false,
4931
linker: Some("gcc".into()),
@@ -67,42 +49,3 @@ fn opts(env: CygwinVariant) -> TargetOptions {
6749
..Default::default()
6850
}
6951
}
70-
71-
pub(crate) fn x86_64_target(env: CygwinVariant) -> Target {
72-
let mut base = opts(env);
73-
base.cpu = "x86-64".into();
74-
// FIXME: Disable ASLR for now to fix relocation error
75-
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
76-
"-m",
77-
"i386pep",
78-
"--disable-high-entropy-va",
79-
]);
80-
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
81-
"-m64",
82-
"-Wl,--disable-high-entropy-va",
83-
]);
84-
base.max_atomic_width = Some(64);
85-
let linker = match env {
86-
CygwinVariant::Cygwin => "x86_64-pc-cygwin-gcc",
87-
CygwinVariant::MSYS2 => "x86_64-pc-msys-gcc",
88-
};
89-
let description = match env {
90-
CygwinVariant::Cygwin => "64-bit x86 Cygwin",
91-
CygwinVariant::MSYS2 => "64-bit x86 MSYS2",
92-
};
93-
base.linker = Some(linker.into());
94-
Target {
95-
llvm_target: "x86_64-pc-cygwin".into(),
96-
pointer_width: 64,
97-
data_layout:
98-
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
99-
arch: "x86_64".into(),
100-
options: base,
101-
metadata: crate::spec::TargetMetadata {
102-
description: Some(description.into()),
103-
tier: Some(3),
104-
host_tools: Some(false),
105-
std: Some(true),
106-
},
107-
}
108-
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,6 @@ supported_targets! {
19791979
("riscv64gc-unknown-nuttx-elf", riscv64gc_unknown_nuttx_elf),
19801980

19811981
("x86_64-pc-cygwin", x86_64_pc_cygwin),
1982-
("x86_64-pc-cygwin-msys2", x86_64_pc_cygwin_msys2),
19831982
}
19841983

19851984
/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1-
use crate::spec::{Target, base};
1+
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
22

33
pub(crate) fn target() -> Target {
4-
base::cygwin::x86_64_target(base::cygwin::CygwinVariant::Cygwin)
4+
let mut base = base::cygwin::opts();
5+
base.cpu = "x86-64".into();
6+
// FIXME: Disable ASLR for now to fix relocation error
7+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
8+
"-m",
9+
"i386pep",
10+
"--disable-high-entropy-va",
11+
]);
12+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
13+
"-m64",
14+
"-Wl,--disable-high-entropy-va",
15+
]);
16+
base.max_atomic_width = Some(64);
17+
base.linker = Some("x86_64-pc-cygwin-gcc".into());
18+
Target {
19+
llvm_target: "x86_64-pc-cygwin".into(),
20+
pointer_width: 64,
21+
data_layout:
22+
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
23+
arch: "x86_64".into(),
24+
options: base,
25+
metadata: crate::spec::TargetMetadata {
26+
description: Some("64-bit x86 Cygwin".into()),
27+
tier: Some(3),
28+
host_tools: Some(false),
29+
std: Some(true),
30+
},
31+
}
532
}

compiler/rustc_target/src/spec/targets/x86_64_pc_cygwin_msys2.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/doc/rustc/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
- [\*-win7-windows-msvc](platform-support/win7-windows-msvc.md)
9999
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
100100
- [x86_64-pc-cygwin](platform-support/x86_64-pc-cygwin.md)
101-
- [x86_64-pc-cygwin-msys2](platform-support/x86_64-pc-cygwin.md)
102101
- [x86_64-pc-solaris](platform-support/solaris.md)
103102
- [x86_64-unknown-linux-none.md](platform-support/x86_64-unknown-linux-none.md)
104103
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)

src/doc/rustc/src/platform-support.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ target | std | host | notes
396396
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
397397
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator
398398
[`x86_64-pc-cygwin`](platform-support/x86_64-pc-cygwin.md) | ? | | 64-bit x86 Cygwin |
399-
[`x86_64-pc-cygwin-msys2`](platform-support/x86_64-pc-cygwin.md) | ? | | 64-bit x86 MSYS2 |
400399
[`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS |
401400
[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.3
402401
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD

src/doc/rustc/src/platform-support/x86_64-pc-cygwin.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
**Tier: 3**
44

5-
Windows targets supporting Cygwin and MSYS2.
6-
The `*-cygwin-*` targets are **not** intended as native targets for applications,
5+
Windows targets supporting Cygwin.
6+
The `*-cygwin` targets are **not** intended as native target for applications,
77
a developer writing Windows applications should use the `*-pc-windows-*` targets instead, which are *native* Windows.
88

99
Cygwin is only intended as an emulation layer for Unix-only programs which do not support the native Windows targets.
@@ -14,19 +14,14 @@ Cygwin is only intended as an emulation layer for Unix-only programs which do no
1414

1515
## Requirements
1616

17-
This target is cross compiled. Different `target_env` needs different linker:
18-
- `x86_64-pc-cygwin`: `x86_64-pc-cygwin-gcc`
19-
- `x86_64-pc-cygwin-msys2`: `x86_64-pc-msys-gcc`
17+
This target is cross compiled. It needs `x86_64-pc-cygwin-gcc` as linker.
2018

21-
The difference between two targets are small.
22-
The `target_os` of these targets are `cygwin`, and they are `unix`.
23-
24-
To gain high performance, users are recommended to use *more* native targets, e.g., `x86_64-pc-windows-*`.
19+
The `target_os` of the target is `cygwin`, and it is `unix`.
2520

2621
## Building the target
2722

28-
For cross-compilation you want LLVM with [llvm/llvm-project#121439](https://github.com/llvm/llvm-project/pull/121439) applied to fix the LLVM codegen on importing external global variables from DLLs.
29-
No native builds on Cygwin or MSYS2 now. It should be possible theoretically though, but might need a lot of patches.
23+
For cross-compilation you want LLVM with [llvm/llvm-project#121439 (merged)](https://github.com/llvm/llvm-project/pull/121439) applied to fix the LLVM codegen on importing external global variables from DLLs.
24+
No native builds on Cygwin now. It should be possible theoretically though, but might need a lot of patches.
3025

3126
## Building Rust programs
3227

@@ -37,8 +32,8 @@ this target, you will either need to build Rust with the target enabled (see
3732

3833
## Testing
3934

40-
Created binaries work fine on Windows with Cygwin or MSYS2.
35+
Created binaries work fine on Windows with Cygwin.
4136

4237
## Cross-compilation toolchains and C code
4338

44-
Compatible C code can be built with GCC shipped with Cygwin or MSYS2. Clang is untested.
39+
Compatible C code can be built with GCC shipped with Cygwin. Clang is untested.

tests/assembly/targets/targets-pe.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@
8181
//@ revisions: x86_64_pc_cygwin
8282
//@ [x86_64_pc_cygwin] compile-flags: --target x86_64-pc-cygwin
8383
//@ [x86_64_pc_cygwin] needs-llvm-components: x86
84-
//@ revisions: x86_64_pc_cygwin_msys2
85-
//@ [x86_64_pc_cygwin_msys2] compile-flags: --target x86_64-pc-cygwin-msys2
86-
//@ [x86_64_pc_cygwin_msys2] needs-llvm-components: x86
8784

8885
// Sanity-check that each target can produce assembly code.
8986

tests/ui/check-cfg/well-known-values.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
156156
LL | target_env = "_UNEXPECTED_VALUE",
157157
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
158158
|
159-
= note: expected values for `target_env` are: ``, `gnu`, `msvc`, `msys2`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, and `uclibc`
159+
= note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, and `uclibc`
160160
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
161161

162162
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`

0 commit comments

Comments
 (0)