Skip to content

Commit

Permalink
Rollup merge of rust-lang#83829 - petrochenkov:minclean, r=nagisa
Browse files Browse the repository at this point in the history
rustc_target: Rely on defaults more in target specs
  • Loading branch information
Dylan-DPC authored Apr 6, 2021
2 parents a39b243 + e7e485c commit dde1d6e
Show file tree
Hide file tree
Showing 27 changed files with 6 additions and 52 deletions.
4 changes: 1 addition & 3 deletions compiler/rustc_target/src/spec/apple_base.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::env;

use crate::spec::{LinkArgs, SplitDebuginfo, TargetOptions};
use crate::spec::{SplitDebuginfo, TargetOptions};

pub fn opts(os: &str) -> TargetOptions {
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
Expand All @@ -27,10 +27,8 @@ pub fn opts(os: &str) -> TargetOptions {
is_like_osx: true,
dwarf_version: Some(2),
has_rpath: true,
dll_prefix: "lib".to_string(),
dll_suffix: ".dylib".to_string(),
archive_format: "darwin".to_string(),
pre_link_args: LinkArgs::new(),
has_elf_tls: version >= (10, 7),
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub fn target() -> Target {

options: TargetOptions {
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}__gnu_mcount_nc".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub fn target() -> Target {
options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}__gnu_mcount_nc".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub fn target() -> Target {

options: TargetOptions {
features: "+v7,+thumb2,+soft-float,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}mcount".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub fn target() -> Target {
// target.
options: TargetOptions {
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}mcount".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub fn target() -> Target {
options: TargetOptions {
env: "eabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "__mcount".to_string(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub fn target() -> Target {
options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
..base
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_target/src/spec/avr_gnu_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ pub fn target(target_cpu: String) -> Target {
exe_suffix: ".elf".to_string(),

linker: Some("avr-gcc".to_owned()),
dynamic_linking: false,
executables: true,
linker_is_gnu: true,
has_rpath: false,
position_independent_executables: false,
eh_frame_header: false,
pre_link_args: vec![(LinkerFlavor::Gcc, vec![format!("-mmcu={}", target_cpu)])]
.into_iter()
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_target/src/spec/fuchsia_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ pub fn opts() -> TargetOptions {
os: "fuchsia".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Ld,
dynamic_linking: true,
executables: true,
os_family: Some("unix".to_string()),
is_like_fuchsia: true,
linker_is_gnu: true,
has_rpath: false,
pre_link_args,
pre_link_objects: crt_objects::new(&[
(LinkOutputKind::DynamicNoPicExe, &["Scrt1.o"]),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/haiku_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub fn opts() -> TargetOptions {
os: "haiku".to_string(),
dynamic_linking: true,
executables: true,
has_rpath: false,
os_family: Some("unix".to_string()),
relro_level: RelroLevel::Full,
linker_is_gnu: true,
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_target/src/spec/hermit_base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy};
use crate::spec::{RelocModel, TargetOptions, TlsModel};
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};

pub fn opts() -> TargetOptions {
let mut pre_link_args = LinkArgs::new();
Expand All @@ -19,8 +18,6 @@ pub fn opts() -> TargetOptions {
panic_strategy: PanicStrategy::Abort,
position_independent_executables: true,
static_position_independent_executables: true,
relocation_model: RelocModel::Pic,
os_family: None,
tls_model: TlsModel::InitialExec,
..Default::default()
}
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_target/src/spec/hermit_kernel_base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy};
use crate::spec::{RelocModel, TargetOptions, TlsModel};
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions, TlsModel};

pub fn opts() -> TargetOptions {
let mut pre_link_args = LinkArgs::new();
Expand All @@ -20,8 +19,6 @@ pub fn opts() -> TargetOptions {
panic_strategy: PanicStrategy::Abort,
position_independent_executables: true,
static_position_independent_executables: true,
relocation_model: RelocModel::Pic,
os_family: None,
tls_model: TlsModel::InitialExec,
..Default::default()
}
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkArgs, Target};
use crate::spec::Target;

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

base.crt_static_default = false;
base.atomic_cas = true;
base.has_rpath = true;
base.linker_is_gnu = false;
base.dynamic_linking = true;
base.executables = true;

base.pre_link_args = LinkArgs::new();
base.post_link_args = LinkArgs::new();

Target {
llvm_target: "hexagon-unknown-linux-musl".to_string(),
pointer_width: 32,
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_target/src/spec/l4re_base.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions};
use crate::spec::{LinkerFlavor, PanicStrategy, TargetOptions};
//use std::process::Command;

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

pub fn opts() -> TargetOptions {
let mut args = LinkArgs::new();
args.insert(LinkerFlavor::Gcc, vec![]);

TargetOptions {
os: "l4re".to_string(),
env: "uclibc".to_string(),
linker_flavor: LinkerFlavor::Ld,
executables: true,
has_elf_tls: false,
panic_strategy: PanicStrategy::Abort,
linker: Some("ld".to_string()),
pre_link_args: args,
os_family: Some("unix".to_string()),
..Default::default()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub fn target() -> Target {
cpu: "generic-rv32".to_string(),
max_atomic_width: Some(0),
atomic_cas: false,
features: String::new(),
executables: true,
panic_strategy: PanicStrategy::Abort,
relocation_model: RelocModel::Static,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub fn target() -> Target {
linker: Some("rust-lld".to_string()),
cpu: "generic-rv32".to_string(),
max_atomic_width: Some(32),
atomic_cas: true,
features: "+m,+a,+c".to_string(),
executables: true,
panic_strategy: PanicStrategy::Abort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub fn target() -> Target {
llvm_abiname: "lp64d".to_string(),
cpu: "generic-rv64".to_string(),
max_atomic_width: Some(64),
atomic_cas: true,
features: "+m,+a,+f,+d,+c".to_string(),
executables: true,
panic_strategy: PanicStrategy::Abort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub fn target() -> Target {
linker: Some("rust-lld".to_string()),
cpu: "generic-rv64".to_string(),
max_atomic_width: Some(64),
atomic_cas: true,
features: "+m,+a,+c".to_string(),
executables: true,
panic_strategy: PanicStrategy::Abort,
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ pub fn target() -> Target {

main_needs_argc_argv: false,

// No thread-local storage (just use a static Cell)
has_elf_tls: false,

// don't have atomic compare-and-swap
atomic_cas: false,
has_thumb_interworking: true,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub fn target() -> Target {

options: TargetOptions {
features: "+vfp3,+neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
..base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
features: "+vfp3,+neon".to_string(),
cpu: "generic".to_string(),
unsupported_abis: super::arm_base::unsupported_abis(),
..base
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub fn target() -> Target {
options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
..base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub fn target() -> Target {
// target.
options: TargetOptions {
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(),
mcount: "\u{1}mcount".to_string(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/vxworks_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn opts() -> TargetOptions {
os_family: Some("unix".to_string()),
linker_is_gnu: true,
has_rpath: true,
position_independent_executables: false,
has_elf_tls: true,
crt_static_default: true,
crt_static_respected: true,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/wasm_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub fn options() -> TargetOptions {
exe_suffix: ".wasm".to_string(),
dll_prefix: String::new(),
dll_suffix: ".wasm".to_string(),
linker_is_gnu: false,
eh_frame_header: false,

max_atomic_width: Some(64),
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_target/src/spec/windows_gnu_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ pub fn opts() -> TargetOptions {
dll_prefix: String::new(),
dll_suffix: ".dll".to_string(),
exe_suffix: ".exe".to_string(),
staticlib_prefix: "lib".to_string(),
staticlib_suffix: ".a".to_string(),
os_family: Some("windows".to_string()),
is_like_windows: true,
allows_weak_linkage: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::iter;

use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions};
use super::{LinkerFlavor, LldFlavor, Target, TargetOptions};

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

0 comments on commit dde1d6e

Please sign in to comment.