Skip to content

Rollup of 5 pull requests #117716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
targets: move target specs to spec/targets
Signed-off-by: David Wood <david@davidtw.co>
  • Loading branch information
davidtwco committed Nov 8, 2023
commit 1af256fe8aea69909e1bf068506a29ebbf82eccf
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_fuchsia.rs

This file was deleted.

2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/base/apple/tests.rs
Original file line number Diff line number Diff line change
@@ -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,
x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim,
};
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,14 +1408,16 @@ impl fmt::Display for StackProtector {

macro_rules! supported_targets {
( $(($triple:literal, $module:ident),)+ ) => {
$(mod $module;)+
mod targets {
$(pub(crate) mod $module;)+
}

/// List of supported targets
pub const TARGETS: &[&str] = &[$($triple),+];

fn load_builtin(target: &str) -> Option<Target> {
let mut t = match target {
$( $triple => $module::target(), )+
$( $triple => targets::$module::target(), )+
_ => return None,
};
t.is_builtin = true;
Expand All @@ -1431,7 +1433,7 @@ macro_rules! supported_targets {
$(
#[test] // `#[test]`
fn $module() {
tests_impl::test_target(super::$module::target());
tests_impl::test_target(crate::spec::targets::$module::target());
}
)+
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use crate::spec::targets::aarch64_unknown_fuchsia::target;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions};
use crate::spec::{base, RelocModel, Target, TargetOptions};

pub fn target() -> Target {
let base = base::solid::opts("asp3");
Expand Down
Original file line number Diff line number Diff line change
@@ -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");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::spec::SanitizerSet;
use crate::spec::{base, Target, TargetOptions};

use super::SanitizerSet;

pub fn target() -> Target {
let mut base = base::linux_ohos::opts();
base.max_atomic_width = Some(128);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// For example, `-C target-cpu=cortex-a53`.

use super::{
use crate::spec::{
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// 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 {
let opts = TargetOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions};
use crate::spec::{base, RelocModel, Target, TargetOptions};

pub fn target() -> Target {
let base = base::solid::opts("asp3");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{base, RelocModel, Target, TargetOptions};
use crate::spec::{base, RelocModel, Target, TargetOptions};

pub fn target() -> Target {
let base = base::solid::opts("asp3");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
// 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 {
let opts = TargetOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal
// `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 {
let opts = TargetOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{wasm32_unknown_emscripten, LinkerFlavor, Target};
use crate::spec::{targets::wasm32_unknown_emscripten, LinkerFlavor, Target};

pub fn target() -> Target {
let mut target = wasm32_unknown_emscripten::target();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel};
use super::{Target, TargetOptions};
use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel};
use super::{Target, TargetOptions};
use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::spec::SanitizerSet;
use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy};
use crate::spec::{RelocModel, Target, TargetOptions};

use super::SanitizerSet;

pub fn target() -> Target {
Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;

use super::{cvs, Cc, LinkerFlavor, Lld, Target, TargetOptions};
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, Target, TargetOptions};

pub fn target() -> Target {
let pre_link_args = TargetOptions::link_args(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use crate::spec::targets::x86_64_unknown_fuchsia::target;
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// `target-cpu` compiler flags to opt-in more hardware-specific
// features.

use super::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy};
use super::{RelroLevel, SanitizerSet, StackProbeType, Target, TargetOptions};
use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy};
use crate::spec::{RelroLevel, SanitizerSet, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
let opts = TargetOptions {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/x86_64_fuchsia.rs

This file was deleted.