1
Fork 0

Rollup merge of #117702 - davidtwco:target-tier-refactors, r=petrochenkov

target: move base and target specifications

Follow-up to #116004.

In anticipation of later PRs where we'll want to add tidy checks to ensure that, for each target, we have a test or a platform support document or something like that, this PR moves target specifications into a directory on their own so that we can just list the files in this directory to get a list of all targets.

- Base specifications are moved to `rustc_target::spec::base`.
- Target specifications are moved to `rustc_target::spec::targets`.
- All the other source files containing types used in the target specs remain in `rustc_target::spec`.
  - `rustc_target/src/spec/abi.rs` is moved to `rustc_target/src/spec/abi/mod.rs` (where there was already a `tests.rs`) for uniformity.

r? ``@petrochenkov``
This commit is contained in:
Guillaume Gomez 2023-11-08 17:14:37 +01:00 committed by GitHub
commit d8c52b378d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
274 changed files with 479 additions and 475 deletions

View file

@ -1 +0,0 @@
pub use crate::spec::aarch64_unknown_fuchsia::target;

View file

@ -1,5 +0,0 @@
use crate::spec::Target;
pub fn target() -> Target {
super::avr_gnu_base::target("atmega328", "-mmcu=atmega328")
}

View file

@ -1,7 +1,7 @@
use crate::spec::{SanitizerSet, TargetOptions}; use crate::spec::{base, SanitizerSet, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts(); let mut base = base::linux::opts();
base.os = "android".into(); base.os = "android".into();
base.is_like_android = true; base.is_like_android = true;
base.default_dwarf_version = 2; base.default_dwarf_version = 2;

View file

@ -1,10 +1,10 @@
use std::{borrow::Cow, env}; use std::{borrow::Cow, env};
use crate::spec::{add_link_args, add_link_args_iter};
use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs}; use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs};
use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions}; use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions};
#[cfg(test)] #[cfg(test)]
#[path = "apple/tests.rs"]
mod tests; mod tests;
use Arch::*; use Arch::*;
@ -102,13 +102,13 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
LinkerFlavor::Darwin(Cc::No, Lld::No), LinkerFlavor::Darwin(Cc::No, Lld::No),
&["-arch", arch, "-platform_version"], &["-arch", arch, "-platform_version"],
); );
super::add_link_args_iter( add_link_args_iter(
&mut args, &mut args,
LinkerFlavor::Darwin(Cc::No, Lld::No), LinkerFlavor::Darwin(Cc::No, Lld::No),
[platform_name, platform_version.clone(), platform_version].into_iter(), [platform_name, platform_version.clone(), platform_version].into_iter(),
); );
if abi != "macabi" { if abi != "macabi" {
super::add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-arch", arch]); add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-arch", arch]);
} }
args args

View file

@ -1,4 +1,4 @@
use crate::spec::{ use crate::spec::targets::{
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_watchos_sim, i686_apple_darwin, aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_watchos_sim, i686_apple_darwin,
x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim, x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim,
}; };

View file

@ -0,0 +1,5 @@
use crate::spec::{base, TargetOptions};
pub fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..base::hurd::opts() }
}

View file

@ -0,0 +1,5 @@
use crate::spec::{base, TargetOptions};
pub fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..base::linux::opts() }
}

View file

