targets: move target specs to spec/targets

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2023-11-08 14:25:34 +08:00
parent 76aa83e3e1
commit 1af256fe8a
No known key found for this signature in database
231 changed files with 26 additions and 26 deletions

View File

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

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

@ -1408,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;
@ -1431,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

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

View File

@ -1,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions}; use crate::spec::{base, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = base::solid::opts("asp3"); let base = base::solid::opts("asp3");

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,6 @@
use crate::spec::SanitizerSet;
use crate::spec::{base, Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};
use super::SanitizerSet;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = base::linux_ohos::opts(); let mut base = base::linux_ohos::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);

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,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions}; use crate::spec::{base, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = base::solid::opts("asp3"); let base = base::solid::opts("asp3");

View File

@ -1,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions}; use crate::spec::{base, RelocModel, Target, TargetOptions};
pub fn target() -> Target { pub fn target() -> Target {
let base = base::solid::opts("asp3"); let base = base::solid::opts("asp3");

View File

@ -14,7 +14,7 @@
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic // - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
// linking. rationale: matches `thumb` targets // linking. rationale: matches `thumb` targets
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

@ -5,7 +5,7 @@
// changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal // changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal
// `thumb` & `aarch64` targets. // `thumb` & `aarch64` targets.
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,4 +1,4 @@
use super::{wasm32_unknown_emscripten, LinkerFlavor, Target}; use crate::spec::{targets::wasm32_unknown_emscripten, LinkerFlavor, Target};
pub fn target() -> Target { pub fn target() -> Target {
let mut target = wasm32_unknown_emscripten::target(); let mut target = wasm32_unknown_emscripten::target();

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