Skip to content

Commit 2dc132e

Browse files
committed
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.
2 parents 59b7c90 + 8f803c2 commit 2dc132e

File tree

13 files changed

+17
-46
lines changed

13 files changed

+17
-46
lines changed

src/compiletest/util.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
3939
("msp430", "msp430"),
4040
("powerpc", "powerpc"),
4141
("powerpc64", "powerpc64"),
42-
("powerpc64le", "powerpc64le"),
4342
("s390x", "systemz"),
4443
("sparc", "sparc"),
4544
("x86_64", "x86_64"),

src/doc/reference.md

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

src/liballoc_jemalloc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ extern "C" {
5151
// constant at the call site and the branch will be optimized out.
5252
#[cfg(all(any(target_arch = "arm",
5353
target_arch = "mips",
54-
target_arch = "mipsel",
5554
target_arch = "powerpc")))]
5655
const MIN_ALIGN: usize = 8;
5756
#[cfg(all(any(target_arch = "x86",

src/liballoc_system/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ extern crate libc;
2929
#[cfg(all(any(target_arch = "x86",
3030
target_arch = "arm",
3131
target_arch = "mips",
32-
target_arch = "mipsel",
3332
target_arch = "powerpc",
34-
target_arch = "powerpc64",
35-
target_arch = "powerpc64le")))]
33+
target_arch = "powerpc64")))]
3634
const MIN_ALIGN: usize = 8;
3735
#[cfg(all(any(target_arch = "x86_64",
3836
target_arch = "aarch64")))]

src/librustc_back/target/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ pub struct Target {
7979
pub target_env: String,
8080
/// Vendor name to use for conditional compilation.
8181
pub target_vendor: String,
82-
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
83-
/// "aarch64", "mips", "powerpc", "powerpc64" and "powerpc64le". "mips" includes "mipsel".
82+
/// Architecture to use for ABI considerations. Valid options: "x86",
83+
/// "x86_64", "arm", "aarch64", "mips", "powerpc", and "powerpc64".
8484
pub arch: String,
8585
/// Optional settings with defaults.
8686
pub options: TargetOptions,

src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn target() -> Target {
1919
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
2020
target_endian: "little".to_string(),
2121
target_pointer_width: "64".to_string(),
22-
arch: "powerpc64le".to_string(),
22+
arch: "powerpc64".to_string(),
2323
target_os: "linux".to_string(),
2424
target_env: "gnu".to_string(),
2525
target_vendor: "unknown".to_string(),

src/librustc_trans/trans/cabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
128128
},
129129
"mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
130130
"powerpc" => cabi_powerpc::compute_abi_info(ccx, atys, rty, ret_def),
131-
"powerpc64" | "powerpc64le" => cabi_powerpc64::compute_abi_info(ccx, atys, rty, ret_def),
131+
"powerpc64" => cabi_powerpc64::compute_abi_info(ccx, atys, rty, ret_def),
132132
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a)
133133
),
134134
}

src/libstd/env.rs

-12
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,8 @@ pub mod consts {
613613
/// - arm
614614
/// - aarch64
615615
/// - mips
616-
/// - mipsel
617616
/// - powerpc
618617
/// - powerpc64
619-
/// - powerpc64le
620618
#[stable(feature = "env", since = "1.0.0")]
621619
pub const ARCH: &'static str = super::arch::ARCH;
622620

@@ -859,11 +857,6 @@ mod arch {
859857
pub const ARCH: &'static str = "mips";
860858
}
861859

862-
#[cfg(target_arch = "mipsel")]
863-
mod arch {
864-
pub const ARCH: &'static str = "mipsel";
865-
}
866-
867860
#[cfg(target_arch = "powerpc")]
868861
mod arch {
869862
pub const ARCH: &'static str = "powerpc";
@@ -874,11 +867,6 @@ mod arch {
874867
pub const ARCH: &'static str = "powerpc64";
875868
}
876869

877-
#[cfg(target_arch = "powerpc64le")]
878-
mod arch {
879-
pub const ARCH: &'static str = "powerpc64le";
880-
}
881-
882870
#[cfg(target_arch = "le32")]
883871
mod arch {
884872
pub const ARCH: &'static str = "le32";

src/libstd/os/linux/raw.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ mod arch {
8686
}
8787
}
8888

89-
#[cfg(any(target_arch = "mips",
90-
target_arch = "mipsel"))]
89+
#[cfg(target_arch = "mips")]
9190
mod arch {
9291
use super::mode_t;
9392
use os::raw::{c_long, c_ulong};
@@ -214,8 +213,7 @@ mod arch {
214213
}
215214
}
216215

217-
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
218-
target_arch = "powerpc64le"))]
216+
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
219217
mod arch {
220218
use super::{dev_t, mode_t};
221219
use os::raw::{c_long, c_int};

src/libstd/os/raw.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
all(target_os = "linux", any(target_arch = "aarch64",
1717
target_arch = "arm",
1818
target_arch = "powerpc",
19-
target_arch = "powerpc64",
20-
target_arch = "powerpc64le"))))]
19+
target_arch = "powerpc64"))))]
2120
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
2221
#[cfg(not(any(target_os = "android",
2322
all(target_os = "linux", any(target_arch = "aarch64",
2423
target_arch = "arm",
2524
target_arch = "powerpc",
26-
target_arch = "powerpc64",
27-
target_arch = "powerpc64le")))))]
25+
target_arch = "powerpc64")))))]
2826
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
2927
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
3028
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8;

src/libstd/rand/os.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ mod imp {
3131
target_arch = "arm",
3232
target_arch = "aarch64",
3333
target_arch = "powerpc",
34-
target_arch = "powerpc64",
35-
target_arch = "powerpc64le")))]
34+
target_arch = "powerpc64")))]
3635
fn getrandom(buf: &mut [u8]) -> libc::c_long {
3736
#[cfg(target_arch = "x86_64")]
3837
const NR_GETRANDOM: libc::c_long = 318;
3938
#[cfg(target_arch = "x86")]
4039
const NR_GETRANDOM: libc::c_long = 355;
4140
#[cfg(target_arch = "arm")]
4241
const NR_GETRANDOM: libc::c_long = 384;
43-
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64",
44-
target_arch = "powerpc64le"))]
42+
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
4543
const NR_GETRANDOM: libc::c_long = 359;
4644
#[cfg(target_arch = "aarch64")]
4745
const NR_GETRANDOM: libc::c_long = 278;
@@ -57,8 +55,7 @@ mod imp {
5755
target_arch = "arm",
5856
target_arch = "aarch64",
5957
target_arch = "powerpc",
60-
target_arch = "powerpc64",
61-
target_arch = "powerpc64le"))))]
58+
target_arch = "powerpc64"))))]
6259
fn getrandom(_buf: &mut [u8]) -> libc::c_long { -1 }
6360

6461
fn getrandom_fill_bytes(v: &mut [u8]) {
@@ -96,8 +93,7 @@ mod imp {
9693
target_arch = "arm",
9794
target_arch = "aarch64",
9895
target_arch = "powerpc",
99-
target_arch = "powerpc64",
100-
target_arch = "powerpc64le")))]
96+
target_arch = "powerpc64")))]
10197
fn is_getrandom_available() -> bool {
10298
use sync::atomic::{AtomicBool, Ordering};
10399
use sync::Once;
@@ -126,8 +122,7 @@ mod imp {
126122
target_arch = "arm",
127123
target_arch = "aarch64",
128124
target_arch = "powerpc",
129-
target_arch = "powerpc64",
130-
target_arch = "powerpc64le"))))]
125+
target_arch = "powerpc64"))))]
131126
fn is_getrandom_available() -> bool { false }
132127

133128
/// A random number generator that retrieves randomness straight from

src/libstd/sys/common/libunwind.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ pub const unwinder_private_data_size: usize = 5;
8080
#[cfg(target_arch = "aarch64")]
8181
pub const unwinder_private_data_size: usize = 2;
8282

83-
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
83+
#[cfg(target_arch = "mips")]
8484
pub const unwinder_private_data_size: usize = 2;
8585

86-
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64",
87-
target_arch = "powerpc64le"))]
86+
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
8887
pub const unwinder_private_data_size: usize = 2;
8988

9089
#[repr(C)]

src/test/run-pass/conditional-compile-arch.rs

-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,3 @@ pub fn main() { }
2424

2525
#[cfg(target_arch = "powerpc64")]
2626
pub fn main() { }
27-
28-
#[cfg(target_arch = "powerpc64le")]
29-
pub fn main() { }

0 commit comments

Comments
 (0)