@ -1,8 +1,8 @@
use crate::spec::crt_objects; use crate::spec::crt_objects;
use crate::spec::{LinkSelfContainedDefault, TargetOptions}; use crate::spec::{base, LinkSelfContainedDefault, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts(); let mut base = base::linux::opts();
base.env = "musl".into(); base.env = "musl".into();
base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained(); base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained();

View file

@ -1,7 +1,7 @@
use crate::spec::TargetOptions; use crate::spec::{base, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts(); let mut base = base::linux::opts();
base.env = "ohos".into(); base.env = "ohos".into();
base.crt_static_default = false; base.crt_static_default = false;

View file

@ -0,0 +1,5 @@
use crate::spec::{base, TargetOptions};
pub fn opts() -> TargetOptions {
TargetOptions { env: "uclibc".into(), ..base::linux::opts() }
}

View file

@ -0,0 +1,37 @@
pub(crate) mod aix;
pub(crate) mod android;
pub(crate) mod apple;
pub(crate) mod avr_gnu;
pub(crate) mod bpf;
pub(crate) mod dragonfly;
pub(crate) mod freebsd;
pub(crate) mod fuchsia;
pub(crate) mod haiku;
pub(crate) mod hermit;
pub(crate) mod hurd;
pub(crate) mod hurd_gnu;
pub(crate) mod illumos;
pub(crate) mod l4re;
pub(crate) mod linux;
pub(crate) mod linux_gnu;
pub(crate) mod linux_musl;
pub(crate) mod linux_ohos;
pub(crate) mod linux_uclibc;
pub(crate) mod msvc;
pub(crate) mod netbsd;
pub(crate) mod nto_qnx;
pub(crate) mod openbsd;
pub(crate) mod redox;
pub(crate) mod solaris;
pub(crate) mod solid;
pub(crate) mod teeos;
pub(crate) mod thumb;
pub(crate) mod uefi_msvc;
pub(crate) mod unikraft_linux_musl;
pub(crate) mod vxworks;
pub(crate) mod wasm;
pub(crate) mod windows_gnu;
pub(crate) mod windows_gnullvm;
pub(crate) mod windows_msvc;
pub(crate) mod windows_uwp_gnu;
pub(crate) mod windows_uwp_msvc;

View file

@ -1,5 +1,4 @@
use super::FramePointer; use crate::spec::{FramePointer, TargetOptions};
use crate::spec::TargetOptions;
pub fn opts(kernel: &str) -> TargetOptions { pub fn opts(kernel: &str) -> TargetOptions {
TargetOptions { TargetOptions {

View file

@ -1,12 +1,11 @@
use super::{Cc, LinkerFlavor, Lld, PanicStrategy}; use crate::spec::{add_link_args, Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, TargetOptions};
use crate::spec::{RelroLevel, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"]; let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"];
let cc_args = &["-Wl,-zmax-page-size=4096", "-Wl,-znow", "-Wl,-ztext", "-mexecute-only"]; let cc_args = &["-Wl,-zmax-page-size=4096", "-Wl,-znow", "-Wl,-ztext", "-mexecute-only"];
let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), lld_args); let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), lld_args);
super::add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), cc_args); add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), cc_args);
TargetOptions { TargetOptions {
os: "teeos".into(), os: "teeos".into(),

View file

@ -9,10 +9,10 @@
// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all // the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all
// code runs in the same environment, no process separation is supported. // code runs in the same environment, no process separation is supported.
use crate::spec::{LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions}; use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut base = super::msvc_base::opts(); let mut base = base::msvc::opts();
base.add_pre_link_args( base.add_pre_link_args(
LinkerFlavor::Msvc(Lld::No), LinkerFlavor::Msvc(Lld::No),

View file

@ -1,5 +1,7 @@
use super::LinkSelfContainedDefault; use crate::spec::{
use super::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions, TlsModel}; add_link_args, cvs, Cc, LinkSelfContainedDefault, LinkerFlavor, PanicStrategy, RelocModel,
TargetOptions, TlsModel,
};
pub fn options() -> TargetOptions { pub fn options() -> TargetOptions {
macro_rules! args { macro_rules! args {
@ -50,7 +52,7 @@ pub fn options() -> TargetOptions {
} }
let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::WasmLld(Cc::No), args!("")); let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::WasmLld(Cc::No), args!(""));
super::add_link_args(&mut pre_link_args, LinkerFlavor::WasmLld(Cc::Yes), args!("-Wl,")); add_link_args(&mut pre_link_args, LinkerFlavor::WasmLld(Cc::Yes), args!("-Wl,"));
TargetOptions { TargetOptions {
is_like_wasm: true, is_like_wasm: true,

View file

@ -1,5 +1,5 @@
use crate::spec::crt_objects;
use crate::spec::LinkSelfContainedDefault; use crate::spec::LinkSelfContainedDefault;
use crate::spec::{add_link_args, crt_objects};
use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions};
use std::borrow::Cow; use std::borrow::Cow;
@ -13,7 +13,7 @@ pub fn opts() -> TargetOptions {
"--disable-auto-image-base", "--disable-auto-image-base",
], ],
); );
super::add_link_args( add_link_args(
&mut pre_link_args, &mut pre_link_args,
LinkerFlavor::Gnu(Cc::Yes, Lld::No), LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&[ &[
@ -45,14 +45,14 @@ pub fn opts() -> TargetOptions {
]; ];
let mut late_link_args = let mut late_link_args =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs); TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs);
super::add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs); add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs);
// If any of our crates are dynamically linked then we need to use // If any of our crates are dynamically linked then we need to use
// the shared libgcc_s-dw2-1.dll. This is required to support // the shared libgcc_s-dw2-1.dll. This is required to support
// unwinding across DLL boundaries. // unwinding across DLL boundaries.
let dynamic_unwind_libs = &["-lgcc_s"]; let dynamic_unwind_libs = &["-lgcc_s"];
let mut late_link_args_dynamic = let mut late_link_args_dynamic =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), dynamic_unwind_libs); TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), dynamic_unwind_libs);
super::add_link_args( add_link_args(
&mut late_link_args_dynamic, &mut late_link_args_dynamic,
LinkerFlavor::Gnu(Cc::Yes, Lld::No), LinkerFlavor::Gnu(Cc::Yes, Lld::No),
dynamic_unwind_libs, dynamic_unwind_libs,
@ -65,7 +65,7 @@ pub fn opts() -> TargetOptions {
let static_unwind_libs = &["-lgcc_eh", "-l:libpthread.a"]; let static_unwind_libs = &["-lgcc_eh", "-l:libpthread.a"];
let mut late_link_args_static = let mut late_link_args_static =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), static_unwind_libs); TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), static_unwind_libs);
super::add_link_args( add_link_args(
&mut late_link_args_static, &mut late_link_args_static,
LinkerFlavor::Gnu(Cc::Yes, Lld::No), LinkerFlavor::Gnu(Cc::Yes, Lld::No),
static_unwind_libs, static_unwind_libs,

View file

@ -1,7 +1,7 @@
use crate::spec::{cvs, TargetOptions}; use crate::spec::{base, cvs, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let base = super::msvc_base::opts(); let base = base::msvc::opts();
TargetOptions { TargetOptions {
os: "windows".into(), os: "windows".into(),

View file

@ -1,7 +1,7 @@
use crate::spec::{Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions}; use crate::spec::{add_link_args, base, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let base = super::windows_gnu_base::opts(); let base = base::windows_gnu::opts();
// FIXME: This should be updated for the exception machinery changes from #67502 // FIXME: This should be updated for the exception machinery changes from #67502
// and inherit from `windows_gnu_base`, at least partially. // and inherit from `windows_gnu_base`, at least partially.
@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
]; ];
let mut late_link_args = let mut late_link_args =
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs); TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs);
super::add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs); add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs);
// Reset the flags back to empty until the FIXME above is addressed. // Reset the flags back to empty until the FIXME above is addressed.
let late_link_args_dynamic = LinkArgs::new(); let late_link_args_dynamic = LinkArgs::new();
let late_link_args_static = LinkArgs::new(); let late_link_args_static = LinkArgs::new();

