rustc_target: Rely on defaults more in target specs

This commit is contained in:
Vadim Petrochenkov 2021-04-04 00:31:28 +03:00
parent 5a7a0ac51e
commit e7e485cf51
27 changed files with 6 additions and 52 deletions

View File

@ -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
@ -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,

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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

View File

@ -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()

View File

@ -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"]),

View File

@ -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,

View File

@ -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();
@ -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()
}

View File

@ -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();
@ -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()
}

View File

@ -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();
@ -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,

View File

@ -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
@ -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()
}

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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
},

View File

@ -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

View File

@ -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(),

View File

@ -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,

View File

@ -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),

View File

@ -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,

View File

@ -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] = &[
@ -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()],