Auto merge of #77729 - petrochenkov:mergetarg, r=Mark-Simulacrum

rustc_target: Move some target options from `Target` to `TargetOptions`

The only reason for `Target` to `TargetOptions` to be separate structures is that options in `TargetOptions` have reasonable defaults and options in `Target` don't.
(Otherwise all the options logically belong to a single `Target` struct.)

This PR moves a number of options with reasonable defaults from `Target` to `TargetOptions`, so they no longer needs to be specified explicitly for majority of the targets.
The move also allows to inherit the options from `rustc_target/src/spec/*_base.rs` files in a nicer way.
I didn't change any specific option values here.

The moved options are `target_c_int_width` (defaults to `"32"`), `target_endian` (defaults to `"little"`), `target_os` (defaults to `"none"`), `target_env` (defaults to `""`), `target_vendor` (defaults to `"unknown"`) and `linker_flavor` (defaults to `LinkerFlavor::Gcc`).

Next steps (in later PRs):
- Find a way to merge `TargetOptions` into `Target`
- If not, always access `TargetOptions` fields through `Deref` making it a part of `Target` at least logically (`session.target.target.options.foo` -> `session.target.target.foo`)
- ~Eliminate `session::config::Config` and use `Target` instead (`session.target.target.foo` -> `session.target.foo`)~ Done in https://github.com/rust-lang/rust/pull/77943.
- Avoid tautologies in option names (`target.target_os` -> `target.os`)
- Resolve _ https://github.com/rust-lang/rust/issues/77730 (rustc_target: The differences between `target_os = "none"` and `target_os = "unknown"`, and `target_vendor = "unknown"` and `target_vendor = ""` are unclear) noticed during implementation of this PR.
This commit is contained in:
bors 2020-11-08 02:21:55 +00:00
commit f2ea2f648e
181 changed files with 322 additions and 1061 deletions

View file

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target { 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.cpu = "apple-a12".to_string();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
@ -16,15 +16,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target, llvm_target,
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: arch.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 }, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
} }
} }

View file

