Skip to content

Commit 93b506c

Browse files
authored
Rollup merge of #83829 - petrochenkov:minclean, r=nagisa
rustc_target: Rely on defaults more in target specs
2 parents c92ac87 + e7e485c commit 93b506c

27 files changed

+6
-52
lines changed

compiler/rustc_target/src/spec/apple_base.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::env;
22

3-
use crate::spec::{LinkArgs, SplitDebuginfo, TargetOptions};
3+
use crate::spec::{SplitDebuginfo, TargetOptions};
44

55
pub fn opts(os: &str) -> TargetOptions {
66
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
@@ -27,10 +27,8 @@ pub fn opts(os: &str) -> TargetOptions {
2727
is_like_osx: true,
2828
dwarf_version: Some(2),
2929
has_rpath: true,
30-
dll_prefix: "lib".to_string(),
3130
dll_suffix: ".dylib".to_string(),
3231
archive_format: "darwin".to_string(),
33-
pre_link_args: LinkArgs::new(),
3432
has_elf_tls: version >= (10, 7),
3533
abi_return_struct_as_int: true,
3634
emit_debug_gdb_scripts: false,

compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313

1414
options: TargetOptions {
1515
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
16-
cpu: "generic".to_string(),
1716
max_atomic_width: Some(64),
1817
unsupported_abis: super::arm_base::unsupported_abis(),
1918
mcount: "\u{1}__gnu_mcount_nc".to_string(),

compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
options: TargetOptions {
1515
// Info about features at https://wiki.debian.org/ArmHardFloatPort
1616
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
17-
cpu: "generic".to_string(),
1817
max_atomic_width: Some(64),
1918
unsupported_abis: super::arm_base::unsupported_abis(),
2019
mcount: "\u{1}__gnu_mcount_nc".to_string(),

compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub fn target() -> Target {
1818

1919
options: TargetOptions {
2020
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
21-
cpu: "generic".to_string(),
2221
max_atomic_width: Some(64),
2322
unsupported_abis: super::arm_base::unsupported_abis(),
2423
mcount: "\u{1}mcount".to_string(),

compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub fn target() -> Target {
1717
// target.
1818
options: TargetOptions {
1919
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
20-
cpu: "generic".to_string(),
2120
max_atomic_width: Some(64),
2221
unsupported_abis: super::arm_base::unsupported_abis(),
2322
mcount: "\u{1}mcount".to_string(),

compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub fn target() -> Target {
1111
options: TargetOptions {
1212
env: "eabihf".to_string(),
1313
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
14-
cpu: "generic".to_string(),
1514
max_atomic_width: Some(64),
1615
unsupported_abis: super::arm_base::unsupported_abis(),
1716
mcount: "__mcount".to_string(),

compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn target() -> Target {
1010
options: TargetOptions {
1111
// Info about features at https://wiki.debian.org/ArmHardFloatPort
1212
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
13-
cpu: "generic".to_string(),
1413
max_atomic_width: Some(64),
1514
unsupported_abis: super::arm_base::unsupported_abis(),
1615
..base

compiler/rustc_target/src/spec/avr_gnu_base.rs

-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ pub fn target(target_cpu: String) -> Target {
1515
exe_suffix: ".elf".to_string(),
1616

1717
linker: Some("avr-gcc".to_owned()),
18-
dynamic_linking: false,
1918
executables: true,
2019
linker_is_gnu: true,
21-
has_rpath: false,
22-
position_independent_executables: false,
2320
eh_frame_header: false,
2421
pre_link_args: vec![(LinkerFlavor::Gcc, vec![format!("-mmcu={}", target_cpu)])]
2522
.into_iter()

compiler/rustc_target/src/spec/fuchsia_base.rs

-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ pub fn opts() -> TargetOptions {
2323
os: "fuchsia".to_string(),
2424
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2525
linker: Some("rust-lld".to_owned()),
26-
lld_flavor: LldFlavor::Ld,
2726
dynamic_linking: true,
2827
executables: true,
2928
os_family: Some("unix".to_string()),
3029
is_like_fuchsia: true,
3130
linker_is_gnu: true,
32-
has_rpath: false,
3331
pre_link_args,
3432
pre_link_objects: crt_objects::new(&[
3533
(LinkOutputKind::DynamicNoPicExe, &["Scrt1.o"]),

compiler/rustc_target/src/spec/haiku_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn opts() -> TargetOptions {
55
os: "haiku".to_string(),
66
dynamic_linking: true,
77
executables: true,
8-
has_rpath: false,
98
os_family: Some("unix".to_string()),
109
relro_level: RelroLevel::Full,
1110
linker_is_gnu: true,

compiler/rustc_target/src/spec/hermit_base.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy};
2-
use crate::spec::{RelocModel, TargetOptions, TlsModel};
1+
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};
32

43
pub fn opts() -> TargetOptions {
54
let mut pre_link_args = LinkArgs::new();
@@ -19,8 +18,6 @@ pub fn opts() -> TargetOptions {
1918
panic_strategy: PanicStrategy::Abort,
2019
position_independent_executables: true,
2120
static_position_independent_executables: true,
22-
relocation_model: RelocModel::Pic,
23-
os_family: None,
2421
tls_model: TlsModel::InitialExec,
2522
..Default::default()
2623
}

compiler/rustc_target/src/spec/hermit_kernel_base.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy};
2-
use crate::spec::{RelocModel, TargetOptions, TlsModel};
1+
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};
32

43
pub fn opts() -> TargetOptions {
54
let mut pre_link_args = LinkArgs::new();
@@ -20,8 +19,6 @@ pub fn opts() -> TargetOptions {
2019
panic_strategy: PanicStrategy::Abort,
2120
position_independent_executables: true,
2221
static_position_independent_executables: true,
23-
relocation_model: RelocModel::Pic,
24-
os_family: None,
2522
tls_model: TlsModel::InitialExec,
2623
..Default::default()
2724
}

compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkArgs, Target};
1+
use crate::spec::Target;
22

33
pub fn target() -> Target {
44
let mut base = super::linux_musl_base::opts();
@@ -8,15 +8,11 @@ pub fn target() -> Target {
88
base.features = "-small-data,+hvx-length128b".to_string();
99

1010
base.crt_static_default = false;
11-
base.atomic_cas = true;
1211
base.has_rpath = true;
1312
base.linker_is_gnu = false;
1413
base.dynamic_linking = true;
1514
base.executables = true;
1615

17-
base.pre_link_args = LinkArgs::new();
18-
base.post_link_args = LinkArgs::new();
19-
2016
Target {
2117
llvm_target: "hexagon-unknown-linux-musl".to_string(),
2218
pointer_width: 32,

compiler/rustc_target/src/spec/l4re_base.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions};
1+
use crate::spec::{LinkerFlavor, PanicStrategy, TargetOptions};
22
//use std::process::Command;
33

44
// Use GCC to locate code for crt* libraries from the host, not from L4Re. Note
@@ -13,18 +13,13 @@ use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions};
1313
//}
1414

1515
pub fn opts() -> TargetOptions {
16-
let mut args = LinkArgs::new();
17-
args.insert(LinkerFlavor::Gcc, vec![]);
18-
1916
TargetOptions {
2017
os: "l4re".to_string(),
2118
env: "uclibc".to_string(),
2219
linker_flavor: LinkerFlavor::Ld,
2320
executables: true,
24-
has_elf_tls: false,
2521
panic_strategy: PanicStrategy::Abort,
2622
linker: Some("ld".to_string()),
27-
pre_link_args: args,
2823
os_family: Some("unix".to_string()),
2924
..Default::default()
3025
}

compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
cpu: "generic-rv32".to_string(),
1515
max_atomic_width: Some(0),
1616
atomic_cas: false,
17-
features: String::new(),
1817
executables: true,
1918
panic_strategy: PanicStrategy::Abort,
2019
relocation_model: RelocModel::Static,

compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
linker: Some("rust-lld".to_string()),
1414
cpu: "generic-rv32".to_string(),
1515
max_atomic_width: Some(32),
16-
atomic_cas: true,
1716
features: "+m,+a,+c".to_string(),
1817
executables: true,
1918
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
llvm_abiname: "lp64d".to_string(),
1515
cpu: "generic-rv64".to_string(),
1616
max_atomic_width: Some(64),
17-
atomic_cas: true,
1817
features: "+m,+a,+f,+d,+c".to_string(),
1918
executables: true,
2019
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
linker: Some("rust-lld".to_string()),
1414
cpu: "generic-rv64".to_string(),
1515
max_atomic_width: Some(64),
16-
atomic_cas: true,
1716
features: "+m,+a,+c".to_string(),
1817
executables: true,
1918
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs

-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ pub fn target() -> Target {
4545

4646
main_needs_argc_argv: false,
4747

48-
// No thread-local storage (just use a static Cell)
49-
has_elf_tls: false,
50-
5148
// don't have atomic compare-and-swap
5249
atomic_cas: false,
5350
has_thumb_interworking: true,

compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub fn target() -> Target {
2929

3030
options: TargetOptions {
3131
features: "+vfp3,+neon".to_string(),
32-
cpu: "generic".to_string(),
3332
max_atomic_width: Some(64),
3433
unsupported_abis: super::arm_base::unsupported_abis(),
3534
..base

compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn target() -> Target {
1616
arch: "arm".to_string(),
1717
options: TargetOptions {
1818
features: "+vfp3,+neon".to_string(),
19-
cpu: "generic".to_string(),
2019
unsupported_abis: super::arm_base::unsupported_abis(),
2120
..base
2221
},

compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub fn target() -> Target {
1717
options: TargetOptions {
1818
// Info about features at https://wiki.debian.org/ArmHardFloatPort
1919
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
20-
cpu: "generic".to_string(),
2120
max_atomic_width: Some(64),
2221
unsupported_abis: super::arm_base::unsupported_abis(),
2322
..base

compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn target() -> Target {
2121
// target.
2222
options: TargetOptions {
2323
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
24-
cpu: "generic".to_string(),
2524
max_atomic_width: Some(64),
2625
unsupported_abis: super::arm_base::unsupported_abis(),
2726
mcount: "\u{1}mcount".to_string(),

compiler/rustc_target/src/spec/vxworks_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub fn opts() -> TargetOptions {
1212
os_family: Some("unix".to_string()),
1313
linker_is_gnu: true,
1414
has_rpath: true,
15-
position_independent_executables: false,
1615
has_elf_tls: true,
1716
crt_static_default: true,
1817
crt_static_respected: true,

compiler/rustc_target/src/spec/wasm_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub fn options() -> TargetOptions {
7575
exe_suffix: ".wasm".to_string(),
7676
dll_prefix: String::new(),
7777
dll_suffix: ".wasm".to_string(),
78-
linker_is_gnu: false,
7978
eh_frame_header: false,
8079

8180
max_atomic_width: Some(64),

compiler/rustc_target/src/spec/windows_gnu_base.rs

-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ pub fn opts() -> TargetOptions {
7171
dll_prefix: String::new(),
7272
dll_suffix: ".dll".to_string(),
7373
exe_suffix: ".exe".to_string(),
74-
staticlib_prefix: "lib".to_string(),
75-
staticlib_suffix: ".a".to_string(),
7674
os_family: Some("windows".to_string()),
7775
is_like_windows: true,
7876
allows_weak_linkage: false,

compiler/rustc_target/src/spec/x86_64_fortanix_unknown_sgx.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::iter;
22

3-
use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions};
3+
use super::{LinkerFlavor, LldFlavor, Target, TargetOptions};
44

55
pub fn target() -> Target {
66
const PRE_LINK_ARGS: &[&str] = &[
@@ -56,12 +56,10 @@ pub fn target() -> Target {
5656
env: "sgx".into(),
5757
vendor: "fortanix".into(),
5858
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
59-
dynamic_linking: false,
6059
executables: true,
6160
linker_is_gnu: true,
6261
linker: Some("rust-lld".to_owned()),
6362
max_atomic_width: Some(64),
64-
panic_strategy: PanicStrategy::Unwind,
6563
cpu: "x86-64".into(),
6664
features: "+rdrnd,+rdseed,+lvi-cfi,+lvi-load-hardening".into(),
6765
llvm_args: vec!["--x86-experimental-lvi-inline-asm-hardening".into()],

0 commit comments

Comments
 (0)