View file

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Lld, TargetOptions}; use crate::spec::{base, LinkerFlavor, Lld, TargetOptions};
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let mut opts = super::windows_msvc_base::opts(); let mut opts = base::windows_msvc::opts();
opts.abi = "uwp".into(); opts.abi = "uwp".into();
opts.vendor = "uwp".into(); opts.vendor = "uwp".into();

View file

@ -1,5 +0,0 @@
use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..super::hurd_base::opts() }
}

View file

@ -1,5 +0,0 @@
use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..super::linux_base::opts() }
}

View file

@ -1,5 +0,0 @@
use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions { env: "uclibc".into(), ..super::linux_base::opts() }
}

View file

@ -57,47 +57,11 @@ use rustc_macros::HashStable_Generic;
pub mod abi; pub mod abi;
pub mod crt_objects; pub mod crt_objects;
mod aix_base; mod base;
mod android_base; pub use base::apple::deployment_target as current_apple_deployment_target;
mod apple_base; pub use base::apple::platform as current_apple_platform;
pub use apple_base::deployment_target as current_apple_deployment_target; pub use base::apple::sdk_version as current_apple_sdk_version;
pub use apple_base::platform as current_apple_platform; pub use base::avr_gnu::ef_avr_arch;
pub use apple_base::sdk_version as current_apple_sdk_version;
mod avr_gnu_base;
pub use avr_gnu_base::ef_avr_arch;
mod bpf_base;
mod dragonfly_base;
mod freebsd_base;
mod fuchsia_base;
mod haiku_base;
mod hermit_base;
mod hurd_base;
mod hurd_gnu_base;
mod illumos_base;
mod l4re_base;
mod linux_base;
mod linux_gnu_base;
mod linux_musl_base;
mod linux_ohos_base;
mod linux_uclibc_base;
mod msvc_base;
mod netbsd_base;
mod nto_qnx_base;
mod openbsd_base;
mod redox_base;
mod solaris_base;
mod solid_base;
mod teeos_base;
mod thumb_base;
mod uefi_msvc_base;
mod unikraft_linux_musl_base;
mod vxworks_base;
mod wasm_base;
mod windows_gnu_base;
mod windows_gnullvm_base;
mod windows_msvc_base;
mod windows_uwp_gnu_base;
mod windows_uwp_msvc_base;
/// Linker is called through a C/C++ compiler. /// Linker is called through a C/C++ compiler.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
@ -1444,14 +1408,16 @@ impl fmt::Display for StackProtector {
macro_rules! supported_targets { macro_rules! supported_targets {
( $(($triple:literal, $module:ident),)+ ) => { ( $(($triple:literal, $module:ident),)+ ) => {
$(mod $module;)+ mod targets {
$(pub(crate) mod $module;)+
}
/// List of supported targets /// List of supported targets
pub const TARGETS: &[&str] = &[$($triple),+]; pub const TARGETS: &[&str] = &[$($triple),+];
fn load_builtin(target: &str) -> Option<Target> { fn load_builtin(target: &str) -> Option<Target> {
let mut t = match target { let mut t = match target {
$( $triple => $module::target(), )+ $( $triple => targets::$module::target(), )+
_ => return None, _ => return None,
}; };
t.is_builtin = true; t.is_builtin = true;
@ -1467,7 +1433,7 @@ macro_rules! supported_targets {
$( $(
#[test] // `#[test]` #[test] // `#[test]`
fn $module() { fn $module() {
tests_impl::test_target(super::$module::target()); tests_impl::test_target(crate::spec::targets::$module::target());
} }
)+ )+
} }

View file

@ -1,4 +1,4 @@
use super::apple_base::{macos_llvm_target, opts, Arch}; use crate::spec::base::apple::{macos_llvm_target, opts, Arch};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{ios_llvm_target, opts, Arch}; use crate::spec::base::apple::{ios_llvm_target, opts, Arch};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{opts, Arch}; use crate::spec::base::apple::{opts, Arch};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{ios_sim_llvm_target, opts, Arch}; use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{opts, tvos_llvm_target, Arch}; use crate::spec::base::apple::{opts, tvos_llvm_target, Arch};
use crate::spec::{FramePointer, Target, TargetOptions}; use crate::spec::{FramePointer, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{opts, tvos_sim_llvm_target, Arch}; use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch};
use crate::spec::{FramePointer, Target, TargetOptions}; use crate::spec::{FramePointer, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use super::apple_base::{opts, watchos_sim_llvm_target, Arch}; use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch};
use crate::spec::{FramePointer, Target, TargetOptions}; use crate::spec::{FramePointer, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,5 +1,5 @@
use crate::abi::Endian; use crate::abi::Endian;
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -12,7 +12,7 @@ pub fn target() -> Target {
max_atomic_width: Some(128), max_atomic_width: Some(128),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
endian: Endian::Big, endian: Endian::Big,
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,8 +1,8 @@
use crate::abi::Endian; use crate::abi::Endian;
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_gnu_base::opts(); let mut base = base::linux_gnu::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Target { Target {

View file

@ -1,5 +1,5 @@
use crate::abi::Endian; use crate::abi::Endian;
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -11,7 +11,7 @@ pub fn target() -> Target {
mcount: "__mcount".into(), mcount: "__mcount".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
endian: Endian::Big, endian: Endian::Big,
..super::netbsd_base::opts() ..base::netbsd::opts()
}, },
} }
} }

View file

@ -0,0 +1 @@
pub use crate::spec::targets::aarch64_unknown_fuchsia::target;

View file

@ -1,7 +1,7 @@
use super::{RelocModel, Target, TargetOptions}; use crate::spec::{base, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = super::solid_base::opts("asp3"); let base = base::solid::opts("asp3");
Target { Target {
llvm_target: "aarch64-unknown-none".into(), llvm_target: "aarch64-unknown-none".into(),
pointer_width: 64, pointer_width: 64,

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
// for target ABI requirements. // for target ABI requirements.
@ -20,7 +20,7 @@ pub fn target() -> Target {
| SanitizerSet::SHADOWCALLSTACK | SanitizerSet::SHADOWCALLSTACK
| SanitizerSet::ADDRESS, | SanitizerSet::ADDRESS,
supports_xray: true, supports_xray: true,
..super::android_base::opts() ..base::android::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use super::{Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, Target, TargetOptions}; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, Target, TargetOptions};
const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld"); const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld");

View file

@ -1,7 +1,7 @@
use crate::spec::Target; use crate::spec::{base, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_gnullvm_base::opts(); let mut base = base::windows_gnullvm::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a,+neon,+fp-armv8".into(); base.features = "+v8a,+neon,+fp-armv8".into();
base.linker = Some("aarch64-w64-mingw32-clang".into()); base.linker = Some("aarch64-w64-mingw32-clang".into());

View file

@ -1,7 +1,7 @@
use crate::spec::Target; use crate::spec::{base, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts(); let mut base = base::windows_msvc::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a,+neon,+fp-armv8".into(); base.features = "+v8a,+neon,+fp-armv8".into();

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -13,7 +13,7 @@ pub fn target() -> Target {
| SanitizerSet::CFI | SanitizerSet::CFI
| SanitizerSet::MEMORY | SanitizerSet::MEMORY
| SanitizerSet::THREAD, | SanitizerSet::THREAD,
..super::freebsd_base::opts() ..base::freebsd::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -12,7 +12,7 @@ pub fn target() -> Target {
supported_sanitizers: SanitizerSet::ADDRESS supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI | SanitizerSet::CFI
| SanitizerSet::SHADOWCALLSTACK, | SanitizerSet::SHADOWCALLSTACK,
..super::fuchsia_base::opts() ..base::fuchsia::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -9,7 +9,7 @@ pub fn target() -> Target {
options: TargetOptions { options: TargetOptions {
features: "+v8a,+strict-align,+neon,+fp-armv8".into(), features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
..super::hermit_base::opts() ..base::hermit::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -18,7 +18,7 @@ pub fn target() -> Target {
| SanitizerSet::THREAD | SanitizerSet::THREAD
| SanitizerSet::HWADDRESS, | SanitizerSet::HWADDRESS,
supports_xray: true, supports_xray: true,
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -11,7 +11,7 @@ pub fn target() -> Target {
features: "+v8a,+outline-atomics".into(), features: "+v8a,+outline-atomics".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,7 +1,7 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = base::linux_musl::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.supports_xray = true; base.supports_xray = true;
base.features = "+v8a".into(); base.features = "+v8a".into();

View file

@ -1,9 +1,8 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::SanitizerSet;
use crate::spec::{base, Target, TargetOptions};
use super::SanitizerSet;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::linux_ohos_base::opts(); let mut base = base::linux_ohos::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
Target { Target {

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -10,7 +10,7 @@ pub fn target() -> Target {
features: "+v8a".into(), features: "+v8a".into(),
mcount: "__mcount".into(), mcount: "__mcount".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
..super::netbsd_base::opts() ..base::netbsd::opts()
}, },
} }
} }

View file

@ -6,7 +6,7 @@
// //
// For example, `-C target-cpu=cortex-a53`. // For example, `-C target-cpu=cortex-a53`.
use super::{ use crate::spec::{
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions,
}; };

View file

@ -6,7 +6,7 @@
// //
// For example, `-C target-cpu=cortex-a53`. // For example, `-C target-cpu=cortex-a53`.
use super::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {

View file

@ -1,5 +1,4 @@
use super::nto_qnx_base; use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -24,7 +23,7 @@ pub fn target() -> Target {
&["-Vgcc_ntoaarch64le_cxx"], &["-Vgcc_ntoaarch64le_cxx"],
), ),
env: "nto71".into(), env: "nto71".into(),
..nto_qnx_base::opts() ..base::nto_qnx::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -9,7 +9,7 @@ pub fn target() -> Target {
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(), features: "+v8a".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
..super::openbsd_base::opts() ..base::openbsd::opts()
}, },
} }
} }

View file

@ -1,7 +1,7 @@
use crate::spec::Target; use crate::spec::{base, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::redox_base::opts(); let mut base = base::redox::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a".into(); base.features = "+v8a".into();

View file

@ -1,7 +1,7 @@
use crate::spec::Target; use crate::spec::{base, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::teeos_base::opts(); let mut base = base::teeos::opts();
base.features = "+strict-align,+neon,+fp-armv8".into(); base.features = "+strict-align,+neon,+fp-armv8".into();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.linker = Some("aarch64-linux-gnu-ld".into()); base.linker = Some("aarch64-linux-gnu-ld".into());

View file

@ -1,11 +1,10 @@
// This defines the aarch64 target for UEFI systems as described in the UEFI specification. See the // This defines the aarch64 target for UEFI systems as described in the UEFI specification. See the
// uefi-base module for generic UEFI options. // uefi-base module for generic UEFI options.
use super::uefi_msvc_base; use crate::spec::{base, LinkerFlavor, Lld, Target};
use crate::spec::{LinkerFlavor, Lld, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = uefi_msvc_base::opts(); let mut base = base::uefi_msvc::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]); base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);

View file

@ -1,7 +1,7 @@
use crate::spec::Target; use crate::spec::{base, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = base::windows_uwp_msvc::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a".into(); base.features = "+v8a".into();

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -9,7 +9,7 @@ pub fn target() -> Target {
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(), features: "+v8a".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
..super::vxworks_base::opts() ..base::vxworks::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use super::apple_base::{opts, Arch}; use crate::spec::base::apple::{opts, Arch};
use crate::spec::{Target, TargetOptions}; use crate::spec::{Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions}; use crate::spec::{base, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -12,7 +12,7 @@ pub fn target() -> Target {
features: "+strict-align,+v5te".into(), features: "+strict-align,+v5te".into(),
supported_sanitizers: SanitizerSet::ADDRESS, supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(32), max_atomic_width: Some(32),
..super::android_base::opts() ..base::android::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -12,7 +12,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -12,7 +12,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -16,7 +16,7 @@ pub fn target() -> Target {
features: "+strict-align,+v6".into(), features: "+strict-align,+v6".into(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(), mcount: "\u{1}mcount".into(),
..super::linux_musl_base::opts() ..base::linux_musl::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -16,7 +16,7 @@ pub fn target() -> Target {
features: "+strict-align,+v6,+vfp2,-d32".into(), features: "+strict-align,+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(), mcount: "\u{1}mcount".into(),
..super::linux_musl_base::opts() ..base::linux_musl::opts()
}, },
} }
} }

View file

@ -1,5 +1,5 @@
use crate::abi::Endian; use crate::abi::Endian;
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -14,7 +14,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -14,7 +14,7 @@ pub fn target() -> Target {
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
has_thumb_interworking: true, has_thumb_interworking: true,
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,6 +1,6 @@
//! Targets the ARMv5TE, with code as `a32` code by default. //! Targets the ARMv5TE, with code as `a32` code by default.
use crate::spec::{cvs, FramePointer, Target, TargetOptions}; use crate::spec::{base, cvs, FramePointer, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -35,7 +35,7 @@ pub fn target() -> Target {
atomic_cas: false, atomic_cas: false,
has_thumb_interworking: true, has_thumb_interworking: true,
..super::thumb_base::opts() ..base::thumb::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32), max_atomic_width: Some(32),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
has_thumb_interworking: true, has_thumb_interworking: true,
..super::linux_gnu_base::opts() ..base::linux_gnu::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -17,7 +17,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32), max_atomic_width: Some(32),
mcount: "\u{1}mcount".into(), mcount: "\u{1}mcount".into(),
has_thumb_interworking: true, has_thumb_interworking: true,
..super::linux_musl_base::opts() ..base::linux_musl::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32), max_atomic_width: Some(32),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
has_thumb_interworking: true, has_thumb_interworking: true,
..super::linux_uclibc_base::opts() ..base::linux_uclibc::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -14,7 +14,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(), mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()), llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
..super::freebsd_base::opts() ..base::freebsd::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
Target { Target {
@ -13,7 +13,7 @@ pub fn target() -> Target {
features: "+v6,+vfp2,-d32".into(), features: "+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
mcount: "__mcount".into(), mcount: "__mcount".into(),
..super::netbsd_base::opts() ..base::netbsd::opts()
}, },
} }
} }

View file

@ -1,4 +1,4 @@
use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
// This target if is for the baseline of the Android v7a ABI // This target if is for the baseline of the Android v7a ABI
// in thumb mode. It's named armv7-* instead of thumbv7-* // in thumb mode. It's named armv7-* instead of thumbv7-*
@ -9,7 +9,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
// for target ABI requirements. // for target ABI requirements.
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::android_base::opts(); let mut base = base::android::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]);
Target { Target {
llvm_target: "armv7-none-linux-android".into(), llvm_target: "armv7-none-linux-android".into(),

Some files were not shown because too many files have changed in this diff Show more