@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = opts(Arch::Arm64); let base = opts("ios", Arch::Arm64);
Target { Target {
llvm_target: "arm64-apple-ios".to_string(), llvm_target: "arm64-apple-ios".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 { options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(), features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false, eliminate_frame_pointer: false,

View file

@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = opts(Arch::Arm64); let base = opts("tvos", Arch::Arm64);
Target { Target {
llvm_target: "arm64-apple-tvos".to_string(), llvm_target: "arm64-apple-tvos".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 { options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".to_string(), features: "+neon,+fp-armv8,+apple-a7".to_string(),
eliminate_frame_pointer: false, eliminate_frame_pointer: false,

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::fuchsia_base::opts(); let mut base = super::fuchsia_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-fuchsia".to_string(), llvm_target: "aarch64-fuchsia".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -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 // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
// for target ABI requirements. // for target ABI requirements.
@ -11,15 +11,9 @@ pub fn target() -> Target {
base.features = "+neon,+fp-armv8".to_string(); base.features = "+neon,+fp-armv8".to_string();
Target { Target {
llvm_target: "aarch64-linux-android".to_string(), llvm_target: "aarch64-linux-android".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts(); let mut base = super::windows_msvc_base::opts();
@ -8,15 +8,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(), llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::cloudabi_base::opts(); let mut base = super::cloudabi_base::opts();
@ -8,15 +8,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-cloudabi".to_string(), llvm_target: "aarch64-unknown-cloudabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::freebsd_base::opts(); let mut base = super::freebsd_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-freebsd".to_string(), llvm_target: "aarch64-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::hermit_base::opts(); let mut base = super::hermit_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-hermit".to_string(), llvm_target: "aarch64-unknown-hermit".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(), llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(), target_mcount: "\u{1}_mcount".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-linux-musl".to_string(), llvm_target: "aarch64-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}_mcount".to_string(), target_mcount: "\u{1}_mcount".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::netbsd_base::opts(); let mut base = super::netbsd_base::opts();
@ -7,15 +7,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-netbsd".to_string(), llvm_target: "aarch64-unknown-netbsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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 }, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
} }
} }

View file

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

View file

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

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::openbsd_base::opts(); let mut base = super::openbsd_base::opts();
@ -7,15 +7,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-openbsd".to_string(), llvm_target: "aarch64-unknown-openbsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::redox_base::opts(); let mut base = super::redox_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-redox".to_string(), llvm_target: "aarch64-unknown-redox".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = super::windows_uwp_msvc_base::opts();
@ -7,15 +7,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(), llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".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, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
@ -6,15 +6,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(), llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, 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(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -2,6 +2,7 @@ use crate::spec::{LinkerFlavor, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.target_os = "android".to_string();
// Many of the symbols defined in compiler-rt are also defined in libgcc. // Many of the symbols defined in compiler-rt are also defined in libgcc.
// Android's linker doesn't like that by default. // Android's linker doesn't like that by default.
base.pre_link_args base.pre_link_args

View file

@ -2,7 +2,7 @@ use std::env;
use crate::spec::{LinkArgs, TargetOptions}; use crate::spec::{LinkArgs, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts(os: &str) -> TargetOptions {
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6 // ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
// either the linker will complain if it is used or the binary will end up // either the linker will complain if it is used or the binary will end up
// segfaulting at runtime when run on 10.6. Rust by default supports macOS // segfaulting at runtime when run on 10.6. Rust by default supports macOS
@ -17,6 +17,8 @@ pub fn opts() -> TargetOptions {
let version = macos_deployment_target(); let version = macos_deployment_target();
TargetOptions { TargetOptions {
target_os: os.to_string(),
target_vendor: "apple".to_string(),
// macOS has -dead_strip, which doesn't rely on function_sections // macOS has -dead_strip, which doesn't rely on function_sections
function_sections: false, function_sections: false,
dynamic_linking: true, dynamic_linking: true,

View file

@ -31,7 +31,7 @@ fn link_env_remove(arch: Arch) -> Vec<String> {
} }
} }
pub fn opts(arch: Arch) -> TargetOptions { pub fn opts(os: &str, arch: Arch) -> TargetOptions {
TargetOptions { TargetOptions {
cpu: target_cpu(arch), cpu: target_cpu(arch),
dynamic_linking: false, dynamic_linking: false,
@ -39,6 +39,6 @@ pub fn opts(arch: Arch) -> TargetOptions {
link_env_remove: link_env_remove(arch), link_env_remove: link_env_remove(arch),
has_elf_tls: false, has_elf_tls: false,
eliminate_frame_pointer: false, eliminate_frame_pointer: false,
..super::apple_base::opts() ..super::apple_base::opts(os)
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
@ -8,15 +8,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "arm-linux-androideabi".to_string(), llvm_target: "arm-linux-androideabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".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 }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -1,19 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Target { Target {
llvm_target: "arm-unknown-linux-gnueabi".to_string(), llvm_target: "arm-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+strict-align,+v6".to_string(), features: "+strict-align,+v6".to_string(),

View file

@ -1,19 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Target { Target {
llvm_target: "arm-unknown-linux-gnueabihf".to_string(), llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+strict-align,+v6,+vfp2,-d32".to_string(), features: "+strict-align,+v6,+vfp2,-d32".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -12,15 +12,9 @@ pub fn target() -> Target {
// to determine the calling convention and float ABI, and it doesn't // to determine the calling convention and float ABI, and it doesn't
// support the "musleabi" value. // support the "musleabi" value.
llvm_target: "arm-unknown-linux-gnueabi".to_string(), llvm_target: "arm-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -12,15 +12,9 @@ pub fn target() -> Target {
// uses it to determine the calling convention and float ABI, and it // uses it to determine the calling convention and float ABI, and it
// doesn't support the "musleabihf" value. // doesn't support the "musleabihf" value.
llvm_target: "arm-unknown-linux-gnueabihf".to_string(), llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),

View file

@ -6,17 +6,14 @@ use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "armebv7r-unknown-none-eabi".to_string(), llvm_target: "armebv7r-unknown-none-eabi".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true, executables: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,

View file

@ -6,17 +6,14 @@ use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "armebv7r-unknown-none-eabihf".to_string(), llvm_target: "armebv7r-unknown-none-eabihf".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true, executables: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,

View file

@ -1,18 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Target { Target {
llvm_target: "armv4t-unknown-linux-gnueabi".to_string(), llvm_target: "armv4t-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+soft-float,+strict-align".to_string(), features: "+soft-float,+strict-align".to_string(),

View file

@ -1,18 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Target { Target {
llvm_target: "armv5te-unknown-linux-gnueabi".to_string(), llvm_target: "armv5te-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+soft-float,+strict-align".to_string(), features: "+soft-float,+strict-align".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::linux_musl_base::opts(); let base = super::linux_musl_base::opts();
@ -7,15 +7,9 @@ pub fn target() -> Target {
// uses it to determine the calling convention and float ABI, and LLVM // uses it to determine the calling convention and float ABI, and LLVM
// doesn't support the "musleabihf" value. // doesn't support the "musleabihf" value.
llvm_target: "armv5te-unknown-linux-gnueabi".to_string(), llvm_target: "armv5te-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+soft-float,+strict-align".to_string(), features: "+soft-float,+strict-align".to_string(),

View file

@ -1,20 +1,15 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::freebsd_base::opts(); let base = super::freebsd_base::opts();
Target { Target {
llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "freebsd".to_string(),
target_env: "gnueabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_env: "gnueabihf".to_string(),
features: "+v6,+vfp2,-d32".to_string(), features: "+v6,+vfp2,-d32".to_string(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),

View file

@ -1,21 +1,16 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::netbsd_base::opts(); let mut base = super::netbsd_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Target { Target {
llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(), llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "netbsd".to_string(),
target_env: "eabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_env: "eabihf".to_string(),
features: "+v6,+vfp2,-d32".to_string(), features: "+v6,+vfp2,-d32".to_string(),
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
target_mcount: "__mcount".to_string(), target_mcount: "__mcount".to_string(),

View file

@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = opts(Arch::Armv7); let base = opts("ios", Arch::Armv7);
Target { Target {
llvm_target: "armv7-apple-ios".to_string(), llvm_target: "armv7-apple-ios".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v7,+vfp3,+neon".to_string(), features: "+v7,+vfp3,+neon".to_string(),
max_atomic_width: Some(64), max_atomic_width: Some(64),

View file

@ -16,15 +16,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "armv7-none-linux-android".to_string(), llvm_target: "armv7-none-linux-android".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".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 }, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::cloudabi_base::opts(); let mut base = super::cloudabi_base::opts();
@ -10,15 +10,9 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(), llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
} }
} }

View file

@ -1,20 +1,15 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::freebsd_base::opts(); let base = super::freebsd_base::opts();
Target { Target {
llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "freebsd".to_string(),
target_env: "gnueabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_env: "gnueabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or // This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
// hardfloat. // hardfloat.
@ -7,15 +7,9 @@ pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Target { Target {
llvm_target: "armv7-unknown-linux-gnueabi".to_string(), llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v7,+thumb2,+soft-float,-neon".to_string(), features: "+v7,+thumb2,+soft-float,-neon".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
// This target is for glibc Linux on ARMv7 without NEON or // This target is for glibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both. // thumb-mode. See the thumbv7neon variant for enabling both.
@ -7,15 +7,9 @@ pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Target { Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort // Info about features at https://wiki.debian.org/ArmHardFloatPort

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or // This target is for musl Linux on ARMv7 without thumb-mode, NEON or
// hardfloat. // hardfloat.
@ -12,15 +12,9 @@ pub fn target() -> Target {
// to determine the calling convention and float ABI, and it doesn't // to determine the calling convention and float ABI, and it doesn't
// support the "musleabi" value. // support the "musleabi" value.
llvm_target: "armv7-unknown-linux-gnueabi".to_string(), llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v7,+thumb2,+soft-float,-neon".to_string(), features: "+v7,+thumb2,+soft-float,-neon".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
// This target is for musl Linux on ARMv7 without thumb-mode or NEON. // This target is for musl Linux on ARMv7 without thumb-mode or NEON.
@ -9,15 +9,9 @@ pub fn target() -> Target {
// uses it to determine the calling convention and float ABI, and LLVM // uses it to determine the calling convention and float ABI, and LLVM
// doesn't support the "musleabihf" value. // doesn't support the "musleabihf" value.
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf // Most of these settings are copied from the armv7_unknown_linux_gnueabihf
// target. // target.

View file

@ -1,20 +1,15 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::netbsd_base::opts(); let base = super::netbsd_base::opts();
Target { Target {
llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(), llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "netbsd".to_string(),
target_env: "eabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_env: "eabihf".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(), cpu: "generic".to_string(),
max_atomic_width: Some(64), max_atomic_width: Some(64),

View file

@ -1,18 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::vxworks_base::opts(); let base = super::vxworks_base::opts();
Target { Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort // Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),

View file

@ -21,6 +21,8 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(), features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(),
executables: true, executables: true,
@ -34,15 +36,9 @@ pub fn target() -> Target {
}; };
Target { Target {
llvm_target: "armv7a-none-eabi".to_string(), llvm_target: "armv7a-none-eabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
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-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
} }
} }

View file

@ -9,6 +9,8 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(), features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(),
executables: true, executables: true,
@ -22,15 +24,9 @@ pub fn target() -> Target {
}; };
Target { Target {
llvm_target: "armv7a-none-eabihf".to_string(), llvm_target: "armv7a-none-eabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
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-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
} }
} }

View file

@ -6,17 +6,13 @@ use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "armv7r-unknown-none-eabi".to_string(), llvm_target: "armv7r-unknown-none-eabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true, executables: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,

View file

@ -6,17 +6,13 @@ use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "armv7r-unknown-none-eabihf".to_string(), llvm_target: "armv7r-unknown-none-eabihf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true, executables: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,

View file

@ -1,19 +1,13 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = opts(Arch::Armv7s); let base = opts("ios", Arch::Armv7s);
Target { Target {
llvm_target: "armv7s-apple-ios".to_string(), llvm_target: "armv7s-apple-ios".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(), arch: "arm".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v7,+vfp4,+neon".to_string(), features: "+v7,+vfp4,+neon".to_string(),
max_atomic_width: Some(64), max_atomic_width: Some(64),

View file

@ -8,14 +8,10 @@ pub fn target(target_cpu: String) -> Target {
arch: "avr".to_string(), arch: "avr".to_string(),
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(), data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(),
llvm_target: "avr-unknown-unknown".to_string(), llvm_target: "avr-unknown-unknown".to_string(),
target_endian: "little".to_string(),
pointer_width: 16, pointer_width: 16,
linker_flavor: LinkerFlavor::Gcc,
target_os: "unknown".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
target_c_int_width: 16.to_string(),
options: TargetOptions { options: TargetOptions {
target_c_int_width: "16".to_string(),
target_os: "unknown".to_string(),
cpu: target_cpu.clone(), cpu: target_cpu.clone(),
exe_suffix: ".elf".to_string(), exe_suffix: ".elf".to_string(),

View file

@ -12,6 +12,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "cloudabi".to_string(),
executables: true, executables: true,
target_family: None, target_family: None,
linker_is_gnu: true, linker_is_gnu: true,

View file

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "dragonfly".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
target_family: Some("unix".to_string()), target_family: Some("unix".to_string()),

View file

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "freebsd".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
target_family: Some("unix".to_string()), target_family: Some("unix".to_string()),

View file

@ -20,6 +20,9 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "fuchsia".to_string(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Ld, lld_flavor: LldFlavor::Ld,
dynamic_linking: true, dynamic_linking: true,

View file

@ -2,6 +2,7 @@ use crate::spec::{RelroLevel, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
TargetOptions { TargetOptions {
target_os: "haiku".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
has_rpath: false, has_rpath: false,

View file

@ -9,6 +9,8 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "hermit".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
executables: true, executables: true,
has_elf_tls: true, has_elf_tls: true,

View file

@ -9,6 +9,8 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "hermit".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
disable_redzone: true, disable_redzone: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),
executables: true, executables: true,

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkArgs, LinkerFlavor, Target}; use crate::spec::{LinkArgs, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -19,9 +19,7 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "hexagon-unknown-linux-musl".to_string(), llvm_target: "hexagon-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: concat!( data_layout: concat!(
"e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32", "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32",
":32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32", ":32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32",
@ -30,10 +28,6 @@ pub fn target() -> Target {
) )
.to_string(), .to_string(),
arch: "hexagon".to_string(), arch: "hexagon".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -1,21 +1,15 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = opts(Arch::I386); let base = opts("ios", Arch::I386);
Target { Target {
llvm_target: "i386-apple-ios".to_string(), llvm_target: "i386-apple-ios".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:128-n8:16:32-S128" f64:32:64-f80:128-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base }, options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base },
} }
} }

View file

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::apple_base::opts(); let mut base = super::apple_base::opts("macos");
base.cpu = "yonah".to_string(); base.cpu = "yonah".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
@ -17,17 +17,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target, llvm_target,
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:128-n8:16:32-S128" f64:32:64-f80:128-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".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 }, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
// See https://developer.android.com/ndk/guides/abis.html#x86 // See https://developer.android.com/ndk/guides/abis.html#x86
// for target ABI requirements. // for target ABI requirements.
@ -15,17 +15,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-linux-android".to_string(), llvm_target: "i686-linux-android".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -18,17 +18,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-pc-windows-gnu".to_string(), llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32" i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "gnu".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -22,17 +22,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-pc-windows-msvc".to_string(), llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32" i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
} }
} }

View file

@ -10,17 +10,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-cloudabi".to_string(), llvm_target: "i686-unknown-cloudabi".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -11,17 +11,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-freebsd".to_string(), llvm_target: "i686-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "freebsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -9,17 +9,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-haiku".to_string(), llvm_target: "i686-unknown-haiku".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "haiku".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -9,17 +9,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-linux-gnu".to_string(), llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -24,17 +24,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-linux-musl".to_string(), llvm_target: "i686-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -9,17 +9,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-netbsdelf".to_string(), llvm_target: "i686-unknown-netbsdelf".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".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 }, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
} }
} }

View file

@ -10,17 +10,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-openbsd".to_string(), llvm_target: "i686-unknown-openbsd".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "openbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -5,7 +5,7 @@
// The cdecl ABI is used. It differs from the stdcall or fastcall ABI. // The cdecl ABI is used. It differs from the stdcall or fastcall ABI.
// "i686-unknown-windows" is used to get the minimal subset of windows-specific features. // "i686-unknown-windows" is used to get the minimal subset of windows-specific features.
use crate::spec::{LinkerFlavor, LldFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::uefi_msvc_base::opts(); let mut base = super::uefi_msvc_base::opts();
@ -78,17 +78,11 @@ pub fn target() -> Target {
// remove -gnu and use the default one. // remove -gnu and use the default one.
Target { Target {
llvm_target: "i686-unknown-windows-gnu".to_string(), llvm_target: "i686-unknown-windows-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32" i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(), .to_string(),
target_os: "uefi".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Link),
options: base, options: base,
} }

View file

@ -17,17 +17,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-pc-windows-gnu".to_string(), llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32" i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "gnu".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target}; use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = super::windows_uwp_msvc_base::opts();
@ -8,17 +8,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-pc-windows-msvc".to_string(), llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32" i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
} }
} }

View file

@ -9,17 +9,11 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "i686-unknown-linux-gnu".to_string(), llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128" f64:32:64-f80:32-n8:16:32-S128"
.to_string(), .to_string(),
arch: "x86".to_string(), arch: "x86".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
} }
} }

View file

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "illumos".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
has_rpath: true, has_rpath: true,

View file

@ -17,6 +17,9 @@ pub fn opts() -> TargetOptions {
args.insert(LinkerFlavor::Gcc, vec![]); args.insert(LinkerFlavor::Gcc, vec![]);
TargetOptions { TargetOptions {
target_os: "l4re".to_string(),
target_env: "uclibc".to_string(),
linker_flavor: LinkerFlavor::Ld,
executables: true, executables: true,
has_elf_tls: false, has_elf_tls: false,
panic_strategy: PanicStrategy::Abort, panic_strategy: PanicStrategy::Abort,

View file

@ -19,6 +19,8 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
target_family: Some("unix".to_string()), target_family: Some("unix".to_string()),

View file

@ -8,6 +8,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_env: "gnu".to_string(),
disable_redzone: true, disable_redzone: true,
panic_strategy: PanicStrategy::Abort, panic_strategy: PanicStrategy::Abort,
stack_probes: true, stack_probes: true,

View file

@ -4,6 +4,7 @@ use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.target_env = "musl".to_string();
base.pre_link_objects_fallback = crt_objects::pre_musl_fallback(); base.pre_link_objects_fallback = crt_objects::pre_musl_fallback();
base.post_link_objects_fallback = crt_objects::post_musl_fallback(); base.post_link_objects_fallback = crt_objects::post_musl_fallback();
base.crt_objects_fallback = Some(CrtObjectsFallback::Musl); base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);

View file

@ -0,0 +1,5 @@
use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions { target_env: "uclibc".to_string(), ..super::linux_base::opts() }
}

View file

@ -1,18 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mips64-unknown-linux-gnuabi64".to_string(), llvm_target: "mips64-unknown-linux-gnuabi64".to_string(),
target_endian: "big".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
// NOTE(mips64r2) matches C toolchain // NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".to_string(), cpu: "mips64r2".to_string(),
features: "+mips64r2".to_string(), features: "+mips64r2".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -8,15 +8,13 @@ pub fn target() -> Target {
Target { Target {
// LLVM doesn't recognize "muslabi64" yet. // LLVM doesn't recognize "muslabi64" yet.
llvm_target: "mips64-unknown-linux-musl".to_string(), llvm_target: "mips64-unknown-linux-musl".to_string(),
target_endian: "big".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(), options: TargetOptions {
target_env: "musl".to_string(), target_endian: "big".to_string(),
target_vendor: "unknown".to_string(), target_mcount: "_mcount".to_string(),
linker_flavor: LinkerFlavor::Gcc, ..base
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, },
} }
} }

View file

@ -1,17 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(), llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
// NOTE(mips64r2) matches C toolchain // NOTE(mips64r2) matches C toolchain
cpu: "mips64r2".to_string(), cpu: "mips64r2".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -8,15 +8,9 @@ pub fn target() -> Target {
Target { Target {
// LLVM doesn't recognize "muslabi64" yet. // LLVM doesn't recognize "muslabi64" yet.
llvm_target: "mips64el-unknown-linux-musl".to_string(), llvm_target: "mips64el-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
} }
} }

View file

@ -1,18 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mips-unknown-linux-gnu".to_string(), llvm_target: "mips-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
cpu: "mips32r2".to_string(), cpu: "mips32r2".to_string(),
features: "+mips32r2,+fpxx,+nooddspreg".to_string(), features: "+mips32r2,+fpxx,+nooddspreg".to_string(),
max_atomic_width: Some(32), max_atomic_width: Some(32),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -8,15 +8,13 @@ pub fn target() -> Target {
base.crt_static_default = false; base.crt_static_default = false;
Target { Target {
llvm_target: "mips-unknown-linux-musl".to_string(), llvm_target: "mips-unknown-linux-musl".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(), options: TargetOptions {
target_env: "musl".to_string(), target_endian: "big".to_string(),
target_vendor: "unknown".to_string(), target_mcount: "_mcount".to_string(),
linker_flavor: LinkerFlavor::Gcc, ..base
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, },
} }
} }

View file

@ -1,24 +1,19 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mips-unknown-linux-uclibc".to_string(), llvm_target: "mips-unknown-linux-uclibc".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "uclibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
cpu: "mips32r2".to_string(), cpu: "mips32r2".to_string(),
features: "+mips32r2,+soft-float".to_string(), features: "+mips32r2,+soft-float".to_string(),
max_atomic_width: Some(32), max_atomic_width: Some(32),
target_mcount: "_mcount".to_string(), target_mcount: "_mcount".to_string(),
..super::linux_base::opts() ..super::linux_uclibc_base::opts()
}, },
} }
} }

View file

@ -10,17 +10,14 @@ pub fn target() -> Target {
Target { Target {
llvm_target: "mipsel-sony-psp".to_string(), llvm_target: "mipsel-sony-psp".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "psp".to_string(),
target_env: "".to_string(),
target_vendor: "sony".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_os: "psp".to_string(),
target_vendor: "sony".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
cpu: "mips2".to_string(), cpu: "mips2".to_string(),
executables: true, executables: true,
linker: Some("rust-lld".to_owned()), linker: Some("rust-lld".to_owned()),

View file

@ -1,17 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsel-unknown-linux-gnu".to_string(), llvm_target: "mipsel-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
cpu: "mips32r2".to_string(), cpu: "mips32r2".to_string(),

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
@ -8,15 +8,9 @@ pub fn target() -> Target {
base.crt_static_default = false; base.crt_static_default = false;
Target { Target {
llvm_target: "mipsel-unknown-linux-musl".to_string(), llvm_target: "mipsel-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
} }
} }

View file

@ -1,17 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsel-unknown-linux-uclibc".to_string(), llvm_target: "mipsel-unknown-linux-uclibc".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "uclibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
cpu: "mips32r2".to_string(), cpu: "mips32r2".to_string(),
@ -19,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32), max_atomic_width: Some(32),
target_mcount: "_mcount".to_string(), target_mcount: "_mcount".to_string(),
..super::linux_base::opts() ..super::linux_uclibc_base::opts()
}, },
} }
} }

