From 268fb9b9fbe2e20e14612bfbdf414e257fbe52c3 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 30 Sep 2024 16:57:16 +0200 Subject: [PATCH 01/16] Reduce the need for the host target triple --- src/lib.rs | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cf6072df..deda67e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -283,6 +283,9 @@ pub struct Build { ccbin: bool, std: Option>, target: Option>, + /// The host compiler. + /// + /// Try to not access this directly, and instead prefer `cfg!(...)`. host: Option>, out_dir: Option>, opt_level: Option>, @@ -658,11 +661,13 @@ impl Build { .cargo_metadata(self.cargo_output.metadata) .target(target) .opt_level(0) - .host(&self.get_host()?) .debug(false) .cpp(self.cpp) .cuda(self.cuda) .emit_rerun_if_env_changed(self.emit_rerun_if_env_changed); + if let Some(host) = &self.host { + cfg.host(host); + } cfg.try_get_compiler()? }; @@ -2866,7 +2871,6 @@ impl Build { out_dir, )); } - let host = self.get_host()?; let target = self.get_target()?; let target = &*target; let (env, msvc, gnu, traditional, clang) = if self.cpp { @@ -2879,7 +2883,7 @@ impl Build { // is not flag-compatible with "gcc". This history casts a long shadow, // and many modern illumos distributions today ship GCC as "gcc" without // also making it available as "cc". - let default = if host.contains("solaris") || host.contains("illumos") { + let default = if cfg!(target_os = "solaris") || cfg!(target_os = "illumos") { gnu } else { traditional @@ -2944,7 +2948,7 @@ impl Build { let tool = match tool_opt { Some(t) => t, None => { - let compiler = if host.contains("windows") && target.contains("windows") { + let compiler = if cfg!(windows) && target.contains("windows") { if target.contains("msvc") { msvc.to_string() } else { @@ -2958,7 +2962,7 @@ impl Build { { clang.to_string() } else if target.contains("android") { - autodetect_android_compiler(target, &host, gnu, clang) + autodetect_android_compiler(target, gnu, clang) } else if target.contains("cloudabi") { format!("{}-{}", target, traditional) } else if Build::is_wasi_target(target) { @@ -2977,7 +2981,7 @@ impl Build { format!("arm-kmc-eabi-{}", gnu) } else if target.starts_with("aarch64-kmc-solid_") { format!("aarch64-kmc-elf-{}", gnu) - } else if &*self.get_host()? != target { + } else if self.get_is_cross_compile()? { let prefix = self.prefix_for_target(target); match prefix { Some(prefix) => { @@ -3042,8 +3046,7 @@ impl Build { // on Windows is restricted to around 8k characters instead of around 32k characters. // To remove this limit, we call the main clang binary directly and construct the // `--target=` ourselves. - if host.contains("windows") && android_clang_compiler_uses_target_arg_internally(&tool.path) - { + if cfg!(windows) && android_clang_compiler_uses_target_arg_internally(&tool.path) { if let Some(path) = tool.path.file_name() { let file_name = path.to_str().unwrap().to_owned(); let (target, clang) = file_name.split_at(file_name.rfind('-').unwrap()); @@ -3430,7 +3433,7 @@ impl Build { // Use the GNU-variant to match other Unix systems. name = format!("g{}", tool).into(); self.cmd(&name) - } else if self.get_host()? != target { + } else if self.get_is_cross_compile()? { match self.prefix_for_target(&target) { Some(p) => { // GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both. @@ -3644,11 +3647,13 @@ impl Build { } } - fn get_host(&self) -> Result, Error> { - match &self.host { - Some(h) => Ok(Cow::Borrowed(h)), - None => self.getenv_unwrap_str("HOST").map(Cow::Owned), - } + fn get_is_cross_compile(&self) -> Result { + let target = self.get_target()?; + let host: Cow<'_, str> = match &self.host { + Some(h) => Cow::Borrowed(h), + None => Cow::Owned(self.getenv_unwrap_str("HOST")?), + }; + Ok(host != target) } fn get_opt_level(&self) -> Result, Error> { @@ -3765,8 +3770,11 @@ impl Build { fn getenv_with_target_prefixes(&self, var_base: &str) -> Result, Error> { let target = self.get_target()?; - let host = self.get_host()?; - let kind = if host == target { "HOST" } else { "TARGET" }; + let kind = if self.get_is_cross_compile()? { + "TARGET" + } else { + "HOST" + }; let target_u = target.replace('-', "_"); let res = self .getenv(&format!("{}_{}", var_base, target)) @@ -3799,8 +3807,7 @@ impl Build { fn fix_env_for_apple_os(&self, cmd: &mut Command) -> Result<(), Error> { let target = self.get_target()?; - let host = self.get_host()?; - if host.contains("apple-darwin") && target.contains("apple-darwin") { + if cfg!(target_os = "macos") && target.contains("apple-darwin") { // 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". @@ -4209,7 +4216,7 @@ fn android_clang_compiler_uses_target_arg_internally(clang_path: &Path) -> bool false } -fn autodetect_android_compiler(target: &str, host: &str, gnu: &str, clang: &str) -> String { +fn autodetect_android_compiler(target: &str, gnu: &str, clang: &str) -> String { let new_clang_key = match target { "aarch64-linux-android" => Some("aarch64"), "armv7-linux-androideabi" => Some("armv7a"), @@ -4249,7 +4256,7 @@ fn autodetect_android_compiler(target: &str, host: &str, gnu: &str, clang: &str) // if not, use clang if Command::new(&gnu_compiler).output().is_ok() { gnu_compiler - } else if host.contains("windows") && Command::new(&clang_compiler_cmd).output().is_ok() { + } else if cfg!(windows) && Command::new(&clang_compiler_cmd).output().is_ok() { clang_compiler_cmd } else { clang_compiler From 0b60b02a196ef48df2d9b9006aeab40cb1e358a8 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 1 Oct 2024 01:12:27 +0200 Subject: [PATCH 02/16] Use Cargo's target information when possible rustc's target triples generally only have a vague resemblance to each other and to the information needed by `cc`. Let's instead prefer `CARGO_CFG_*` variables when available, since these contain the information directly from the compiler itself. In the cases where it isn't available (i.e. when running outside of a build script), we fall back to parsing the target triple, but instead of doing it in an ad-hoc fashion with string manipulation, we do it in a more structured fashion up front. --- dev-tools/gen-target-info/src/main.rs | 35 +- src/lib.rs | 655 ++++++++++++-------------- src/target.rs | 418 ++++++++++++++++ src/target_info.rs | 24 - src/windows/find_tools.rs | 12 +- 5 files changed, 715 insertions(+), 429 deletions(-) create mode 100644 src/target.rs diff --git a/dev-tools/gen-target-info/src/main.rs b/dev-tools/gen-target-info/src/main.rs index cf4abef1..e8c083bf 100644 --- a/dev-tools/gen-target-info/src/main.rs +++ b/dev-tools/gen-target-info/src/main.rs @@ -1,41 +1,11 @@ -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::{fs::File, io::Write as _}; 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_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); -} - fn main() { - let target_specs = get_target_specs_from_json(); - // Open file to write to let manifest_dir = env!("CARGO_MANIFEST_DIR"); @@ -45,8 +15,7 @@ fn main() { 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); + // TODO // Flush the data onto disk f.flush().unwrap(); diff --git a/src/lib.rs b/src/lib.rs index deda67e5..67fcfaa7 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; @@ -633,7 +635,7 @@ impl Build { &self, flag: &OsStr, compiler_path: &Path, - target: &str, + target: &Target, ) -> Result { let compiler_flag = CompilerFlag { compiler: compiler_path.into(), @@ -659,12 +661,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 +687,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 +1357,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 +1403,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 +1427,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(target.arch.clone() + "-linux"); 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 +1702,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 +1726,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 +1933,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 +1975,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,29 +1992,28 @@ 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( - !target.contains("windows") - && !target.contains("-none-") - && !target.ends_with("-none") - && !target.contains("uefi"), + target.os != "windows" && target.os != "none" && target.env != "uefi", ) { 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()); @@ -2038,11 +2042,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()); } } @@ -2051,155 +2055,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 @@ -2222,20 +2175,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()); } } } @@ -2246,17 +2195,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 @@ -2268,21 +2218,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()); } @@ -2295,22 +2243,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. @@ -2319,27 +2268,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()); @@ -2347,7 +2296,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()); @@ -2356,12 +2305,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()); } @@ -2370,43 +2319,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()); @@ -2418,54 +2366,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)?; } @@ -2499,11 +2440,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" @@ -2515,7 +2456,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"); } @@ -2548,7 +2489,7 @@ impl Build { } } - if target.contains("i686") || target.contains("i586") { + if target.arch == "x86" { cmd.arg("-safeseh"); } @@ -2585,7 +2526,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. @@ -2623,7 +2564,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 @@ -2681,37 +2622,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"), @@ -2722,7 +2647,7 @@ impl Build { )); } } - } else if is_catalyst { + } else if target.abi == "macabi" { match arch_str { "arm64e" => AppleArchSpec::Catalyst("arm64e"), "arm64" | "aarch64" => AppleArchSpec::Catalyst("arm64"), @@ -2734,9 +2659,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( @@ -2753,8 +2679,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, @@ -2768,7 +2692,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()); } @@ -2805,8 +2729,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 @@ -2872,7 +2796,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 { @@ -2889,7 +2813,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) @@ -2920,7 +2844,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) { @@ -2948,44 +2872,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(), @@ -3082,7 +3009,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())); @@ -3090,7 +3017,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"); } @@ -3211,17 +3138,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++")))) @@ -3344,7 +3271,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"); @@ -3355,7 +3282,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... @@ -3382,14 +3309,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 @@ -3418,7 +3349,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 @@ -3426,7 +3357,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. // @@ -3434,7 +3365,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 @@ -3469,6 +3400,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") @@ -3640,7 +3572,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), @@ -3648,7 +3587,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")?), @@ -3678,16 +3617,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 @@ -3769,7 +3706,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 { @@ -3807,7 +3744,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". @@ -4033,18 +3970,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 @@ -4101,12 +4026,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<'_> { @@ -4216,8 +4141,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"), @@ -4239,7 +4165,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") @@ -4264,23 +4190,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..4dada79a --- /dev/null +++ b/src/target.rs @@ -0,0 +1,418 @@ +//! Very basic parsing of `rustc` target triples. +//! +//! See the `target-lexicon` crate for a more principled approach to this. + +use std::{env, str::FromStr}; + +use crate::{Error, ErrorKind}; + +/// The parts of `rustc`'s target triple. +/// +/// See . +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +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: String, + /// The overall target architecture. + /// + /// This is the same as the value of `cfg!(target_arch)`. + pub arch: String, + /// The target vendor. + /// + /// This is the same as the value of `cfg!(target_vendor)`. + pub vendor: String, + /// The operating system, or `none` on bare-metal targets. + /// + /// This is the same as the value of `cfg!(target_os)`. + pub os: String, + /// The environment on top of the operating system. + /// + /// This is the same as the value of `cfg!(target_env)`. + pub env: String, + /// The ABI on top of the operating system. + /// + /// This is the same as the value of `cfg!(target_abi)`. + pub abi: String, +} + +impl Target { + pub fn from_cargo_environment_variables() -> Result { + let getenv = |name| { + // No need to emit `rerun-if-env-changed` for these variables, + // as they are controlled by Cargo itself. + #[allow(clippy::disallowed_methods)] + env::var(name).map_err(|err| { + Error::new( + ErrorKind::EnvVarNotFound, + format!("failed reading {name}: {err}"), + ) + }) + }; + + let target = getenv("TARGET")?; + let (full_arch, _rest) = target.split_once('-').ok_or(Error::new( + ErrorKind::InvalidTarget, + format!("target `{target}` had an unknown architecture"), + ))?; + + let arch = getenv("CARGO_CFG_TARGET_ARCH")?; + let vendor = getenv("CARGO_CFG_TARGET_VENDOR")?; + let os = getenv("CARGO_CFG_TARGET_OS")?; + let env = getenv("CARGO_CFG_TARGET_ENV")?; + // `target_abi` was stabilized in Rust 1.78, so may not always be available. + let abi = if let Ok(abi) = getenv("CARGO_CFG_TARGET_ABI") { + abi + } else { + Self::from_str(&target)?.abi + }; + + Ok(Self { + full_arch: full_arch.to_string(), + arch, + vendor, + os, + env, + abi, + }) + } +} + +impl FromStr for Target { + type Err = Error; + + fn from_str(target: &str) -> Result { + let mut components = target.split('-'); + + // Insist that the triple start with a valid architecture. + let full_arch = components.next().ok_or(Error::new( + ErrorKind::InvalidTarget, + format!("target `{target}` was empty"), + ))?; + + let arch = match full_arch { + // FIXME(rustc): This is probably the wrong arch, should be `aarch64`? + "arm64ec" => "arm64ec", + "asmjs" => "wasm32", + "avr" => "avr", + "bpfeb" | "bpfel" => "bpf", + "csky" => "csky", + "hexagon" => "hexagon", + "i386" | "i586" | "i686" => "x86", + "loongarch64" => "loongarch64", + "m68k" => "m68k", + "mipsisa32r6" | "mipsisa32r6el" => "mips32r6", + "mipsisa64r6" | "mipsisa64r6el" => "mips64r6", + "mips64" | "mips64el" => "mips64", + "mips" | "mipsel" => "mips", + "msp430" => "msp430", + "nvptx64" => "nvptx64", + "powerpc" => "powerpc", + "powerpc64" | "powerpc64le" => "powerpc64", + "s390x" => "s390x", + "sparc" => "sparc", + "sparc64" | "sparcv9" => "sparc64", + "wasm32" => "wasm32", + "wasm64" => "wasm64", + "x86_64" | "x86_64h" => "x86_64", + "xtensa" => "xtensa", + aarch64 if aarch64.starts_with("aarch64") | aarch64.starts_with("arm64") => "aarch64", + arm if arm.starts_with("arm") | arm.starts_with("thumb") => "arm", + riscv32 if riscv32.starts_with("riscv32") => "riscv32", + riscv64 if riscv64.starts_with("riscv64") => "riscv64", + _ => { + // TODO: Should we warn on unknown architectures instead? + return Err(Error::new( + ErrorKind::ArchitectureInvalid, + format!("target `{target}` had an unknown architecture"), + )); + } + }; + + let maybe_vendor = components.next().ok_or(Error::new( + ErrorKind::InvalidTarget, + format!("target `{target}` must have at least two components"), + ))?; + + // Lately, newer target triples have begun omitting the vendor. To + // still be able to parse these, we match it against a list of known + // vendors here, and assume that if it doesn't match, that the triple + // does not contain a vendor. + let mut has_vendor = true; + let mut vendor = match maybe_vendor { + "unknown" => "unknown", + "amd" => "amd", + "apple" => "apple", + // esp, esp32, esp32s2 etc. + esp if esp.starts_with("esp") => "espressif", + "fortanix" => "fortanix", + "frc" => "frc", + "ibm" => "ibm", + "kmc" => "kmc", + "nintendo" => "nintendo", + "nvidia" => "nvidia", + // FIXME(rustc): Seems unintentional? OpenWRT is the OS? + "openwrt" => "unknown", + "pc" => "pc", + "risc0" => "risc0", + "rumprun" => "rumprun", + "sony" => "sony", + "sun" => "sun", + "unikraft" => "unikraft", + "uwp" => "uwp", + // FIXME(rustc): win7 does not really make sense as a vendor? + "win7" => "win7", + "wrs" => "wrs", + _ => { + has_vendor = false; + "unknown" + } + }; + + let os = if has_vendor { + components.next().ok_or(Error::new( + ErrorKind::InvalidTarget, + format!("target `{target}` must have at least two components"), + ))? + } else { + // The triple does not contain a vendor, so that part is the os. + maybe_vendor + }; + + let env_and_abi = components.next().unwrap_or(""); + + if components.next().is_some() { + return Err(Error::new( + ErrorKind::InvalidTarget, + format!("too many components in target `{target}`"), + )); + } + + // Parse actual OS out of the two last components. + let (mut os, env_and_abi) = match (os, env_and_abi) { + (wasi, _) if wasi.starts_with("wasi") => { + let mut env = wasi.strip_prefix("wasi").unwrap(); + if env.is_empty() { + // Currently transitioning some targets here, remove once transition is over: + // + env = "p1"; + } + ("wasi", env) + } + // Android is the actual OS name, `linux` in the target name is legacy. + ("linux", "android") => ("android", ""), + ("linux", "androideabi") => ("android", "eabi"), + // Horizon is the common OS name between the 3DS and the Switch. + ("3ds", "") => ("horizon", "newlibeabihf"), + ("switch", "freestanding") => { + // FIXME(rustc): Is the missing vendor intentional? + vendor = "unknown"; + ("horizon", "") + } + // FIXME(rustc): `mipsel-sony-psx` has no OS component. + ("psx", "") => ("none", "psx"), + // macOS targets are badly named. + ("darwin", env_and_abi) => ("macos", env_and_abi), + (os, env_and_abi) => (os, env_and_abi), + }; + + // Parse environment and ABI. + let (mut env, mut abi) = match (os, env_and_abi) { + ("windows", env) if vendor == "uwp" => (env, "uwp"), + ("vxworks", abi) => ("gnu", abi), + ("rtems", abi) => ("newlib", abi), + ("espidf", abi) => ("newlib", abi), + ("redox", abi) => ("relibc", abi), + ("aix", env) => (env, "vec-extabi"), + ("unknown", "sgx") => ("sgx", "fortanix"), + (_, "sim") => ("", "sim"), + (_, "macabi") => ("", "macabi"), + (_, gnu) if gnu.starts_with("gnu") => { + let abi = gnu.strip_prefix("gnu").unwrap(); + // To handle gnu_ilp32 + let abi = abi.strip_prefix("_").unwrap_or(abi); + ("gnu", abi) + } + (_, musl) if musl.starts_with("musl") => { + let abi = musl.strip_prefix("musl").unwrap(); + ("musl", abi) + } + (_, "softfloat") => ("", "softfloat"), + (_, "qnx700") => ("nto70", ""), + (_, "qnx710") => ("nto71", ""), + (_, "elf") => ("", ""), + (_, "none") => ("", ""), + (_, "eabi") => ("", "eabi"), + (_, "eabihf") => ("", "eabihf"), + (_, "uclibceabi") => ("uclibc", "eabi"), + (_, "uclibceabihf") => ("uclibc", "eabihf"), + (_, "newlibeabihf") => ("newlib", "eabihf"), + // General fallback + (_, env) => (env, ""), + }; + + // FIXME(rustc): The name has `pc` as the vendor, but it's not set? + if os == "nto" { + vendor = "unknown"; + } + + // FIXME(rustc): Vendor isn't set for these targets? + if vendor == "espressif" && os == "none" { + vendor = "unknown"; + } + + // Extra overrides for badly named targets. + match target { + // Actually simulator targets. + "i386-apple-ios" | "x86_64-apple-ios" | "x86_64-apple-tvos" => { + abi = "sim"; + } + // Name should've contained `muslabi64`. + "mips64-openwrt-linux-musl" => { + abi = "abi64"; + } + // Has no OS name + "avr-unknown-gnu-atmega328" => { + os = "none"; + // FIXME(rustc): Should this specify `gnu` env? + env = ""; + abi = ""; + } + // Specifies abi even though not in name + "armv6-unknown-freebsd" | "armv7-unknown-freebsd" => { + // FIXME(rustc): Is it a bug that the env is set to "gnu" here? + env = "gnu"; + abi = "eabihf"; + } + // Specifies abi even though not in name + "armv7-unknown-linux-ohos" | "armv7-unknown-trusty" => { + abi = "eabi"; + } + // FIXME(rustc): Is it a bug that the ABI isn't set here? + "armv7a-kmc-solid_asp3-eabi" | "armv7a-kmc-solid_asp3-eabihf" => { + abi = ""; + } + // FIXME(rustc): Specifies "elf" ABI, is that correct? + "sparc-unknown-none-elf" => { + abi = "elf"; + } + _ => {} + } + + Ok(Target { + full_arch: full_arch.into(), + arch: arch.into(), + vendor: vendor.into(), + os: os.into(), + env: env.into(), + abi: abi.into(), + }) + } +} + +#[cfg(test)] +mod tests { + use std::{process::Command, str::FromStr}; + + use super::Target; + + fn target_from_cfgs(target: &str, cfgs: &str) -> Target { + // Cannot determine full architecture from cfgs. + let (full_arch, _rest) = target.split_once('-').expect("target to have arch"); + + let mut target = Target { + full_arch: full_arch.into(), + arch: "invalid-none-set".into(), + vendor: "invalid-none-set".into(), + os: "invalid-none-set".into(), + env: "invalid-none-set".into(), + // Not set in older Rust versions + abi: "".into(), + }; + + for cfg in cfgs.lines() { + if let Some((name, value)) = cfg.split_once('=') { + // Remove whitespace, if `rustc` decided to insert any + let name = name.trim(); + let value = value.trim(); + + // Remove quotes around value + let value = value.strip_prefix('"').unwrap_or(value); + let value = value.strip_suffix('"').unwrap_or(value); + + let value = value.to_string(); + match name { + "target_arch" => target.arch = value, + "target_vendor" => target.vendor = value, + "target_os" => target.os = value, + "target_env" => target.env = value, + "target_abi" => target.abi = value, + _ => {} + } + } else { + // Skip cfgs like `debug_assertions` and `unix`. + } + } + + target + } + + #[test] + fn parse_rustc_targets() { + let target_list = Command::new("rustc") + .arg("--print=target-list") + .output() + .unwrap() + .stdout; + let target_list = String::from_utf8(target_list).unwrap(); + + let mut has_failure = false; + for target in target_list.lines() { + let cfgs = Command::new("rustc") + .arg("--target") + .arg(target) + .arg("--print=cfg") + .output() + .unwrap() + .stdout; + let cfgs = String::from_utf8(cfgs).unwrap(); + + let expected = target_from_cfgs(target, &cfgs); + let actual = Target::from_str(target); + + if Some(&expected) != actual.as_ref().ok() { + eprintln!("failed comparing {target}:"); + eprintln!(" expected: Ok({expected:?})"); + eprintln!(" actual: {actual:?}"); + eprintln!(); + has_failure = true; + } + } + + if has_failure { + panic!("failed comparing targets"); + } + } + + // Various custom target triples not (or no longer) known by `rustc` + #[test] + fn parse_extra() { + let targets = [ + "arm-frc-linux-gnueabi", + "aarch64-uwp-windows-gnu", + "arm-unknown-netbsd-eabi", + "armv7neon-unknown-linux-gnueabihf", + "armv7neon-unknown-linux-musleabihf", + "thumbv7-unknown-linux-gnueabihf", + "thumbv7-unknown-linux-musleabihf", + "x86_64-rumprun-netbsd", + ]; + + for target in targets { + // Check that it parses + let _ = Target::from_str(target).unwrap(); + } + } +} diff --git a/src/target_info.rs b/src/target_info.rs index f2f9548f..6f5f0a4a 100644 --- a/src/target_info.rs +++ b/src/target_info.rs @@ -1,26 +1,2 @@ //! 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)] = &[ - ("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. From f4446b3f01de0d81a2e6d91bc0bdefc33e5d5987 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 2 Oct 2024 17:08:24 +0200 Subject: [PATCH 03/16] Remove unnecessary derive --- src/target.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target.rs b/src/target.rs index 4dada79a..97b50c48 100644 --- a/src/target.rs +++ b/src/target.rs @@ -9,7 +9,7 @@ use crate::{Error, ErrorKind}; /// The parts of `rustc`'s target triple. /// /// See . -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Debug, PartialEq)] pub(crate) struct Target { /// The full architecture, including the subarchitecture. /// From 74c9897b82f72fa5e89c56106950a6ee4c93bc9f Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 22:10:14 +0200 Subject: [PATCH 04/16] Use pre-generated target information --- .gitignore | 2 +- dev-tools/gen-target-info/src/main.rs | 48 +- dev-tools/gen-target-info/src/target_specs.rs | 2 + src/lib.rs | 1 - src/target.rs | 237 +- src/target/generated.rs | 2130 +++++++++++++++++ src/target_info.rs | 2 - 7 files changed, 2188 insertions(+), 234 deletions(-) create mode 100644 src/target/generated.rs delete mode 100644 src/target_info.rs 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/main.rs b/dev-tools/gen-target-info/src/main.rs index e8c083bf..835e5c49 100644 --- a/dev-tools/gen-target-info/src/main.rs +++ b/dev-tools/gen-target-info/src/main.rs @@ -1,21 +1,61 @@ -use std::{fs::File, io::Write as _}; +use std::fs::File; +use std::io::Write as _; + +use gen_target_info::{get_target_specs_from_json, 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_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std::io::Result<()> { + writeln!(f, "use super::Target;")?; + writeln!(f)?; + writeln!( + f, + "pub(crate) fn get(target_triple: &str) -> Option {{" + )?; + writeln!(f, " Some(match target_triple {{")?; + + 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, " {triple:?} => Target {{")?; + writeln!(f, " full_arch: {full_arch:?}.into(),")?; + writeln!(f, " arch: {arch:?}.into(),")?; + writeln!(f, " vendor: {vendor:?}.into(),")?; + writeln!(f, " os: {os:?}.into(),")?; + writeln!(f, " env: {env:?}.into(),")?; + writeln!(f, " abi: {abi:?}.into(),")?; + writeln!(f, " }},")?; + } + + writeln!(f, " _ => return None,")?; + + writeln!(f, " }})")?; + writeln!(f, "}}")?; + + Ok(()) +} + fn main() { + let target_specs = get_target_specs_from_json(); + // 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 - // TODO + 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/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 67fcfaa7..c0c2174c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -246,7 +246,6 @@ mod tool; pub use tool::Tool; use tool::ToolFamily; -mod target_info; mod tempfile; mod utilities; diff --git a/src/target.rs b/src/target.rs index 97b50c48..b59c2427 100644 --- a/src/target.rs +++ b/src/target.rs @@ -6,6 +6,8 @@ use std::{env, str::FromStr}; use crate::{Error, ErrorKind}; +mod generated; + /// The parts of `rustc`'s target triple. /// /// See . @@ -83,232 +85,15 @@ impl Target { impl FromStr for Target { type Err = Error; - fn from_str(target: &str) -> Result { - let mut components = target.split('-'); - - // Insist that the triple start with a valid architecture. - let full_arch = components.next().ok_or(Error::new( - ErrorKind::InvalidTarget, - format!("target `{target}` was empty"), - ))?; - - let arch = match full_arch { - // FIXME(rustc): This is probably the wrong arch, should be `aarch64`? - "arm64ec" => "arm64ec", - "asmjs" => "wasm32", - "avr" => "avr", - "bpfeb" | "bpfel" => "bpf", - "csky" => "csky", - "hexagon" => "hexagon", - "i386" | "i586" | "i686" => "x86", - "loongarch64" => "loongarch64", - "m68k" => "m68k", - "mipsisa32r6" | "mipsisa32r6el" => "mips32r6", - "mipsisa64r6" | "mipsisa64r6el" => "mips64r6", - "mips64" | "mips64el" => "mips64", - "mips" | "mipsel" => "mips", - "msp430" => "msp430", - "nvptx64" => "nvptx64", - "powerpc" => "powerpc", - "powerpc64" | "powerpc64le" => "powerpc64", - "s390x" => "s390x", - "sparc" => "sparc", - "sparc64" | "sparcv9" => "sparc64", - "wasm32" => "wasm32", - "wasm64" => "wasm64", - "x86_64" | "x86_64h" => "x86_64", - "xtensa" => "xtensa", - aarch64 if aarch64.starts_with("aarch64") | aarch64.starts_with("arm64") => "aarch64", - arm if arm.starts_with("arm") | arm.starts_with("thumb") => "arm", - riscv32 if riscv32.starts_with("riscv32") => "riscv32", - riscv64 if riscv64.starts_with("riscv64") => "riscv64", - _ => { - // TODO: Should we warn on unknown architectures instead? - return Err(Error::new( - ErrorKind::ArchitectureInvalid, - format!("target `{target}` had an unknown architecture"), - )); - } - }; - - let maybe_vendor = components.next().ok_or(Error::new( - ErrorKind::InvalidTarget, - format!("target `{target}` must have at least two components"), - ))?; - - // Lately, newer target triples have begun omitting the vendor. To - // still be able to parse these, we match it against a list of known - // vendors here, and assume that if it doesn't match, that the triple - // does not contain a vendor. - let mut has_vendor = true; - let mut vendor = match maybe_vendor { - "unknown" => "unknown", - "amd" => "amd", - "apple" => "apple", - // esp, esp32, esp32s2 etc. - esp if esp.starts_with("esp") => "espressif", - "fortanix" => "fortanix", - "frc" => "frc", - "ibm" => "ibm", - "kmc" => "kmc", - "nintendo" => "nintendo", - "nvidia" => "nvidia", - // FIXME(rustc): Seems unintentional? OpenWRT is the OS? - "openwrt" => "unknown", - "pc" => "pc", - "risc0" => "risc0", - "rumprun" => "rumprun", - "sony" => "sony", - "sun" => "sun", - "unikraft" => "unikraft", - "uwp" => "uwp", - // FIXME(rustc): win7 does not really make sense as a vendor? - "win7" => "win7", - "wrs" => "wrs", - _ => { - has_vendor = false; - "unknown" - } - }; - - let os = if has_vendor { - components.next().ok_or(Error::new( - ErrorKind::InvalidTarget, - format!("target `{target}` must have at least two components"), - ))? + fn from_str(target_triple: &str) -> Result { + if let Some(target) = generated::get(target_triple) { + Ok(target) } else { - // The triple does not contain a vendor, so that part is the os. - maybe_vendor - }; - - let env_and_abi = components.next().unwrap_or(""); - - if components.next().is_some() { - return Err(Error::new( + Err(Error::new( ErrorKind::InvalidTarget, - format!("too many components in target `{target}`"), - )); + format!("unknown target `{target_triple}`"), + )) } - - // Parse actual OS out of the two last components. - let (mut os, env_and_abi) = match (os, env_and_abi) { - (wasi, _) if wasi.starts_with("wasi") => { - let mut env = wasi.strip_prefix("wasi").unwrap(); - if env.is_empty() { - // Currently transitioning some targets here, remove once transition is over: - // - env = "p1"; - } - ("wasi", env) - } - // Android is the actual OS name, `linux` in the target name is legacy. - ("linux", "android") => ("android", ""), - ("linux", "androideabi") => ("android", "eabi"), - // Horizon is the common OS name between the 3DS and the Switch. - ("3ds", "") => ("horizon", "newlibeabihf"), - ("switch", "freestanding") => { - // FIXME(rustc): Is the missing vendor intentional? - vendor = "unknown"; - ("horizon", "") - } - // FIXME(rustc): `mipsel-sony-psx` has no OS component. - ("psx", "") => ("none", "psx"), - // macOS targets are badly named. - ("darwin", env_and_abi) => ("macos", env_and_abi), - (os, env_and_abi) => (os, env_and_abi), - }; - - // Parse environment and ABI. - let (mut env, mut abi) = match (os, env_and_abi) { - ("windows", env) if vendor == "uwp" => (env, "uwp"), - ("vxworks", abi) => ("gnu", abi), - ("rtems", abi) => ("newlib", abi), - ("espidf", abi) => ("newlib", abi), - ("redox", abi) => ("relibc", abi), - ("aix", env) => (env, "vec-extabi"), - ("unknown", "sgx") => ("sgx", "fortanix"), - (_, "sim") => ("", "sim"), - (_, "macabi") => ("", "macabi"), - (_, gnu) if gnu.starts_with("gnu") => { - let abi = gnu.strip_prefix("gnu").unwrap(); - // To handle gnu_ilp32 - let abi = abi.strip_prefix("_").unwrap_or(abi); - ("gnu", abi) - } - (_, musl) if musl.starts_with("musl") => { - let abi = musl.strip_prefix("musl").unwrap(); - ("musl", abi) - } - (_, "softfloat") => ("", "softfloat"), - (_, "qnx700") => ("nto70", ""), - (_, "qnx710") => ("nto71", ""), - (_, "elf") => ("", ""), - (_, "none") => ("", ""), - (_, "eabi") => ("", "eabi"), - (_, "eabihf") => ("", "eabihf"), - (_, "uclibceabi") => ("uclibc", "eabi"), - (_, "uclibceabihf") => ("uclibc", "eabihf"), - (_, "newlibeabihf") => ("newlib", "eabihf"), - // General fallback - (_, env) => (env, ""), - }; - - // FIXME(rustc): The name has `pc` as the vendor, but it's not set? - if os == "nto" { - vendor = "unknown"; - } - - // FIXME(rustc): Vendor isn't set for these targets? - if vendor == "espressif" && os == "none" { - vendor = "unknown"; - } - - // Extra overrides for badly named targets. - match target { - // Actually simulator targets. - "i386-apple-ios" | "x86_64-apple-ios" | "x86_64-apple-tvos" => { - abi = "sim"; - } - // Name should've contained `muslabi64`. - "mips64-openwrt-linux-musl" => { - abi = "abi64"; - } - // Has no OS name - "avr-unknown-gnu-atmega328" => { - os = "none"; - // FIXME(rustc): Should this specify `gnu` env? - env = ""; - abi = ""; - } - // Specifies abi even though not in name - "armv6-unknown-freebsd" | "armv7-unknown-freebsd" => { - // FIXME(rustc): Is it a bug that the env is set to "gnu" here? - env = "gnu"; - abi = "eabihf"; - } - // Specifies abi even though not in name - "armv7-unknown-linux-ohos" | "armv7-unknown-trusty" => { - abi = "eabi"; - } - // FIXME(rustc): Is it a bug that the ABI isn't set here? - "armv7a-kmc-solid_asp3-eabi" | "armv7a-kmc-solid_asp3-eabihf" => { - abi = ""; - } - // FIXME(rustc): Specifies "elf" ABI, is that correct? - "sparc-unknown-none-elf" => { - abi = "elf"; - } - _ => {} - } - - Ok(Target { - full_arch: full_arch.into(), - arch: arch.into(), - vendor: vendor.into(), - os: os.into(), - env: env.into(), - abi: abi.into(), - }) } } @@ -398,7 +183,7 @@ mod tests { // Various custom target triples not (or no longer) known by `rustc` #[test] - fn parse_extra() { + fn cannot_parse_extra() { let targets = [ "arm-frc-linux-gnueabi", "aarch64-uwp-windows-gnu", @@ -411,8 +196,8 @@ mod tests { ]; for target in targets { - // Check that it parses - let _ = Target::from_str(target).unwrap(); + // 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..6b1b986b --- /dev/null +++ b/src/target/generated.rs @@ -0,0 +1,2130 @@ +//! This file is generated code. Please edit the generator +//! in dev-tools/gen-target-info if you need to make changes. + +use super::Target; + +pub(crate) fn get(target_triple: &str) -> Option { + Some(match target_triple { + "aarch64-apple-darwin" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "macos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-apple-ios" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-apple-ios-macabi" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "macabi".into(), + }, + "aarch64-apple-ios-sim" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "sim".into(), + }, + "aarch64-apple-tvos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "tvos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-apple-tvos-sim" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "tvos".into(), + env: "".into(), + abi: "sim".into(), + }, + "aarch64-apple-visionos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "visionos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-apple-visionos-sim" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "visionos".into(), + env: "".into(), + abi: "sim".into(), + }, + "aarch64-apple-watchos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "watchos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-apple-watchos-sim" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "watchos".into(), + env: "".into(), + abi: "sim".into(), + }, + "aarch64-fuchsia" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "fuchsia".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-kmc-solid_asp3" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "kmc".into(), + os: "solid_asp3".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-linux-android" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-nintendo-switch-freestanding" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "horizon".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-pc-windows-gnullvm" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "llvm".into(), + }, + "aarch64-pc-windows-msvc" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "aarch64-unknown-freebsd" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-fuchsia" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "fuchsia".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-hermit" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "hermit".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-illumos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "illumos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-linux-gnu" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "aarch64-unknown-linux-gnu_ilp32" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "ilp32".into(), + }, + "aarch64-unknown-linux-musl" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "aarch64-unknown-linux-ohos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "ohos".into(), + abi: "".into(), + }, + "aarch64-unknown-netbsd" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-none" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-none-softfloat" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "softfloat".into(), + }, + "aarch64-unknown-nto-qnx700" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "nto".into(), + env: "nto70".into(), + abi: "".into(), + }, + "aarch64-unknown-nto-qnx710" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "nto".into(), + env: "nto71".into(), + abi: "".into(), + }, + "aarch64-unknown-openbsd" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-redox" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "redox".into(), + env: "relibc".into(), + abi: "".into(), + }, + "aarch64-unknown-teeos" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "teeos".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-trusty" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "trusty".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-unknown-uefi" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "uefi".into(), + env: "".into(), + abi: "".into(), + }, + "aarch64-uwp-windows-msvc" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "uwp".into(), + }, + "aarch64-wrs-vxworks" => Target { + full_arch: "aarch64".into(), + arch: "aarch64".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "aarch64_be-unknown-linux-gnu" => Target { + full_arch: "aarch64_be".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "aarch64_be-unknown-linux-gnu_ilp32" => Target { + full_arch: "aarch64_be".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "ilp32".into(), + }, + "aarch64_be-unknown-netbsd" => Target { + full_arch: "aarch64_be".into(), + arch: "aarch64".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "arm-linux-androideabi" => Target { + full_arch: "arm".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "eabi".into(), + }, + "arm-unknown-linux-gnueabi" => Target { + full_arch: "arm".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabi".into(), + }, + "arm-unknown-linux-gnueabihf" => Target { + full_arch: "arm".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "arm-unknown-linux-musleabi" => Target { + full_arch: "arm".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabi".into(), + }, + "arm-unknown-linux-musleabihf" => Target { + full_arch: "arm".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabihf".into(), + }, + "arm64_32-apple-watchos" => Target { + full_arch: "arm64_32".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "watchos".into(), + env: "".into(), + abi: "".into(), + }, + "arm64e-apple-darwin" => Target { + full_arch: "arm64e".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "macos".into(), + env: "".into(), + abi: "".into(), + }, + "arm64e-apple-ios" => Target { + full_arch: "arm64e".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "".into(), + }, + "arm64ec-pc-windows-msvc" => Target { + full_arch: "arm64ec".into(), + arch: "arm64ec".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "armeb-unknown-linux-gnueabi" => Target { + full_arch: "armeb".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabi".into(), + }, + "armebv7r-none-eabi" => Target { + full_arch: "armebv7r".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armebv7r-none-eabihf" => Target { + full_arch: "armebv7r".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "armv4t-none-eabi" => Target { + full_arch: "armv4t".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv4t-unknown-linux-gnueabi" => Target { + full_arch: "armv4t".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabi".into(), + }, + "armv5te-none-eabi" => Target { + full_arch: "armv5te".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv5te-unknown-linux-gnueabi" => Target { + full_arch: "armv5te".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabi".into(), + }, + "armv5te-unknown-linux-musleabi" => Target { + full_arch: "armv5te".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabi".into(), + }, + "armv5te-unknown-linux-uclibceabi" => Target { + full_arch: "armv5te".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "uclibc".into(), + abi: "eabi".into(), + }, + "armv6-unknown-freebsd" => Target { + full_arch: "armv6".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "armv6-unknown-netbsd-eabihf" => Target { + full_arch: "armv6".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "armv6k-nintendo-3ds" => Target { + full_arch: "armv6k".into(), + arch: "arm".into(), + vendor: "nintendo".into(), + os: "horizon".into(), + env: "newlib".into(), + abi: "eabihf".into(), + }, + "armv7-linux-androideabi" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv7-rtems-eabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "rtems".into(), + env: "newlib".into(), + abi: "eabihf".into(), + }, + "armv7-sony-vita-newlibeabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "sony".into(), + os: "vita".into(), + env: "newlib".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-freebsd" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-linux-gnueabi" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabi".into(), + }, + "armv7-unknown-linux-gnueabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-linux-musleabi" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabi".into(), + }, + "armv7-unknown-linux-musleabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-linux-ohos" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "ohos".into(), + abi: "eabi".into(), + }, + "armv7-unknown-linux-uclibceabi" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "uclibc".into(), + abi: "eabi".into(), + }, + "armv7-unknown-linux-uclibceabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "uclibc".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-netbsd-eabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "armv7-unknown-trusty" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "trusty".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv7-wrs-vxworks-eabihf" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "armv7a-kmc-solid_asp3-eabi" => Target { + full_arch: "armv7a".into(), + arch: "arm".into(), + vendor: "kmc".into(), + os: "solid_asp3".into(), + env: "".into(), + abi: "".into(), + }, + "armv7a-kmc-solid_asp3-eabihf" => Target { + full_arch: "armv7a".into(), + arch: "arm".into(), + vendor: "kmc".into(), + os: "solid_asp3".into(), + env: "".into(), + abi: "".into(), + }, + "armv7a-none-eabi" => Target { + full_arch: "armv7a".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv7a-none-eabihf" => Target { + full_arch: "armv7a".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "armv7k-apple-watchos" => Target { + full_arch: "armv7k".into(), + arch: "arm".into(), + vendor: "apple".into(), + os: "watchos".into(), + env: "".into(), + abi: "".into(), + }, + "armv7r-none-eabi" => Target { + full_arch: "armv7r".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "armv7r-none-eabihf" => Target { + full_arch: "armv7r".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "armv7s-apple-ios" => Target { + full_arch: "armv7s".into(), + arch: "arm".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "".into(), + }, + "armv8r-none-eabihf" => Target { + full_arch: "armv8r".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "avr-unknown-gnu-atmega328" => Target { + full_arch: "avr".into(), + arch: "avr".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "bpfeb-unknown-none" => Target { + full_arch: "bpfeb".into(), + arch: "bpf".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "bpfel-unknown-none" => Target { + full_arch: "bpfel".into(), + arch: "bpf".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "csky-unknown-linux-gnuabiv2" => Target { + full_arch: "csky".into(), + arch: "csky".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abiv2".into(), + }, + "csky-unknown-linux-gnuabiv2hf" => Target { + full_arch: "csky".into(), + arch: "csky".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abiv2hf".into(), + }, + "hexagon-unknown-linux-musl" => Target { + full_arch: "hexagon".into(), + arch: "hexagon".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "hexagon-unknown-none-elf" => Target { + full_arch: "hexagon".into(), + arch: "hexagon".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "i386-apple-ios" => Target { + full_arch: "i386".into(), + arch: "x86".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "sim".into(), + }, + "i586-pc-nto-qnx700" => Target { + full_arch: "i586".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "nto".into(), + env: "nto70".into(), + abi: "".into(), + }, + "i586-pc-windows-msvc" => Target { + full_arch: "i586".into(), + arch: "x86".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "i586-unknown-linux-gnu" => Target { + full_arch: "i586".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "i586-unknown-linux-musl" => Target { + full_arch: "i586".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "i586-unknown-netbsd" => Target { + full_arch: "i586".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "i686-apple-darwin" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "apple".into(), + os: "macos".into(), + env: "".into(), + abi: "".into(), + }, + "i686-linux-android" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "".into(), + }, + "i686-pc-windows-gnu" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "".into(), + }, + "i686-pc-windows-gnullvm" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "llvm".into(), + }, + "i686-pc-windows-msvc" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "i686-unknown-freebsd" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "i686-unknown-haiku" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "haiku".into(), + env: "".into(), + abi: "".into(), + }, + "i686-unknown-hurd-gnu" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "hurd".into(), + env: "gnu".into(), + abi: "".into(), + }, + "i686-unknown-linux-gnu" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "i686-unknown-linux-musl" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "i686-unknown-netbsd" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "i686-unknown-openbsd" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "i686-unknown-redox" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "redox".into(), + env: "relibc".into(), + abi: "".into(), + }, + "i686-unknown-uefi" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "unknown".into(), + os: "uefi".into(), + env: "".into(), + abi: "".into(), + }, + "i686-uwp-windows-gnu" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "uwp".into(), + }, + "i686-uwp-windows-msvc" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "uwp".into(), + }, + "i686-win7-windows-msvc" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "win7".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "i686-wrs-vxworks" => Target { + full_arch: "i686".into(), + arch: "x86".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "loongarch64-unknown-linux-gnu" => Target { + full_arch: "loongarch64".into(), + arch: "loongarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "loongarch64-unknown-linux-musl" => Target { + full_arch: "loongarch64".into(), + arch: "loongarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "loongarch64-unknown-none" => Target { + full_arch: "loongarch64".into(), + arch: "loongarch64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "loongarch64-unknown-none-softfloat" => Target { + full_arch: "loongarch64".into(), + arch: "loongarch64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "softfloat".into(), + }, + "m68k-unknown-linux-gnu" => Target { + full_arch: "m68k".into(), + arch: "m68k".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "mips-unknown-linux-gnu" => Target { + full_arch: "mips".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "mips-unknown-linux-musl" => Target { + full_arch: "mips".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "mips-unknown-linux-uclibc" => Target { + full_arch: "mips".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "uclibc".into(), + abi: "".into(), + }, + "mips64-openwrt-linux-musl" => Target { + full_arch: "mips64".into(), + arch: "mips64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "abi64".into(), + }, + "mips64-unknown-linux-gnuabi64" => Target { + full_arch: "mips64".into(), + arch: "mips64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abi64".into(), + }, + "mips64-unknown-linux-muslabi64" => Target { + full_arch: "mips64".into(), + arch: "mips64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "abi64".into(), + }, + "mips64el-unknown-linux-gnuabi64" => Target { + full_arch: "mips64el".into(), + arch: "mips64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abi64".into(), + }, + "mips64el-unknown-linux-muslabi64" => Target { + full_arch: "mips64el".into(), + arch: "mips64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "abi64".into(), + }, + "mipsel-sony-psp" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "sony".into(), + os: "psp".into(), + env: "".into(), + abi: "".into(), + }, + "mipsel-sony-psx" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "sony".into(), + os: "none".into(), + env: "psx".into(), + abi: "".into(), + }, + "mipsel-unknown-linux-gnu" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "mipsel-unknown-linux-musl" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "mipsel-unknown-linux-uclibc" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "uclibc".into(), + abi: "".into(), + }, + "mipsel-unknown-netbsd" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "mipsel-unknown-none" => Target { + full_arch: "mipsel".into(), + arch: "mips".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "mipsisa32r6-unknown-linux-gnu" => Target { + full_arch: "mipsisa32r6".into(), + arch: "mips32r6".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "mipsisa32r6el-unknown-linux-gnu" => Target { + full_arch: "mipsisa32r6el".into(), + arch: "mips32r6".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "mipsisa64r6-unknown-linux-gnuabi64" => Target { + full_arch: "mipsisa64r6".into(), + arch: "mips64r6".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abi64".into(), + }, + "mipsisa64r6el-unknown-linux-gnuabi64" => Target { + full_arch: "mipsisa64r6el".into(), + arch: "mips64r6".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "abi64".into(), + }, + "msp430-none-elf" => Target { + full_arch: "msp430".into(), + arch: "msp430".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "nvptx64-nvidia-cuda" => Target { + full_arch: "nvptx64".into(), + arch: "nvptx64".into(), + vendor: "nvidia".into(), + os: "cuda".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc-unknown-freebsd" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc-unknown-linux-gnu" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "powerpc-unknown-linux-gnuspe" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "spe".into(), + }, + "powerpc-unknown-linux-musl" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "powerpc-unknown-linux-muslspe" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "spe".into(), + }, + "powerpc-unknown-netbsd" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc-unknown-openbsd" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc-wrs-vxworks" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "powerpc-wrs-vxworks-spe" => Target { + full_arch: "powerpc".into(), + arch: "powerpc".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "spe".into(), + }, + "powerpc64-ibm-aix" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "ibm".into(), + os: "aix".into(), + env: "".into(), + abi: "vec-extabi".into(), + }, + "powerpc64-unknown-freebsd" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc64-unknown-linux-gnu" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "powerpc64-unknown-linux-musl" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "powerpc64-unknown-openbsd" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc64-wrs-vxworks" => Target { + full_arch: "powerpc64".into(), + arch: "powerpc64".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "powerpc64le-unknown-freebsd" => Target { + full_arch: "powerpc64le".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "powerpc64le-unknown-linux-gnu" => Target { + full_arch: "powerpc64le".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "powerpc64le-unknown-linux-musl" => Target { + full_arch: "powerpc64le".into(), + arch: "powerpc64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "riscv32gc-unknown-linux-gnu" => Target { + full_arch: "riscv32gc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "riscv32gc-unknown-linux-musl" => Target { + full_arch: "riscv32gc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "riscv32i-unknown-none-elf" => Target { + full_arch: "riscv32i".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32im-risc0-zkvm-elf" => Target { + full_arch: "riscv32im".into(), + arch: "riscv32".into(), + vendor: "risc0".into(), + os: "zkvm".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32im-unknown-none-elf" => Target { + full_arch: "riscv32im".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32ima-unknown-none-elf" => Target { + full_arch: "riscv32ima".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imac-esp-espidf" => Target { + full_arch: "riscv32imac".into(), + arch: "riscv32".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "riscv32imac-unknown-none-elf" => Target { + full_arch: "riscv32imac".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imac-unknown-nuttx-elf" => Target { + full_arch: "riscv32imac".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imac-unknown-xous-elf" => Target { + full_arch: "riscv32imac".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "xous".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imafc-esp-espidf" => Target { + full_arch: "riscv32imafc".into(), + arch: "riscv32".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "riscv32imafc-unknown-none-elf" => Target { + full_arch: "riscv32imafc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imafc-unknown-nuttx-elf" => Target { + full_arch: "riscv32imafc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imc-esp-espidf" => Target { + full_arch: "riscv32imc".into(), + arch: "riscv32".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "riscv32imc-unknown-none-elf" => Target { + full_arch: "riscv32imc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32imc-unknown-nuttx-elf" => Target { + full_arch: "riscv32imc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64-linux-android" => Target { + full_arch: "riscv64".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-freebsd" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-fuchsia" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "fuchsia".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-hermit" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "hermit".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-linux-gnu" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "riscv64gc-unknown-linux-musl" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "riscv64gc-unknown-netbsd" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-none-elf" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-nuttx-elf" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64gc-unknown-openbsd" => Target { + full_arch: "riscv64gc".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64imac-unknown-none-elf" => Target { + full_arch: "riscv64imac".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv64imac-unknown-nuttx-elf" => Target { + full_arch: "riscv64imac".into(), + arch: "riscv64".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "".into(), + }, + "s390x-unknown-linux-gnu" => Target { + full_arch: "s390x".into(), + arch: "s390x".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "s390x-unknown-linux-musl" => Target { + full_arch: "s390x".into(), + arch: "s390x".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "sparc-unknown-linux-gnu" => Target { + full_arch: "sparc".into(), + arch: "sparc".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "sparc-unknown-none-elf" => Target { + full_arch: "sparc".into(), + arch: "sparc".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "elf".into(), + }, + "sparc64-unknown-linux-gnu" => Target { + full_arch: "sparc64".into(), + arch: "sparc64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "sparc64-unknown-netbsd" => Target { + full_arch: "sparc64".into(), + arch: "sparc64".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "sparc64-unknown-openbsd" => Target { + full_arch: "sparc64".into(), + arch: "sparc64".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "sparcv9-sun-solaris" => Target { + full_arch: "sparcv9".into(), + arch: "sparc64".into(), + vendor: "sun".into(), + os: "solaris".into(), + env: "".into(), + abi: "".into(), + }, + "thumbv4t-none-eabi" => Target { + full_arch: "thumbv4t".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv5te-none-eabi" => Target { + full_arch: "thumbv5te".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv6m-none-eabi" => Target { + full_arch: "thumbv6m".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv6m-nuttx-eabi" => Target { + full_arch: "thumbv6m".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7a-pc-windows-msvc" => Target { + full_arch: "thumbv7a".into(), + arch: "arm".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "thumbv7a-uwp-windows-msvc" => Target { + full_arch: "thumbv7a".into(), + arch: "arm".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "uwp".into(), + }, + "thumbv7em-none-eabi" => Target { + full_arch: "thumbv7em".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7em-none-eabihf" => Target { + full_arch: "thumbv7em".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "thumbv7em-nuttx-eabi" => Target { + full_arch: "thumbv7em".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7em-nuttx-eabihf" => Target { + full_arch: "thumbv7em".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "thumbv7m-none-eabi" => Target { + full_arch: "thumbv7m".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7m-nuttx-eabi" => Target { + full_arch: "thumbv7m".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7neon-linux-androideabi" => Target { + full_arch: "thumbv7neon".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv7neon-unknown-linux-gnueabihf" => Target { + full_arch: "thumbv7neon".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "eabihf".into(), + }, + "thumbv7neon-unknown-linux-musleabihf" => Target { + full_arch: "thumbv7neon".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "eabihf".into(), + }, + "thumbv8m.base-none-eabi" => Target { + full_arch: "thumbv8m.base".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv8m.base-nuttx-eabi" => Target { + full_arch: "thumbv8m.base".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv8m.main-none-eabi" => Target { + full_arch: "thumbv8m.main".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv8m.main-none-eabihf" => Target { + full_arch: "thumbv8m.main".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "thumbv8m.main-nuttx-eabi" => Target { + full_arch: "thumbv8m.main".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabi".into(), + }, + "thumbv8m.main-nuttx-eabihf" => Target { + full_arch: "thumbv8m.main".into(), + arch: "arm".into(), + vendor: "unknown".into(), + os: "nuttx".into(), + env: "".into(), + abi: "eabihf".into(), + }, + "wasm32-unknown-emscripten" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "emscripten".into(), + env: "".into(), + abi: "".into(), + }, + "wasm32-unknown-unknown" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "unknown".into(), + env: "".into(), + abi: "".into(), + }, + "wasm32-wasi" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "wasi".into(), + env: "p1".into(), + abi: "".into(), + }, + "wasm32-wasip1" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "wasi".into(), + env: "p1".into(), + abi: "".into(), + }, + "wasm32-wasip1-threads" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "wasi".into(), + env: "p1".into(), + abi: "".into(), + }, + "wasm32-wasip2" => Target { + full_arch: "wasm32".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "wasi".into(), + env: "p2".into(), + abi: "".into(), + }, + "wasm64-unknown-unknown" => Target { + full_arch: "wasm64".into(), + arch: "wasm64".into(), + vendor: "unknown".into(), + os: "unknown".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-apple-darwin" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "macos".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-apple-ios" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "sim".into(), + }, + "x86_64-apple-ios-macabi" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "macabi".into(), + }, + "x86_64-apple-tvos" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "tvos".into(), + env: "".into(), + abi: "sim".into(), + }, + "x86_64-apple-watchos-sim" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "watchos".into(), + env: "".into(), + abi: "sim".into(), + }, + "x86_64-fortanix-unknown-sgx" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "fortanix".into(), + os: "unknown".into(), + env: "sgx".into(), + abi: "fortanix".into(), + }, + "x86_64-fuchsia" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "fuchsia".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-linux-android" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "android".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-pc-nto-qnx710" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "nto".into(), + env: "nto71".into(), + abi: "".into(), + }, + "x86_64-pc-solaris" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "pc".into(), + os: "solaris".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-pc-windows-gnu" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "".into(), + }, + "x86_64-pc-windows-gnullvm" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "llvm".into(), + }, + "x86_64-pc-windows-msvc" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "pc".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "x86_64-unikraft-linux-musl" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unikraft".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "x86_64-unknown-dragonfly" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "dragonfly".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-freebsd" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "freebsd".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-fuchsia" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "fuchsia".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-haiku" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "haiku".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-hermit" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "hermit".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-hurd-gnu" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "hurd".into(), + env: "gnu".into(), + abi: "".into(), + }, + "x86_64-unknown-illumos" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "illumos".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-l4re-uclibc" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "l4re".into(), + env: "uclibc".into(), + abi: "".into(), + }, + "x86_64-unknown-linux-gnu" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "".into(), + }, + "x86_64-unknown-linux-gnux32" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "gnu".into(), + abi: "x32".into(), + }, + "x86_64-unknown-linux-musl" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "musl".into(), + abi: "".into(), + }, + "x86_64-unknown-linux-none" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-linux-ohos" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "ohos".into(), + abi: "".into(), + }, + "x86_64-unknown-netbsd" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "netbsd".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-none" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-openbsd" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "openbsd".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-unknown-redox" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "redox".into(), + env: "relibc".into(), + abi: "".into(), + }, + "x86_64-unknown-uefi" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "uefi".into(), + env: "".into(), + abi: "".into(), + }, + "x86_64-uwp-windows-gnu" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "gnu".into(), + abi: "uwp".into(), + }, + "x86_64-uwp-windows-msvc" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "uwp".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "uwp".into(), + }, + "x86_64-win7-windows-msvc" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "win7".into(), + os: "windows".into(), + env: "msvc".into(), + abi: "".into(), + }, + "x86_64-wrs-vxworks" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "x86_64h-apple-darwin" => Target { + full_arch: "x86_64h".into(), + arch: "x86_64".into(), + vendor: "apple".into(), + os: "macos".into(), + env: "".into(), + abi: "".into(), + }, + "xtensa-esp32-espidf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "xtensa-esp32-none-elf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "xtensa-esp32s2-espidf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "xtensa-esp32s2-none-elf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "xtensa-esp32s3-espidf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "espressif".into(), + os: "espidf".into(), + env: "newlib".into(), + abi: "".into(), + }, + "xtensa-esp32s3-none-elf" => Target { + full_arch: "xtensa".into(), + arch: "xtensa".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + _ => return None, + }) +} diff --git a/src/target_info.rs b/src/target_info.rs deleted file mode 100644 index 6f5f0a4a..00000000 --- a/src/target_info.rs +++ /dev/null @@ -1,2 +0,0 @@ -//! This file is generated code. Please edit the generator -//! in dev-tools/gen-target-info if you need to make changes. From 5bb25a5a9371623b27320161780e6d0d9b193642 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 22:14:55 +0200 Subject: [PATCH 05/16] Use Cow<'static, str> in Target --- src/lib.rs | 2 +- src/target.rs | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c0c2174c..bb7d1746 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1428,7 +1428,7 @@ impl Build { libdir.push(".."); if cfg!(target_os = "linux") { libdir.push("targets"); - libdir.push(target.arch.clone() + "-linux"); + libdir.push(format!("{}-linux", target.arch)); libdir.push("lib"); libtst = true; } else if cfg!(target_env = "msvc") { diff --git a/src/target.rs b/src/target.rs index b59c2427..121abceb 100644 --- a/src/target.rs +++ b/src/target.rs @@ -2,7 +2,7 @@ //! //! See the `target-lexicon` crate for a more principled approach to this. -use std::{env, str::FromStr}; +use std::{borrow::Cow, env, str::FromStr}; use crate::{Error, ErrorKind}; @@ -17,27 +17,27 @@ pub(crate) struct Target { /// /// This differs from `cfg!(target_arch)`, which only specifies the /// overall architecture, which is too coarse for certain cases. - pub full_arch: String, + pub full_arch: Cow<'static, str>, /// The overall target architecture. /// /// This is the same as the value of `cfg!(target_arch)`. - pub arch: String, + pub arch: Cow<'static, str>, /// The target vendor. /// /// This is the same as the value of `cfg!(target_vendor)`. - pub vendor: String, + 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: String, + 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: String, + 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: String, + pub abi: Cow<'static, str>, } impl Target { @@ -66,17 +66,17 @@ impl Target { let env = getenv("CARGO_CFG_TARGET_ENV")?; // `target_abi` was stabilized in Rust 1.78, so may not always be available. let abi = if let Ok(abi) = getenv("CARGO_CFG_TARGET_ABI") { - abi + abi.into() } else { Self::from_str(&target)?.abi }; Ok(Self { - full_arch: full_arch.to_string(), - arch, - vendor, - os, - env, + full_arch: full_arch.to_string().into(), + arch: arch.into(), + vendor: vendor.into(), + os: os.into(), + env: env.into(), abi, }) } @@ -108,7 +108,7 @@ mod tests { let (full_arch, _rest) = target.split_once('-').expect("target to have arch"); let mut target = Target { - full_arch: full_arch.into(), + full_arch: full_arch.to_string().into(), arch: "invalid-none-set".into(), vendor: "invalid-none-set".into(), os: "invalid-none-set".into(), @@ -127,7 +127,7 @@ mod tests { let value = value.strip_prefix('"').unwrap_or(value); let value = value.strip_suffix('"').unwrap_or(value); - let value = value.to_string(); + let value = value.to_string().into(); match name { "target_arch" => target.arch = value, "target_vendor" => target.vendor = value, From f857326fc9e4e24a48870d5167db8402b0d5004e Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 22:18:53 +0200 Subject: [PATCH 06/16] Remove redundant test --- src/target.rs | 91 ++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 74 deletions(-) diff --git a/src/target.rs b/src/target.rs index 121abceb..d715152b 100644 --- a/src/target.rs +++ b/src/target.rs @@ -99,85 +99,28 @@ impl FromStr for Target { #[cfg(test)] mod tests { - use std::{process::Command, str::FromStr}; + use std::str::FromStr; use super::Target; - fn target_from_cfgs(target: &str, cfgs: &str) -> Target { - // Cannot determine full architecture from cfgs. - let (full_arch, _rest) = target.split_once('-').expect("target to have arch"); - - let mut target = Target { - full_arch: full_arch.to_string().into(), - arch: "invalid-none-set".into(), - vendor: "invalid-none-set".into(), - os: "invalid-none-set".into(), - env: "invalid-none-set".into(), - // Not set in older Rust versions - abi: "".into(), - }; - - for cfg in cfgs.lines() { - if let Some((name, value)) = cfg.split_once('=') { - // Remove whitespace, if `rustc` decided to insert any - let name = name.trim(); - let value = value.trim(); - - // Remove quotes around value - let value = value.strip_prefix('"').unwrap_or(value); - let value = value.strip_suffix('"').unwrap_or(value); - - let value = value.to_string().into(); - match name { - "target_arch" => target.arch = value, - "target_vendor" => target.vendor = value, - "target_os" => target.os = value, - "target_env" => target.env = value, - "target_abi" => target.abi = value, - _ => {} - } - } else { - // Skip cfgs like `debug_assertions` and `unix`. - } - } - - target - } - + // Test tier 1 targets #[test] - fn parse_rustc_targets() { - let target_list = Command::new("rustc") - .arg("--print=target-list") - .output() - .unwrap() - .stdout; - let target_list = String::from_utf8(target_list).unwrap(); - - let mut has_failure = false; - for target in target_list.lines() { - let cfgs = Command::new("rustc") - .arg("--target") - .arg(target) - .arg("--print=cfg") - .output() - .unwrap() - .stdout; - let cfgs = String::from_utf8(cfgs).unwrap(); - - let expected = target_from_cfgs(target, &cfgs); - let actual = Target::from_str(target); - - if Some(&expected) != actual.as_ref().ok() { - eprintln!("failed comparing {target}:"); - eprintln!(" expected: Ok({expected:?})"); - eprintln!(" actual: {actual:?}"); - eprintln!(); - has_failure = true; - } - } + 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", + ]; - if has_failure { - panic!("failed comparing targets"); + for target in targets { + // Check that it parses + let _ = Target::from_str(target).unwrap(); } } From 5ade71fb4010226605f8e267f8ecb741909e3a5d Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 22:56:13 +0200 Subject: [PATCH 07/16] Redo from_cargo_environment_variables to be more error resilient --- src/target.rs | 80 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/src/target.rs b/src/target.rs index d715152b..3595ece4 100644 --- a/src/target.rs +++ b/src/target.rs @@ -42,35 +42,66 @@ pub(crate) struct Target { impl Target { pub fn from_cargo_environment_variables() -> Result { - let getenv = |name| { - // No need to emit `rerun-if-env-changed` for these variables, - // as they are controlled by Cargo itself. - #[allow(clippy::disallowed_methods)] - env::var(name).map_err(|err| { - Error::new( - ErrorKind::EnvVarNotFound, - format!("failed reading {name}: {err}"), - ) - }) - }; - - let target = getenv("TARGET")?; - let (full_arch, _rest) = target.split_once('-').ok_or(Error::new( + // `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}` had an unknown architecture"), + format!("target `{target_triple}` had an unknown architecture"), ))?; - let arch = getenv("CARGO_CFG_TARGET_ARCH")?; - let vendor = getenv("CARGO_CFG_TARGET_VENDOR")?; - let os = getenv("CARGO_CFG_TARGET_OS")?; - let env = getenv("CARGO_CFG_TARGET_ENV")?; - // `target_abi` was stabilized in Rust 1.78, so may not always be available. - let abi = if let Ok(abi) = getenv("CARGO_CFG_TARGET_ABI") { - abi.into() - } else { - Self::from_str(&target)?.abi + 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: arch.into(), @@ -85,6 +116,7 @@ impl Target { 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 Some(target) = generated::get(target_triple) { Ok(target) From 1ce8dd6ee276ddc97e831ccea893ade7b7eb0e6d Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:05:17 +0200 Subject: [PATCH 08/16] Fix after merge --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7fcc15ea..eb194b6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2023,7 +2023,8 @@ impl Build { ); } - if target.contains("threads") { + // FIXME(madsmtm): Put `threads` as part of the ABI? + if raw_target.contains("threads") { cmd.push_cc_arg("-pthread".into()); } } From 1d2bafcf49a4f73d3f0931c3415e6e62c7b3eef4 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:07:41 +0200 Subject: [PATCH 09/16] Appease clippy --- src/target.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/target.rs b/src/target.rs index 3595ece4..58377322 100644 --- a/src/target.rs +++ b/src/target.rs @@ -104,10 +104,10 @@ impl Target { Ok(Self { full_arch: full_arch.to_string().into(), - arch: arch.into(), - vendor: vendor.into(), - os: os.into(), - env: env.into(), + arch, + vendor, + os, + env, abi, }) } From 36b3bb78fbca96fd850a5d9be45d084a47b99751 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:26:10 +0200 Subject: [PATCH 10/16] Add support for targets within MSRV --- .github/workflows/regenerate-target-info.yml | 5 ++- dev-tools/gen-target-info/src/lib.rs | 2 +- dev-tools/gen-target-info/src/main.rs | 18 ++++++-- dev-tools/gen-target-info/src/read.rs | 45 ++++++++++++++++++-- src/target/generated.rs | 32 ++++++++++++++ 5 files changed, 93 insertions(+), 9 deletions(-) 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/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 835e5c49..8723ecff 100644 --- a/dev-tools/gen-target-info/src/main.rs +++ b/dev-tools/gen-target-info/src/main.rs @@ -1,7 +1,9 @@ -use std::fs::File; use std::io::Write as _; +use std::{fs::File, io::BufRead}; -use gen_target_info::{get_target_specs_from_json, RustcTargetSpecs}; +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. @@ -44,7 +46,17 @@ fn generate_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std } 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"); 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/src/target/generated.rs b/src/target/generated.rs index 6b1b986b..6daee7c5 100644 --- a/src/target/generated.rs +++ b/src/target/generated.rs @@ -485,6 +485,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "newlib".into(), abi: "eabihf".into(), }, + "armv7-apple-ios" => Target { + full_arch: "armv7".into(), + arch: "arm".into(), + vendor: "apple".into(), + os: "ios".into(), + env: "".into(), + abi: "".into(), + }, "armv7-linux-androideabi" => Target { full_arch: "armv7".into(), arch: "arm".into(), @@ -669,6 +677,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "".into(), abi: "eabihf".into(), }, + "asmjs-unknown-emscripten" => Target { + full_arch: "asmjs".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "emscripten".into(), + env: "".into(), + abi: "".into(), + }, "avr-unknown-gnu-atmega328" => Target { full_arch: "avr".into(), arch: "avr".into(), @@ -1885,6 +1901,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "msvc".into(), abi: "".into(), }, + "x86_64-sun-solaris" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "sun".into(), + os: "solaris".into(), + env: "".into(), + abi: "".into(), + }, "x86_64-unikraft-linux-musl" => Target { full_arch: "x86_64".into(), arch: "x86_64".into(), @@ -2013,6 +2037,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "".into(), abi: "".into(), }, + "x86_64-unknown-none-linuxkernel" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "gnu".into(), + abi: "".into(), + }, "x86_64-unknown-openbsd" => Target { full_arch: "x86_64".into(), arch: "x86_64".into(), From 1117c509272bc842bfd831361ec358a6a55d2052 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:29:59 +0200 Subject: [PATCH 11/16] Fix test --- src/target.rs | 3 ++- tests/test.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/target.rs b/src/target.rs index 58377322..646819fa 100644 --- a/src/target.rs +++ b/src/target.rs @@ -160,8 +160,9 @@ mod tests { #[test] fn cannot_parse_extra() { let targets = [ - "arm-frc-linux-gnueabi", + "aarch64-unknown-none-gnu", "aarch64-uwp-windows-gnu", + "arm-frc-linux-gnueabi", "arm-unknown-netbsd-eabi", "armv7neon-unknown-linux-gnueabihf", "armv7neon-unknown-linux-musleabihf", diff --git a/tests/test.rs b/tests/test.rs index 9d5ce508..0f4b616e 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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) From 8da1265c655c44745885540dd854283256b905ca Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:32:18 +0200 Subject: [PATCH 12/16] Fix a few more tests --- src/target.rs | 1 + tests/test.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/target.rs b/src/target.rs index 646819fa..c4869669 100644 --- a/src/target.rs +++ b/src/target.rs @@ -169,6 +169,7 @@ mod tests { "thumbv7-unknown-linux-gnueabihf", "thumbv7-unknown-linux-musleabihf", "x86_64-rumprun-netbsd", + "x86_64-unknown-linux", ]; for target in targets { diff --git a/tests/test.rs b/tests/test.rs index 0f4b616e..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") From e7e5b67f2f9cc1b722eb9e091dd41698424a6a90 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 8 Oct 2024 23:48:36 +0200 Subject: [PATCH 13/16] Properly match previous behaviour --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index eb194b6f..a758a7a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2006,8 +2006,8 @@ impl Build { cmd.push_cc_arg("-fPIC".into()); // PLT only applies if code is compiled with PIC support, // and only for ELF targets. - if target.os == "linux" - || target.os == "android" && !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()); } @@ -2023,7 +2023,7 @@ impl Build { ); } - // FIXME(madsmtm): Put `threads` as part of the ABI? + // FIXME(madsmtm): Read from `target_features` instead? if raw_target.contains("threads") { cmd.push_cc_arg("-pthread".into()); } From f694c4c22ea00c3b1de8bc4bfc74651faeab77ee Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 31 Oct 2024 16:14:11 +0100 Subject: [PATCH 14/16] Update to Rust 2024-10-25 --- src/target/generated.rs | 92 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/src/target/generated.rs b/src/target/generated.rs index 6daee7c5..87f4f205 100644 --- a/src/target/generated.rs +++ b/src/target/generated.rs @@ -112,7 +112,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "aarch64-nintendo-switch-freestanding" => Target { full_arch: "aarch64".into(), arch: "aarch64".into(), - vendor: "unknown".into(), + vendor: "nintendo".into(), os: "horizon".into(), env: "".into(), abi: "".into(), @@ -381,6 +381,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "".into(), abi: "".into(), }, + "arm64e-apple-tvos" => Target { + full_arch: "arm64e".into(), + arch: "aarch64".into(), + vendor: "apple".into(), + os: "tvos".into(), + env: "".into(), + abi: "".into(), + }, "arm64ec-pc-windows-msvc" => Target { full_arch: "arm64ec".into(), arch: "arm64ec".into(), @@ -611,7 +619,7 @@ pub(crate) fn get(target_triple: &str) -> Option { vendor: "kmc".into(), os: "solid_asp3".into(), env: "".into(), - abi: "".into(), + abi: "eabi".into(), }, "armv7a-kmc-solid_asp3-eabihf" => Target { full_arch: "armv7a".into(), @@ -619,7 +627,7 @@ pub(crate) fn get(target_triple: &str) -> Option { vendor: "kmc".into(), os: "solid_asp3".into(), env: "".into(), - abi: "".into(), + abi: "eabihf".into(), }, "armv7a-none-eabi" => Target { full_arch: "armv7a".into(), @@ -690,7 +698,7 @@ pub(crate) fn get(target_triple: &str) -> Option { arch: "avr".into(), vendor: "unknown".into(), os: "none".into(), - env: "".into(), + env: "gnu".into(), abi: "".into(), }, "bpfeb-unknown-none" => Target { @@ -752,7 +760,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "i586-pc-nto-qnx700" => Target { full_arch: "i586".into(), arch: "x86".into(), - vendor: "unknown".into(), + vendor: "pc".into(), os: "nto".into(), env: "nto70".into(), abi: "".into(), @@ -949,6 +957,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "musl".into(), abi: "".into(), }, + "loongarch64-unknown-linux-ohos" => Target { + full_arch: "loongarch64".into(), + arch: "loongarch64".into(), + vendor: "unknown".into(), + os: "linux".into(), + env: "ohos".into(), + abi: "".into(), + }, "loongarch64-unknown-none" => Target { full_arch: "loongarch64".into(), arch: "loongarch64".into(), @@ -1285,6 +1301,38 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "musl".into(), abi: "".into(), }, + "riscv32-wrs-vxworks" => Target { + full_arch: "riscv32".into(), + arch: "riscv32".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, + "riscv32e-unknown-none-elf" => Target { + full_arch: "riscv32e".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32em-unknown-none-elf" => Target { + full_arch: "riscv32em".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, + "riscv32emc-unknown-none-elf" => Target { + full_arch: "riscv32emc".into(), + arch: "riscv32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, "riscv32gc-unknown-linux-gnu" => Target { full_arch: "riscv32gc".into(), arch: "riscv32".into(), @@ -1421,6 +1469,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "".into(), abi: "".into(), }, + "riscv64-wrs-vxworks" => Target { + full_arch: "riscv64".into(), + arch: "riscv64".into(), + vendor: "wrs".into(), + os: "vxworks".into(), + env: "gnu".into(), + abi: "".into(), + }, "riscv64gc-unknown-freebsd" => Target { full_arch: "riscv64gc".into(), arch: "riscv64".into(), @@ -1539,7 +1595,7 @@ pub(crate) fn get(target_triple: &str) -> Option { vendor: "unknown".into(), os: "none".into(), env: "".into(), - abi: "elf".into(), + abi: "".into(), }, "sparc64-unknown-linux-gnu" => Target { full_arch: "sparc64".into(), @@ -1789,6 +1845,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "p2".into(), abi: "".into(), }, + "wasm32v1-none" => Target { + full_arch: "wasm32v1".into(), + arch: "wasm32".into(), + vendor: "unknown".into(), + os: "none".into(), + env: "".into(), + abi: "".into(), + }, "wasm64-unknown-unknown" => Target { full_arch: "wasm64".into(), arch: "wasm64".into(), @@ -1864,7 +1928,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "x86_64-pc-nto-qnx710" => Target { full_arch: "x86_64".into(), arch: "x86_64".into(), - vendor: "unknown".into(), + vendor: "pc".into(), os: "nto".into(), env: "nto71".into(), abi: "".into(), @@ -2061,6 +2125,14 @@ pub(crate) fn get(target_triple: &str) -> Option { env: "relibc".into(), abi: "".into(), }, + "x86_64-unknown-trusty" => Target { + full_arch: "x86_64".into(), + arch: "x86_64".into(), + vendor: "unknown".into(), + os: "trusty".into(), + env: "".into(), + abi: "".into(), + }, "x86_64-unknown-uefi" => Target { full_arch: "x86_64".into(), arch: "x86_64".into(), @@ -2120,7 +2192,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "xtensa-esp32-none-elf" => Target { full_arch: "xtensa".into(), arch: "xtensa".into(), - vendor: "unknown".into(), + vendor: "espressif".into(), os: "none".into(), env: "".into(), abi: "".into(), @@ -2136,7 +2208,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "xtensa-esp32s2-none-elf" => Target { full_arch: "xtensa".into(), arch: "xtensa".into(), - vendor: "unknown".into(), + vendor: "espressif".into(), os: "none".into(), env: "".into(), abi: "".into(), @@ -2152,7 +2224,7 @@ pub(crate) fn get(target_triple: &str) -> Option { "xtensa-esp32s3-none-elf" => Target { full_arch: "xtensa".into(), arch: "xtensa".into(), - vendor: "unknown".into(), + vendor: "espressif".into(), os: "none".into(), env: "".into(), abi: "".into(), From ae310a3fded30f0f5b2debc9a963dd2a45e73b46 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 31 Oct 2024 16:21:02 +0100 Subject: [PATCH 15/16] Use a `const` and binary search instead of a match --- dev-tools/gen-target-info/src/main.rs | 29 +- src/target.rs | 9 +- src/target/generated.rs | 5290 ++++++++++++++----------- 3 files changed, 3080 insertions(+), 2248 deletions(-) diff --git a/dev-tools/gen-target-info/src/main.rs b/dev-tools/gen-target-info/src/main.rs index 8723ecff..bc6a3d5e 100644 --- a/dev-tools/gen-target-info/src/main.rs +++ b/dev-tools/gen-target-info/src/main.rs @@ -12,12 +12,9 @@ const PRELUDE: &str = r#"//! This file is generated code. Please edit the genera 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) fn get(target_triple: &str) -> Option {{" - )?; - writeln!(f, " Some(match target_triple {{")?; + writeln!(f, "pub(crate) const LIST: &[(&str, Target)] = &[")?; for (triple, spec) in &target_specs.0 { let full_arch = triple.split_once('-').unwrap().0; @@ -27,20 +24,20 @@ fn generate_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std let env = spec.env.as_deref().unwrap_or(""); let abi = spec.abi.as_deref().unwrap_or(""); - writeln!(f, " {triple:?} => Target {{")?; - writeln!(f, " full_arch: {full_arch:?}.into(),")?; - writeln!(f, " arch: {arch:?}.into(),")?; - writeln!(f, " vendor: {vendor:?}.into(),")?; - writeln!(f, " os: {os:?}.into(),")?; - writeln!(f, " env: {env:?}.into(),")?; - writeln!(f, " abi: {abi:?}.into(),")?; + 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, " _ => return None,")?; - - writeln!(f, " }})")?; - writeln!(f, "}}")?; + writeln!(f, "];")?; Ok(()) } diff --git a/src/target.rs b/src/target.rs index c4869669..61ce91ee 100644 --- a/src/target.rs +++ b/src/target.rs @@ -11,7 +11,7 @@ mod generated; /// The parts of `rustc`'s target triple. /// /// See . -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub(crate) struct Target { /// The full architecture, including the subarchitecture. /// @@ -118,8 +118,11 @@ impl FromStr for Target { /// This will fail when using a custom target triple unknown to `rustc`. fn from_str(target_triple: &str) -> Result { - if let Some(target) = generated::get(target_triple) { - Ok(target) + 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, diff --git a/src/target/generated.rs b/src/target/generated.rs index 87f4f205..d28b9223 100644 --- a/src/target/generated.rs +++ b/src/target/generated.rs @@ -2,2233 +2,3065 @@ //! in dev-tools/gen-target-info if you need to make changes. use super::Target; +use std::borrow::Cow; -pub(crate) fn get(target_triple: &str) -> Option { - Some(match target_triple { - "aarch64-apple-darwin" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "macos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-apple-ios" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-apple-ios-macabi" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "macabi".into(), - }, - "aarch64-apple-ios-sim" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "sim".into(), - }, - "aarch64-apple-tvos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "tvos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-apple-tvos-sim" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "tvos".into(), - env: "".into(), - abi: "sim".into(), - }, - "aarch64-apple-visionos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "visionos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-apple-visionos-sim" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "visionos".into(), - env: "".into(), - abi: "sim".into(), - }, - "aarch64-apple-watchos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "watchos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-apple-watchos-sim" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "watchos".into(), - env: "".into(), - abi: "sim".into(), - }, - "aarch64-fuchsia" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "fuchsia".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-kmc-solid_asp3" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "kmc".into(), - os: "solid_asp3".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-linux-android" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-nintendo-switch-freestanding" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "nintendo".into(), - os: "horizon".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-pc-windows-gnullvm" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "llvm".into(), - }, - "aarch64-pc-windows-msvc" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "aarch64-unknown-freebsd" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-fuchsia" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "fuchsia".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-hermit" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "hermit".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-illumos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "illumos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-linux-gnu" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "aarch64-unknown-linux-gnu_ilp32" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "ilp32".into(), - }, - "aarch64-unknown-linux-musl" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "aarch64-unknown-linux-ohos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "ohos".into(), - abi: "".into(), - }, - "aarch64-unknown-netbsd" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-none" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-none-softfloat" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "softfloat".into(), - }, - "aarch64-unknown-nto-qnx700" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "nto".into(), - env: "nto70".into(), - abi: "".into(), - }, - "aarch64-unknown-nto-qnx710" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "nto".into(), - env: "nto71".into(), - abi: "".into(), - }, - "aarch64-unknown-openbsd" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-redox" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "redox".into(), - env: "relibc".into(), - abi: "".into(), - }, - "aarch64-unknown-teeos" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "teeos".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-trusty" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "trusty".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-unknown-uefi" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "uefi".into(), - env: "".into(), - abi: "".into(), - }, - "aarch64-uwp-windows-msvc" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "uwp".into(), - }, - "aarch64-wrs-vxworks" => Target { - full_arch: "aarch64".into(), - arch: "aarch64".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "aarch64_be-unknown-linux-gnu" => Target { - full_arch: "aarch64_be".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "aarch64_be-unknown-linux-gnu_ilp32" => Target { - full_arch: "aarch64_be".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "ilp32".into(), - }, - "aarch64_be-unknown-netbsd" => Target { - full_arch: "aarch64_be".into(), - arch: "aarch64".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "arm-linux-androideabi" => Target { - full_arch: "arm".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "eabi".into(), - }, - "arm-unknown-linux-gnueabi" => Target { - full_arch: "arm".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabi".into(), - }, - "arm-unknown-linux-gnueabihf" => Target { - full_arch: "arm".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "arm-unknown-linux-musleabi" => Target { - full_arch: "arm".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabi".into(), - }, - "arm-unknown-linux-musleabihf" => Target { - full_arch: "arm".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabihf".into(), - }, - "arm64_32-apple-watchos" => Target { - full_arch: "arm64_32".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "watchos".into(), - env: "".into(), - abi: "".into(), - }, - "arm64e-apple-darwin" => Target { - full_arch: "arm64e".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "macos".into(), - env: "".into(), - abi: "".into(), - }, - "arm64e-apple-ios" => Target { - full_arch: "arm64e".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "".into(), - }, - "arm64e-apple-tvos" => Target { - full_arch: "arm64e".into(), - arch: "aarch64".into(), - vendor: "apple".into(), - os: "tvos".into(), - env: "".into(), - abi: "".into(), - }, - "arm64ec-pc-windows-msvc" => Target { - full_arch: "arm64ec".into(), - arch: "arm64ec".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "armeb-unknown-linux-gnueabi" => Target { - full_arch: "armeb".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabi".into(), - }, - "armebv7r-none-eabi" => Target { - full_arch: "armebv7r".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armebv7r-none-eabihf" => Target { - full_arch: "armebv7r".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv4t-none-eabi" => Target { - full_arch: "armv4t".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv4t-unknown-linux-gnueabi" => Target { - full_arch: "armv4t".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabi".into(), - }, - "armv5te-none-eabi" => Target { - full_arch: "armv5te".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv5te-unknown-linux-gnueabi" => Target { - full_arch: "armv5te".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabi".into(), - }, - "armv5te-unknown-linux-musleabi" => Target { - full_arch: "armv5te".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabi".into(), - }, - "armv5te-unknown-linux-uclibceabi" => Target { - full_arch: "armv5te".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "uclibc".into(), - abi: "eabi".into(), - }, - "armv6-unknown-freebsd" => Target { - full_arch: "armv6".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "armv6-unknown-netbsd-eabihf" => Target { - full_arch: "armv6".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv6k-nintendo-3ds" => Target { - full_arch: "armv6k".into(), - arch: "arm".into(), - vendor: "nintendo".into(), - os: "horizon".into(), - env: "newlib".into(), - abi: "eabihf".into(), - }, - "armv7-apple-ios" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "".into(), - }, - "armv7-linux-androideabi" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv7-rtems-eabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "rtems".into(), - env: "newlib".into(), - abi: "eabihf".into(), - }, - "armv7-sony-vita-newlibeabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "sony".into(), - os: "vita".into(), - env: "newlib".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-freebsd" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-linux-gnueabi" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabi".into(), - }, - "armv7-unknown-linux-gnueabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-linux-musleabi" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabi".into(), - }, - "armv7-unknown-linux-musleabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-linux-ohos" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "ohos".into(), - abi: "eabi".into(), - }, - "armv7-unknown-linux-uclibceabi" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "uclibc".into(), - abi: "eabi".into(), - }, - "armv7-unknown-linux-uclibceabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "uclibc".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-netbsd-eabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv7-unknown-trusty" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "trusty".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv7-wrs-vxworks-eabihf" => Target { - full_arch: "armv7".into(), - arch: "arm".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "armv7a-kmc-solid_asp3-eabi" => Target { - full_arch: "armv7a".into(), - arch: "arm".into(), - vendor: "kmc".into(), - os: "solid_asp3".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv7a-kmc-solid_asp3-eabihf" => Target { - full_arch: "armv7a".into(), - arch: "arm".into(), - vendor: "kmc".into(), - os: "solid_asp3".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv7a-none-eabi" => Target { - full_arch: "armv7a".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv7a-none-eabihf" => Target { - full_arch: "armv7a".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv7k-apple-watchos" => Target { - full_arch: "armv7k".into(), - arch: "arm".into(), - vendor: "apple".into(), - os: "watchos".into(), - env: "".into(), - abi: "".into(), - }, - "armv7r-none-eabi" => Target { - full_arch: "armv7r".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "armv7r-none-eabihf" => Target { - full_arch: "armv7r".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "armv7s-apple-ios" => Target { - full_arch: "armv7s".into(), - arch: "arm".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "".into(), - }, - "armv8r-none-eabihf" => Target { - full_arch: "armv8r".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "asmjs-unknown-emscripten" => Target { - full_arch: "asmjs".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "emscripten".into(), - env: "".into(), - abi: "".into(), - }, - "avr-unknown-gnu-atmega328" => Target { - full_arch: "avr".into(), - arch: "avr".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "gnu".into(), - abi: "".into(), - }, - "bpfeb-unknown-none" => Target { - full_arch: "bpfeb".into(), - arch: "bpf".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "bpfel-unknown-none" => Target { - full_arch: "bpfel".into(), - arch: "bpf".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "csky-unknown-linux-gnuabiv2" => Target { - full_arch: "csky".into(), - arch: "csky".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abiv2".into(), - }, - "csky-unknown-linux-gnuabiv2hf" => Target { - full_arch: "csky".into(), - arch: "csky".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abiv2hf".into(), - }, - "hexagon-unknown-linux-musl" => Target { - full_arch: "hexagon".into(), - arch: "hexagon".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "hexagon-unknown-none-elf" => Target { - full_arch: "hexagon".into(), - arch: "hexagon".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "i386-apple-ios" => Target { - full_arch: "i386".into(), - arch: "x86".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "sim".into(), - }, - "i586-pc-nto-qnx700" => Target { - full_arch: "i586".into(), - arch: "x86".into(), - vendor: "pc".into(), - os: "nto".into(), - env: "nto70".into(), - abi: "".into(), - }, - "i586-pc-windows-msvc" => Target { - full_arch: "i586".into(), - arch: "x86".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "i586-unknown-linux-gnu" => Target { - full_arch: "i586".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "i586-unknown-linux-musl" => Target { - full_arch: "i586".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "i586-unknown-netbsd" => Target { - full_arch: "i586".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "i686-apple-darwin" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "apple".into(), - os: "macos".into(), - env: "".into(), - abi: "".into(), - }, - "i686-linux-android" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "".into(), - }, - "i686-pc-windows-gnu" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "".into(), - }, - "i686-pc-windows-gnullvm" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "llvm".into(), - }, - "i686-pc-windows-msvc" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "i686-unknown-freebsd" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "i686-unknown-haiku" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "haiku".into(), - env: "".into(), - abi: "".into(), - }, - "i686-unknown-hurd-gnu" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "hurd".into(), - env: "gnu".into(), - abi: "".into(), - }, - "i686-unknown-linux-gnu" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "i686-unknown-linux-musl" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "i686-unknown-netbsd" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "i686-unknown-openbsd" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "i686-unknown-redox" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "redox".into(), - env: "relibc".into(), - abi: "".into(), - }, - "i686-unknown-uefi" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "unknown".into(), - os: "uefi".into(), - env: "".into(), - abi: "".into(), - }, - "i686-uwp-windows-gnu" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "uwp".into(), - }, - "i686-uwp-windows-msvc" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "uwp".into(), - }, - "i686-win7-windows-msvc" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "win7".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "i686-wrs-vxworks" => Target { - full_arch: "i686".into(), - arch: "x86".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "loongarch64-unknown-linux-gnu" => Target { - full_arch: "loongarch64".into(), - arch: "loongarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "loongarch64-unknown-linux-musl" => Target { - full_arch: "loongarch64".into(), - arch: "loongarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "loongarch64-unknown-linux-ohos" => Target { - full_arch: "loongarch64".into(), - arch: "loongarch64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "ohos".into(), - abi: "".into(), - }, - "loongarch64-unknown-none" => Target { - full_arch: "loongarch64".into(), - arch: "loongarch64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "loongarch64-unknown-none-softfloat" => Target { - full_arch: "loongarch64".into(), - arch: "loongarch64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "softfloat".into(), - }, - "m68k-unknown-linux-gnu" => Target { - full_arch: "m68k".into(), - arch: "m68k".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "mips-unknown-linux-gnu" => Target { - full_arch: "mips".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "mips-unknown-linux-musl" => Target { - full_arch: "mips".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "mips-unknown-linux-uclibc" => Target { - full_arch: "mips".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "uclibc".into(), - abi: "".into(), - }, - "mips64-openwrt-linux-musl" => Target { - full_arch: "mips64".into(), - arch: "mips64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "abi64".into(), - }, - "mips64-unknown-linux-gnuabi64" => Target { - full_arch: "mips64".into(), - arch: "mips64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abi64".into(), - }, - "mips64-unknown-linux-muslabi64" => Target { - full_arch: "mips64".into(), - arch: "mips64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "abi64".into(), - }, - "mips64el-unknown-linux-gnuabi64" => Target { - full_arch: "mips64el".into(), - arch: "mips64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abi64".into(), - }, - "mips64el-unknown-linux-muslabi64" => Target { - full_arch: "mips64el".into(), - arch: "mips64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "abi64".into(), - }, - "mipsel-sony-psp" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "sony".into(), - os: "psp".into(), - env: "".into(), - abi: "".into(), - }, - "mipsel-sony-psx" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "sony".into(), - os: "none".into(), - env: "psx".into(), - abi: "".into(), - }, - "mipsel-unknown-linux-gnu" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "mipsel-unknown-linux-musl" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "mipsel-unknown-linux-uclibc" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "uclibc".into(), - abi: "".into(), - }, - "mipsel-unknown-netbsd" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "mipsel-unknown-none" => Target { - full_arch: "mipsel".into(), - arch: "mips".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "mipsisa32r6-unknown-linux-gnu" => Target { - full_arch: "mipsisa32r6".into(), - arch: "mips32r6".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "mipsisa32r6el-unknown-linux-gnu" => Target { - full_arch: "mipsisa32r6el".into(), - arch: "mips32r6".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "mipsisa64r6-unknown-linux-gnuabi64" => Target { - full_arch: "mipsisa64r6".into(), - arch: "mips64r6".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abi64".into(), - }, - "mipsisa64r6el-unknown-linux-gnuabi64" => Target { - full_arch: "mipsisa64r6el".into(), - arch: "mips64r6".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "abi64".into(), - }, - "msp430-none-elf" => Target { - full_arch: "msp430".into(), - arch: "msp430".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "nvptx64-nvidia-cuda" => Target { - full_arch: "nvptx64".into(), - arch: "nvptx64".into(), - vendor: "nvidia".into(), - os: "cuda".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc-unknown-freebsd" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc-unknown-linux-gnu" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "powerpc-unknown-linux-gnuspe" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "spe".into(), - }, - "powerpc-unknown-linux-musl" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "powerpc-unknown-linux-muslspe" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "spe".into(), - }, - "powerpc-unknown-netbsd" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc-unknown-openbsd" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc-wrs-vxworks" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "powerpc-wrs-vxworks-spe" => Target { - full_arch: "powerpc".into(), - arch: "powerpc".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "spe".into(), - }, - "powerpc64-ibm-aix" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "ibm".into(), - os: "aix".into(), - env: "".into(), - abi: "vec-extabi".into(), - }, - "powerpc64-unknown-freebsd" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc64-unknown-linux-gnu" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "powerpc64-unknown-linux-musl" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "powerpc64-unknown-openbsd" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc64-wrs-vxworks" => Target { - full_arch: "powerpc64".into(), - arch: "powerpc64".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "powerpc64le-unknown-freebsd" => Target { - full_arch: "powerpc64le".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "powerpc64le-unknown-linux-gnu" => Target { - full_arch: "powerpc64le".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "powerpc64le-unknown-linux-musl" => Target { - full_arch: "powerpc64le".into(), - arch: "powerpc64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "riscv32-wrs-vxworks" => Target { - full_arch: "riscv32".into(), - arch: "riscv32".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "riscv32e-unknown-none-elf" => Target { - full_arch: "riscv32e".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32em-unknown-none-elf" => Target { - full_arch: "riscv32em".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32emc-unknown-none-elf" => Target { - full_arch: "riscv32emc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32gc-unknown-linux-gnu" => Target { - full_arch: "riscv32gc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "riscv32gc-unknown-linux-musl" => Target { - full_arch: "riscv32gc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "riscv32i-unknown-none-elf" => Target { - full_arch: "riscv32i".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32im-risc0-zkvm-elf" => Target { - full_arch: "riscv32im".into(), - arch: "riscv32".into(), - vendor: "risc0".into(), - os: "zkvm".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32im-unknown-none-elf" => Target { - full_arch: "riscv32im".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32ima-unknown-none-elf" => Target { - full_arch: "riscv32ima".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imac-esp-espidf" => Target { - full_arch: "riscv32imac".into(), - arch: "riscv32".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "riscv32imac-unknown-none-elf" => Target { - full_arch: "riscv32imac".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imac-unknown-nuttx-elf" => Target { - full_arch: "riscv32imac".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imac-unknown-xous-elf" => Target { - full_arch: "riscv32imac".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "xous".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imafc-esp-espidf" => Target { - full_arch: "riscv32imafc".into(), - arch: "riscv32".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "riscv32imafc-unknown-none-elf" => Target { - full_arch: "riscv32imafc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imafc-unknown-nuttx-elf" => Target { - full_arch: "riscv32imafc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imc-esp-espidf" => Target { - full_arch: "riscv32imc".into(), - arch: "riscv32".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "riscv32imc-unknown-none-elf" => Target { - full_arch: "riscv32imc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv32imc-unknown-nuttx-elf" => Target { - full_arch: "riscv32imc".into(), - arch: "riscv32".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64-linux-android" => Target { - full_arch: "riscv64".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64-wrs-vxworks" => Target { - full_arch: "riscv64".into(), - arch: "riscv64".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "riscv64gc-unknown-freebsd" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-fuchsia" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "fuchsia".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-hermit" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "hermit".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-linux-gnu" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "riscv64gc-unknown-linux-musl" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "riscv64gc-unknown-netbsd" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-none-elf" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-nuttx-elf" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64gc-unknown-openbsd" => Target { - full_arch: "riscv64gc".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64imac-unknown-none-elf" => Target { - full_arch: "riscv64imac".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "riscv64imac-unknown-nuttx-elf" => Target { - full_arch: "riscv64imac".into(), - arch: "riscv64".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "".into(), - }, - "s390x-unknown-linux-gnu" => Target { - full_arch: "s390x".into(), - arch: "s390x".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "s390x-unknown-linux-musl" => Target { - full_arch: "s390x".into(), - arch: "s390x".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "sparc-unknown-linux-gnu" => Target { - full_arch: "sparc".into(), - arch: "sparc".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "sparc-unknown-none-elf" => Target { - full_arch: "sparc".into(), - arch: "sparc".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "sparc64-unknown-linux-gnu" => Target { - full_arch: "sparc64".into(), - arch: "sparc64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "sparc64-unknown-netbsd" => Target { - full_arch: "sparc64".into(), - arch: "sparc64".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "sparc64-unknown-openbsd" => Target { - full_arch: "sparc64".into(), - arch: "sparc64".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "sparcv9-sun-solaris" => Target { - full_arch: "sparcv9".into(), - arch: "sparc64".into(), - vendor: "sun".into(), - os: "solaris".into(), - env: "".into(), - abi: "".into(), - }, - "thumbv4t-none-eabi" => Target { - full_arch: "thumbv4t".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv5te-none-eabi" => Target { - full_arch: "thumbv5te".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv6m-none-eabi" => Target { - full_arch: "thumbv6m".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv6m-nuttx-eabi" => Target { - full_arch: "thumbv6m".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7a-pc-windows-msvc" => Target { - full_arch: "thumbv7a".into(), - arch: "arm".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "thumbv7a-uwp-windows-msvc" => Target { - full_arch: "thumbv7a".into(), - arch: "arm".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "uwp".into(), - }, - "thumbv7em-none-eabi" => Target { - full_arch: "thumbv7em".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7em-none-eabihf" => Target { - full_arch: "thumbv7em".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "thumbv7em-nuttx-eabi" => Target { - full_arch: "thumbv7em".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7em-nuttx-eabihf" => Target { - full_arch: "thumbv7em".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "thumbv7m-none-eabi" => Target { - full_arch: "thumbv7m".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7m-nuttx-eabi" => Target { - full_arch: "thumbv7m".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7neon-linux-androideabi" => Target { - full_arch: "thumbv7neon".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv7neon-unknown-linux-gnueabihf" => Target { - full_arch: "thumbv7neon".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "eabihf".into(), - }, - "thumbv7neon-unknown-linux-musleabihf" => Target { - full_arch: "thumbv7neon".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "eabihf".into(), - }, - "thumbv8m.base-none-eabi" => Target { - full_arch: "thumbv8m.base".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv8m.base-nuttx-eabi" => Target { - full_arch: "thumbv8m.base".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv8m.main-none-eabi" => Target { - full_arch: "thumbv8m.main".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv8m.main-none-eabihf" => Target { - full_arch: "thumbv8m.main".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "thumbv8m.main-nuttx-eabi" => Target { - full_arch: "thumbv8m.main".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabi".into(), - }, - "thumbv8m.main-nuttx-eabihf" => Target { - full_arch: "thumbv8m.main".into(), - arch: "arm".into(), - vendor: "unknown".into(), - os: "nuttx".into(), - env: "".into(), - abi: "eabihf".into(), - }, - "wasm32-unknown-emscripten" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "emscripten".into(), - env: "".into(), - abi: "".into(), - }, - "wasm32-unknown-unknown" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "unknown".into(), - env: "".into(), - abi: "".into(), - }, - "wasm32-wasi" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "wasi".into(), - env: "p1".into(), - abi: "".into(), - }, - "wasm32-wasip1" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "wasi".into(), - env: "p1".into(), - abi: "".into(), - }, - "wasm32-wasip1-threads" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "wasi".into(), - env: "p1".into(), - abi: "".into(), - }, - "wasm32-wasip2" => Target { - full_arch: "wasm32".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "wasi".into(), - env: "p2".into(), - abi: "".into(), - }, - "wasm32v1-none" => Target { - full_arch: "wasm32v1".into(), - arch: "wasm32".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "wasm64-unknown-unknown" => Target { - full_arch: "wasm64".into(), - arch: "wasm64".into(), - vendor: "unknown".into(), - os: "unknown".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-apple-darwin" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "macos".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-apple-ios" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "sim".into(), - }, - "x86_64-apple-ios-macabi" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "ios".into(), - env: "".into(), - abi: "macabi".into(), - }, - "x86_64-apple-tvos" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "tvos".into(), - env: "".into(), - abi: "sim".into(), - }, - "x86_64-apple-watchos-sim" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "watchos".into(), - env: "".into(), - abi: "sim".into(), - }, - "x86_64-fortanix-unknown-sgx" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "fortanix".into(), - os: "unknown".into(), - env: "sgx".into(), - abi: "fortanix".into(), - }, - "x86_64-fuchsia" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "fuchsia".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-linux-android" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "android".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-pc-nto-qnx710" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "pc".into(), - os: "nto".into(), - env: "nto71".into(), - abi: "".into(), - }, - "x86_64-pc-solaris" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "pc".into(), - os: "solaris".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-pc-windows-gnu" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "".into(), - }, - "x86_64-pc-windows-gnullvm" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "llvm".into(), - }, - "x86_64-pc-windows-msvc" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "pc".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "x86_64-sun-solaris" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "sun".into(), - os: "solaris".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unikraft-linux-musl" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unikraft".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "x86_64-unknown-dragonfly" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "dragonfly".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-freebsd" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "freebsd".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-fuchsia" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "fuchsia".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-haiku" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "haiku".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-hermit" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "hermit".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-hurd-gnu" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "hurd".into(), - env: "gnu".into(), - abi: "".into(), - }, - "x86_64-unknown-illumos" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "illumos".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-l4re-uclibc" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "l4re".into(), - env: "uclibc".into(), - abi: "".into(), - }, - "x86_64-unknown-linux-gnu" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "".into(), - }, - "x86_64-unknown-linux-gnux32" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "gnu".into(), - abi: "x32".into(), - }, - "x86_64-unknown-linux-musl" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "musl".into(), - abi: "".into(), - }, - "x86_64-unknown-linux-none" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-linux-ohos" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "linux".into(), - env: "ohos".into(), - abi: "".into(), - }, - "x86_64-unknown-netbsd" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "netbsd".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-none" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-none-linuxkernel" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "none".into(), - env: "gnu".into(), - abi: "".into(), - }, - "x86_64-unknown-openbsd" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "openbsd".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-redox" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "redox".into(), - env: "relibc".into(), - abi: "".into(), - }, - "x86_64-unknown-trusty" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "trusty".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-unknown-uefi" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "unknown".into(), - os: "uefi".into(), - env: "".into(), - abi: "".into(), - }, - "x86_64-uwp-windows-gnu" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "gnu".into(), - abi: "uwp".into(), - }, - "x86_64-uwp-windows-msvc" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "uwp".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "uwp".into(), - }, - "x86_64-win7-windows-msvc" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "win7".into(), - os: "windows".into(), - env: "msvc".into(), - abi: "".into(), - }, - "x86_64-wrs-vxworks" => Target { - full_arch: "x86_64".into(), - arch: "x86_64".into(), - vendor: "wrs".into(), - os: "vxworks".into(), - env: "gnu".into(), - abi: "".into(), - }, - "x86_64h-apple-darwin" => Target { - full_arch: "x86_64h".into(), - arch: "x86_64".into(), - vendor: "apple".into(), - os: "macos".into(), - env: "".into(), - abi: "".into(), - }, - "xtensa-esp32-espidf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "xtensa-esp32-none-elf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "xtensa-esp32s2-espidf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "xtensa-esp32s2-none-elf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - "xtensa-esp32s3-espidf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "espidf".into(), - env: "newlib".into(), - abi: "".into(), - }, - "xtensa-esp32s3-none-elf" => Target { - full_arch: "xtensa".into(), - arch: "xtensa".into(), - vendor: "espressif".into(), - os: "none".into(), - env: "".into(), - abi: "".into(), - }, - _ => return None, - }) -} +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(""), + }, + ), +]; From 450de39c0c5f73fa8b7803b8f8a8271248fc45ce Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 31 Oct 2024 17:01:29 +0100 Subject: [PATCH 16/16] Fix formatting --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5239303d..45faecd3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2001,7 +2001,10 @@ impl Build { } // Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet if self.pic.unwrap_or( - target.os != "windows" && target.os != "none" && target.env != "uefi" && target.os != "wasi", + 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,