Auto merge of #31312 - alexcrichton:no-le-in-powerpc64le, r=alexcrichton

Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the
`target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the
`powerpc64le` target does indeed set the `target_arch` as `powerpc64le`,
causing a bit of inconsistency between theset two.

As these are just the same instance of one instruction set, let's use
`target_endian` to switch between them and only set the `target_arch` as one
value. This should cut down on the number of `#[cfg]` annotations necessary and
all around be a little more ergonomic.
This commit is contained in:
bors 2016-02-02 17:11:48 +00:00
commit 2dc132e4d2
13 changed files with 17 additions and 46 deletions

View File

@ -39,7 +39,6 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
("msp430", "msp430"), ("msp430", "msp430"),
("powerpc", "powerpc"), ("powerpc", "powerpc"),
("powerpc64", "powerpc64"), ("powerpc64", "powerpc64"),
("powerpc64le", "powerpc64le"),
("s390x", "systemz"), ("s390x", "systemz"),
("sparc", "sparc"), ("sparc", "sparc"),
("x86_64", "x86_64"), ("x86_64", "x86_64"),

View File

@ -2044,7 +2044,7 @@ The following configurations must be defined by the implementation:
production. For example, it controls the behavior of the standard library's production. For example, it controls the behavior of the standard library's
`debug_assert!` macro. `debug_assert!` macro.
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"` * `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
`"mips"`, `"powerpc"`, `"powerpc64"`, `"powerpc64le"`, `"arm"`, or `"aarch64"`. `"mips"`, `"powerpc"`, `"powerpc64"`, `"arm"`, or `"aarch64"`.
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or * `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
`"big"`. `"big"`.
* `target_env = ".."` - An option provided by the compiler by default * `target_env = ".."` - An option provided by the compiler by default

View File

@ -51,7 +51,6 @@ extern "C" {
// constant at the call site and the branch will be optimized out. // constant at the call site and the branch will be optimized out.
#[cfg(all(any(target_arch = "arm", #[cfg(all(any(target_arch = "arm",
target_arch = "mips", target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc")))] target_arch = "powerpc")))]
const MIN_ALIGN: usize = 8; const MIN_ALIGN: usize = 8;
#[cfg(all(any(target_arch = "x86", #[cfg(all(any(target_arch = "x86",

View File

@ -29,10 +29,8 @@ extern crate libc;
#[cfg(all(any(target_arch = "x86", #[cfg(all(any(target_arch = "x86",
target_arch = "arm", target_arch = "arm",
target_arch = "mips", target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64")))]
target_arch = "powerpc64le")))]
const MIN_ALIGN: usize = 8; const MIN_ALIGN: usize = 8;
#[cfg(all(any(target_arch = "x86_64", #[cfg(all(any(target_arch = "x86_64",
target_arch = "aarch64")))] target_arch = "aarch64")))]

View File

@ -79,8 +79,8 @@ pub struct Target {
pub target_env: String, pub target_env: String,
/// Vendor name to use for conditional compilation. /// Vendor name to use for conditional compilation.
pub target_vendor: String, pub target_vendor: String,
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm", /// Architecture to use for ABI considerations. Valid options: "x86",
/// "aarch64", "mips", "powerpc", "powerpc64" and "powerpc64le". "mips" includes "mipsel". /// "x86_64", "arm", "aarch64", "mips", "powerpc", and "powerpc64".
pub arch: String, pub arch: String,
/// Optional settings with defaults. /// Optional settings with defaults.
pub options: TargetOptions, pub options: TargetOptions,

View File

@ -19,7 +19,7 @@ pub fn 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(),
arch: "powerpc64le".to_string(), arch: "powerpc64".to_string(),
target_os: "linux".to_string(), target_os: "linux".to_string(),
target_env: "gnu".to_string(), target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(), target_vendor: "unknown".to_string(),

View File

@ -128,7 +128,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
}, },
"mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def), "mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
"powerpc" => cabi_powerpc::compute_abi_info(ccx, atys, rty, ret_def), "powerpc" => cabi_powerpc::compute_abi_info(ccx, atys, rty, ret_def),
"powerpc64" | "powerpc64le" => cabi_powerpc64::compute_abi_info(ccx, atys, rty, ret_def), "powerpc64" => cabi_powerpc64::compute_abi_info(ccx, atys, rty, ret_def),
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a) a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a)
), ),
} }

View File

@ -613,10 +613,8 @@ pub mod consts {
/// - arm /// - arm
/// - aarch64 /// - aarch64
/// - mips /// - mips
/// - mipsel
/// - powerpc /// - powerpc
/// - powerpc64 /// - powerpc64
/// - powerpc64le
#[stable(feature = "env", since = "1.0.0")] #[stable(feature = "env", since = "1.0.0")]
pub const ARCH: &'static str = super::arch::ARCH; pub const ARCH: &'static str = super::arch::ARCH;
@ -859,11 +857,6 @@ mod arch {
pub const ARCH: &'static str = "mips"; pub const ARCH: &'static str = "mips";
} }
#[cfg(target_arch = "mipsel")]
mod arch {
pub const ARCH: &'static str = "mipsel";
}
#[cfg(target_arch = "powerpc")] #[cfg(target_arch = "powerpc")]
mod arch { mod arch {
pub const ARCH: &'static str = "powerpc"; pub const ARCH: &'static str = "powerpc";
@ -874,11 +867,6 @@ mod arch {
pub const ARCH: &'static str = "powerpc64"; pub const ARCH: &'static str = "powerpc64";
} }
#[cfg(target_arch = "powerpc64le")]
mod arch {
pub const ARCH: &'static str = "powerpc64le";
}
#[cfg(target_arch = "le32")] #[cfg(target_arch = "le32")]
mod arch { mod arch {
pub const ARCH: &'static str = "le32"; pub const ARCH: &'static str = "le32";

View File

@ -86,8 +86,7 @@ mod arch {
} }
} }
#[cfg(any(target_arch = "mips", #[cfg(target_arch = "mips")]
target_arch = "mipsel"))]
mod arch { mod arch {
use super::mode_t; use super::mode_t;
use os::raw::{c_long, c_ulong}; use os::raw::{c_long, c_ulong};
@ -214,8 +213,7 @@ mod arch {
} }
} }
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64", #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
target_arch = "powerpc64le"))]
mod arch { mod arch {
use super::{dev_t, mode_t}; use super::{dev_t, mode_t};
use os::raw::{c_long, c_int}; use os::raw::{c_long, c_int};

View File

@ -16,15 +16,13 @@
all(target_os = "linux", any(target_arch = "aarch64", all(target_os = "linux", any(target_arch = "aarch64",
target_arch = "arm", target_arch = "arm",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64"))))]
target_arch = "powerpc64le"))))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
#[cfg(not(any(target_os = "android", #[cfg(not(any(target_os = "android",
all(target_os = "linux", any(target_arch = "aarch64", all(target_os = "linux", any(target_arch = "aarch64",
target_arch = "arm", target_arch = "arm",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64")))))]
target_arch = "powerpc64le")))))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8;

View File

@ -31,8 +31,7 @@ mod imp {
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64", target_arch = "aarch64",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64")))]
target_arch = "powerpc64le")))]
fn getrandom(buf: &mut [u8]) -> libc::c_long { fn getrandom(buf: &mut [u8]) -> libc::c_long {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
const NR_GETRANDOM: libc::c_long = 318; const NR_GETRANDOM: libc::c_long = 318;
@ -40,8 +39,7 @@ mod imp {
const NR_GETRANDOM: libc::c_long = 355; const NR_GETRANDOM: libc::c_long = 355;
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
const NR_GETRANDOM: libc::c_long = 384; const NR_GETRANDOM: libc::c_long = 384;
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64", #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
target_arch = "powerpc64le"))]
const NR_GETRANDOM: libc::c_long = 359; const NR_GETRANDOM: libc::c_long = 359;
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
const NR_GETRANDOM: libc::c_long = 278; const NR_GETRANDOM: libc::c_long = 278;
@ -57,8 +55,7 @@ mod imp {
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64", target_arch = "aarch64",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64"))))]
target_arch = "powerpc64le"))))]
fn getrandom(_buf: &mut [u8]) -> libc::c_long { -1 } fn getrandom(_buf: &mut [u8]) -> libc::c_long { -1 }
fn getrandom_fill_bytes(v: &mut [u8]) { fn getrandom_fill_bytes(v: &mut [u8]) {
@ -96,8 +93,7 @@ mod imp {
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64", target_arch = "aarch64",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64")))]
target_arch = "powerpc64le")))]
fn is_getrandom_available() -> bool { fn is_getrandom_available() -> bool {
use sync::atomic::{AtomicBool, Ordering}; use sync::atomic::{AtomicBool, Ordering};
use sync::Once; use sync::Once;
@ -126,8 +122,7 @@ mod imp {
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64", target_arch = "aarch64",
target_arch = "powerpc", target_arch = "powerpc",
target_arch = "powerpc64", target_arch = "powerpc64"))))]
target_arch = "powerpc64le"))))]
fn is_getrandom_available() -> bool { false } fn is_getrandom_available() -> bool { false }
/// A random number generator that retrieves randomness straight from /// A random number generator that retrieves randomness straight from

View File

@ -80,11 +80,10 @@ pub const unwinder_private_data_size: usize = 5;
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
pub const unwinder_private_data_size: usize = 2; pub const unwinder_private_data_size: usize = 2;
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))] #[cfg(target_arch = "mips")]
pub const unwinder_private_data_size: usize = 2; pub const unwinder_private_data_size: usize = 2;
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64", #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
target_arch = "powerpc64le"))]
pub const unwinder_private_data_size: usize = 2; pub const unwinder_private_data_size: usize = 2;
#[repr(C)] #[repr(C)]

View File

@ -24,6 +24,3 @@ pub fn main() { }
#[cfg(target_arch = "powerpc64")] #[cfg(target_arch = "powerpc64")]
pub fn main() { } pub fn main() { }
#[cfg(target_arch = "powerpc64le")]
pub fn main() { }