View file

@ -9,17 +9,13 @@ use crate::spec::{PanicStrategy, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsel-unknown-none".to_string(), llvm_target: "mipsel-unknown-none".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions { options: TargetOptions {
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
cpu: "mips32r2".to_string(), cpu: "mips32r2".to_string(),
features: "+mips32r2,+soft-float,+noabicalls".to_string(), features: "+mips32r2,+soft-float,+noabicalls".to_string(),
max_atomic_width: Some(32), max_atomic_width: Some(32),

View file

@ -1,18 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsisa32r6-unknown-linux-gnu".to_string(), llvm_target: "mipsisa32r6-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
cpu: "mips32r6".to_string(), cpu: "mips32r6".to_string(),
features: "+mips32r6".to_string(), features: "+mips32r6".to_string(),
max_atomic_width: Some(32), max_atomic_width: Some(32),

View file

@ -1,17 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsisa32r6el-unknown-linux-gnu".to_string(), llvm_target: "mipsisa32r6el-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
pointer_width: 32, pointer_width: 32,
target_c_int_width: "32".to_string(),
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(), data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(), arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
cpu: "mips32r6".to_string(), cpu: "mips32r6".to_string(),

View file

@ -1,18 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".to_string(), llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".to_string(),
target_endian: "big".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_endian: "big".to_string(),
// NOTE(mips64r6) matches C toolchain // NOTE(mips64r6) matches C toolchain
cpu: "mips64r6".to_string(), cpu: "mips64r6".to_string(),
features: "+mips64r6".to_string(), features: "+mips64r6".to_string(),

View file

@ -1,17 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".to_string(), llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".to_string(),
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(), arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
// NOTE(mips64r6) matches C toolchain // NOTE(mips64r6) matches C toolchain
cpu: "mips64r6".to_string(), cpu: "mips64r6".to_string(),

View file

@ -38,6 +38,7 @@ use crate::spec::abi::{lookup as lookup_abi, Abi};
use crate::spec::crt_objects::{CrtObjects, CrtObjectsFallback}; use crate::spec::crt_objects::{CrtObjects, CrtObjectsFallback};
use rustc_serialize::json::{Json, ToJson}; use rustc_serialize::json::{Json, ToJson};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::ops::Deref;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::{fmt, io}; use std::{fmt, io};
@ -64,6 +65,7 @@ mod l4re_base;
mod linux_base; mod linux_base;
mod linux_kernel_base; mod linux_kernel_base;
mod linux_musl_base; mod linux_musl_base;
mod linux_uclibc_base;
mod msvc_base; mod msvc_base;
mod netbsd_base; mod netbsd_base;
mod openbsd_base; mod openbsd_base;
@ -664,26 +666,13 @@ supported_targets! {
pub struct Target { pub struct Target {
/// Target triple to pass to LLVM. /// Target triple to pass to LLVM.
pub llvm_target: String, pub llvm_target: String,
/// String to use as the `target_endian` `cfg` variable.
pub target_endian: String,
/// Number of bits in a pointer. Influences the `target_pointer_width` `cfg` variable. /// Number of bits in a pointer. Influences the `target_pointer_width` `cfg` variable.
pub pointer_width: u32, pub pointer_width: u32,
/// Width of c_int type
pub target_c_int_width: String,
/// OS name to use for conditional compilation.
pub target_os: String,
/// Environment name to use for conditional compilation.
pub target_env: String,
/// Vendor name to use for conditional compilation.
pub target_vendor: String,
/// Architecture to use for ABI considerations. Valid options include: "x86", /// Architecture to use for ABI considerations. Valid options include: "x86",
/// "x86_64", "arm", "aarch64", "mips", "powerpc", "powerpc64", and others. /// "x86_64", "arm", "aarch64", "mips", "powerpc", "powerpc64", and others.
pub arch: String, pub arch: String,
/// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM.
pub data_layout: String, pub data_layout: String,
/// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed
/// on the command line.
pub linker_flavor: LinkerFlavor,
/// Optional settings with defaults. /// Optional settings with defaults.
pub options: TargetOptions, pub options: TargetOptions,
} }
@ -707,6 +696,20 @@ pub struct TargetOptions {
/// Whether the target is built-in or loaded from a custom target specification. /// Whether the target is built-in or loaded from a custom target specification.
pub is_builtin: bool, pub is_builtin: bool,
/// String to use as the `target_endian` `cfg` variable. Defaults to "little".
pub target_endian: String,
/// Width of c_int type. Defaults to "32".
pub target_c_int_width: String,
/// OS name to use for conditional compilation. Defaults to "none".
pub target_os: String,
/// Environment name to use for conditional compilation. Defaults to "".
pub target_env: String,
/// Vendor name to use for conditional compilation. Defaults to "unknown".
pub target_vendor: String,
/// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed
/// on the command line. Defaults to `LinkerFlavor::Gcc`.
pub linker_flavor: LinkerFlavor,
/// Linker to invoke /// Linker to invoke
pub linker: Option<String>, pub linker: Option<String>,
@ -985,6 +988,12 @@ impl Default for TargetOptions {
fn default() -> TargetOptions { fn default() -> TargetOptions {
TargetOptions { TargetOptions {
is_builtin: false, is_builtin: false,
target_endian: "little".to_string(),
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()), linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
lld_flavor: LldFlavor::Ld, lld_flavor: LldFlavor::Ld,
pre_link_args: LinkArgs::new(), pre_link_args: LinkArgs::new(),
@ -1075,6 +1084,17 @@ impl Default for TargetOptions {
} }
} }
/// `TargetOptions` being a separate type is basically an implementation detail of `Target` that is
/// used for providing defaults. Perhaps there's a way to merge `TargetOptions` into `Target` so
/// this `Deref` implementation is no longer necessary.
impl Deref for Target {
type Target = TargetOptions;
fn deref(&self) -> &Self::Target {
&self.options
}
}
impl Target { impl Target {
/// Given a function ABI, turn it into the correct ABI for this target. /// Given a function ABI, turn it into the correct ABI for this target.
pub fn adjust_abi(&self, abi: Abi) -> Abi { pub fn adjust_abi(&self, abi: Abi) -> Abi {
@ -1135,27 +1155,13 @@ impl Target {
.ok_or_else(|| format!("Field {} in target specification is required", name)) .ok_or_else(|| format!("Field {} in target specification is required", name))
}; };
let get_opt_field = |name: &str, default: &str| {
obj.find(name)
.and_then(|s| s.as_string())
.map(|s| s.to_string())
.unwrap_or_else(|| default.to_string())
};
let mut base = Target { let mut base = Target {
llvm_target: get_req_field("llvm-target")?, llvm_target: get_req_field("llvm-target")?,
target_endian: get_req_field("target-endian")?,
pointer_width: get_req_field("target-pointer-width")? pointer_width: get_req_field("target-pointer-width")?
.parse::<u32>() .parse::<u32>()
.map_err(|_| "target-pointer-width must be an integer".to_string())?, .map_err(|_| "target-pointer-width must be an integer".to_string())?,
target_c_int_width: get_req_field("target-c-int-width")?,
data_layout: get_req_field("data-layout")?, data_layout: get_req_field("data-layout")?,
arch: get_req_field("arch")?, arch: get_req_field("arch")?,
target_os: get_req_field("os")?,
target_env: get_opt_field("env", ""),
target_vendor: get_opt_field("vendor", "unknown"),
linker_flavor: LinkerFlavor::from_str(&*get_req_field("linker-flavor")?)
.ok_or_else(|| format!("linker flavor must be {}", LinkerFlavor::one_of()))?,
options: Default::default(), options: Default::default(),
}; };
@ -1166,6 +1172,12 @@ impl Target {
base.options.$key_name = s.to_string(); base.options.$key_name = s.to_string();
} }
} ); } );
($key_name:ident = $json_name:expr) => ( {
let name = $json_name;
if let Some(s) = obj.find(&name).and_then(Json::as_string) {
base.options.$key_name = s.to_string();
}
} );
($key_name:ident, bool) => ( { ($key_name:ident, bool) => ( {
let name = (stringify!($key_name)).replace("_", "-"); let name = (stringify!($key_name)).replace("_", "-");
if let Some(s) = obj.find(&name).and_then(Json::as_boolean) { if let Some(s) = obj.find(&name).and_then(Json::as_boolean) {
@ -1301,11 +1313,13 @@ impl Target {
} ); } );
($key_name:ident, LinkerFlavor) => ( { ($key_name:ident, LinkerFlavor) => ( {
let name = (stringify!($key_name)).replace("_", "-"); let name = (stringify!($key_name)).replace("_", "-");
obj.find(&name[..]).and_then(|o| o.as_string().map(|s| { obj.find(&name[..]).and_then(|o| o.as_string().and_then(|s| {
LinkerFlavor::from_str(&s).ok_or_else(|| { match LinkerFlavor::from_str(s) {
Err(format!("'{}' is not a valid value for linker-flavor. \ Some(linker_flavor) => base.options.$key_name = linker_flavor,
Use 'em', 'gcc', 'ld' or 'msvc.", s)) _ => return Some(Err(format!("'{}' is not a valid value for linker-flavor. \
}) Use {}", s, LinkerFlavor::one_of()))),
}
Some(Ok(()))
})).unwrap_or(Ok(())) })).unwrap_or(Ok(()))
} ); } );
($key_name:ident, crt_objects_fallback) => ( { ($key_name:ident, crt_objects_fallback) => ( {
@ -1392,6 +1406,12 @@ impl Target {
} }
key!(is_builtin, bool); key!(is_builtin, bool);
key!(target_endian);
key!(target_c_int_width);
key!(target_os = "os");
key!(target_env = "env");
key!(target_vendor = "vendor");
key!(linker_flavor, LinkerFlavor)?;
key!(linker, optional); key!(linker, optional);
key!(lld_flavor, LldFlavor)?; key!(lld_flavor, LldFlavor)?;
key!(pre_link_objects, link_objects); key!(pre_link_objects, link_objects);
@ -1619,17 +1639,17 @@ impl ToJson for Target {
} }
target_val!(llvm_target); target_val!(llvm_target);
target_val!(target_endian);
d.insert("target-pointer-width".to_string(), self.pointer_width.to_string().to_json()); d.insert("target-pointer-width".to_string(), self.pointer_width.to_string().to_json());
target_val!(target_c_int_width);
target_val!(arch); target_val!(arch);
target_val!(target_os, "os");
target_val!(target_env, "env");
target_val!(target_vendor, "vendor");
target_val!(data_layout); target_val!(data_layout);
target_val!(linker_flavor);
target_option_val!(is_builtin); target_option_val!(is_builtin);
target_option_val!(target_endian);
target_option_val!(target_c_int_width);
target_option_val!(target_os, "os");
target_option_val!(target_env, "env");
target_option_val!(target_vendor, "vendor");
target_option_val!(linker_flavor);
target_option_val!(linker); target_option_val!(linker);
target_option_val!(lld_flavor); target_option_val!(lld_flavor);
target_option_val!(pre_link_objects); target_option_val!(pre_link_objects);

View file

@ -1,19 +1,15 @@
use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
llvm_target: "msp430-none-elf".to_string(), llvm_target: "msp430-none-elf".to_string(),
target_endian: "little".to_string(),
pointer_width: 16, pointer_width: 16,
target_c_int_width: "16".to_string(),
data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(), data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
arch: "msp430".to_string(), arch: "msp430".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
target_c_int_width: "16".to_string(),
target_vendor: String::new(),
executables: true, executables: true,
// The LLVM backend currently can't generate object files. To // The LLVM backend currently can't generate object files. To

View file

@ -18,6 +18,7 @@ pub fn opts() -> TargetOptions {
pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc); pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_link_args_msvc);
TargetOptions { TargetOptions {
linker_flavor: LinkerFlavor::Msvc,
executables: true, executables: true,
is_like_windows: true, is_like_windows: true,
is_like_msvc: true, is_like_msvc: true,

View file

@ -14,6 +14,7 @@ pub fn opts() -> TargetOptions {
); );
TargetOptions { TargetOptions {
target_os: "netbsd".to_string(),
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,
target_family: Some("unix".to_string()), target_family: Some("unix".to_string()),

View file

@ -6,18 +6,12 @@ pub fn target() -> Target {
arch: "nvptx64".to_string(), arch: "nvptx64".to_string(),
data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(), data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(),
llvm_target: "nvptx64-nvidia-cuda".to_string(), llvm_target: "nvptx64-nvidia-cuda".to_string(),
target_os: "cuda".to_string(),
target_vendor: "nvidia".to_string(),
target_env: String::new(),
linker_flavor: LinkerFlavor::PtxLinker,
target_endian: "little".to_string(),
pointer_width: 64, pointer_width: 64,
target_c_int_width: "32".to_string(),
options: TargetOptions { options: TargetOptions {
target_os: "cuda".to_string(),
target_vendor: "nvidia".to_string(),
linker_flavor: LinkerFlavor::PtxLinker,
// The linker can be installed from `crates.io`. // The linker can be installed from `crates.io`.
linker: Some("rust-ptx-linker".to_string()), linker: Some("rust-ptx-linker".to_string()),

Some files were not shown because too many files have changed in this diff Show more