Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_target: Move some target options from Target to TargetOptions #77729

Merged
merged 7 commits into from
Nov 8, 2020
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::apple_base::opts();
let mut base = super::apple_base::opts("macos");
base.cpu = "apple-a12".to_string();
base.max_atomic_width = Some(128);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
Expand All @@ -16,15 +16,9 @@ pub fn target() -> Target {

Target {
llvm_target,
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: arch.to_string(),
target_os: "macos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
}
}
10 changes: 2 additions & 8 deletions compiler/rustc_target/src/spec/aarch64_apple_ios.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let base = opts(Arch::Arm64);
let base = opts("ios", Arch::Arm64);
Target {
llvm_target: "arm64-apple-ios".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
Expand Down
10 changes: 2 additions & 8 deletions compiler/rustc_target/src/spec/aarch64_apple_tvos.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let base = opts(Arch::Arm64);
let base = opts("tvos", Arch::Arm64);
Target {
llvm_target: "arm64-apple-tvos".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "tvos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false,
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_fuchsia.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::fuchsia_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-fuchsia".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "fuchsia".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_linux_android.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
// for target ABI requirements.
Expand All @@ -11,15 +11,9 @@ pub fn target() -> Target {
base.features = "+neon,+fp-armv8".to_string();
Target {
llvm_target: "aarch64-linux-android".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts();
Expand All @@ -8,15 +8,9 @@ pub fn target() -> Target {

Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc,
options: base,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_cloudabi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::cloudabi_base::opts();
Expand All @@ -8,15 +8,9 @@ pub fn target() -> Target {

Target {
llvm_target: "aarch64-unknown-cloudabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::freebsd_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "freebsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::hermit_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-unknown-hermit".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "hermit".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: base,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
target_env: "gnu".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(),
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
target_env: "musl".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(),
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::netbsd_base::opts();
Expand All @@ -7,15 +7,9 @@ pub fn target() -> Target {

Target {
llvm_target: "aarch64-unknown-netbsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "netbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
}
}
8 changes: 2 additions & 6 deletions compiler/rustc_target/src/spec/aarch64_unknown_none.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp

pub fn target() -> Target {
let opts = TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+strict-align,+neon,+fp-armv8".to_string(),
executables: true,
Expand All @@ -23,15 +25,9 @@ pub fn target() -> Target {
};
Target {
llvm_target: "aarch64-unknown-none".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp

pub fn target() -> Target {
let opts = TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+strict-align,-neon,-fp-armv8".to_string(),
executables: true,
Expand All @@ -23,15 +25,9 @@ pub fn target() -> Target {
};
Target {
llvm_target: "aarch64-unknown-none".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::openbsd_base::opts();
Expand All @@ -7,15 +7,9 @@ pub fn target() -> Target {

Target {
llvm_target: "aarch64-unknown-openbsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "openbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_unknown_redox.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
use crate::spec::{LinkerFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::redox_base::opts();
base.max_atomic_width = Some(128);

Target {
llvm_target: "aarch64-unknown-redox".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "redox".to_string(),
target_env: "relibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
}
}
8 changes: 1 addition & 7 deletions compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target};
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts();
Expand All @@ -7,15 +7,9 @@ pub fn target() -> Target {

Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc,
options: base,
}
}
Loading