use rustc_cfg::Cfg;
pub fn arch_name<'a>(cfg: &'a Cfg, target: &'a str) -> &'a str {
const BIG: &str = "big";
const LITTLE: &str = "little";
let endian = &*cfg.target_endian;
let arch = &*cfg.target_arch;
if target.starts_with("thumb") {
if endian == BIG {
"thumbeb"
} else {
"thumb"
}
} else {
match (arch, endian) {
("aarch64", BIG) => "aarch64_be",
("arm", BIG) => "armeb",
("mips", LITTLE) => "mipsel",
("mips64", LITTLE) => "mips64el",
("powerpc64", LITTLE) => "ppc64le",
("sparc", LITTLE) => "sparcel",
("powerpc", _) => "ppc32",
("powerpc64", BIG) => "ppc64",
("sparc64", _) => "sparcv9",
("s390x", _) => "systemz",
("x86_64", _) => "x86-64",
_ => arch,
}
}
}