diff --git a/.github/workflows/regenerate-target-info.yml b/.github/workflows/regenerate-target-info.yml index 9d30a4a1..c3b92546 100644 --- a/.github/workflows/regenerate-target-info.yml +++ b/.github/workflows/regenerate-target-info.yml @@ -19,12 +19,13 @@ jobs: git checkout -b regenerate-target-info-${{ github.run_id }} - name: Install rust + # Install both MSRV and current nightly run: | - rustup toolchain install stable nightly --no-self-update --profile minimal + rustup toolchain install 1.63 stable nightly --no-self-update --profile minimal - name: Create lockfile run: cargo update - + - uses: Swatinem/rust-cache@v2 with: cache-all-crates: 'true' diff --git a/.gitignore b/.gitignore index 3b874ca5..15baff94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -target +/target Cargo.lock .idea *.iml diff --git a/dev-tools/gen-target-info/src/lib.rs b/dev-tools/gen-target-info/src/lib.rs index c53839a6..48bb5550 100644 --- a/dev-tools/gen-target-info/src/lib.rs +++ b/dev-tools/gen-target-info/src/lib.rs @@ -2,7 +2,7 @@ mod target_specs; pub use target_specs::*; mod read; -pub use read::get_target_specs_from_json; +pub use read::*; mod write; pub use write::*; diff --git a/dev-tools/gen-target-info/src/main.rs b/dev-tools/gen-target-info/src/main.rs index cf4abef1..bc6a3d5e 100644 --- a/dev-tools/gen-target-info/src/main.rs +++ b/dev-tools/gen-target-info/src/main.rs @@ -1,52 +1,70 @@ -use gen_target_info::{get_target_specs_from_json, write_target_tuple_mapping, RustcTargetSpecs}; -use std::{collections::BTreeMap, fs::File, io::Write as _}; +use std::io::Write as _; +use std::{fs::File, io::BufRead}; + +use gen_target_info::{ + get_target_spec_from_msrv, get_target_specs_from_json, get_targets_msrv, RustcTargetSpecs, +}; const PRELUDE: &str = r#"//! This file is generated code. Please edit the generator //! in dev-tools/gen-target-info if you need to make changes. "#; -fn generate_riscv_arch_mapping(f: &mut File, target_specs: &RustcTargetSpecs) { - let riscv_target_mapping = target_specs - .0 - .iter() - .filter_map(|(target, target_spec)| { - let arch = target.split_once('-').unwrap().0; - (arch.contains("riscv") && arch != target_spec.arch) - .then_some((arch, &*target_spec.arch)) - }) - .collect::>(); - write_target_tuple_mapping(f, "RISCV_ARCH_MAPPING", &riscv_target_mapping); -} +fn generate_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std::io::Result<()> { + writeln!(f, "use super::Target;")?; + writeln!(f, "use std::borrow::Cow;")?; + writeln!(f)?; + writeln!(f, "pub(crate) const LIST: &[(&str, Target)] = &[")?; + + for (triple, spec) in &target_specs.0 { + let full_arch = triple.split_once('-').unwrap().0; + let arch = &spec.arch; + let vendor = spec.vendor.as_deref().unwrap_or("unknown"); + let os = spec.os.as_deref().unwrap_or("none"); + let env = spec.env.as_deref().unwrap_or(""); + let abi = spec.abi.as_deref().unwrap_or(""); + + writeln!(f, " (")?; + writeln!(f, " {triple:?},")?; + writeln!(f, " Target {{")?; + writeln!(f, " full_arch: Cow::Borrowed({full_arch:?}),")?; + writeln!(f, " arch: Cow::Borrowed({arch:?}),")?; + writeln!(f, " vendor: Cow::Borrowed({vendor:?}),")?; + writeln!(f, " os: Cow::Borrowed({os:?}),")?; + writeln!(f, " env: Cow::Borrowed({env:?}),")?; + writeln!(f, " abi: Cow::Borrowed({abi:?}),")?; + writeln!(f, " }},")?; + writeln!(f, " ),")?; + } + + writeln!(f, "];")?; -fn generate_windows_triple_mapping(f: &mut File, target_specs: &RustcTargetSpecs) { - let windows_target_mapping = target_specs - .0 - .iter() - .filter_map(|(target, target_spec)| { - let rust_target_parts = target.splitn(4, '-').collect::>(); - let os = *rust_target_parts.get(2)?; - (os.contains("windows") && target != &*target_spec.llvm_target) - .then_some((&**target, &*target_spec.llvm_target)) - }) - .collect::>(); - write_target_tuple_mapping(f, "WINDOWS_TRIPLE_MAPPING", &windows_target_mapping); + Ok(()) } fn main() { - let target_specs = get_target_specs_from_json(); + // Primarily use information from nightly. + let mut target_specs = get_target_specs_from_json(); + // Next, read from MSRV to support old, removed targets. + for target_triple in get_targets_msrv().lines() { + let target_triple = target_triple.unwrap(); + let target_triple = target_triple.trim(); + target_specs + .0 + .entry(target_triple.to_string()) + .or_insert_with(|| get_target_spec_from_msrv(target_triple)); + } // Open file to write to let manifest_dir = env!("CARGO_MANIFEST_DIR"); - let path = format!("{manifest_dir}/../../src/target_info.rs"); - let mut f = File::create(path).expect("failed to create src/target_info.rs"); + let path = format!("{manifest_dir}/../../src/target/generated.rs"); + let mut f = File::create(path).expect("failed to create src/target/generated.rs"); f.write_all(PRELUDE.as_bytes()).unwrap(); // Start generating - generate_riscv_arch_mapping(&mut f, &target_specs); - generate_windows_triple_mapping(&mut f, &target_specs); + generate_target_mapping(&mut f, &target_specs).unwrap(); // Flush the data onto disk f.flush().unwrap(); diff --git a/dev-tools/gen-target-info/src/read.rs b/dev-tools/gen-target-info/src/read.rs index fc31f463..c5c81f50 100644 --- a/dev-tools/gen-target-info/src/read.rs +++ b/dev-tools/gen-target-info/src/read.rs @@ -1,6 +1,44 @@ use std::process; -use crate::RustcTargetSpecs; +use crate::{RustcTargetSpecs, TargetSpec}; + +pub fn get_targets_msrv() -> Vec { + let mut cmd = process::Command::new("rustc"); + cmd.args(["+1.63", "--print", "target-list"]); + cmd.stdout(process::Stdio::piped()); + cmd.stderr(process::Stdio::inherit()); + + let process::Output { status, stdout, .. } = cmd.output().unwrap(); + + if !status.success() { + panic!("{:?} failed with non-zero exit status: {}", cmd, status) + } + + stdout +} + +pub fn get_target_spec_from_msrv(target: &str) -> TargetSpec { + let mut cmd = process::Command::new("rustc"); + cmd.args([ + "+1.63", + "-Zunstable-options", + "--print", + "target-spec-json", + "--target", + target, + ]); + cmd.env("RUSTC_BOOTSTRAP", "1"); + cmd.stdout(process::Stdio::piped()); + cmd.stderr(process::Stdio::inherit()); + + let process::Output { status, stdout, .. } = cmd.output().unwrap(); + + if !status.success() { + panic!("{:?} failed with non-zero exit status: {}", cmd, status) + } + + serde_json::from_slice(&stdout).unwrap() +} pub fn get_target_specs_from_json() -> RustcTargetSpecs { let mut cmd = process::Command::new("rustc"); @@ -9,8 +47,9 @@ pub fn get_target_specs_from_json() -> RustcTargetSpecs { "-Zunstable-options", "--print", "all-target-specs-json", - ]) - .stdout(process::Stdio::piped()); + ]); + cmd.stdout(process::Stdio::piped()); + cmd.stderr(process::Stdio::inherit()); let process::Output { status, stdout, .. } = cmd.output().unwrap(); diff --git a/dev-tools/gen-target-info/src/target_specs.rs b/dev-tools/gen-target-info/src/target_specs.rs index a8a78616..a928d0be 100644 --- a/dev-tools/gen-target-info/src/target_specs.rs +++ b/dev-tools/gen-target-info/src/target_specs.rs @@ -21,6 +21,8 @@ pub struct TargetSpec { pub os: Option, /// `apple`, `pc` pub vendor: Option, + pub env: Option, + pub abi: Option, pub pre_link_args: Option, } diff --git a/src/lib.rs b/src/lib.rs index a7c44420..45faecd3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -232,7 +232,9 @@ use shlex::Shlex; #[cfg(feature = "parallel")] mod parallel; +mod target; mod windows; +use target::Target; // Regardless of whether this should be in this crate's public API, // it has been since 2015, so don't break it. pub use windows::find_tools as windows_registry; @@ -244,7 +246,6 @@ mod tool; pub use tool::Tool; use tool::ToolFamily; -mod target_info; mod tempfile; mod utilities; @@ -633,7 +634,7 @@ impl Build { &self, flag: &OsStr, compiler_path: &Path, - target: &str, + target: &Target, ) -> Result { let compiler_flag = CompilerFlag { compiler: compiler_path.into(), @@ -659,12 +660,14 @@ impl Build { cfg.flag(flag) .compiler(compiler_path) .cargo_metadata(self.cargo_output.metadata) - .target(target) .opt_level(0) .debug(false) .cpp(self.cpp) .cuda(self.cuda) .emit_rerun_if_env_changed(self.emit_rerun_if_env_changed); + if let Some(target) = &self.target { + cfg.target(target); + } if let Some(host) = &self.host { cfg.host(host); } @@ -683,7 +686,7 @@ impl Build { } let mut cmd = compiler.to_command(); - let is_arm = target.contains("aarch64") || target.contains("arm"); + let is_arm = matches!(&*target.arch, "aarch64" | "arm"); let clang = compiler.is_like_clang(); let gnu = compiler.family == ToolFamily::Gnu; command_add_output_file( @@ -1353,7 +1356,7 @@ impl Build { self.assemble(lib_name, &dst.join(gnu_lib_name), &objects)?; let target = self.get_target()?; - if target.contains("msvc") { + if target.env == "msvc" { let compiler = self.get_base_compiler()?; let atlmfc_lib = compiler .env() @@ -1399,12 +1402,12 @@ impl Build { .print_metadata(&format_args!("cargo:rustc-link-lib={}", stdlib.display())); } // Link c++ lib from WASI sysroot - if Build::is_wasi_target(target.as_ref()) { + if target.os == "wasi" { if let Ok(wasi_sysroot) = self.wasi_sysroot() { self.cargo_output.print_metadata(&format_args!( "cargo:rustc-flags=-L {}/lib/{} -lstatic=c++ -lstatic=c++abi", Path::new(&wasi_sysroot).display(), - target + self.get_raw_target()? )); } } @@ -1423,15 +1426,14 @@ impl Build { let mut libdir = nvcc; libdir.pop(); // remove 'nvcc' libdir.push(".."); - let target_arch = self.getenv_unwrap_str("CARGO_CFG_TARGET_ARCH")?; if cfg!(target_os = "linux") { libdir.push("targets"); - libdir.push(target_arch.to_owned() + "-linux"); + libdir.push(format!("{}-linux", target.arch)); libdir.push("lib"); libtst = true; } else if cfg!(target_env = "msvc") { libdir.push("lib"); - match target_arch.as_str() { + match &*target.arch { "x86_64" => { libdir.push("x64"); libtst = true; @@ -1699,7 +1701,7 @@ impl Build { let asm_ext = AsmFileExt::from_path(&obj.src); let is_asm = asm_ext.is_some(); let target = self.get_target()?; - let msvc = target.contains("msvc"); + let msvc = target.env == "msvc"; let compiler = self.try_get_compiler()?; let clang = compiler.is_like_clang(); let gnu = compiler.family == ToolFamily::Gnu; @@ -1723,7 +1725,7 @@ impl Build { .map(Cow::Owned)?, ) }; - let is_arm = target.contains("aarch64") || target.contains("arm"); + let is_arm = matches!(&*target.arch, "aarch64" | "arm"); command_add_output_file( &mut cmd, &obj.dst, @@ -1930,9 +1932,10 @@ impl Build { fn add_default_flags( &self, cmd: &mut Tool, - target: &str, + target: &Target, opt_level: &str, ) -> Result<(), Error> { + let raw_target = self.get_raw_target()?; // Non-target flags // If the flag is not conditioned on target variable, it belongs here :) match cmd.family { @@ -1971,14 +1974,15 @@ impl Build { cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into()); } - if cmd.is_like_clang() && target.contains("windows") { + if cmd.is_like_clang() && target.os == "windows" { // Disambiguate mingw and msvc on Windows. Problem is that // depending on the origin clang can default to a mismatchig // run-time. - cmd.push_cc_arg(format!("--target={}", target).into()); + // FIXME: Convert rustc target to Clang target. + cmd.push_cc_arg(format!("--target={raw_target}").into()); } - if cmd.is_like_clang() && target.contains("android") { + if cmd.is_like_clang() && target.os == "android" { // For compatibility with code that doesn't use pre-defined `__ANDROID__` macro. // If compiler used via ndk-build or cmake (officially supported build methods) // this macros is defined. @@ -1987,30 +1991,31 @@ impl Build { cmd.push_opt_unless_duplicate("-DANDROID".into()); } - if !target.contains("apple-ios") - && !target.contains("apple-watchos") - && !target.contains("apple-tvos") - && !target.contains("apple-visionos") + if target.os != "ios" + && target.os != "watchos" + && target.os != "tvos" + && target.os != "visionos" { cmd.push_cc_arg("-ffunction-sections".into()); cmd.push_cc_arg("-fdata-sections".into()); } // Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet - if self.pic.unwrap_or_else(|| { - !target.contains("windows") - && !target.contains("-none-") - && !target.ends_with("-none") - && !target.contains("uefi") - && !Build::is_wasi_target(target) - }) { + if self.pic.unwrap_or( + target.os != "windows" + && target.os != "none" + && target.env != "uefi" + && target.os != "wasi", + ) { cmd.push_cc_arg("-fPIC".into()); // PLT only applies if code is compiled with PIC support, // and only for ELF targets. - if target.contains("linux") && !self.use_plt.unwrap_or(true) { + if (target.os == "linux" || target.os == "android") + && !self.use_plt.unwrap_or(true) + { cmd.push_cc_arg("-fno-plt".into()); } } - if Build::is_wasi_target(target) { + if target.os == "wasi" { // WASI does not support exceptions yet. // https://github.com/WebAssembly/exception-handling cmd.push_cc_arg("-fno-exceptions".into()); @@ -2021,7 +2026,8 @@ impl Build { ); } - if target.contains("threads") { + // FIXME(madsmtm): Read from `target_features` instead? + if raw_target.contains("threads") { cmd.push_cc_arg("-pthread".into()); } } @@ -2043,11 +2049,11 @@ impl Build { } if !cmd.is_like_msvc() { - if target.contains("i686") || target.contains("i586") { + if target.arch == "x86" { cmd.args.push("-m32".into()); - } else if target == "x86_64-unknown-linux-gnux32" { + } else if target.abi == "x32" { cmd.args.push("-mx32".into()); - } else if target.contains("x86_64") || target.contains("powerpc64") { + } else if target.arch == "x86_64" || target.arch == "powerpc64" { cmd.args.push("-m64".into()); } } @@ -2056,155 +2062,104 @@ impl Build { match cmd.family { ToolFamily::Clang { .. } => { if !(cmd.has_internal_target_arg - || (target.contains("android") + || (target.os == "android" && android_clang_compiler_uses_target_arg_internally(&cmd.path))) { - let (arch, rest) = target.split_once('-').ok_or_else(|| { - Error::new( - ErrorKind::InvalidTarget, - format!("Invalid target `{}`: no `-` in it", target), - ) - })?; - - if target.contains("darwin") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - cmd.args - .push(format!("--target={}-apple-darwin", arch).into()); - } - } else if target.contains("macabi") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - cmd.args - .push(format!("--target={}-apple-ios-macabi", arch).into()); - } - } else if target.contains("ios-sim") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = - apple_os_sdk_parts(AppleOs::Ios, &AppleArchSpec::Simulator("")); - let deployment_target = - self.apple_deployment_version(AppleOs::Ios, None, &sdk_details.sdk); - cmd.args.push( - format!( - "--target={}-apple-ios{}-simulator", - arch, deployment_target - ) - .into(), - ); - } - } else if target.contains("watchos-sim") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = - apple_os_sdk_parts(AppleOs::WatchOs, &AppleArchSpec::Simulator("")); - let deployment_target = self.apple_deployment_version( - AppleOs::WatchOs, - None, - &sdk_details.sdk, - ); - cmd.args.push( - format!( - "--target={}-apple-watchos{}-simulator", - arch, deployment_target - ) - .into(), - ); - } - } else if target.contains("tvos-sim") || target.contains("x86_64-apple-tvos") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = - apple_os_sdk_parts(AppleOs::TvOs, &AppleArchSpec::Simulator("")); - let deployment_target = self.apple_deployment_version( - AppleOs::TvOs, - None, - &sdk_details.sdk, - ); - cmd.args.push( - format!( - "--target={}-apple-tvos{}-simulator", - arch, deployment_target - ) - .into(), - ); - } - } else if target.contains("aarch64-apple-tvos") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = - apple_os_sdk_parts(AppleOs::TvOs, &AppleArchSpec::Device("")); - let deployment_target = self.apple_deployment_version( - AppleOs::TvOs, - None, - &sdk_details.sdk, - ); - cmd.args.push( - format!("--target={}-apple-tvos{}", arch, deployment_target).into(), - ); - } - } else if target.contains("visionos-sim") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = apple_os_sdk_parts( - AppleOs::VisionOS, - &AppleArchSpec::Simulator(""), - ); - let deployment_target = self.apple_deployment_version( - AppleOs::VisionOS, - None, - &sdk_details.sdk, - ); - cmd.args.push( - format!( - "--target={}-apple-xros{}-simulator", - arch, deployment_target - ) + if target.os == "macos" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + cmd.args + .push(format!("--target={}-apple-darwin", arch).into()); + } else if target.abi == "macabi" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + cmd.args + .push(format!("--target={}-apple-ios-macabi", arch).into()); + } else if target.os == "ios" && target.abi == "sim" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::Ios, &AppleArchSpec::Simulator("")); + let deployment_target = + self.apple_deployment_version(AppleOs::Ios, None, &sdk_details.sdk); + cmd.args.push( + format!("--target={}-apple-ios{}-simulator", arch, deployment_target) .into(), - ); - } - } else if target.contains("visionos") { - if let Some(arch) = - map_darwin_target_from_rust_to_compiler_architecture(target) - { - let sdk_details = - apple_os_sdk_parts(AppleOs::VisionOS, &AppleArchSpec::Device("")); - let deployment_target = self.apple_deployment_version( - AppleOs::VisionOS, - None, - &sdk_details.sdk, - ); - cmd.args.push( - format!("--target={}-apple-xros{}", arch, deployment_target).into(), - ); - } - } else if let Ok(index) = target_info::RISCV_ARCH_MAPPING - .binary_search_by_key(&arch, |(arch, _)| arch) - { + ); + } else if target.os == "watchos" && target.abi == "sim" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::WatchOs, &AppleArchSpec::Simulator("")); + let deployment_target = + self.apple_deployment_version(AppleOs::WatchOs, None, &sdk_details.sdk); cmd.args.push( format!( - "--target={}-{}", - target_info::RISCV_ARCH_MAPPING[index].1, - rest + "--target={}-apple-watchos{}-simulator", + arch, deployment_target ) .into(), ); - } else if target.contains("uefi") { - if target.contains("x86_64") { + } else if target.os == "tvos" && target.abi == "sim" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::TvOs, &AppleArchSpec::Simulator("")); + let deployment_target = + self.apple_deployment_version(AppleOs::TvOs, None, &sdk_details.sdk); + cmd.args.push( + format!( + "--target={}-apple-tvos{}-simulator", + arch, deployment_target + ) + .into(), + ); + } else if target.os == "tvos" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::TvOs, &AppleArchSpec::Device("")); + let deployment_target = + self.apple_deployment_version(AppleOs::TvOs, None, &sdk_details.sdk); + cmd.args.push( + format!("--target={}-apple-tvos{}", arch, deployment_target).into(), + ); + } else if target.os == "visionos" && target.abi == "sim" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::VisionOS, &AppleArchSpec::Simulator("")); + let deployment_target = self.apple_deployment_version( + AppleOs::VisionOS, + None, + &sdk_details.sdk, + ); + cmd.args.push( + format!( + "--target={}-apple-xros{}-simulator", + arch, deployment_target + ) + .into(), + ); + } else if target.os == "visionos" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + let sdk_details = + apple_os_sdk_parts(AppleOs::VisionOS, &AppleArchSpec::Device("")); + let deployment_target = self.apple_deployment_version( + AppleOs::VisionOS, + None, + &sdk_details.sdk, + ); + cmd.args.push( + format!("--target={}-apple-xros{}", arch, deployment_target).into(), + ); + } else if target.arch == "riscv32" || target.arch == "riscv64" { + // FIXME: Convert rustc target to Clang target + let (_, rest) = raw_target.split_once('-').unwrap(); + cmd.args + .push(format!("--target={}-{}", &target.arch, rest).into()); + } else if target.os == "uefi" { + if target.arch == "x86_64" { cmd.args.push("--target=x86_64-unknown-windows-gnu".into()); - } else if target.contains("i686") { + } else if target.arch == "x86" { cmd.args.push("--target=i686-unknown-windows-gnu".into()) - } else if target.contains("aarch64") { + } else if target.arch == "aarch64" { cmd.args.push("--target=aarch64-unknown-windows-gnu".into()) } - } else if target.ends_with("-freebsd") { + } else if target.os == "freebsd" { // FreeBSD only supports C++11 and above when compiling against libc++ // (available from FreeBSD 10 onwards). Under FreeBSD, clang uses libc++ by // default on FreeBSD 10 and newer unless `--target` is manually passed to @@ -2227,20 +2182,16 @@ impl Build { cmd.push_cc_arg("-stdlib=libc++".into()); } - cmd.push_cc_arg(format!("--target={}", target).into()); - } else if let Ok(index) = target_info::WINDOWS_TRIPLE_MAPPING - .binary_search_by_key(&target, |(target, _)| target) - { + // FIXME: Convert rustc target to Clang target. + cmd.push_cc_arg(format!("--target={}", raw_target).into()); + } else if target.os == "windows" { cmd.args.push( - format!( - "--target={}-{}", - target_info::WINDOWS_TRIPLE_MAPPING[index].1, - rest - ) - .into(), + format!("--target={}-pc-windows-{}", target.full_arch, target.env) + .into(), ) } else { - cmd.push_cc_arg(format!("--target={}", target).into()); + // FIXME: Convert rustc target to Clang target. + cmd.push_cc_arg(format!("--target={}", raw_target).into()); } } } @@ -2251,17 +2202,18 @@ impl Build { cmd.push_cc_arg("-Brepro".into()); if clang_cl { - if target.contains("x86_64") { + if target.arch == "x86_64" { cmd.push_cc_arg("-m64".into()); - } else if target.contains("86") { + } else if target.arch == "x86" { cmd.push_cc_arg("-m32".into()); cmd.push_cc_arg("-arch:IA32".into()); } else { - cmd.push_cc_arg(format!("--target={}", target).into()); + // FIXME: Convert rustc target to Clang target. + cmd.push_cc_arg(format!("--target={}", raw_target).into()); } - } else if target.contains("i586") { + } else if target.full_arch == "i586" { cmd.push_cc_arg("-arch:IA32".into()); - } else if target.contains("arm64ec") { + } else if target.full_arch == "arm64ec" { cmd.push_cc_arg("-arm64EC".into()); } // There is a check in corecrt.h that will generate a @@ -2273,21 +2225,19 @@ impl Build { // The check will be going away in future versions of // the SDK, but for all released versions of the // Windows SDK it is required. - if target.contains("arm") || target.contains("thumb") { + if target.arch == "arm" { cmd.args .push("-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1".into()); } } ToolFamily::Gnu => { - if target.contains("darwin") { - if let Some(arch) = map_darwin_target_from_rust_to_compiler_architecture(target) - { - cmd.args.push("-arch".into()); - cmd.args.push(arch.into()); - } + if target.os == "macos" { + let arch = map_darwin_target_from_rust_to_compiler_architecture(target); + cmd.args.push("-arch".into()); + cmd.args.push(arch.into()); } - if target.contains("-kmc-solid_") { + if target.vendor == "kmc" { cmd.args.push("-finput-charset=utf-8".into()); } @@ -2300,22 +2250,23 @@ impl Build { } // armv7 targets get to use armv7 instructions - if (target.starts_with("armv7") || target.starts_with("thumbv7")) - && (target.contains("-linux-") || target.contains("-kmc-solid_")) + if (target.full_arch.starts_with("armv7") + || target.full_arch.starts_with("thumbv7")) + && (target.os == "linux" || target.vendor == "kmc") { cmd.args.push("-march=armv7-a".into()); - if target.ends_with("eabihf") { + if target.abi == "eabihf" { // lowest common denominator FPU cmd.args.push("-mfpu=vfpv3-d16".into()); } } // (x86 Android doesn't say "eabi") - if target.contains("-androideabi") && target.contains("v7") { - // -march=armv7-a handled above + if target.os == "android" && target.full_arch.contains("v7") { + cmd.args.push("-march=armv7-a".into()); cmd.args.push("-mthumb".into()); - if !target.contains("neon") { + if !target.full_arch.contains("neon") { // On android we can guarantee some extra float instructions // (specified in the android spec online) // NEON guarantees even more; see below. @@ -2324,27 +2275,27 @@ impl Build { cmd.args.push("-mfloat-abi=softfp".into()); } - if target.contains("neon") { + if target.full_arch.contains("neon") { cmd.args.push("-mfpu=neon-vfpv4".into()); } - if target.starts_with("armv4t-unknown-linux-") { + if target.full_arch == "armv4t" && target.os == "linux" { cmd.args.push("-march=armv4t".into()); cmd.args.push("-marm".into()); cmd.args.push("-mfloat-abi=soft".into()); } - if target.starts_with("armv5te-unknown-linux-") { + if target.full_arch == "armv5te" && target.os == "linux" { cmd.args.push("-march=armv5te".into()); cmd.args.push("-marm".into()); cmd.args.push("-mfloat-abi=soft".into()); } // For us arm == armv6 by default - if target.starts_with("arm-unknown-linux-") { + if target.full_arch == "arm" && target.os == "linux" { cmd.args.push("-march=armv6".into()); cmd.args.push("-marm".into()); - if target.ends_with("hf") { + if target.abi == "eabihf" { cmd.args.push("-mfpu=vfp".into()); } else { cmd.args.push("-mfloat-abi=soft".into()); @@ -2352,7 +2303,7 @@ impl Build { } // We can guarantee some settings for FRC - if target.starts_with("arm-frc-") { + if target.arch == "arm" && target.vendor == "frc" { cmd.args.push("-march=armv7-a".into()); cmd.args.push("-mcpu=cortex-a9".into()); cmd.args.push("-mfpu=vfpv3".into()); @@ -2361,12 +2312,12 @@ impl Build { } // Turn codegen down on i586 to avoid some instructions. - if target.starts_with("i586-unknown-linux-") { + if target.full_arch == "i586" && target.os == "linux" { cmd.args.push("-march=pentium".into()); } // Set codegen level for i686 correctly - if target.starts_with("i686-unknown-linux-") { + if target.full_arch == "i686" && target.os == "linux" { cmd.args.push("-march=i686".into()); } @@ -2375,43 +2326,42 @@ impl Build { // linker that we're generating 32-bit executables as well. This'll // typically only be used for build scripts which transitively use // these flags that try to compile executables. - if target == "i686-unknown-linux-musl" || target == "i586-unknown-linux-musl" { + if target.arch == "x86" && target.env == "musl" { cmd.args.push("-Wl,-melf_i386".into()); } - if (target.starts_with("arm") || target.starts_with("thumb")) - && target.ends_with("-none-eabihf") - { + if target.arch == "arm" && target.os == "none" && target.abi == "eabihf" { cmd.args.push("-mfloat-abi=hard".into()) } - if target.starts_with("thumb") { + if target.full_arch.starts_with("thumb") { cmd.args.push("-mthumb".into()); } - if target.starts_with("thumbv6m") { + if target.full_arch.starts_with("thumbv6m") { cmd.args.push("-march=armv6s-m".into()); } - if target.starts_with("thumbv7em") { + if target.full_arch.starts_with("thumbv7em") { cmd.args.push("-march=armv7e-m".into()); - if target.ends_with("eabihf") { + if target.abi == "eabihf" { cmd.args.push("-mfpu=fpv4-sp-d16".into()) } } - if target.starts_with("thumbv7m") { + if target.full_arch.starts_with("thumbv7m") { cmd.args.push("-march=armv7-m".into()); } - if target.starts_with("thumbv8m.base") { + if target.full_arch.starts_with("thumbv8m.base") { cmd.args.push("-march=armv8-m.base".into()); } - if target.starts_with("thumbv8m.main") { + if target.full_arch.starts_with("thumbv8m.main") { cmd.args.push("-march=armv8-m.main".into()); - if target.ends_with("eabihf") { + if target.abi == "eabihf" { cmd.args.push("-mfpu=fpv5-sp-d16".into()) } } - if target.starts_with("armebv7r") | target.starts_with("armv7r") { - if target.starts_with("armeb") { + if target.full_arch.starts_with("armebv7r") | target.full_arch.starts_with("armv7r") + { + if target.full_arch.starts_with("armeb") { cmd.args.push("-mbig-endian".into()); } else { cmd.args.push("-mlittle-endian".into()); @@ -2423,54 +2373,47 @@ impl Build { // R Profile cmd.args.push("-march=armv7-r".into()); - if target.ends_with("eabihf") { + if target.abi == "eabihf" { // lowest common denominator FPU // (see Cortex-R4 technical reference manual) cmd.args.push("-mfpu=vfpv3-d16".into()) } } - if target.starts_with("armv7a") { + if target.full_arch.starts_with("armv7a") { cmd.args.push("-march=armv7-a".into()); - if target.ends_with("eabihf") { + if target.abi == "eabihf" { // lowest common denominator FPU cmd.args.push("-mfpu=vfpv3-d16".into()); } } - if target.starts_with("riscv32") || target.starts_with("riscv64") { + if target.arch == "riscv32" || target.arch == "riscv64" { // get the 32i/32imac/32imc/64gc/64imac/... part - let mut parts = target.split('-'); - if let Some(arch) = parts.next() { - let arch = &arch[5..]; - if arch.starts_with("64") { - if target.contains("linux") - | target.contains("freebsd") - | target.contains("netbsd") - | target.contains("linux") - { - cmd.args.push(("-march=rv64gc").into()); - cmd.args.push("-mabi=lp64d".into()); - } else { - cmd.args.push(("-march=rv".to_owned() + arch).into()); - cmd.args.push("-mabi=lp64".into()); - } - } else if arch.starts_with("32") { - if target.contains("linux") { - cmd.args.push(("-march=rv32gc").into()); - cmd.args.push("-mabi=ilp32d".into()); - } else { - cmd.args.push(("-march=rv".to_owned() + arch).into()); - cmd.args.push("-mabi=ilp32".into()); - } + let arch = &target.full_arch[5..]; + if arch.starts_with("64") { + if matches!(&*target.os, "linux" | "freebsd" | "netbsd") { + cmd.args.push(("-march=rv64gc").into()); + cmd.args.push("-mabi=lp64d".into()); + } else { + cmd.args.push(("-march=rv".to_owned() + arch).into()); + cmd.args.push("-mabi=lp64".into()); + } + } else if arch.starts_with("32") { + if target.os == "linux" { + cmd.args.push(("-march=rv32gc").into()); + cmd.args.push("-mabi=ilp32d".into()); } else { - cmd.args.push("-mcmodel=medany".into()); + cmd.args.push(("-march=rv".to_owned() + arch).into()); + cmd.args.push("-mabi=ilp32".into()); } + } else { + cmd.args.push("-mcmodel=medany".into()); } } } } - if target.contains("-apple-") { + if target.vendor == "apple" { self.apple_flags(cmd)?; } @@ -2504,11 +2447,11 @@ impl Build { fn msvc_macro_assembler(&self) -> Result<(Command, &'static str), Error> { let target = self.get_target()?; - let tool = if target.contains("x86_64") { + let tool = if target.arch == "x86_64" { "ml64.exe" - } else if target.contains("arm") { + } else if target.arch == "arm" { "armasm.exe" - } else if target.contains("aarch64") { + } else if target.arch == "aarch64" { "armasm64.exe" } else { "ml.exe" @@ -2520,7 +2463,7 @@ impl Build { for directory in self.include_directories.iter() { cmd.arg("-I").arg(&**directory); } - if target.contains("aarch64") || target.contains("arm") { + if target.arch == "aarch64" || target.arch == "arm" { if self.get_debug() { cmd.arg("-g"); } @@ -2553,7 +2496,7 @@ impl Build { } } - if target.contains("i686") || target.contains("i586") { + if target.arch == "x86" { cmd.arg("-safeseh"); } @@ -2590,7 +2533,7 @@ impl Build { } let target = self.get_target()?; - if target.contains("msvc") { + if target.env == "msvc" { // The Rust compiler will look for libfoo.a and foo.lib, but the // MSVC linker will also be passed foo.lib, so be sure that both // exist for now. @@ -2628,7 +2571,7 @@ impl Build { let target = self.get_target()?; let (mut cmd, program, any_flags) = self.get_ar()?; - if target.contains("msvc") && !program.to_string_lossy().contains("llvm-ar") { + if target.env == "msvc" && !program.to_string_lossy().contains("llvm-ar") { // NOTE: -out: here is an I/O flag, and so must be included even if $ARFLAGS/ar_flag is // in use. -nologo on the other hand is just a regular flag, and one that we'll skip if // the caller has explicitly dictated the flags they want. See @@ -2686,37 +2629,21 @@ impl Build { fn apple_flags(&self, cmd: &mut Tool) -> Result<(), Error> { let target = self.get_target()?; - let os = if target.contains("-darwin") { + let os = if target.os == "macos" { AppleOs::MacOs - } else if target.contains("-watchos") { + } else if target.os == "watchos" { AppleOs::WatchOs - } else if target.contains("-tvos") { + } else if target.os == "tvos" { AppleOs::TvOs - } else if target.contains("-visionos") { + } else if target.os == "visionos" { AppleOs::VisionOS } else { AppleOs::Ios }; - let is_mac = matches!(os, AppleOs::MacOs); - - let arch_str = target.split('-').nth(0).ok_or_else(|| { - Error::new( - ErrorKind::ArchitectureInvalid, - format!("Unknown architecture for {:?} target.", os), - ) - })?; - - let is_catalyst = match target.split('-').nth(3) { - Some(v) => v == "macabi", - None => false, - }; - let is_arm_sim = match target.split('-').nth(3) { - Some(v) => v == "sim", - None => false, - }; + let arch_str = &*target.full_arch; - let arch = if is_mac { + let arch = if target.os == "macos" { match arch_str { "i686" => AppleArchSpec::Device("-m32"), "x86_64" | "x86_64h" | "aarch64" | "arm64e" => AppleArchSpec::Device("-m64"), @@ -2727,7 +2654,7 @@ impl Build { )); } } - } else if is_catalyst { + } else if target.abi == "macabi" { match arch_str { "arm64e" => AppleArchSpec::Catalyst("arm64e"), "arm64" | "aarch64" => AppleArchSpec::Catalyst("arm64"), @@ -2739,9 +2666,10 @@ impl Build { )); } } - } else if is_arm_sim { + } else if target.abi == "sim" { match arch_str { "arm64" | "aarch64" => AppleArchSpec::Simulator("arm64"), + "i386" | "i686" => AppleArchSpec::Simulator("-m32"), "x86_64" | "x86_64h" => AppleArchSpec::Simulator("-m64"), _ => { return Err(Error::new( @@ -2758,8 +2686,6 @@ impl Build { "arm64e" => AppleArchSpec::Device("arm64e"), "arm64" | "aarch64" => AppleArchSpec::Device("arm64"), "arm64_32" => AppleArchSpec::Device("arm64_32"), - "i386" | "i686" => AppleArchSpec::Simulator("-m32"), - "x86_64" | "x86_64h" => AppleArchSpec::Simulator("-m64"), _ => { return Err(Error::new( ErrorKind::ArchitectureInvalid, @@ -2773,7 +2699,7 @@ impl Build { let min_version = self.apple_deployment_version(os, Some(arch_str), &sdk_details.sdk); match arch { - AppleArchSpec::Device(_) if is_mac => { + AppleArchSpec::Device(_) if target.os == "macos" => { cmd.args .push(format!("-mmacosx-version-min={}", min_version).into()); } @@ -2810,8 +2736,8 @@ impl Build { AppleArchSpec::Catalyst(_) => {} }; - // AppleClang sometimes requires sysroot even for darwin - if cmd.is_xctoolchain_clang() || !target.ends_with("-darwin") { + // AppleClang sometimes requires sysroot even on macOS + if cmd.is_xctoolchain_clang() || target.os != "macos" { self.cargo_output.print_metadata(&format_args!( "Detecting {:?} SDK path for {}", os, sdk_details.sdk @@ -2877,7 +2803,7 @@ impl Build { )); } let target = self.get_target()?; - let target = &*target; + let raw_target = self.get_raw_target()?; let (env, msvc, gnu, traditional, clang) = if self.cpp { ("CXX", "cl.exe", "g++", "c++", "clang++") } else { @@ -2894,7 +2820,7 @@ impl Build { traditional }; - let cl_exe = self.windows_registry_find_tool(target, "cl.exe"); + let cl_exe = self.windows_registry_find_tool(&target, "cl.exe"); let tool_opt: Option = self .env_tool(env) @@ -2925,7 +2851,7 @@ impl Build { t }) .or_else(|| { - if target.contains("emscripten") { + if target.os == "emscripten" { let tool = if self.cpp { "em++" } else { "emcc" }; // Windows uses bat file so we have to be a bit more specific if cfg!(windows) { @@ -2953,44 +2879,47 @@ impl Build { let tool = match tool_opt { Some(t) => t, None => { - let compiler = if cfg!(windows) && target.contains("windows") { - if target.contains("msvc") { + let compiler = if cfg!(windows) && target.os == "windows" { + if target.env == "msvc" { msvc.to_string() } else { - let cc = if target.contains("llvm") { clang } else { gnu }; + let cc = if target.abi == "llvm" { clang } else { gnu }; format!("{}.exe", cc) } - } else if target.contains("apple-ios") - | target.contains("apple-watchos") - | target.contains("apple-tvos") - | target.contains("apple-visionos") + } else if target.os == "ios" + || target.os == "watchos" + || target.os == "tvos" + || target.os == "visionos" { clang.to_string() - } else if target.contains("android") { - autodetect_android_compiler(target, gnu, clang) - } else if target.contains("cloudabi") { - format!("{}-{}", target, traditional) - } else if Build::is_wasi_target(target) { + } else if target.os == "android" { + autodetect_android_compiler(&raw_target, gnu, clang) + } else if target.os == "cloudabi" { + format!( + "{}-{}-{}-{}", + target.full_arch, target.vendor, target.os, traditional + ) + } else if target.os == "wasi" { if self.cpp { "clang++".to_string() } else { "clang".to_string() } - } else if target.contains("vxworks") { + } else if target.os == "vxworks" { if self.cpp { "wr-c++".to_string() } else { "wr-cc".to_string() } - } else if target.starts_with("armv7a-kmc-solid_") { + } else if target.arch == "arm" && target.vendor == "kmc" { format!("arm-kmc-eabi-{}", gnu) - } else if target.starts_with("aarch64-kmc-solid_") { + } else if target.arch == "aarch64" && target.vendor == "kmc" { format!("aarch64-kmc-elf-{}", gnu) } else if self.get_is_cross_compile()? { - let prefix = self.prefix_for_target(target); + let prefix = self.prefix_for_target(&raw_target); match prefix { Some(prefix) => { - let cc = if target.contains("llvm") { clang } else { gnu }; + let cc = if target.abi == "llvm" { clang } else { gnu }; format!("{}-{}", prefix, cc) } None => default.to_string(), @@ -3087,7 +3016,7 @@ impl Build { if let Some(cl_exe) = cl_exe { if tool.family == (ToolFamily::Msvc { clang_cl: true }) && tool.env.is_empty() - && target.contains("msvc") + && target.env == "msvc" { for (k, v) in cl_exe.env.iter() { tool.env.push((k.to_owned(), v.to_owned())); @@ -3095,7 +3024,7 @@ impl Build { } } - if target.contains("msvc") && tool.family == ToolFamily::Gnu { + if target.env == "msvc" && tool.family == ToolFamily::Gnu { self.cargo_output .print_warning(&"GNU compiler is not supported for this target"); } @@ -3216,17 +3145,17 @@ impl Build { } } else { let target = self.get_target()?; - if target.contains("msvc") { + if target.env == "msvc" { Ok(None) - } else if target.contains("apple") - | target.contains("freebsd") - | target.contains("openbsd") - | target.contains("aix") - | target.contains("linux-ohos") - | target.contains("-wasi") + } else if target.vendor == "apple" + || target.os == "freebsd" + || target.os == "openbsd" + || target.os == "aix" + || (target.os == "linux" && target.env == "ohos") + || target.os == "wasi" { Ok(Some(Cow::Borrowed(Path::new("c++")))) - } else if target.contains("android") { + } else if target.os == "android" { Ok(Some(Cow::Borrowed(Path::new("c++_shared")))) } else { Ok(Some(Cow::Borrowed(Path::new("stdc++")))) @@ -3349,7 +3278,7 @@ impl Build { cmd }) .or_else(|| { - if target.contains("emscripten") { + if target.os == "emscripten" { // Windows use bat files so we have to be a bit more specific if cfg!(windows) { let mut cmd = self.cmd("cmd"); @@ -3360,7 +3289,7 @@ impl Build { name = format!("em{}", tool).into(); Some(self.cmd(&name)) } - } else if target.starts_with("wasm32") { + } else if target.arch == "wasm32" { // Formally speaking one should be able to use this approach, // parsing -print-search-dirs output, to cover all clang targets, // including Android SDKs and other cross-compilation scenarios... @@ -3387,14 +3316,18 @@ impl Build { let tool = match tool_opt { Some(t) => t, None => { - if target.contains("android") { + if target.os == "android" { name = format!("llvm-{}", tool).into(); match Command::new(&name).arg("--version").status() { Ok(status) if status.success() => (), - _ => name = format!("{}-{}", target.replace("armv7", "arm"), tool).into(), + _ => { + // FIXME: Use parsed target. + let raw_target = self.get_raw_target()?; + name = format!("{}-{}", raw_target.replace("armv7", "arm"), tool).into() + } } self.cmd(&name) - } else if target.contains("msvc") { + } else if target.env == "msvc" { // NOTE: There isn't really a ranlib on msvc, so arguably we should return // `None` somehow here. But in general, callers will already have to be aware // of not running ranlib on Windows anyway, so it feels okay to return lib.exe @@ -3423,7 +3356,7 @@ impl Build { Some(t) => t, None => self.cmd("lib.exe"), }; - if target.contains("arm64ec") { + if target.full_arch == "arm64ec" { cmd.arg("/machine:arm64ec"); } cmd @@ -3431,7 +3364,7 @@ impl Build { name = lib.into(); self.cmd(&name) } - } else if target.contains("illumos") { + } else if target.os == "illumos" { // The default 'ar' on illumos uses a non-standard flags, // but the OS comes bundled with a GNU-compatible variant. // @@ -3439,7 +3372,7 @@ impl Build { name = format!("g{}", tool).into(); self.cmd(&name) } else if self.get_is_cross_compile()? { - match self.prefix_for_target(&target) { + match self.prefix_for_target(&self.get_raw_target()?) { Some(p) => { // GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both. // Prefer -ar if it exists, as builds of `-gcc-ar` have been observed to be @@ -3474,6 +3407,7 @@ impl Build { Ok((tool, name)) } + // FIXME: Use parsed target instead of raw target. fn prefix_for_target(&self, target: &str) -> Option> { // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" self.getenv("CROSS_COMPILE") @@ -3645,7 +3579,14 @@ impl Build { .or_else(|| prefixes.first().copied()) } - fn get_target(&self) -> Result, Error> { + fn get_target(&self) -> Result { + match &self.target { + Some(t) => t.parse(), + None => Target::from_cargo_environment_variables(), + } + } + + fn get_raw_target(&self) -> Result, Error> { match &self.target { Some(t) => Ok(Cow::Borrowed(t)), None => self.getenv_unwrap_str("TARGET").map(Cow::Owned), @@ -3653,7 +3594,7 @@ impl Build { } fn get_is_cross_compile(&self) -> Result { - let target = self.get_target()?; + let target = self.get_raw_target()?; let host: Cow<'_, str> = match &self.host { Some(h) => Cow::Borrowed(h), None => Cow::Owned(self.getenv_unwrap_str("HOST")?), @@ -3680,16 +3621,14 @@ impl Build { fn get_dwarf_version(&self) -> Option { // Tentatively matches the DWARF version defaults as of rustc 1.62. let target = self.get_target().ok()?; - if target.contains("android") - || target.contains("apple") - || target.contains("dragonfly") - || target.contains("freebsd") - || target.contains("netbsd") - || target.contains("openbsd") - || target.contains("windows-gnu") + if matches!( + &*target.os, + "android" | "dragonfly" | "freebsd" | "netbsd" | "openbsd" + ) || target.vendor == "apple" + || (target.os == "windows" && target.env == "gnu") { Some(2) - } else if target.contains("linux") { + } else if target.os == "linux" { Some(4) } else { None @@ -3781,7 +3720,7 @@ impl Build { } fn getenv_with_target_prefixes(&self, var_base: &str) -> Result, Error> { - let target = self.get_target()?; + let target = self.get_raw_target()?; let kind = if self.get_is_cross_compile()? { "TARGET" } else { @@ -3819,7 +3758,7 @@ impl Build { fn fix_env_for_apple_os(&self, cmd: &mut Command) -> Result<(), Error> { let target = self.get_target()?; - if cfg!(target_os = "macos") && target.contains("apple-darwin") { + if cfg!(target_os = "macos") && target.os == "macos" { // Additionally, `IPHONEOS_DEPLOYMENT_TARGET` must not be set when using the Xcode linker at // "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld", // although this is apparently ignored when using the linker at "/usr/bin/ld". @@ -4045,18 +3984,6 @@ impl Build { )) } } - fn is_wasi_target(target: &str) -> bool { - const TARGETS: [&str; 7] = [ - "wasm32-wasi", - "wasm32-wasip1", - "wasm32-wasip1-threads", - "wasm32-wasip2", - "wasm32-wasi-threads", - "wasm32-unknown-wasi", - "wasm32-unknown-unknown", - ]; - TARGETS.contains(&target) - } fn cuda_file_count(&self) -> usize { self.files @@ -4113,12 +4040,12 @@ impl Build { None } - fn windows_registry_find(&self, target: &str, tool: &str) -> Option { + fn windows_registry_find(&self, target: &Target, tool: &str) -> Option { self.windows_registry_find_tool(target, tool) .map(|c| c.to_command()) } - fn windows_registry_find_tool(&self, target: &str, tool: &str) -> Option { + fn windows_registry_find_tool(&self, target: &Target, tool: &str) -> Option { struct BuildEnvGetter<'s>(&'s Build); impl windows_registry::EnvGetter for BuildEnvGetter<'_> { @@ -4228,8 +4155,9 @@ fn android_clang_compiler_uses_target_arg_internally(clang_path: &Path) -> bool false } -fn autodetect_android_compiler(target: &str, gnu: &str, clang: &str) -> String { - let new_clang_key = match target { +// FIXME: Use parsed target. +fn autodetect_android_compiler(raw_target: &str, gnu: &str, clang: &str) -> String { + let new_clang_key = match raw_target { "aarch64-linux-android" => Some("aarch64"), "armv7-linux-androideabi" => Some("armv7a"), "i686-linux-android" => Some("i686"), @@ -4251,7 +4179,7 @@ fn autodetect_android_compiler(target: &str, gnu: &str, clang: &str) -> String { } } - let target = target + let target = raw_target .replace("armv7neon", "arm") .replace("armv7", "arm") .replace("thumbv7neon", "arm") @@ -4276,23 +4204,20 @@ fn autodetect_android_compiler(target: &str, gnu: &str, clang: &str) -> String { } // Rust and clang/cc don't agree on how to name the target. -fn map_darwin_target_from_rust_to_compiler_architecture(target: &str) -> Option<&'static str> { - if target.contains("x86_64h") { - Some("x86_64h") - } else if target.contains("x86_64") { - Some("x86_64") - } else if target.contains("arm64e") { - Some("arm64e") - } else if target.contains("aarch64") { - Some("arm64") - } else if target.contains("i686") { - Some("i386") - } else if target.contains("powerpc") { - Some("ppc") - } else if target.contains("powerpc64") { - Some("ppc64") - } else { - None +fn map_darwin_target_from_rust_to_compiler_architecture(target: &Target) -> &str { + match &*target.full_arch { + "aarch64" => "arm64", + "arm64_32" => "arm64_32", + "arm64e" => "arm64e", + "armv7k" => "armv7k", + "armv7s" => "armv7s", + "i386" => "i386", + "i686" => "i386", + "powerpc" => "ppc", + "powerpc64" => "ppc64", + "x86_64" => "x86_64", + "x86_64h" => "x86_64h", + arch => arch, } } diff --git a/src/target.rs b/src/target.rs new file mode 100644 index 00000000..61ce91ee --- /dev/null +++ b/src/target.rs @@ -0,0 +1,183 @@ +//! Very basic parsing of `rustc` target triples. +//! +//! See the `target-lexicon` crate for a more principled approach to this. + +use std::{borrow::Cow, env, str::FromStr}; + +use crate::{Error, ErrorKind}; + +mod generated; + +/// The parts of `rustc`'s target triple. +/// +/// See . +#[derive(Debug, PartialEq, Clone)] +pub(crate) struct Target { + /// The full architecture, including the subarchitecture. + /// + /// This differs from `cfg!(target_arch)`, which only specifies the + /// overall architecture, which is too coarse for certain cases. + pub full_arch: Cow<'static, str>, + /// The overall target architecture. + /// + /// This is the same as the value of `cfg!(target_arch)`. + pub arch: Cow<'static, str>, + /// The target vendor. + /// + /// This is the same as the value of `cfg!(target_vendor)`. + pub vendor: Cow<'static, str>, + /// The operating system, or `none` on bare-metal targets. + /// + /// This is the same as the value of `cfg!(target_os)`. + pub os: Cow<'static, str>, + /// The environment on top of the operating system. + /// + /// This is the same as the value of `cfg!(target_env)`. + pub env: Cow<'static, str>, + /// The ABI on top of the operating system. + /// + /// This is the same as the value of `cfg!(target_abi)`. + pub abi: Cow<'static, str>, +} + +impl Target { + pub fn from_cargo_environment_variables() -> Result { + // `TARGET` must be present. + // + // No need to emit `rerun-if-env-changed` for this, + // as it is controlled by Cargo itself. + #[allow(clippy::disallowed_methods)] + let target_triple = env::var("TARGET").map_err(|err| { + Error::new( + ErrorKind::EnvVarNotFound, + format!("failed reading TARGET: {err}"), + ) + })?; + + // Parse the full architecture name from the target triple. + let (full_arch, _rest) = target_triple.split_once('-').ok_or(Error::new( + ErrorKind::InvalidTarget, + format!("target `{target_triple}` had an unknown architecture"), + ))?; + + let cargo_env = |name, fallback| { + // No need to emit `rerun-if-env-changed` for these, + // as they are controlled by Cargo itself. + #[allow(clippy::disallowed_methods)] + match env::var(name) { + Ok(var) => Ok(Cow::Owned(var)), + Err(err) => match fallback { + Some(fallback) => Ok(fallback), + None => Err(Error::new( + ErrorKind::EnvVarNotFound, + format!("did not find fallback information for target `{target_triple}`, and failed reading {name}: {err}"), + )), + }, + } + }; + + // Prefer to use `CARGO_ENV_*` if set, since these contain the most + // correct information relative to the current `rustc`, and makes it + // possible to support custom target JSON specs unknown to `rustc`. + // + // NOTE: If the user is using an older `rustc`, that data may be older + // than our pre-generated data, but we still prefer Cargo's view of + // the world, since at least `cc` won't differ from `rustc` in that + // case. + // + // These may not be set in case the user depended on being able to + // just set `TARGET` outside of build scripts; in those cases, fall + // back back to data from the known set of target triples instead. + // + // See discussion in #1225 for further details. + let fallback_target = Target::from_str(&target_triple).ok(); + let ft = fallback_target.as_ref(); + let arch = cargo_env("CARGO_CFG_TARGET_ARCH", ft.map(|t| t.arch.clone()))?; + let vendor = cargo_env("CARGO_CFG_TARGET_VENDOR", ft.map(|t| t.vendor.clone()))?; + let os = cargo_env("CARGO_CFG_TARGET_OS", ft.map(|t| t.os.clone()))?; + let env = cargo_env("CARGO_CFG_TARGET_ENV", ft.map(|t| t.env.clone()))?; + // `target_abi` was stabilized in Rust 1.78, which is higher than our + // MSRV, so it may not always be available; In that case, fall back to + // `""`, which is _probably_ correct for unknown target triples. + let abi = cargo_env("CARGO_CFG_TARGET_ABI", ft.map(|t| t.abi.clone())) + .unwrap_or(Cow::Borrowed("")); + + Ok(Self { + full_arch: full_arch.to_string().into(), + arch, + vendor, + os, + env, + abi, + }) + } +} + +impl FromStr for Target { + type Err = Error; + + /// This will fail when using a custom target triple unknown to `rustc`. + fn from_str(target_triple: &str) -> Result { + if let Ok(index) = + generated::LIST.binary_search_by_key(&target_triple, |(target_triple, _)| target_triple) + { + let (_, target) = &generated::LIST[index]; + Ok(target.clone()) + } else { + Err(Error::new( + ErrorKind::InvalidTarget, + format!("unknown target `{target_triple}`"), + )) + } + } +} + +#[cfg(test)] +mod tests { + use std::str::FromStr; + + use super::Target; + + // Test tier 1 targets + #[test] + fn tier1() { + let targets = [ + "aarch64-unknown-linux-gnu", + "aarch64-apple-darwin", + "i686-pc-windows-gnu", + "i686-pc-windows-msvc", + "i686-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-gnu", + "x86_64-pc-windows-msvc", + "x86_64-unknown-linux-gnu", + ]; + + for target in targets { + // Check that it parses + let _ = Target::from_str(target).unwrap(); + } + } + + // Various custom target triples not (or no longer) known by `rustc` + #[test] + fn cannot_parse_extra() { + let targets = [ + "aarch64-unknown-none-gnu", + "aarch64-uwp-windows-gnu", + "arm-frc-linux-gnueabi", + "arm-unknown-netbsd-eabi", + "armv7neon-unknown-linux-gnueabihf", + "armv7neon-unknown-linux-musleabihf", + "thumbv7-unknown-linux-gnueabihf", + "thumbv7-unknown-linux-musleabihf", + "x86_64-rumprun-netbsd", + "x86_64-unknown-linux", + ]; + + for target in targets { + // Check that it does not parse + let _ = Target::from_str(target).unwrap_err(); + } + } +} diff --git a/src/target/generated.rs b/src/target/generated.rs new file mode 100644 index 00000000..d28b9223 --- /dev/null +++ b/src/target/generated.rs @@ -0,0 +1,3066 @@ +//! This file is generated code. Please edit the generator +//! in dev-tools/gen-target-info if you need to make changes. + +use super::Target; +use std::borrow::Cow; + +pub(crate) const LIST: &[(&str, Target)] = &[ + ( + "aarch64-apple-darwin", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("macos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-apple-ios", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-apple-ios-macabi", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("macabi"), + }, + ), + ( + "aarch64-apple-ios-sim", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "aarch64-apple-tvos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("tvos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-apple-tvos-sim", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("tvos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "aarch64-apple-visionos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("visionos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-apple-visionos-sim", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("visionos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "aarch64-apple-watchos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("watchos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-apple-watchos-sim", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("watchos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "aarch64-fuchsia", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("fuchsia"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-kmc-solid_asp3", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("kmc"), + os: Cow::Borrowed("solid_asp3"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-linux-android", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-nintendo-switch-freestanding", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("nintendo"), + os: Cow::Borrowed("horizon"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-pc-windows-gnullvm", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("llvm"), + }, + ), + ( + "aarch64-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-fuchsia", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("fuchsia"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-hermit", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("hermit"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-illumos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("illumos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-linux-gnu_ilp32", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("ilp32"), + }, + ), + ( + "aarch64-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-linux-ohos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("ohos"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-none", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-none-softfloat", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("softfloat"), + }, + ), + ( + "aarch64-unknown-nto-qnx700", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nto"), + env: Cow::Borrowed("nto70"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-nto-qnx710", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nto"), + env: Cow::Borrowed("nto71"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-redox", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("redox"), + env: Cow::Borrowed("relibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-teeos", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("teeos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-trusty", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("trusty"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-unknown-uefi", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("uefi"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64-uwp-windows-msvc", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "aarch64-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("aarch64"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64_be-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("aarch64_be"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "aarch64_be-unknown-linux-gnu_ilp32", + Target { + full_arch: Cow::Borrowed("aarch64_be"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("ilp32"), + }, + ), + ( + "aarch64_be-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("aarch64_be"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "arm-linux-androideabi", + Target { + full_arch: Cow::Borrowed("arm"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "arm-unknown-linux-gnueabi", + Target { + full_arch: Cow::Borrowed("arm"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "arm-unknown-linux-gnueabihf", + Target { + full_arch: Cow::Borrowed("arm"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "arm-unknown-linux-musleabi", + Target { + full_arch: Cow::Borrowed("arm"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "arm-unknown-linux-musleabihf", + Target { + full_arch: Cow::Borrowed("arm"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "arm64_32-apple-watchos", + Target { + full_arch: Cow::Borrowed("arm64_32"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("watchos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "arm64e-apple-darwin", + Target { + full_arch: Cow::Borrowed("arm64e"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("macos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "arm64e-apple-ios", + Target { + full_arch: Cow::Borrowed("arm64e"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "arm64e-apple-tvos", + Target { + full_arch: Cow::Borrowed("arm64e"), + arch: Cow::Borrowed("aarch64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("tvos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "arm64ec-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("arm64ec"), + arch: Cow::Borrowed("arm64ec"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "armeb-unknown-linux-gnueabi", + Target { + full_arch: Cow::Borrowed("armeb"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armebv7r-none-eabi", + Target { + full_arch: Cow::Borrowed("armebv7r"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armebv7r-none-eabihf", + Target { + full_arch: Cow::Borrowed("armebv7r"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv4t-none-eabi", + Target { + full_arch: Cow::Borrowed("armv4t"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv4t-unknown-linux-gnueabi", + Target { + full_arch: Cow::Borrowed("armv4t"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv5te-none-eabi", + Target { + full_arch: Cow::Borrowed("armv5te"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv5te-unknown-linux-gnueabi", + Target { + full_arch: Cow::Borrowed("armv5te"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv5te-unknown-linux-musleabi", + Target { + full_arch: Cow::Borrowed("armv5te"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv5te-unknown-linux-uclibceabi", + Target { + full_arch: Cow::Borrowed("armv5te"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv6-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("armv6"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv6-unknown-netbsd-eabihf", + Target { + full_arch: Cow::Borrowed("armv6"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv6k-nintendo-3ds", + Target { + full_arch: Cow::Borrowed("armv6k"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("nintendo"), + os: Cow::Borrowed("horizon"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-apple-ios", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "armv7-linux-androideabi", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-rtems-eabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("rtems"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-sony-vita-newlibeabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("sony"), + os: Cow::Borrowed("vita"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-linux-gnueabi", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-unknown-linux-gnueabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-linux-musleabi", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-unknown-linux-musleabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-linux-ohos", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("ohos"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-unknown-linux-uclibceabi", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-unknown-linux-uclibceabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-netbsd-eabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7-unknown-trusty", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("trusty"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7-wrs-vxworks-eabihf", + Target { + full_arch: Cow::Borrowed("armv7"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7a-kmc-solid_asp3-eabi", + Target { + full_arch: Cow::Borrowed("armv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("kmc"), + os: Cow::Borrowed("solid_asp3"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7a-kmc-solid_asp3-eabihf", + Target { + full_arch: Cow::Borrowed("armv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("kmc"), + os: Cow::Borrowed("solid_asp3"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7a-none-eabi", + Target { + full_arch: Cow::Borrowed("armv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7a-none-eabihf", + Target { + full_arch: Cow::Borrowed("armv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7k-apple-watchos", + Target { + full_arch: Cow::Borrowed("armv7k"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("watchos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "armv7r-none-eabi", + Target { + full_arch: Cow::Borrowed("armv7r"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "armv7r-none-eabihf", + Target { + full_arch: Cow::Borrowed("armv7r"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "armv7s-apple-ios", + Target { + full_arch: Cow::Borrowed("armv7s"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "armv8r-none-eabihf", + Target { + full_arch: Cow::Borrowed("armv8r"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "asmjs-unknown-emscripten", + Target { + full_arch: Cow::Borrowed("asmjs"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("emscripten"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "avr-unknown-gnu-atmega328", + Target { + full_arch: Cow::Borrowed("avr"), + arch: Cow::Borrowed("avr"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "bpfeb-unknown-none", + Target { + full_arch: Cow::Borrowed("bpfeb"), + arch: Cow::Borrowed("bpf"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "bpfel-unknown-none", + Target { + full_arch: Cow::Borrowed("bpfel"), + arch: Cow::Borrowed("bpf"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "csky-unknown-linux-gnuabiv2", + Target { + full_arch: Cow::Borrowed("csky"), + arch: Cow::Borrowed("csky"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abiv2"), + }, + ), + ( + "csky-unknown-linux-gnuabiv2hf", + Target { + full_arch: Cow::Borrowed("csky"), + arch: Cow::Borrowed("csky"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abiv2hf"), + }, + ), + ( + "hexagon-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("hexagon"), + arch: Cow::Borrowed("hexagon"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "hexagon-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("hexagon"), + arch: Cow::Borrowed("hexagon"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i386-apple-ios", + Target { + full_arch: Cow::Borrowed("i386"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "i586-pc-nto-qnx700", + Target { + full_arch: Cow::Borrowed("i586"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("nto"), + env: Cow::Borrowed("nto70"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i586-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("i586"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i586-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("i586"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i586-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("i586"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i586-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("i586"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-apple-darwin", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("macos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-linux-android", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-pc-windows-gnu", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-pc-windows-gnullvm", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("llvm"), + }, + ), + ( + "i686-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-haiku", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("haiku"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-hurd-gnu", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("hurd"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-redox", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("redox"), + env: Cow::Borrowed("relibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-unknown-uefi", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("uefi"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-uwp-windows-gnu", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "i686-uwp-windows-msvc", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "i686-win7-windows-msvc", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("win7"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "i686-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("i686"), + arch: Cow::Borrowed("x86"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "loongarch64-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("loongarch64"), + arch: Cow::Borrowed("loongarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "loongarch64-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("loongarch64"), + arch: Cow::Borrowed("loongarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "loongarch64-unknown-linux-ohos", + Target { + full_arch: Cow::Borrowed("loongarch64"), + arch: Cow::Borrowed("loongarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("ohos"), + abi: Cow::Borrowed(""), + }, + ), + ( + "loongarch64-unknown-none", + Target { + full_arch: Cow::Borrowed("loongarch64"), + arch: Cow::Borrowed("loongarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "loongarch64-unknown-none-softfloat", + Target { + full_arch: Cow::Borrowed("loongarch64"), + arch: Cow::Borrowed("loongarch64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("softfloat"), + }, + ), + ( + "m68k-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("m68k"), + arch: Cow::Borrowed("m68k"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mips-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("mips"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mips-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("mips"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mips-unknown-linux-uclibc", + Target { + full_arch: Cow::Borrowed("mips"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mips64-openwrt-linux-musl", + Target { + full_arch: Cow::Borrowed("mips64"), + arch: Cow::Borrowed("mips64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mips64-unknown-linux-gnuabi64", + Target { + full_arch: Cow::Borrowed("mips64"), + arch: Cow::Borrowed("mips64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mips64-unknown-linux-muslabi64", + Target { + full_arch: Cow::Borrowed("mips64"), + arch: Cow::Borrowed("mips64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mips64el-unknown-linux-gnuabi64", + Target { + full_arch: Cow::Borrowed("mips64el"), + arch: Cow::Borrowed("mips64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mips64el-unknown-linux-muslabi64", + Target { + full_arch: Cow::Borrowed("mips64el"), + arch: Cow::Borrowed("mips64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mipsel-sony-psp", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("sony"), + os: Cow::Borrowed("psp"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-sony-psx", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("sony"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed("psx"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-unknown-linux-uclibc", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsel-unknown-none", + Target { + full_arch: Cow::Borrowed("mipsel"), + arch: Cow::Borrowed("mips"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsisa32r6-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("mipsisa32r6"), + arch: Cow::Borrowed("mips32r6"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsisa32r6el-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("mipsisa32r6el"), + arch: Cow::Borrowed("mips32r6"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "mipsisa64r6-unknown-linux-gnuabi64", + Target { + full_arch: Cow::Borrowed("mipsisa64r6"), + arch: Cow::Borrowed("mips64r6"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "mipsisa64r6el-unknown-linux-gnuabi64", + Target { + full_arch: Cow::Borrowed("mipsisa64r6el"), + arch: Cow::Borrowed("mips64r6"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("abi64"), + }, + ), + ( + "msp430-none-elf", + Target { + full_arch: Cow::Borrowed("msp430"), + arch: Cow::Borrowed("msp430"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "nvptx64-nvidia-cuda", + Target { + full_arch: Cow::Borrowed("nvptx64"), + arch: Cow::Borrowed("nvptx64"), + vendor: Cow::Borrowed("nvidia"), + os: Cow::Borrowed("cuda"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-unknown-linux-gnuspe", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("spe"), + }, + ), + ( + "powerpc-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-unknown-linux-muslspe", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("spe"), + }, + ), + ( + "powerpc-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc-wrs-vxworks-spe", + Target { + full_arch: Cow::Borrowed("powerpc"), + arch: Cow::Borrowed("powerpc"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("spe"), + }, + ), + ( + "powerpc64-ibm-aix", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("ibm"), + os: Cow::Borrowed("aix"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("vec-extabi"), + }, + ), + ( + "powerpc64-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("powerpc64"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64le-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("powerpc64le"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64le-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("powerpc64le"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "powerpc64le-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("powerpc64le"), + arch: Cow::Borrowed("powerpc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("riscv32"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32e-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32e"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32em-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32em"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32emc-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32emc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32gc-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("riscv32gc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32gc-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("riscv32gc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32i-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32i"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32im-risc0-zkvm-elf", + Target { + full_arch: Cow::Borrowed("riscv32im"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("risc0"), + os: Cow::Borrowed("zkvm"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32im-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32im"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32ima-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32ima"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imac-esp-espidf", + Target { + full_arch: Cow::Borrowed("riscv32imac"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imac-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32imac"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imac-unknown-nuttx-elf", + Target { + full_arch: Cow::Borrowed("riscv32imac"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imac-unknown-xous-elf", + Target { + full_arch: Cow::Borrowed("riscv32imac"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("xous"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imafc-esp-espidf", + Target { + full_arch: Cow::Borrowed("riscv32imafc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imafc-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32imafc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imafc-unknown-nuttx-elf", + Target { + full_arch: Cow::Borrowed("riscv32imafc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imc-esp-espidf", + Target { + full_arch: Cow::Borrowed("riscv32imc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imc-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv32imc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv32imc-unknown-nuttx-elf", + Target { + full_arch: Cow::Borrowed("riscv32imc"), + arch: Cow::Borrowed("riscv32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64-linux-android", + Target { + full_arch: Cow::Borrowed("riscv64"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("riscv64"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-fuchsia", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("fuchsia"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-hermit", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("hermit"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-nuttx-elf", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64gc-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("riscv64gc"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64imac-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("riscv64imac"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "riscv64imac-unknown-nuttx-elf", + Target { + full_arch: Cow::Borrowed("riscv64imac"), + arch: Cow::Borrowed("riscv64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "s390x-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("s390x"), + arch: Cow::Borrowed("s390x"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "s390x-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("s390x"), + arch: Cow::Borrowed("s390x"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparc-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("sparc"), + arch: Cow::Borrowed("sparc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparc-unknown-none-elf", + Target { + full_arch: Cow::Borrowed("sparc"), + arch: Cow::Borrowed("sparc"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparc64-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("sparc64"), + arch: Cow::Borrowed("sparc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparc64-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("sparc64"), + arch: Cow::Borrowed("sparc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparc64-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("sparc64"), + arch: Cow::Borrowed("sparc64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "sparcv9-sun-solaris", + Target { + full_arch: Cow::Borrowed("sparcv9"), + arch: Cow::Borrowed("sparc64"), + vendor: Cow::Borrowed("sun"), + os: Cow::Borrowed("solaris"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "thumbv4t-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv4t"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv5te-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv5te"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv6m-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv6m"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv6m-nuttx-eabi", + Target { + full_arch: Cow::Borrowed("thumbv6m"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7a-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("thumbv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "thumbv7a-uwp-windows-msvc", + Target { + full_arch: Cow::Borrowed("thumbv7a"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "thumbv7em-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv7em"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7em-none-eabihf", + Target { + full_arch: Cow::Borrowed("thumbv7em"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "thumbv7em-nuttx-eabi", + Target { + full_arch: Cow::Borrowed("thumbv7em"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7em-nuttx-eabihf", + Target { + full_arch: Cow::Borrowed("thumbv7em"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "thumbv7m-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv7m"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7m-nuttx-eabi", + Target { + full_arch: Cow::Borrowed("thumbv7m"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7neon-linux-androideabi", + Target { + full_arch: Cow::Borrowed("thumbv7neon"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv7neon-unknown-linux-gnueabihf", + Target { + full_arch: Cow::Borrowed("thumbv7neon"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "thumbv7neon-unknown-linux-musleabihf", + Target { + full_arch: Cow::Borrowed("thumbv7neon"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "thumbv8m.base-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv8m.base"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv8m.base-nuttx-eabi", + Target { + full_arch: Cow::Borrowed("thumbv8m.base"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv8m.main-none-eabi", + Target { + full_arch: Cow::Borrowed("thumbv8m.main"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv8m.main-none-eabihf", + Target { + full_arch: Cow::Borrowed("thumbv8m.main"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "thumbv8m.main-nuttx-eabi", + Target { + full_arch: Cow::Borrowed("thumbv8m.main"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabi"), + }, + ), + ( + "thumbv8m.main-nuttx-eabihf", + Target { + full_arch: Cow::Borrowed("thumbv8m.main"), + arch: Cow::Borrowed("arm"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("nuttx"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("eabihf"), + }, + ), + ( + "wasm32-unknown-emscripten", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("emscripten"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32-unknown-unknown", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("unknown"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32-wasi", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("wasi"), + env: Cow::Borrowed("p1"), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32-wasip1", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("wasi"), + env: Cow::Borrowed("p1"), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32-wasip1-threads", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("wasi"), + env: Cow::Borrowed("p1"), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32-wasip2", + Target { + full_arch: Cow::Borrowed("wasm32"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("wasi"), + env: Cow::Borrowed("p2"), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm32v1-none", + Target { + full_arch: Cow::Borrowed("wasm32v1"), + arch: Cow::Borrowed("wasm32"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "wasm64-unknown-unknown", + Target { + full_arch: Cow::Borrowed("wasm64"), + arch: Cow::Borrowed("wasm64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("unknown"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-apple-darwin", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("macos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-apple-ios", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "x86_64-apple-ios-macabi", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("ios"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("macabi"), + }, + ), + ( + "x86_64-apple-tvos", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("tvos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "x86_64-apple-watchos-sim", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("watchos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed("sim"), + }, + ), + ( + "x86_64-fortanix-unknown-sgx", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("fortanix"), + os: Cow::Borrowed("unknown"), + env: Cow::Borrowed("sgx"), + abi: Cow::Borrowed("fortanix"), + }, + ), + ( + "x86_64-fuchsia", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("fuchsia"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-linux-android", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("android"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-pc-nto-qnx710", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("nto"), + env: Cow::Borrowed("nto71"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-pc-solaris", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("solaris"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-pc-windows-gnu", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-pc-windows-gnullvm", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("llvm"), + }, + ), + ( + "x86_64-pc-windows-msvc", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("pc"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-sun-solaris", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("sun"), + os: Cow::Borrowed("solaris"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unikraft-linux-musl", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unikraft"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-dragonfly", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("dragonfly"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-freebsd", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("freebsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-fuchsia", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("fuchsia"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-haiku", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("haiku"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-hermit", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("hermit"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-hurd-gnu", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("hurd"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-illumos", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("illumos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-l4re-uclibc", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("l4re"), + env: Cow::Borrowed("uclibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-linux-gnu", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-linux-gnux32", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("x32"), + }, + ), + ( + "x86_64-unknown-linux-musl", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("musl"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-linux-none", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-linux-ohos", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("linux"), + env: Cow::Borrowed("ohos"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-netbsd", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("netbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-none", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-none-linuxkernel", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-openbsd", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("openbsd"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-redox", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("redox"), + env: Cow::Borrowed("relibc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-trusty", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("trusty"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-unknown-uefi", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("unknown"), + os: Cow::Borrowed("uefi"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-uwp-windows-gnu", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "x86_64-uwp-windows-msvc", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("uwp"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed("uwp"), + }, + ), + ( + "x86_64-win7-windows-msvc", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("win7"), + os: Cow::Borrowed("windows"), + env: Cow::Borrowed("msvc"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64-wrs-vxworks", + Target { + full_arch: Cow::Borrowed("x86_64"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("wrs"), + os: Cow::Borrowed("vxworks"), + env: Cow::Borrowed("gnu"), + abi: Cow::Borrowed(""), + }, + ), + ( + "x86_64h-apple-darwin", + Target { + full_arch: Cow::Borrowed("x86_64h"), + arch: Cow::Borrowed("x86_64"), + vendor: Cow::Borrowed("apple"), + os: Cow::Borrowed("macos"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32-espidf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32-none-elf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32s2-espidf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32s2-none-elf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32s3-espidf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("espidf"), + env: Cow::Borrowed("newlib"), + abi: Cow::Borrowed(""), + }, + ), + ( + "xtensa-esp32s3-none-elf", + Target { + full_arch: Cow::Borrowed("xtensa"), + arch: Cow::Borrowed("xtensa"), + vendor: Cow::Borrowed("espressif"), + os: Cow::Borrowed("none"), + env: Cow::Borrowed(""), + abi: Cow::Borrowed(""), + }, + ), +]; diff --git a/src/target_info.rs b/src/target_info.rs deleted file mode 100644 index 085412ad..00000000 --- a/src/target_info.rs +++ /dev/null @@ -1,29 +0,0 @@ -//! This file is generated code. Please edit the generator -//! in dev-tools/gen-target-info if you need to make changes. - -pub const RISCV_ARCH_MAPPING: &[(&str, &str)] = &[ - ("riscv32e", "riscv32"), - ("riscv32em", "riscv32"), - ("riscv32emc", "riscv32"), - ("riscv32gc", "riscv32"), - ("riscv32i", "riscv32"), - ("riscv32im", "riscv32"), - ("riscv32ima", "riscv32"), - ("riscv32imac", "riscv32"), - ("riscv32imafc", "riscv32"), - ("riscv32imc", "riscv32"), - ("riscv64gc", "riscv64"), - ("riscv64imac", "riscv64"), -]; -pub const WINDOWS_TRIPLE_MAPPING: &[(&str, &str)] = &[ - ("aarch64-pc-windows-gnullvm", "aarch64-pc-windows-gnu"), - ("aarch64-uwp-windows-msvc", "aarch64-pc-windows-msvc"), - ("i686-pc-windows-gnullvm", "i686-pc-windows-gnu"), - ("i686-uwp-windows-gnu", "i686-pc-windows-gnu"), - ("i686-uwp-windows-msvc", "i686-pc-windows-msvc"), - ("i686-win7-windows-msvc", "i686-pc-windows-msvc"), - ("thumbv7a-uwp-windows-msvc", "thumbv7a-pc-windows-msvc"), - ("x86_64-pc-windows-gnullvm", "x86_64-pc-windows-gnu"), - ("x86_64-uwp-windows-gnu", "x86_64-pc-windows-gnu"), - ("x86_64-uwp-windows-msvc", "x86_64-pc-windows-msvc"), -]; diff --git a/src/windows/find_tools.rs b/src/windows/find_tools.rs index 54470f3e..48e78a7f 100644 --- a/src/windows/find_tools.rs +++ b/src/windows/find_tools.rs @@ -23,8 +23,8 @@ use std::{ sync::Arc, }; -use crate::Tool; use crate::ToolFamily; +use crate::{target::Target, Tool}; const MSVC_FAMILY: ToolFamily = ToolFamily::Msvc { clang_cl: false }; @@ -107,22 +107,22 @@ pub fn find(target: &str, tool: &str) -> Option { /// operation (finding a MSVC tool in a local install) but instead returns a /// `Tool` which may be introspected. pub fn find_tool(target: &str, tool: &str) -> Option { - find_tool_inner(target, tool, &StdEnvGetter) + find_tool_inner(&target.parse().ok()?, tool, &StdEnvGetter) } pub(crate) fn find_tool_inner( - target: &str, + target: &Target, tool: &str, env_getter: &dyn EnvGetter, ) -> Option { // This logic is all tailored for MSVC, if we're not that then bail out // early. - if !target.contains("msvc") { + if target.env != "msvc" { return None; } - // Split the target to get the arch. - let target = TargetArch(target.split_once('-')?.0); + // We only need the arch. + let target = TargetArch(&target.full_arch); // Looks like msbuild isn't located in the same location as other tools like // cl.exe and lib.exe. diff --git a/tests/test.rs b/tests/test.rs index 9d5ce508..02cda7c0 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -59,7 +59,7 @@ fn gnu_opt_level_s() { fn gnu_debug() { let test = Test::gnu(); test.gcc() - .target("x86_64-unknown-linux") + .target("x86_64-unknown-linux-none") .debug(true) .file("foo.c") .compile("foo"); @@ -78,7 +78,7 @@ fn gnu_debug() { fn gnu_debug_fp_auto() { let test = Test::gnu(); test.gcc() - .target("x86_64-unknown-linux") + .target("x86_64-unknown-linux-none") .debug(true) .file("foo.c") .compile("foo"); @@ -90,7 +90,7 @@ fn gnu_debug_fp_auto() { fn gnu_debug_fp() { let test = Test::gnu(); test.gcc() - .target("x86_64-unknown-linux") + .target("x86_64-unknown-linux-none") .debug(true) .file("foo.c") .compile("foo"); @@ -104,7 +104,7 @@ fn gnu_debug_nofp() { let test = Test::gnu(); test.gcc() - .target("x86_64-unknown-linux") + .target("x86_64-unknown-linux-none") .debug(true) .force_frame_pointer(false) .file("foo.c") @@ -114,7 +114,7 @@ fn gnu_debug_nofp() { let test = Test::gnu(); test.gcc() - .target("x86_64-unknown-linux") + .target("x86_64-unknown-linux-none") .force_frame_pointer(false) .debug(true) .file("foo.c") @@ -271,7 +271,7 @@ fn gnu_x86_64_no_plt() { #[test] fn gnu_aarch64_none_no_pic() { - for target in &["aarch64-unknown-none-gnu", "aarch64-unknown-none"] { + for target in &["aarch64-unknown-none-softfloat", "aarch64-unknown-none"] { let test = Test::gnu(); test.gcc() .target(&target)