Auto merge of #77580 - petrochenkov:norestarg, r=matthewjasper

rustc_target: Refactor away `TargetResult`

Follow-up to https://github.com/rust-lang/rust/pull/77202.

Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.

The second commit contains some further cleanup based on built-in target construction being infallible.
This commit is contained in:
bors 2020-10-10 09:07:35 +00:00
commit 0e022fc2b8
159 changed files with 632 additions and 667 deletions

View File

@ -671,7 +671,8 @@ impl RustcDefaultCalls {
for req in &sess.opts.prints { for req in &sess.opts.prints {
match *req { match *req {
TargetList => { TargetList => {
let mut targets = rustc_target::spec::get_targets().collect::<Vec<String>>(); let mut targets =
rustc_target::spec::TARGETS.iter().copied().collect::<Vec<_>>();
targets.sort(); targets.sort();
println!("{}", targets.join("\n")); println!("{}", targets.join("\n"));
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::apple_base::opts(); let mut base = super::apple_base::opts();
base.cpu = "apple-a12".to_string(); base.cpu = "apple-a12".to_string();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
@ -14,7 +14,7 @@ pub fn target() -> TargetResult {
let arch = "aarch64"; let arch = "aarch64";
let llvm_target = super::apple_base::macos_llvm_target(&arch); let llvm_target = super::apple_base::macos_llvm_target(&arch);
Ok(Target { Target {
llvm_target, llvm_target,
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,9 +1,9 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = opts(Arch::Arm64); let base = opts(Arch::Arm64);
Ok(Target { Target {
llvm_target: "arm64-apple-ios".to_string(), llvm_target: "arm64-apple-ios".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -33,5 +33,5 @@ pub fn target() -> TargetResult {
.to_string(), .to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,9 +1,9 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = opts(Arch::Arm64); let base = opts(Arch::Arm64);
Ok(Target { Target {
llvm_target: "arm64-apple-tvos".to_string(), llvm_target: "arm64-apple-tvos".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
forces_embed_bitcode: true, forces_embed_bitcode: true,
..base ..base
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::fuchsia_base::opts(); let mut base = super::fuchsia_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-fuchsia".to_string(), llvm_target: "aarch64-fuchsia".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -16,5 +16,5 @@ pub fn target() -> TargetResult {
target_vendor: String::new(), target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), 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,15 +1,15 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
// As documented in http://developer.android.com/ndk/guides/cpu-features.html // As documented in http://developer.android.com/ndk/guides/cpu-features.html
// the neon (ASIMD) and FP must exist on all android aarch64 targets. // the neon (ASIMD) and FP must exist on all android aarch64 targets.
base.features = "+neon,+fp-armv8".to_string(); base.features = "+neon,+fp-armv8".to_string();
Ok(Target { Target {
llvm_target: "aarch64-linux-android".to_string(), llvm_target: "aarch64-linux-android".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts(); let mut base = super::windows_msvc_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.has_elf_tls = true; base.has_elf_tls = true;
base.features = "+neon,+fp-armv8".to_string(); base.features = "+neon,+fp-armv8".to_string();
Ok(Target { Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(), llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "pc".to_string(), target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc, linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::cloudabi_base::opts(); let mut base = super::cloudabi_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.unsupported_abis = super::arm_base::unsupported_abis(); base.unsupported_abis = super::arm_base::unsupported_abis();
base.linker = Some("aarch64-unknown-cloudabi-cc".to_string()); base.linker = Some("aarch64-unknown-cloudabi-cc".to_string());
Ok(Target { Target {
llvm_target: "aarch64-unknown-cloudabi".to_string(), llvm_target: "aarch64-unknown-cloudabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::freebsd_base::opts(); let mut base = super::freebsd_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-freebsd".to_string(), llvm_target: "aarch64-unknown-freebsd".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -16,5 +16,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,10 +1,10 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::hermit_base::opts(); let mut base = super::hermit_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-hermit".to_string(), llvm_target: "aarch64-unknown-hermit".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -16,5 +16,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: base, options: base,
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(), llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}_mcount".to_string(), target_mcount: "\u{1}_mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-linux-musl".to_string(), llvm_target: "aarch64-unknown-linux-musl".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}_mcount".to_string(), target_mcount: "\u{1}_mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::netbsd_base::opts(); let mut base = super::netbsd_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.unsupported_abis = super::arm_base::unsupported_abis(); base.unsupported_abis = super::arm_base::unsupported_abis();
Ok(Target { Target {
llvm_target: "aarch64-unknown-netbsd".to_string(), llvm_target: "aarch64-unknown-netbsd".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
}) }
} }

View File

@ -8,7 +8,7 @@
use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Result<Target, String> { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
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(),
@ -21,7 +21,7 @@ pub fn target() -> Result<Target, String> {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
..Default::default() ..Default::default()
}; };
Ok(Target { Target {
llvm_target: "aarch64-unknown-none".to_string(), llvm_target: "aarch64-unknown-none".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -33,5 +33,5 @@ pub fn target() -> Result<Target, String> {
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
}) }
} }

View File

@ -8,7 +8,7 @@
use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Result<Target, String> { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
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(),
@ -21,7 +21,7 @@ pub fn target() -> Result<Target, String> {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
..Default::default() ..Default::default()
}; };
Ok(Target { Target {
llvm_target: "aarch64-unknown-none".to_string(), llvm_target: "aarch64-unknown-none".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -33,5 +33,5 @@ pub fn target() -> Result<Target, String> {
arch: "aarch64".to_string(), arch: "aarch64".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::openbsd_base::opts(); let mut base = super::openbsd_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.unsupported_abis = super::arm_base::unsupported_abis(); base.unsupported_abis = super::arm_base::unsupported_abis();
Ok(Target { Target {
llvm_target: "aarch64-unknown-openbsd".to_string(), llvm_target: "aarch64-unknown-openbsd".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::redox_base::opts(); let mut base = super::redox_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-redox".to_string(), llvm_target: "aarch64-unknown-redox".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -16,5 +16,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = super::windows_uwp_msvc_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.has_elf_tls = true; base.has_elf_tls = true;
Ok(Target { Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(), llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "uwp".to_string(), target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc, linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Ok(Target { Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(), llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -16,5 +16,5 @@ pub fn target() -> TargetResult {
target_vendor: "wrs".to_string(), target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
// https://developer.android.com/ndk/guides/abis.html#armeabi // https://developer.android.com/ndk/guides/abis.html#armeabi
base.features = "+strict-align,+v5te".to_string(); base.features = "+strict-align,+v5te".to_string();
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "arm-linux-androideabi".to_string(), llvm_target: "arm-linux-androideabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,9 +1,9 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { 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);
Ok(Target { Target {
llvm_target: "arm-unknown-linux-gnueabi".to_string(), llvm_target: "arm-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,9 +1,9 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { 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);
Ok(Target { Target {
llvm_target: "arm-unknown-linux-gnueabihf".to_string(), llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
// Most of these settings are copied from the arm_unknown_linux_gnueabi // Most of these settings are copied from the arm_unknown_linux_gnueabi
// target. // target.
base.features = "+strict-align,+v6".to_string(); base.features = "+strict-align,+v6".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// 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.
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
// Most of these settings are copied from the arm_unknown_linux_gnueabihf // Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target. // target.
base.features = "+strict-align,+v6,+vfp2,-d32".to_string(); base.features = "+strict-align,+v6,+vfp2,-d32".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM // It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// 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.
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
// Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R)
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions, TargetResult}; use crate::spec::{Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "armebv7r-unknown-none-eabi".to_string(), llvm_target: "armebv7r-unknown-none-eabi".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
// Targets the Cortex-R4F/R5F processor (ARMv7-R) // Targets the Cortex-R4F/R5F processor (ARMv7-R)
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions, TargetResult}; use crate::spec::{Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "armebv7r-unknown-none-eabihf".to_string(), llvm_target: "armebv7r-unknown-none-eabihf".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -27,5 +27,5 @@ pub fn target() -> TargetResult {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Ok(Target { Target {
llvm_target: "armv4t-unknown-linux-gnueabi".to_string(), llvm_target: "armv4t-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -23,5 +23,5 @@ pub fn target() -> TargetResult {
has_thumb_interworking: true, has_thumb_interworking: true,
..base ..base
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Ok(Target { Target {
llvm_target: "armv5te-unknown-linux-gnueabi".to_string(), llvm_target: "armv5te-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -23,5 +23,5 @@ pub fn target() -> TargetResult {
has_thumb_interworking: true, has_thumb_interworking: true,
..base ..base
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_musl_base::opts(); let base = super::linux_musl_base::opts();
Ok(Target { Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM // It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// 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.
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
has_thumb_interworking: true, has_thumb_interworking: true,
..base ..base
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::freebsd_base::opts(); let base = super::freebsd_base::opts();
Ok(Target { Target {
llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,9 +1,9 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { 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);
Ok(Target { Target {
llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(), llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_mcount: "__mcount".to_string(), target_mcount: "__mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,9 +1,9 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = opts(Arch::Armv7); let base = opts(Arch::Armv7);
Ok(Target { Target {
llvm_target: "armv7-apple-ios".to_string(), llvm_target: "armv7-apple-ios".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
..base ..base
}, },
}) }
} }

View File

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
// This target if is for the baseline of the Android v7a ABI // This target if is for the baseline of the Android v7a ABI
// in thumb mode. It's named armv7-* instead of thumbv7-* // in thumb mode. It's named armv7-* instead of thumbv7-*
@ -8,13 +8,13 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
// See https://developer.android.com/ndk/guides/abis.html#v7a // See https://developer.android.com/ndk/guides/abis.html#v7a
// for target ABI requirements. // for target ABI requirements.
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
base.features = "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(); base.features = "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string());
Ok(Target { Target {
llvm_target: "armv7-none-linux-android".to_string(), llvm_target: "armv7-none-linux-android".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::cloudabi_base::opts(); let mut base = super::cloudabi_base::opts();
base.cpu = "cortex-a8".to_string(); base.cpu = "cortex-a8".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -8,7 +8,7 @@ pub fn target() -> TargetResult {
base.unsupported_abis = super::arm_base::unsupported_abis(); base.unsupported_abis = super::arm_base::unsupported_abis();
base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string()); base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string());
Ok(Target { Target {
llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(), llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::freebsd_base::opts(); let base = super::freebsd_base::opts();
Ok(Target { Target {
llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Ok(Target { Target {
llvm_target: "armv7-unknown-linux-gnueabi".to_string(), llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -25,5 +25,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_base::opts(); let base = super::linux_base::opts();
Ok(Target { Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}__gnu_mcount_nc".to_string(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_musl_base::opts(); let base = super::linux_musl_base::opts();
// Most of these settings are copied from the armv7_unknown_linux_gnueabi // Most of these settings are copied from the armv7_unknown_linux_gnueabi
// target. // target.
Ok(Target { Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// 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.
@ -30,5 +30,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::linux_musl_base::opts(); let base = super::linux_musl_base::opts();
Ok(Target { Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM // It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// 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.
@ -29,5 +29,5 @@ pub fn target() -> TargetResult {
target_mcount: "\u{1}mcount".to_string(), target_mcount: "\u{1}mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::netbsd_base::opts(); let base = super::netbsd_base::opts();
Ok(Target { Target {
llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(), llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
target_mcount: "__mcount".to_string(), target_mcount: "__mcount".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,8 +1,8 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = super::vxworks_base::opts(); let base = super::vxworks_base::opts();
Ok(Target { Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
..base ..base
}, },
}) }
} }

View File

@ -19,7 +19,7 @@
use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Result<Target, String> { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
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(),
@ -32,7 +32,7 @@ pub fn target() -> Result<Target, String> {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}; };
Ok(Target { Target {
llvm_target: "armv7a-none-eabi".to_string(), llvm_target: "armv7a-none-eabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -44,5 +44,5 @@ pub fn target() -> Result<Target, String> {
arch: "arm".to_string(), arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
}) }
} }

View File

@ -7,7 +7,7 @@
use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Result<Target, String> { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
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(),
@ -20,7 +20,7 @@ pub fn target() -> Result<Target, String> {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}; };
Ok(Target { Target {
llvm_target: "armv7a-none-eabihf".to_string(), llvm_target: "armv7a-none-eabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -32,5 +32,5 @@ pub fn target() -> Result<Target, String> {
arch: "arm".to_string(), arch: "arm".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: opts, options: opts,
}) }
} }

View File

@ -1,10 +1,10 @@
// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions, TargetResult}; use crate::spec::{Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "armv7r-unknown-none-eabi".to_string(), llvm_target: "armv7r-unknown-none-eabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -26,5 +26,5 @@ pub fn target() -> TargetResult {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,10 +1,10 @@
// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions, TargetResult}; use crate::spec::{Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "armv7r-unknown-none-eabihf".to_string(), llvm_target: "armv7r-unknown-none-eabihf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -27,5 +27,5 @@ pub fn target() -> TargetResult {
emit_debug_gdb_scripts: false, emit_debug_gdb_scripts: false,
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,9 +1,9 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = opts(Arch::Armv7s); let base = opts(Arch::Armv7s);
Ok(Target { Target {
llvm_target: "armv7s-apple-ios".to_string(), llvm_target: "armv7s-apple-ios".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
unsupported_abis: super::arm_base::unsupported_abis(), unsupported_abis: super::arm_base::unsupported_abis(),
..base ..base
}, },
}) }
} }

View File

@ -1,12 +1,12 @@
use super::{wasm32_unknown_emscripten, LinkerFlavor, Target}; use super::{wasm32_unknown_emscripten, LinkerFlavor, Target};
pub fn target() -> Result<Target, String> { pub fn target() -> Target {
let mut target = wasm32_unknown_emscripten::target()?; let mut target = wasm32_unknown_emscripten::target();
target target
.options .options
.post_link_args .post_link_args
.entry(LinkerFlavor::Em) .entry(LinkerFlavor::Em)
.or_default() .or_default()
.extend(vec!["-s".to_string(), "WASM=0".to_string()]); .extend(vec!["-s".to_string(), "WASM=0".to_string()]);
Ok(target) target
} }

View File

@ -1,10 +1,10 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
/// A base target for AVR devices using the GNU toolchain. /// A base target for AVR devices using the GNU toolchain.
/// ///
/// Requires GNU avr-gcc and avr-binutils on the host system. /// Requires GNU avr-gcc and avr-binutils on the host system.
pub fn target(target_cpu: String) -> TargetResult { pub fn target(target_cpu: String) -> Target {
Ok(Target { 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(),
@ -49,5 +49,5 @@ pub fn target(target_cpu: String) -> TargetResult {
atomic_cas: false, atomic_cas: false,
..TargetOptions::default() ..TargetOptions::default()
}, },
}) }
} }

View File

@ -1,5 +1,5 @@
use crate::spec::TargetResult; use crate::spec::Target;
pub fn target() -> TargetResult { pub fn target() -> Target {
super::avr_gnu_base::target("atmega328".to_owned()) super::avr_gnu_base::target("atmega328".to_owned())
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkArgs, LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkArgs, LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "hexagonv60".to_string(); base.cpu = "hexagonv60".to_string();
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
@ -17,7 +17,7 @@ pub fn target() -> TargetResult {
base.pre_link_args = LinkArgs::new(); base.pre_link_args = LinkArgs::new();
base.post_link_args = LinkArgs::new(); base.post_link_args = LinkArgs::new();
Ok(Target { Target {
llvm_target: "hexagon-unknown-linux-musl".to_string(), llvm_target: "hexagon-unknown-linux-musl".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -35,5 +35,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,9 +1,9 @@
use super::apple_sdk_base::{opts, Arch}; use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let base = opts(Arch::I386); let base = opts(Arch::I386);
Ok(Target { Target {
llvm_target: "i386-apple-ios".to_string(), llvm_target: "i386-apple-ios".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,8 +1,8 @@
use crate::spec::TargetResult; use crate::spec::Target;
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::i686_pc_windows_msvc::target()?; let mut base = super::i686_pc_windows_msvc::target();
base.options.cpu = "pentium".to_string(); base.options.cpu = "pentium".to_string();
base.llvm_target = "i586-pc-windows-msvc".to_string(); base.llvm_target = "i586-pc-windows-msvc".to_string();
Ok(base) base
} }

View File

@ -1,8 +1,8 @@
use crate::spec::TargetResult; use crate::spec::Target;
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::i686_unknown_linux_gnu::target()?; let mut base = super::i686_unknown_linux_gnu::target();
base.options.cpu = "pentium".to_string(); base.options.cpu = "pentium".to_string();
base.llvm_target = "i586-unknown-linux-gnu".to_string(); base.llvm_target = "i586-unknown-linux-gnu".to_string();
Ok(base) base
} }

View File

@ -1,8 +1,8 @@
use crate::spec::TargetResult; use crate::spec::Target;
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::i686_unknown_linux_musl::target()?; let mut base = super::i686_unknown_linux_musl::target();
base.options.cpu = "pentium".to_string(); base.options.cpu = "pentium".to_string();
base.llvm_target = "i586-unknown-linux-musl".to_string(); base.llvm_target = "i586-unknown-linux-musl".to_string();
Ok(base) base
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::apple_base::opts(); let mut base = super::apple_base::opts();
base.cpu = "yonah".to_string(); base.cpu = "yonah".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -15,7 +15,7 @@ pub fn target() -> TargetResult {
let arch = "i686"; let arch = "i686";
let llvm_target = super::apple_base::macos_llvm_target(&arch); let llvm_target = super::apple_base::macos_llvm_target(&arch);
Ok(Target { Target {
llvm_target, llvm_target,
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -29,5 +29,5 @@ pub fn target() -> TargetResult {
target_vendor: "apple".to_string(), target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc, 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,9 +1,9 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, 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.
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -13,7 +13,7 @@ pub fn target() -> TargetResult {
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".to_string(); base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".to_string();
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-linux-android".to_string(), llvm_target: "i686-linux-android".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -27,5 +27,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_gnu_base::opts(); let mut base = super::windows_gnu_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.pre_link_args base.pre_link_args
@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
.unwrap() .unwrap()
.push("-Wl,--large-address-aware".to_string()); .push("-Wl,--large-address-aware".to_string());
Ok(Target { Target {
llvm_target: "i686-pc-windows-gnu".to_string(), llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -30,5 +30,5 @@ pub fn target() -> TargetResult {
target_vendor: "pc".to_string(), target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts(); let mut base = super::windows_msvc_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -20,7 +20,7 @@ pub fn target() -> TargetResult {
.unwrap() .unwrap()
.extend(pre_link_args_msvc); .extend(pre_link_args_msvc);
Ok(Target { Target {
llvm_target: "i686-pc-windows-msvc".to_string(), llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -34,5 +34,5 @@ pub fn target() -> TargetResult {
target_vendor: "pc".to_string(), target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc, linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::cloudabi_base::opts(); let mut base = super::cloudabi_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -8,7 +8,7 @@ pub fn target() -> TargetResult {
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-cloudabi".to_string(), llvm_target: "i686-unknown-cloudabi".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::freebsd_base::opts(); let mut base = super::freebsd_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -9,7 +9,7 @@ pub fn target() -> TargetResult {
pre_link_args.push("-Wl,-znotext".to_string()); pre_link_args.push("-Wl,-znotext".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-freebsd".to_string(), llvm_target: "i686-unknown-freebsd".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -23,5 +23,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::haiku_base::opts(); let mut base = super::haiku_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".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()]);
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-haiku".to_string(), llvm_target: "i686-unknown-haiku".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-linux-gnu".to_string(), llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -22,7 +22,7 @@ pub fn target() -> TargetResult {
// https://llvm.org/bugs/show_bug.cgi?id=30879 // https://llvm.org/bugs/show_bug.cgi?id=30879
base.eliminate_frame_pointer = false; base.eliminate_frame_pointer = false;
Ok(Target { Target {
llvm_target: "i686-unknown-linux-musl".to_string(), llvm_target: "i686-unknown-linux-musl".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -36,5 +36,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::netbsd_base::opts(); let mut base = super::netbsd_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-netbsdelf".to_string(), llvm_target: "i686-unknown-netbsdelf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::openbsd_base::opts(); let mut base = super::openbsd_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -8,7 +8,7 @@ pub fn target() -> TargetResult {
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-fuse-ld=lld".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-fuse-ld=lld".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-openbsd".to_string(), llvm_target: "i686-unknown-openbsd".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -5,9 +5,9 @@
// 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, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::uefi_msvc_base::opts(); let mut base = super::uefi_msvc_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
@ -76,7 +76,7 @@ pub fn target() -> TargetResult {
// As a result, we choose -gnu for i686 version before those intrisics are implemented in // As a result, we choose -gnu for i686 version before those intrisics are implemented in
// compiler-builtins. After compiler-builtins implements all required intrinsics, we may // compiler-builtins. After compiler-builtins implements all required intrinsics, we may
// remove -gnu and use the default one. // remove -gnu and use the default one.
Ok(Target { Target {
llvm_target: "i686-unknown-windows-gnu".to_string(), llvm_target: "i686-unknown-windows-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -91,5 +91,5 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Lld(LldFlavor::Link), linker_flavor: LinkerFlavor::Lld(LldFlavor::Link),
options: base, options: base,
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, LldFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_uwp_gnu_base::opts(); let mut base = super::windows_uwp_gnu_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.pre_link_args base.pre_link_args
@ -15,7 +15,7 @@ pub fn target() -> TargetResult {
.unwrap() .unwrap()
.push("-Wl,--large-address-aware".to_string()); .push("-Wl,--large-address-aware".to_string());
Ok(Target { Target {
llvm_target: "i686-pc-windows-gnu".to_string(), llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -29,5 +29,5 @@ pub fn target() -> TargetResult {
target_vendor: "uwp".to_string(), target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = super::windows_uwp_msvc_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.has_elf_tls = true; base.has_elf_tls = true;
Ok(Target { Target {
llvm_target: "i686-pc-windows-msvc".to_string(), llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
target_vendor: "uwp".to_string(), target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc, linker_flavor: LinkerFlavor::Msvc,
options: base, options: base,
}) }
} }

View File

@ -1,13 +1,13 @@
use crate::spec::{LinkerFlavor, Target, TargetResult}; use crate::spec::{LinkerFlavor, Target};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
base.cpu = "pentium4".to_string(); base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.stack_probes = true; base.stack_probes = true;
Ok(Target { Target {
llvm_target: "i686-unknown-linux-gnu".to_string(), llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
target_vendor: "wrs".to_string(), target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: base, options: base,
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mips64-unknown-linux-gnuabi64".to_string(), llvm_target: "mips64-unknown-linux-gnuabi64".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "mips64r2".to_string(); base.cpu = "mips64r2".to_string();
base.features = "+mips64r2".to_string(); base.features = "+mips64r2".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(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(), target_endian: "big".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(), llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "mips64r2".to_string(); base.cpu = "mips64r2".to_string();
base.features = "+mips64r2".to_string(); base.features = "+mips64r2".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(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(), target_endian: "little".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mips-unknown-linux-gnu".to_string(), llvm_target: "mips-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "mips32r2".to_string(); base.cpu = "mips32r2".to_string();
base.features = "+mips32r2,+soft-float".to_string(); base.features = "+mips32r2,+soft-float".to_string();
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
base.crt_static_default = false; base.crt_static_default = false;
Ok(Target { Target {
llvm_target: "mips-unknown-linux-musl".to_string(), llvm_target: "mips-unknown-linux-musl".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mips-unknown-linux-uclibc".to_string(), llvm_target: "mips-unknown-linux-uclibc".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,14 +1,14 @@
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel};
use crate::spec::{Target, TargetOptions, TargetResult}; use crate::spec::{Target, TargetOptions};
// The PSP has custom linker requirements. // The PSP has custom linker requirements.
const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut pre_link_args = LinkArgs::new(); let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["--emit-relocs".to_string()]); pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["--emit-relocs".to_string()]);
Ok(Target { Target {
llvm_target: "mipsel-sony-psp".to_string(), llvm_target: "mipsel-sony-psp".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -36,5 +36,5 @@ pub fn target() -> TargetResult {
link_script: Some(LINKER_SCRIPT.to_string()), link_script: Some(LINKER_SCRIPT.to_string()),
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsel-unknown-linux-gnu".to_string(), llvm_target: "mipsel-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "mips32r2".to_string(); base.cpu = "mips32r2".to_string();
base.features = "+mips32r2,+soft-float".to_string(); base.features = "+mips32r2,+soft-float".to_string();
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
base.crt_static_default = false; base.crt_static_default = false;
Ok(Target { Target {
llvm_target: "mipsel-unknown-linux-musl".to_string(), llvm_target: "mipsel-unknown-linux-musl".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsel-unknown-linux-uclibc".to_string(), llvm_target: "mipsel-unknown-linux-uclibc".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsisa32r6-unknown-linux-gnu".to_string(), llvm_target: "mipsisa32r6-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -20,5 +20,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsisa32r6el-unknown-linux-gnu".to_string(), llvm_target: "mipsisa32r6el-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".to_string(), llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".to_string(), llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

View File

@ -430,48 +430,23 @@ impl fmt::Display for LinkOutputKind {
} }
} }
pub enum LoadTargetError {
BuiltinTargetNotFound(String),
Other(String),
}
pub type LinkArgs = BTreeMap<LinkerFlavor, Vec<String>>; pub type LinkArgs = BTreeMap<LinkerFlavor, Vec<String>>;
pub type TargetResult = Result<Target, String>;
macro_rules! supported_targets { macro_rules! supported_targets {
( $(($( $triple:literal, )+ $module:ident ),)+ ) => { ( $(($( $triple:literal, )+ $module:ident ),)+ ) => {
$(mod $module;)+ $(mod $module;)+
/// List of supported targets /// List of supported targets
const TARGETS: &[&str] = &[$($($triple),+),+]; pub const TARGETS: &[&str] = &[$($($triple),+),+];
fn load_specific(target: &str) -> Result<Target, LoadTargetError> { fn load_builtin(target: &str) -> Option<Target> {
match target { let mut t = match target {
$( $( $($triple)|+ => $module::target(), )+
$($triple)|+ => { _ => return None,
let mut t = $module::target() };
.map_err(LoadTargetError::Other)?; t.options.is_builtin = true;
t.options.is_builtin = true; debug!("got builtin target: {:?}", t);
Some(t)
// round-trip through the JSON parser to ensure at
// run-time that the parser works correctly
t = Target::from_json(t.to_json())
.map_err(LoadTargetError::Other)?;
debug!("got builtin target: {:?}", t);
Ok(t)
},
)+
_ => Err(LoadTargetError::BuiltinTargetNotFound(
format!("Unable to find target: {}", target)))
}
}
pub fn get_targets() -> impl Iterator<Item = String> {
TARGETS.iter().filter_map(|t| -> Option<String> {
load_specific(t)
.and(Ok(t.to_string()))
.ok()
})
} }
#[cfg(test)] #[cfg(test)]
@ -1140,7 +1115,7 @@ impl Target {
} }
/// Loads a target descriptor from a JSON object. /// Loads a target descriptor from a JSON object.
pub fn from_json(obj: Json) -> TargetResult { pub fn from_json(obj: Json) -> Result<Target, String> {
// While ugly, this code must remain this way to retain // While ugly, this code must remain this way to retain
// compatibility with existing JSON fields and the internal // compatibility with existing JSON fields and the internal
// expected naming of the Target and TargetOptions structs. // expected naming of the Target and TargetOptions structs.
@ -1537,11 +1512,9 @@ impl Target {
match *target_triple { match *target_triple {
TargetTriple::TargetTriple(ref target_triple) => { TargetTriple::TargetTriple(ref target_triple) => {
// check if triple is in list of supported targets // check if triple is in list of built-in targets
match load_specific(target_triple) { if let Some(t) = load_builtin(target_triple) {
Ok(t) => return Ok(t), return Ok(t);
Err(LoadTargetError::BuiltinTargetNotFound(_)) => (),
Err(LoadTargetError::Other(e)) => return Err(e),
} }
// search for a file named `target_triple`.json in RUST_TARGET_PATH // search for a file named `target_triple`.json in RUST_TARGET_PATH

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "msp430-none-elf".to_string(), llvm_target: "msp430-none-elf".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "16".to_string(), target_pointer_width: "16".to_string(),
@ -60,5 +60,5 @@ pub fn target() -> TargetResult {
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,10 +1,8 @@
use crate::spec::abi::Abi; use crate::spec::abi::Abi;
use crate::spec::{ use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions};
LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, TargetResult,
};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(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(),
@ -71,5 +69,5 @@ pub fn target() -> TargetResult {
..Default::default() ..Default::default()
}, },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::freebsd_base::opts(); let mut base = super::freebsd_base::opts();
base.cpu = "ppc64".to_string(); base.cpu = "ppc64".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
llvm_target: "powerpc64-unknown-freebsd".to_string(), llvm_target: "powerpc64-unknown-freebsd".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,6 +1,6 @@
use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.cpu = "ppc64".to_string(); base.cpu = "ppc64".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
@ -10,7 +10,7 @@ pub fn target() -> TargetResult {
// for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474 // for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474
base.relro_level = RelroLevel::Partial; base.relro_level = RelroLevel::Partial;
Ok(Target { Target {
llvm_target: "powerpc64-unknown-linux-gnu".to_string(), llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "ppc64".to_string(); base.cpu = "ppc64".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
llvm_target: "powerpc64-unknown-linux-musl".to_string(), llvm_target: "powerpc64-unknown-linux-musl".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
base.cpu = "ppc64".to_string(); base.cpu = "ppc64".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
llvm_target: "powerpc64-unknown-linux-gnu".to_string(), llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "wrs".to_string(), target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { ..base }, options: TargetOptions { ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.cpu = "ppc64le".to_string(); base.cpu = "ppc64le".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(), llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.cpu = "ppc64le".to_string(); base.cpu = "ppc64le".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Target {
llvm_target: "powerpc64le-unknown-linux-musl".to_string(), llvm_target: "powerpc64le-unknown-linux-musl".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "64".to_string(), target_pointer_width: "64".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-linux-gnu".to_string(), llvm_target: "powerpc-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_base::opts(); let mut base = super::linux_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-linux-gnuspe".to_string(), llvm_target: "powerpc-unknown-linux-gnuspe".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-linux-musl".to_string(), llvm_target: "powerpc-unknown-linux-musl".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base },
}) }
} }

View File

@ -1,11 +1,11 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::netbsd_base::opts(); let mut base = super::netbsd_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-netbsd".to_string(), llvm_target: "powerpc-unknown-netbsd".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -17,5 +17,5 @@ pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-linux-gnu".to_string(), llvm_target: "powerpc-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -18,5 +18,5 @@ pub fn target() -> TargetResult {
target_vendor: "wrs".to_string(), target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { features: "+secure-plt".to_string(), ..base }, options: TargetOptions { features: "+secure-plt".to_string(), ..base },
}) }
} }

View File

@ -1,12 +1,12 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
let mut base = super::vxworks_base::opts(); let mut base = super::vxworks_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string());
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string());
base.max_atomic_width = Some(32); base.max_atomic_width = Some(32);
Ok(Target { Target {
llvm_target: "powerpc-unknown-linux-gnuspe".to_string(), llvm_target: "powerpc-unknown-linux-gnuspe".to_string(),
target_endian: "big".to_string(), target_endian: "big".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -22,5 +22,5 @@ pub fn target() -> TargetResult {
features: "+secure-plt,+msync".to_string(), features: "+secure-plt,+msync".to_string(),
..base ..base
}, },
}) }
} }

View File

@ -1,7 +1,7 @@
use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions, TargetResult}; use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions};
pub fn target() -> TargetResult { pub fn target() -> Target {
Ok(Target { Target {
llvm_target: "riscv32-unknown-linux-gnu".to_string(), llvm_target: "riscv32-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(), target_endian: "little".to_string(),
target_pointer_width: "32".to_string(), target_pointer_width: "32".to_string(),
@ -21,5 +21,5 @@ pub fn target() -> TargetResult {
max_atomic_width: Some(32), max_atomic_width: Some(32),
..super::linux_base::opts() ..super::linux_base::opts()
}, },
}) }
} }

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