summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_target/src/spec
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_target/src/spec')
-rw-r--r--compiler/rustc_target/src/spec/aarch64_apple_darwin.rs2
-rw-r--r--compiler/rustc_target/src/spec/aarch64_fuchsia.rs16
-rw-r--r--compiler/rustc_target/src/spec/aarch64_unknown_fuchsia.rs17
-rw-r--r--compiler/rustc_target/src/spec/aarch64_unknown_none.rs5
-rw-r--r--compiler/rustc_target/src/spec/abi.rs6
-rw-r--r--compiler/rustc_target/src/spec/apple_base.rs14
-rw-r--r--compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs40
-rw-r--r--compiler/rustc_target/src/spec/bpf_base.rs6
-rw-r--r--compiler/rustc_target/src/spec/i686_apple_darwin.rs2
-rw-r--r--compiler/rustc_target/src/spec/illumos_base.rs12
-rw-r--r--compiler/rustc_target/src/spec/mod.rs34
-rw-r--r--compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs7
-rw-r--r--compiler/rustc_target/src/spec/solid_base.rs2
-rw-r--r--compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs2
-rw-r--r--compiler/rustc_target/src/spec/x86_64_apple_darwin.rs2
-rw-r--r--compiler/rustc_target/src/spec/x86_64_fuchsia.rs19
-rw-r--r--compiler/rustc_target/src/spec/x86_64_unknown_fuchsia.rs18
-rw-r--r--compiler/rustc_target/src/spec/x86_64_unknown_none.rs3
18 files changed, 129 insertions, 78 deletions
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
index e72cab629..b69ade7e4 100644
--- a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs
@@ -12,7 +12,7 @@ pub fn target() -> Target {
Target {
// Clang automatically chooses a more specific target based on
- // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
+ // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
// correctly, we do too.
llvm_target: macos_llvm_target(arch).into(),
pointer_width: 64,
diff --git a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs
index 4634433c4..ddecbb1a8 100644
--- a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs
@@ -1,15 +1 @@
-use crate::spec::{SanitizerSet, Target, TargetOptions};
-
-pub fn target() -> Target {
- Target {
- llvm_target: "aarch64-fuchsia".into(),
- pointer_width: 64,
- data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
- arch: "aarch64".into(),
- options: TargetOptions {
- max_atomic_width: Some(128),
- supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI,
- ..super::fuchsia_base::opts()
- },
- }
-}
+pub use crate::spec::aarch64_unknown_fuchsia::target;
diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/aarch64_unknown_fuchsia.rs
new file mode 100644
index 000000000..ef2ab304f
--- /dev/null
+++ b/compiler/rustc_target/src/spec/aarch64_unknown_fuchsia.rs
@@ -0,0 +1,17 @@
+use crate::spec::{SanitizerSet, Target, TargetOptions};
+
+pub fn target() -> Target {
+ Target {
+ llvm_target: "aarch64-unknown-fuchsia".into(),
+ pointer_width: 64,
+ data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
+ arch: "aarch64".into(),
+ options: TargetOptions {
+ max_atomic_width: Some(128),
+ supported_sanitizers: SanitizerSet::ADDRESS
+ | SanitizerSet::CFI
+ | SanitizerSet::SHADOWCALLSTACK,
+ ..super::fuchsia_base::opts()
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs
index 4ae6d4120..aca52e147 100644
--- a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs
@@ -6,13 +6,16 @@
//
// For example, `-C target-cpu=cortex-a53`.
-use super::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
+use super::{
+ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions,
+};
pub fn target() -> Target {
let opts = TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
features: "+strict-align,+neon,+fp-armv8".into(),
+ supported_sanitizers: SanitizerSet::KCFI,
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(128),
diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs
index cb2a0c04c..d4f7ed31b 100644
--- a/compiler/rustc_target/src/spec/abi.rs
+++ b/compiler/rustc_target/src/spec/abi.rs
@@ -149,7 +149,7 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
match name {
// Stable
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
- | "system" => Ok(()),
+ | "system" | "efiapi" => Ok(()),
"rust-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::intrinsics,
explain: "intrinsics are subject to change",
@@ -198,10 +198,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
feature: sym::abi_avr_interrupt,
explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
}),
- "efiapi" => Err(AbiDisabled::Unstable {
- feature: sym::abi_efiapi,
- explain: "efiapi ABI is experimental and subject to change",
- }),
"C-cmse-nonsecure-call" => Err(AbiDisabled::Unstable {
feature: sym::abi_c_cmse_nonsecure_call,
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs
index 7f8160b5d..5c6dcc0ab 100644
--- a/compiler/rustc_target/src/spec/apple_base.rs
+++ b/compiler/rustc_target/src/spec/apple_base.rs
@@ -76,12 +76,12 @@ impl Arch {
fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
let platform_name: StaticCow<str> = match abi {
- "sim" => format!("{}-simulator", os).into(),
+ "sim" => format!("{os}-simulator").into(),
"macabi" => "mac-catalyst".into(),
_ => os.into(),
};
- let platform_version: StaticCow<str> = match os.as_ref() {
+ let platform_version: StaticCow<str> = match os {
"ios" => ios_lld_platform_version(),
"tvos" => tvos_lld_platform_version(),
"watchos" => watchos_lld_platform_version(),
@@ -193,7 +193,7 @@ fn macos_deployment_target(arch: Arch) -> (u32, u32) {
fn macos_lld_platform_version(arch: Arch) -> String {
let (major, minor) = macos_deployment_target(arch);
- format!("{}.{}", major, minor)
+ format!("{major}.{minor}")
}
pub fn macos_llvm_target(arch: Arch) -> String {
@@ -204,7 +204,7 @@ pub fn macos_llvm_target(arch: Arch) -> String {
fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]> {
// Apple platforms only officially support macOS as a host for any compilation.
//
- // If building for macOS, we go ahead and remove any erronous environment state
+ // If building for macOS, we go ahead and remove any erroneous environment state
// that's only applicable to cross-OS compilation. Always leave anything for the
// host OS alone though.
if os == "macos" {
@@ -252,7 +252,7 @@ pub fn ios_llvm_target(arch: Arch) -> String {
fn ios_lld_platform_version() -> String {
let (major, minor) = ios_deployment_target();
- format!("{}.{}", major, minor)
+ format!("{major}.{minor}")
}
pub fn ios_sim_llvm_target(arch: Arch) -> String {
@@ -266,7 +266,7 @@ fn tvos_deployment_target() -> (u32, u32) {
fn tvos_lld_platform_version() -> String {
let (major, minor) = tvos_deployment_target();
- format!("{}.{}", major, minor)
+ format!("{major}.{minor}")
}
fn watchos_deployment_target() -> (u32, u32) {
@@ -275,7 +275,7 @@ fn watchos_deployment_target() -> (u32, u32) {
fn watchos_lld_platform_version() -> String {
let (major, minor) = watchos_deployment_target();
- format!("{}.{}", major, minor)
+ format!("{major}.{minor}")
}
pub fn watchos_sim_llvm_target(arch: Arch) -> String {
diff --git a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs
new file mode 100644
index 000000000..ebd2cca25
--- /dev/null
+++ b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs
@@ -0,0 +1,40 @@
+use crate::abi::Endian;
+use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
+
+/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).
+///
+/// Requires the VITASDK toolchain on the host system.
+
+pub fn target() -> Target {
+ let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q"]);
+
+ Target {
+ llvm_target: "armv7a-vita-newlibeabihf".into(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
+ arch: "arm".into(),
+
+ options: TargetOptions {
+ os: "vita".into(),
+ endian: Endian::Little,
+ c_int_width: "32".into(),
+ dynamic_linking: false,
+ env: "newlib".into(),
+ vendor: "sony".into(),
+ abi: "eabihf".into(),
+ linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
+ no_default_libraries: false,
+ cpu: "cortex-a9".into(),
+ executables: true,
+ families: cvs!["unix"],
+ linker: Some("arm-vita-eabi-gcc".into()),
+ relocation_model: RelocModel::Static,
+ features: "+v7,+neon".into(),
+ pre_link_args,
+ exe_suffix: ".elf".into(),
+ panic_strategy: PanicStrategy::Abort,
+ max_atomic_width: Some(32),
+ ..Default::default()
+ },
+ }
+}
diff --git a/compiler/rustc_target/src/spec/bpf_base.rs b/compiler/rustc_target/src/spec/bpf_base.rs
index baf365871..2b00cda44 100644
--- a/compiler/rustc_target/src/spec/bpf_base.rs
+++ b/compiler/rustc_target/src/spec/bpf_base.rs
@@ -6,7 +6,7 @@ pub fn opts(endian: Endian) -> TargetOptions {
allow_asm: true,
endian,
linker_flavor: LinkerFlavor::Bpf,
- atomic_cas: false,
+ atomic_cas: true,
dynamic_linking: true,
no_builtins: true,
panic_strategy: PanicStrategy::Abort,
@@ -19,6 +19,10 @@ pub fn opts(endian: Endian) -> TargetOptions {
obj_is_bitcode: true,
requires_lto: false,
singlethread: true,
+ // When targeting the `v3` cpu in llvm, 32-bit atomics are also supported.
+ // But making this value change based on the target cpu can be mostly confusing
+ // and would require a bit of a refactor.
+ min_atomic_width: Some(64),
max_atomic_width: Some(64),
..Default::default()
}
diff --git a/compiler/rustc_target/src/spec/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/i686_apple_darwin.rs
index ad22467ba..b5103d15d 100644
--- a/compiler/rustc_target/src/spec/i686_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/i686_apple_darwin.rs
@@ -12,7 +12,7 @@ pub fn target() -> Target {
Target {
// Clang automatically chooses a more specific target based on
- // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
+ // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
// correctly, we do too.
//
// While ld64 doesn't understand i686, LLVM does.
diff --git a/compiler/rustc_target/src/spec/illumos_base.rs b/compiler/rustc_target/src/spec/illumos_base.rs
index 8ac351584..e63e78975 100644
--- a/compiler/rustc_target/src/spec/illumos_base.rs
+++ b/compiler/rustc_target/src/spec/illumos_base.rs
@@ -5,8 +5,8 @@ pub fn opts() -> TargetOptions {
LinkerFlavor::Unix(Cc::Yes),
&[
// The illumos libc contains a stack unwinding implementation, as
- // does libgcc_s. The latter implementation includes several
- // additional symbols that are not always in base libc. To force
+ // does libgcc_s. The latter implementation includes several
+ // additional symbols that are not always in base libc. To force
// the consistent use of just one unwinder, we ensure libc appears
// after libgcc_s in the NEEDED list for the resultant binary by
// ignoring any attempts to add it as a dynamic dependency until the
@@ -17,7 +17,7 @@ pub fn opts() -> TargetOptions {
"-lc",
// LLVM will insert calls to the stack protector functions
// "__stack_chk_fail" and "__stack_chk_guard" into code in native
- // object files. Some platforms include these symbols directly in
+ // object files. Some platforms include these symbols directly in
// libc, but at least historically these have been provided in
// libssp.so on illumos and Solaris systems.
"-lssp",
@@ -40,16 +40,16 @@ pub fn opts() -> TargetOptions {
// cleanup handlers (in C, this would be something along the lines of:
// void register_callback(void (*fn)(void *), void *arg);
// (see src/libstd/sys/unix/fast_thread_local.rs) that is currently
- // missing in illumos. For now at least, we must fallback to using
+ // missing in illumos. For now at least, we must fallback to using
// pthread_{get,set}specific.
//has_thread_local: true,
// FIXME: Currently, rust is invoking cc to link, which ends up
- // causing these to get included twice. We should eventually transition
+ // causing these to get included twice. We should eventually transition
// to having rustc invoke ld directly, in which case these will need to
// be uncommented.
//
- // We want XPG6 behavior from libc and libm. See standards(5)
+ // We want XPG6 behavior from libc and libm. See standards(5)
//pre_link_objects_exe: vec![
// "/usr/lib/amd64/values-Xc.o".into(),
// "/usr/lib/amd64/values-xpg6.o".into(),
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index d05b8aa42..a094c2c54 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -45,9 +45,7 @@ use rustc_span::symbol::{sym, Symbol};
use serde_json::Value;
use std::borrow::Cow;
use std::collections::BTreeMap;
-use std::convert::TryFrom;
use std::hash::{Hash, Hasher};
-use std::iter::FromIterator;
use std::ops::{Deref, DerefMut};
use std::path::{Path, PathBuf};
use std::str::FromStr;
@@ -804,7 +802,7 @@ impl ToJson for StackProbeType {
bitflags::bitflags! {
#[derive(Default, Encodable, Decodable)]
- pub struct SanitizerSet: u8 {
+ pub struct SanitizerSet: u16 {
const ADDRESS = 1 << 0;
const LEAK = 1 << 1;
const MEMORY = 1 << 2;
@@ -813,6 +811,7 @@ bitflags::bitflags! {
const CFI = 1 << 5;
const MEMTAG = 1 << 6;
const SHADOWCALLSTACK = 1 << 7;
+ const KCFI = 1 << 8;
}
}
@@ -824,6 +823,7 @@ impl SanitizerSet {
Some(match self {
SanitizerSet::ADDRESS => "address",
SanitizerSet::CFI => "cfi",
+ SanitizerSet::KCFI => "kcfi",
SanitizerSet::LEAK => "leak",
SanitizerSet::MEMORY => "memory",
SanitizerSet::MEMTAG => "memtag",
@@ -840,7 +840,7 @@ impl fmt::Display for SanitizerSet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut first = true;
for s in *self {
- let name = s.as_str().unwrap_or_else(|| panic!("unrecognized sanitizer {:?}", s));
+ let name = s.as_str().unwrap_or_else(|| panic!("unrecognized sanitizer {s:?}"));
if !first {
f.write_str(", ")?;
}
@@ -859,6 +859,7 @@ impl IntoIterator for SanitizerSet {
[
SanitizerSet::ADDRESS,
SanitizerSet::CFI,
+ SanitizerSet::KCFI,
SanitizerSet::LEAK,
SanitizerSet::MEMORY,
SanitizerSet::MEMTAG,
@@ -980,7 +981,7 @@ impl fmt::Display for StackProtector {
}
macro_rules! supported_targets {
- ( $(($triple:literal, $module:ident ),)+ ) => {
+ ( $(($triple:literal, $module:ident),)+ ) => {
$(mod $module;)+
/// List of supported targets
@@ -1108,8 +1109,12 @@ supported_targets! {
("x86_64-apple-darwin", x86_64_apple_darwin),
("i686-apple-darwin", i686_apple_darwin),
+ // FIXME(#106649): Remove aarch64-fuchsia in favor of aarch64-unknown-fuchsia
("aarch64-fuchsia", aarch64_fuchsia),
+ ("aarch64-unknown-fuchsia", aarch64_unknown_fuchsia),
+ // FIXME(#106649): Remove x86_64-fuchsia in favor of x86_64-unknown-fuchsia
("x86_64-fuchsia", x86_64_fuchsia),
+ ("x86_64-unknown-fuchsia", x86_64_unknown_fuchsia),
("avr-unknown-gnu-atmega328", avr_unknown_gnu_atmega328),
@@ -1240,6 +1245,8 @@ supported_targets! {
("aarch64-nintendo-switch-freestanding", aarch64_nintendo_switch_freestanding),
+ ("armv7-sony-vita-newlibeabihf", armv7_sony_vita_newlibeabihf),
+
("armv7-unknown-linux-uclibceabi", armv7_unknown_linux_uclibceabi),
("armv7-unknown-linux-uclibceabihf", armv7_unknown_linux_uclibceabihf),
@@ -1318,7 +1325,7 @@ pub struct Target {
}
impl Target {
- pub fn parse_data_layout<'a>(&'a self) -> Result<TargetDataLayout, TargetDataLayoutErrors<'a>> {
+ pub fn parse_data_layout(&self) -> Result<TargetDataLayout, TargetDataLayoutErrors<'_>> {
let mut dl = TargetDataLayout::parse_from_llvm_datalayout_string(&self.data_layout)?;
// Perform consistency checks against the Target information.
@@ -2071,7 +2078,7 @@ impl Target {
let mut get_req_field = |name: &str| {
obj.remove(name)
.and_then(|j| j.as_str().map(str::to_string))
- .ok_or_else(|| format!("Field {} in target specification is required", name))
+ .ok_or_else(|| format!("Field {name} in target specification is required"))
};
let mut base = Target {
@@ -2290,7 +2297,7 @@ impl Target {
} else {
return Some(Err(format!(
"'{}' is not a valid value for lld-flavor. \
- Use 'darwin', 'gnu', 'link' or 'wasm.",
+ Use 'darwin', 'gnu', 'link' or 'wasm'.",
s)))
}
Some(Ok(()))
@@ -2327,6 +2334,7 @@ impl Target {
base.$key_name |= match s.as_str() {
Some("address") => SanitizerSet::ADDRESS,
Some("cfi") => SanitizerSet::CFI,
+ Some("kcfi") => SanitizerSet::KCFI,
Some("leak") => SanitizerSet::LEAK,
Some("memory") => SanitizerSet::MEMORY,
Some("memtag") => SanitizerSet::MEMTAG,
@@ -2476,7 +2484,7 @@ impl Target {
if let Some(s) = fp.as_str() {
base.frame_pointer = s
.parse()
- .map_err(|()| format!("'{}' is not a valid value for frame-pointer", s))?;
+ .map_err(|()| format!("'{s}' is not a valid value for frame-pointer"))?;
} else {
incorrect_type.push("frame-pointer".into())
}
@@ -2614,7 +2622,7 @@ impl Target {
/// Search for a JSON file specifying the given target triple.
///
/// If none is found in `$RUST_TARGET_PATH`, look for a file called `target.json` inside the
- /// sysroot under the target-triple's `rustlib` directory. Note that it could also just be a
+ /// sysroot under the target-triple's `rustlib` directory. Note that it could also just be a
/// bare filename already, so also check for that. If one of the hardcoded targets we know
/// about, just return it directly.
///
@@ -2668,7 +2676,7 @@ impl Target {
return load_file(&p);
}
- Err(format!("Could not find specification for target {:?}", target_triple))
+ Err(format!("Could not find specification for target {target_triple:?}"))
}
TargetTriple::TargetJson { ref contents, .. } => {
let obj = serde_json::from_str(contents).map_err(|e| e.to_string())?;
@@ -2932,7 +2940,7 @@ impl TargetTriple {
let contents = std::fs::read_to_string(&canonicalized_path).map_err(|err| {
io::Error::new(
io::ErrorKind::InvalidInput,
- format!("target path {:?} is not a valid file: {}", canonicalized_path, err),
+ format!("target path {canonicalized_path:?} is not a valid file: {err}"),
)
})?;
let triple = canonicalized_path
@@ -2967,7 +2975,7 @@ impl TargetTriple {
let mut hasher = DefaultHasher::new();
content.hash(&mut hasher);
let hash = hasher.finish();
- format!("{}-{}", triple, hash)
+ format!("{triple}-{hash}")
}
}
}
diff --git a/compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs b/compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs
index e3eb9bccd..34934379c 100644
--- a/compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs
+++ b/compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs
@@ -5,12 +5,7 @@ pub fn target() -> Target {
base.max_atomic_width = Some(64);
base.add_pre_link_args(
LinkerFlavor::Unix(Cc::No),
- &[
- "-b64".into(),
- "-bpT:0x100000000".into(),
- "-bpD:0x110000000".into(),
- "-bcdtors:all:0:s".into(),
- ],
+ &["-b64", "-bpT:0x100000000", "-bpD:0x110000000", "-bcdtors:all:0:s"],
);
Target {
diff --git a/compiler/rustc_target/src/spec/solid_base.rs b/compiler/rustc_target/src/spec/solid_base.rs
index c585a6cd5..eaf72b761 100644
--- a/compiler/rustc_target/src/spec/solid_base.rs
+++ b/compiler/rustc_target/src/spec/solid_base.rs
@@ -3,7 +3,7 @@ use crate::spec::TargetOptions;
pub fn opts(kernel: &str) -> TargetOptions {
TargetOptions {
- os: format!("solid_{}", kernel).into(),
+ os: format!("solid_{kernel}").into(),
vendor: "kmc".into(),
executables: false,
frame_pointer: FramePointer::NonLeaf,
diff --git a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
index 440194ef2..4d2bc98ab 100644
--- a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
+++ b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs
@@ -15,7 +15,7 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i64:64-n32:64-S128".into(),
// Use "sparc64" instead of "sparcv9" here, since the former is already
- // used widely in the source base. If we ever needed ABI
+ // used widely in the source base. If we ever needed ABI
// differentiation from the sparc64, we could, but that would probably
// just be confusing.
arch: "sparc64".into(),
diff --git a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
index 9a3e7a805..e90bda9c9 100644
--- a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
@@ -14,7 +14,7 @@ pub fn target() -> Target {
Target {
// Clang automatically chooses a more specific target based on
- // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
+ // MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
// correctly, we do too.
llvm_target: macos_llvm_target(arch).into(),
pointer_width: 64,
diff --git a/compiler/rustc_target/src/spec/x86_64_fuchsia.rs b/compiler/rustc_target/src/spec/x86_64_fuchsia.rs
index 532dd6d07..96fed0975 100644
--- a/compiler/rustc_target/src/spec/x86_64_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/x86_64_fuchsia.rs
@@ -1,18 +1 @@
-use crate::spec::{SanitizerSet, StackProbeType, Target};
-
-pub fn target() -> Target {
- let mut base = super::fuchsia_base::opts();
- base.cpu = "x86-64".into();
- base.max_atomic_width = Some(64);
- base.stack_probes = StackProbeType::X86;
- base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
-
- Target {
- llvm_target: "x86_64-fuchsia".into(),
- pointer_width: 64,
- data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
- .into(),
- arch: "x86_64".into(),
- options: base,
- }
-}
+pub use crate::spec::x86_64_unknown_fuchsia::target;
diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/x86_64_unknown_fuchsia.rs
new file mode 100644
index 000000000..a3231d19f
--- /dev/null
+++ b/compiler/rustc_target/src/spec/x86_64_unknown_fuchsia.rs
@@ -0,0 +1,18 @@
+use crate::spec::{SanitizerSet, StackProbeType, Target};
+
+pub fn target() -> Target {
+ let mut base = super::fuchsia_base::opts();
+ base.cpu = "x86-64".into();
+ base.max_atomic_width = Some(64);
+ base.stack_probes = StackProbeType::X86;
+ base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI;
+
+ Target {
+ llvm_target: "x86_64-unknown-fuchsia".into(),
+ pointer_width: 64,
+ data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+ .into(),
+ arch: "x86_64".into(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs
index e4d33c2b8..32060c35c 100644
--- a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs
@@ -5,7 +5,7 @@
// features.
use super::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy};
-use super::{RelroLevel, StackProbeType, Target, TargetOptions};
+use super::{RelroLevel, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let opts = TargetOptions {
@@ -20,6 +20,7 @@ pub fn target() -> Target {
features:
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
.into(),
+ supported_sanitizers: SanitizerSet::KCFI,
disable_redzone: true,
panic_strategy: PanicStrategy::Abort,
code_model: Some(CodeModel::Kernel),