Rollup merge of #74888 - infinity0:ignore-endian-big, r=nikomatsakis

compiletest: ignore-endian-big, fixes #74829, fixes #74885

See discussion on #74829

I tested it on a Debian s390x machine, works well.
This commit is contained in:
Yuki Okushi 2020-08-07 09:35:13 +09:00 committed by GitHub
commit 9d5bd597ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 9 deletions

View file

@ -827,6 +827,7 @@ impl Config {
name == util::get_pointer_width(&self.target) || // pointer width
name == self.stage_id.split('-').next().unwrap() || // stage
(self.target != self.host && name == "cross-compile") ||
(name == "endian-big" && util::is_big_endian(&self.target)) ||
(self.remote_test_client.is_some() && name == "remote") ||
match self.compare_mode {
Some(CompareMode::Nll) => name == "compare-mode-nll",

View file

@ -99,6 +99,20 @@ pub const MSAN_SUPPORTED_TARGETS: &'static [&'static str] =
pub const TSAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
const BIG_ENDIAN: &'static [&'static str] = &[
"armebv7r",
"mips",
"mips64",
"mipsisa32r6",
"mipsisa64r6",
"powerpc",
"powerpc64",
"s390x",
"sparc",
"sparc64",
"sparcv9",
];
pub fn matches_os(triple: &str, name: &str) -> bool {
// For the wasm32 bare target we ignore anything also ignored on emscripten
// and then we also recognize `wasm32-bare` as the os for the target
@ -125,6 +139,12 @@ pub fn get_arch(triple: &str) -> &'static str {
panic!("Cannot determine Architecture from triple");
}
/// Determine the endianness from `triple`
pub fn is_big_endian(triple: &str) -> bool {
let triple_arch = triple.split('-').next().unwrap();
BIG_ENDIAN.contains(&triple_arch)
}
pub fn matches_env(triple: &str, name: &str) -> bool {
if let Some(env) = triple.split('-').nth(3) { env.starts_with(name) } else { false }
}