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_ios_macabi.rs3
-rw-r--r--compiler/rustc_target/src/spec/abi.rs46
-rw-r--r--compiler/rustc_target/src/spec/apple_base.rs99
-rw-r--r--compiler/rustc_target/src/spec/armv7_apple_ios.rs21
-rw-r--r--compiler/rustc_target/src/spec/armv7s_apple_ios.rs4
-rw-r--r--compiler/rustc_target/src/spec/hurd_base.rs15
-rw-r--r--compiler/rustc_target/src/spec/hurd_gnu_base.rs5
-rw-r--r--compiler/rustc_target/src/spec/i686_pc_windows_gnullvm.rs26
-rw-r--r--compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs19
-rw-r--r--compiler/rustc_target/src/spec/mod.rs15
-rw-r--r--compiler/rustc_target/src/spec/riscv64_linux_android.rs2
-rw-r--r--compiler/rustc_target/src/spec/uefi_msvc_base.rs1
-rw-r--r--compiler/rustc_target/src/spec/x86_64_apple_darwin.rs2
-rw-r--r--compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs3
-rw-r--r--compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs3
15 files changed, 187 insertions, 77 deletions
diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
index e2df7e0bd..b29ab14e7 100644
--- a/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_macabi.rs
@@ -1,5 +1,5 @@
use super::apple_base::{opts, Arch};
-use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions};
+use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
pub fn target() -> Target {
let llvm_target = "arm64-apple-ios14.0-macabi";
@@ -7,6 +7,7 @@ pub fn target() -> Target {
let arch = Arch::Arm64_macabi;
let mut base = opts("ios", arch);
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-target", llvm_target]);
+ base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
Target {
llvm_target: llvm_target.into(),
diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs
index 550cdf6bd..a99cccd42 100644
--- a/compiler/rustc_target/src/spec/abi.rs
+++ b/compiler/rustc_target/src/spec/abi.rs
@@ -14,15 +14,33 @@ pub enum Abi {
// hashing tests. These are used in many places, so giving them stable values reduces test
// churn. The specific values are meaningless.
Rust,
- C { unwind: bool },
- Cdecl { unwind: bool },
- Stdcall { unwind: bool },
- Fastcall { unwind: bool },
- Vectorcall { unwind: bool },
- Thiscall { unwind: bool },
- Aapcs { unwind: bool },
- Win64 { unwind: bool },
- SysV64 { unwind: bool },
+ C {
+ unwind: bool,
+ },
+ Cdecl {
+ unwind: bool,
+ },
+ Stdcall {
+ unwind: bool,
+ },
+ Fastcall {
+ unwind: bool,
+ },
+ Vectorcall {
+ unwind: bool,
+ },
+ Thiscall {
+ unwind: bool,
+ },
+ Aapcs {
+ unwind: bool,
+ },
+ Win64 {
+ unwind: bool,
+ },
+ SysV64 {
+ unwind: bool,
+ },
PtxKernel,
Msp430Interrupt,
X86Interrupt,
@@ -32,11 +50,16 @@ pub enum Abi {
AvrNonBlockingInterrupt,
CCmseNonSecureCall,
Wasm,
- System { unwind: bool },
+ System {
+ unwind: bool,
+ },
RustIntrinsic,
RustCall,
PlatformIntrinsic,
Unadjusted,
+ /// For things unlikely to be called, where reducing register pressure in
+ /// `extern "Rust"` callers is worth paying extra cost in the callee.
+ /// Stronger than just `#[cold]` because `fn` pointers might be incompatible.
RustCold,
RiscvInterruptM,
RiscvInterruptS,
@@ -45,7 +68,7 @@ pub enum Abi {
impl Abi {
pub fn supports_varargs(self) -> bool {
// * C and Cdecl obviously support varargs.
- // * C can be based on SysV64 or Win64, so they must support varargs.
+ // * C can be based on Aapcs, SysV64 or Win64, so they must support varargs.
// * EfiApi is based on Win64 or C, so it also supports it.
//
// * Stdcall does not, because it would be impossible for the callee to clean
@@ -56,6 +79,7 @@ impl Abi {
match self {
Self::C { .. }
| Self::Cdecl { .. }
+ | Self::Aapcs { .. }
| Self::Win64 { .. }
| Self::SysV64 { .. }
| Self::EfiApi => true,
diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs
index 8a8d1ab95..7a666eea4 100644
--- a/compiler/rustc_target/src/spec/apple_base.rs
+++ b/compiler/rustc_target/src/spec/apple_base.rs
@@ -11,7 +11,6 @@ use Arch::*;
#[allow(non_camel_case_types)]
#[derive(Copy, Clone)]
pub enum Arch {
- Armv7,
Armv7k,
Armv7s,
Arm64,
@@ -29,7 +28,6 @@ pub enum Arch {
impl Arch {
pub fn target_name(self) -> &'static str {
match self {
- Armv7 => "armv7",
Armv7k => "armv7k",
Armv7s => "armv7s",
Arm64 | Arm64_macabi | Arm64_sim => "arm64",
@@ -43,7 +41,7 @@ impl Arch {
pub fn target_arch(self) -> Cow<'static, str> {
Cow::Borrowed(match self {
- Armv7 | Armv7k | Armv7s => "arm",
+ Armv7k | Armv7s => "arm",
Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64",
I386 | I686 => "x86",
X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64",
@@ -52,7 +50,7 @@ impl Arch {
fn target_abi(self) -> &'static str {
match self {
- Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
+ Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
X86_64_macabi | Arm64_macabi => "macabi",
// x86_64-apple-ios is a simulator target, even though it isn't
// declared that way in the target like the other ones...
@@ -62,18 +60,20 @@ impl Arch {
fn target_cpu(self) -> &'static str {
match self {
- Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher
Armv7k => "cortex-a8",
- Armv7s => "cortex-a9",
+ Armv7s => "swift", // iOS 10 is only supported on iPhone 5 or higher.
Arm64 => "apple-a7",
Arm64_32 => "apple-s4",
- I386 | I686 => "yonah",
- X86_64 | X86_64_sim => "core2",
+ // Only macOS 10.12+ is supported, which means
+ // all x86_64/x86 CPUs must be running at least penryn
+ // https://github.com/llvm/llvm-project/blob/01f924d0e37a5deae51df0d77e10a15b63aa0c0f/clang/lib/Driver/ToolChains/Arch/X86.cpp#L79-L82
+ I386 | I686 => "penryn",
+ X86_64 | X86_64_sim => "penryn",
+ X86_64_macabi => "penryn",
// Note: `core-avx2` is slightly more advanced than `x86_64h`, see
// comments (and disabled features) in `x86_64h_apple_darwin` for
- // details.
+ // details. It is a higher baseline then `penryn` however.
X86_64h => "core-avx2",
- X86_64_macabi => "core2",
Arm64_macabi => "apple-a12",
Arm64_sim => "apple-a12",
}
@@ -115,21 +115,6 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
}
pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
- // Static TLS is only available in macOS 10.7+. If you try to compile for 10.6
- // either the linker will complain if it is used or the binary will end up
- // segfaulting at runtime when run on 10.6. Rust by default supports macOS
- // 10.7+, but there is a standard environment variable,
- // MACOSX_DEPLOYMENT_TARGET, which is used to signal targeting older
- // versions of macOS. For example compiling on 10.10 with
- // MACOSX_DEPLOYMENT_TARGET set to 10.6 will cause the linker to generate
- // warnings about the usage of static TLS.
- //
- // Here we detect what version is being requested, defaulting to 10.7. Static
- // TLS is flagged as enabled if it looks to be supported. The architecture
- // only matters for default deployment target which is 11.0 for ARM64 and
- // 10.7 for everything else.
- let has_thread_local = os == "macos" && macos_deployment_target(Arch::X86_64) >= (10, 7);
-
let abi = arch.target_abi();
TargetOptions {
@@ -145,12 +130,17 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
pre_link_args: pre_link_args(os, arch, abi),
families: cvs!["unix"],
is_like_osx: true,
- default_dwarf_version: 2,
+ // LLVM notes that macOS 10.11+ and iOS 9+ default
+ // to v4, so we do the same.
+ // https://github.com/llvm/llvm-project/blob/378778a0d10c2f8d5df8ceff81f95b6002984a4b/clang/lib/Driver/ToolChains/Darwin.cpp#L1203
+ default_dwarf_version: 4,
frame_pointer: FramePointer::Always,
has_rpath: true,
dll_suffix: ".dylib".into(),
archive_format: "darwin".into(),
- has_thread_local,
+ // Thread locals became available with iOS 8 and macOS 10.7,
+ // and both are far below our minimum.
+ has_thread_local: true,
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
eh_frame_header: false,
@@ -179,20 +169,52 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
}
}
-pub fn deployment_target(target: &Target) -> Option<String> {
+pub fn sdk_version(platform: u32) -> Option<(u32, u32)> {
+ // NOTE: These values are from an arbitrary point in time but shouldn't make it into the final
+ // binary since the final link command will have the current SDK version passed to it.
+ match platform {
+ object::macho::PLATFORM_MACOS => Some((13, 1)),
+ object::macho::PLATFORM_IOS
+ | object::macho::PLATFORM_IOSSIMULATOR
+ | object::macho::PLATFORM_TVOS
+ | object::macho::PLATFORM_TVOSSIMULATOR
+ | object::macho::PLATFORM_MACCATALYST => Some((16, 2)),
+ object::macho::PLATFORM_WATCHOS | object::macho::PLATFORM_WATCHOSSIMULATOR => Some((9, 1)),
+ _ => None,
+ }
+}
+
+pub fn platform(target: &Target) -> Option<u32> {
+ Some(match (&*target.os, &*target.abi) {
+ ("macos", _) => object::macho::PLATFORM_MACOS,
+ ("ios", "macabi") => object::macho::PLATFORM_MACCATALYST,
+ ("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR,
+ ("ios", _) => object::macho::PLATFORM_IOS,
+ ("watchos", "sim") => object::macho::PLATFORM_WATCHOSSIMULATOR,
+ ("watchos", _) => object::macho::PLATFORM_WATCHOS,
+ ("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
+ ("tvos", _) => object::macho::PLATFORM_TVOS,
+ _ => return None,
+ })
+}
+
+pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
let (major, minor) = match &*target.os {
"macos" => {
// This does not need to be specific. It just needs to handle x86 vs M1.
let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 };
macos_deployment_target(arch)
}
- "ios" => ios_deployment_target(),
+ "ios" => match &*target.abi {
+ "macabi" => mac_catalyst_deployment_target(),
+ _ => ios_deployment_target(),
+ },
"watchos" => watchos_deployment_target(),
"tvos" => tvos_deployment_target(),
_ => return None,
};
- Some(format!("{major}.{minor}"))
+ Some((major, minor))
}
fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
@@ -207,9 +229,7 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
match arch {
// Note: Arm64_sim is not included since macOS has no simulator.
Arm64 | Arm64_macabi => (11, 0),
- // x86_64h-apple-darwin only supports macOS 10.8 and later
- X86_64h => (10, 8),
- _ => (10, 7),
+ _ => (10, 12),
}
}
@@ -260,8 +280,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
// Otherwise if cross-compiling for a different OS/SDK, remove any part
// of the linking environment that's wrong and reversed.
match arch {
- Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
- | X86_64h | Arm64_sim => {
+ Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim | X86_64h
+ | Arm64_sim => {
cvs!["MACOSX_DEPLOYMENT_TARGET"]
}
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
@@ -271,7 +291,12 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
fn ios_deployment_target() -> (u32, u32) {
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
- from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
+ from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
+}
+
+fn mac_catalyst_deployment_target() -> (u32, u32) {
+ // If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
+ from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((14, 0))
}
pub fn ios_llvm_target(arch: Arch) -> String {
@@ -297,7 +322,7 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
fn tvos_deployment_target() -> (u32, u32) {
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
- from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
+ from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
}
fn tvos_lld_platform_version() -> String {
diff --git a/compiler/rustc_target/src/spec/armv7_apple_ios.rs b/compiler/rustc_target/src/spec/armv7_apple_ios.rs
deleted file mode 100644
index 3259c8547..000000000
--- a/compiler/rustc_target/src/spec/armv7_apple_ios.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use super::apple_base::{ios_llvm_target, opts, Arch};
-use crate::spec::{Target, TargetOptions};
-
-pub fn target() -> Target {
- let arch = Arch::Armv7;
- Target {
- // Clang automatically chooses a more specific target based on
- // IPHONEOS_DEPLOYMENT_TARGET.
- // This is required for the target to pick the right
- // MACH-O commands, so we do too.
- llvm_target: ios_llvm_target(arch).into(),
- pointer_width: 32,
- data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".into(),
- arch: arch.target_arch(),
- options: TargetOptions {
- features: "+v7,+vfp3,+neon".into(),
- max_atomic_width: Some(64),
- ..opts("ios", arch)
- },
- }
-}
diff --git a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs
index be4bc6758..be7f8542c 100644
--- a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs
@@ -1,10 +1,10 @@
-use super::apple_base::{opts, Arch};
+use super::apple_base::{ios_llvm_target, opts, Arch};
use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::Armv7s;
Target {
- llvm_target: "armv7s-apple-ios".into(),
+ llvm_target: ios_llvm_target(arch).into(),
pointer_width: 32,
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".into(),
arch: arch.target_arch(),
diff --git a/compiler/rustc_target/src/spec/hurd_base.rs b/compiler/rustc_target/src/spec/hurd_base.rs
new file mode 100644
index 000000000..76f8223c0
--- /dev/null
+++ b/compiler/rustc_target/src/spec/hurd_base.rs
@@ -0,0 +1,15 @@
+use crate::spec::{cvs, RelroLevel, TargetOptions};
+
+pub fn opts() -> TargetOptions {
+ TargetOptions {
+ os: "hurd".into(),
+ dynamic_linking: true,
+ families: cvs!["unix"],
+ has_rpath: true,
+ position_independent_executables: true,
+ relro_level: RelroLevel::Full,
+ has_thread_local: true,
+ crt_static_respected: true,
+ ..Default::default()
+ }
+}
diff --git a/compiler/rustc_target/src/spec/hurd_gnu_base.rs b/compiler/rustc_target/src/spec/hurd_gnu_base.rs
new file mode 100644
index 000000000..b9cf26d93
--- /dev/null
+++ b/compiler/rustc_target/src/spec/hurd_gnu_base.rs
@@ -0,0 +1,5 @@
+use crate::spec::TargetOptions;
+
+pub fn opts() -> TargetOptions {
+ TargetOptions { env: "gnu".into(), ..super::hurd_base::opts() }
+}
diff --git a/compiler/rustc_target/src/spec/i686_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/i686_pc_windows_gnullvm.rs
new file mode 100644
index 000000000..3154b512a
--- /dev/null
+++ b/compiler/rustc_target/src/spec/i686_pc_windows_gnullvm.rs
@@ -0,0 +1,26 @@
+use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target};
+
+pub fn target() -> Target {
+ let mut base = super::windows_gnullvm_base::opts();
+ base.cpu = "pentium4".into();
+ base.max_atomic_width = Some(64);
+ base.frame_pointer = FramePointer::Always; // Required for backtraces
+ base.linker = Some("i686-w64-mingw32-clang".into());
+
+ // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
+ // space available to x86 Windows binaries on x86_64.
+ base.add_pre_link_args(
+ LinkerFlavor::Gnu(Cc::No, Lld::No),
+ &["-m", "i386pe", "--large-address-aware"],
+ );
+
+ Target {
+ llvm_target: "i686-pc-windows-gnu".into(),
+ pointer_width: 32,
+ data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
+ i64:64-f80:32-n8:16:32-a:0:32-S32"
+ .into(),
+ arch: "x86".into(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs b/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
new file mode 100644
index 000000000..29f803601
--- /dev/null
+++ b/compiler/rustc_target/src/spec/i686_unknown_hurd_gnu.rs
@@ -0,0 +1,19 @@
+use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target};
+
+pub fn target() -> Target {
+ let mut base = super::hurd_gnu_base::opts();
+ base.cpu = "pentiumpro".into();
+ base.max_atomic_width = Some(64);
+ base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
+ base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
+
+ Target {
+ llvm_target: "i686-unknown-hurd-gnu".into(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
+ f64:32:64-f80:32-n8:16:32-S128"
+ .into(),
+ arch: "x86".into(),
+ options: base,
+ }
+}
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 31b6961bb..1bcb1f353 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -61,6 +61,8 @@ mod aix_base;
mod android_base;
mod apple_base;
pub use apple_base::deployment_target as current_apple_deployment_target;
+pub use apple_base::platform as current_apple_platform;
+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;
@@ -69,6 +71,8 @@ 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;
@@ -1365,6 +1369,8 @@ supported_targets! {
("i686-unknown-haiku", i686_unknown_haiku),
("x86_64-unknown-haiku", x86_64_unknown_haiku),
+ ("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
+
("aarch64-apple-darwin", aarch64_apple_darwin),
("x86_64-apple-darwin", x86_64_apple_darwin),
("x86_64h-apple-darwin", x86_64h_apple_darwin),
@@ -1388,7 +1394,6 @@ supported_targets! {
("i386-apple-ios", i386_apple_ios),
("x86_64-apple-ios", x86_64_apple_ios),
("aarch64-apple-ios", aarch64_apple_ios),
- ("armv7-apple-ios", armv7_apple_ios),
("armv7s-apple-ios", armv7s_apple_ios),
("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi),
("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi),
@@ -1418,6 +1423,7 @@ supported_targets! {
("x86_64-uwp-windows-gnu", x86_64_uwp_windows_gnu),
("aarch64-pc-windows-gnullvm", aarch64_pc_windows_gnullvm),
+ ("i686-pc-windows-gnullvm", i686_pc_windows_gnullvm),
("x86_64-pc-windows-gnullvm", x86_64_pc_windows_gnullvm),
("aarch64-pc-windows-msvc", aarch64_pc_windows_msvc),
@@ -2276,6 +2282,13 @@ impl Target {
Abi::Vectorcall { .. } if ["x86", "x86_64"].contains(&&self.arch[..]) => abi,
Abi::Fastcall { unwind } | Abi::Vectorcall { unwind } => Abi::C { unwind },
+ // The Windows x64 calling convention we use for `extern "Rust"`
+ // <https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions#register-volatility-and-preservation>
+ // expects the callee to save `xmm6` through `xmm15`, but `PreserveMost`
+ // (that we use by default for `extern "rust-cold"`) doesn't save any of those.
+ // So to avoid bloating callers, just use the Rust convention here.
+ Abi::RustCold if self.is_like_windows && self.arch == "x86_64" => Abi::Rust,
+
abi => abi,
}
}
diff --git a/compiler/rustc_target/src/spec/riscv64_linux_android.rs b/compiler/rustc_target/src/spec/riscv64_linux_android.rs
index af0d68554..91f5e562d 100644
--- a/compiler/rustc_target/src/spec/riscv64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/riscv64_linux_android.rs
@@ -9,7 +9,7 @@ pub fn target() -> Target {
options: TargetOptions {
code_model: Some(CodeModel::Medium),
cpu: "generic-rv64".into(),
- features: "+m,+a,+f,+d,+c".into(),
+ features: "+m,+a,+f,+d,+c,+Zba,+Zbb,+Zbs".into(),
llvm_abiname: "lp64d".into(),
supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(64),
diff --git a/compiler/rustc_target/src/spec/uefi_msvc_base.rs b/compiler/rustc_target/src/spec/uefi_msvc_base.rs
index 8968d3c8f..a50a55ad7 100644
--- a/compiler/rustc_target/src/spec/uefi_msvc_base.rs
+++ b/compiler/rustc_target/src/spec/uefi_msvc_base.rs
@@ -46,6 +46,7 @@ pub fn opts() -> TargetOptions {
stack_probes: StackProbeType::Call,
singlethread: true,
linker: Some("rust-lld".into()),
+ entry_name: "efi_main".into(),
..base
}
}
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 e90bda9c9..e3f5d7321 100644
--- a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs
@@ -5,7 +5,7 @@ use crate::spec::{StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let arch = Arch::X86_64;
let mut base = opts("macos", arch);
- base.max_atomic_width = Some(128); // core2 supports cmpxchg16b
+ base.max_atomic_width = Some(128); // penryn+ supports cmpxchg16b
base.frame_pointer = FramePointer::Always;
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]);
base.stack_probes = StackProbeType::X86;
diff --git a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
index 50f359c35..fd1926f29 100644
--- a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
@@ -1,5 +1,5 @@
use super::apple_base::{opts, Arch};
-use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
+use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions};
pub fn target() -> Target {
let llvm_target = "x86_64-apple-ios14.0-macabi";
@@ -7,6 +7,7 @@ pub fn target() -> Target {
let arch = Arch::X86_64_macabi;
let mut base = opts("ios", arch);
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-target", llvm_target]);
+ base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
Target {
llvm_target: llvm_target.into(),
diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
index 67664a747..41ba76806 100644
--- a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
@@ -5,13 +5,14 @@
// The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with
// LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features.
-use crate::spec::Target;
+use crate::{abi::call::Conv, spec::Target};
pub fn target() -> Target {
let mut base = super::uefi_msvc_base::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
base.max_atomic_width = Some(64);
+ base.entry_abi = Conv::X86_64Win64;
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions