From b99b5e57521783d2d70a1ee2bcfdf59b25b68fdf Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 30 Nov 2023 16:41:45 -0800 Subject: [PATCH 1/2] Enable stack probes on aarch64 for LLVM 18 --- .../src/spec/targets/aarch64_apple_darwin.rs | 3 ++- .../src/spec/targets/aarch64_apple_ios.rs | 3 ++- .../src/spec/targets/aarch64_apple_ios_macabi.rs | 5 ++++- .../src/spec/targets/aarch64_apple_ios_sim.rs | 3 ++- .../src/spec/targets/aarch64_apple_tvos.rs | 3 ++- .../src/spec/targets/aarch64_apple_tvos_sim.rs | 3 ++- .../src/spec/targets/aarch64_apple_watchos_sim.rs | 3 ++- .../src/spec/targets/aarch64_be_unknown_linux_gnu.rs | 3 ++- .../targets/aarch64_be_unknown_linux_gnu_ilp32.rs | 3 ++- .../src/spec/targets/aarch64_be_unknown_netbsd.rs | 3 ++- .../src/spec/targets/aarch64_kmc_solid_asp3.rs | 3 ++- .../src/spec/targets/aarch64_linux_android.rs | 3 ++- .../targets/aarch64_nintendo_switch_freestanding.rs | 5 ++++- .../src/spec/targets/aarch64_unknown_freebsd.rs | 3 ++- .../src/spec/targets/aarch64_unknown_fuchsia.rs | 3 ++- .../src/spec/targets/aarch64_unknown_hermit.rs | 3 ++- .../src/spec/targets/aarch64_unknown_linux_gnu.rs | 3 ++- .../spec/targets/aarch64_unknown_linux_gnu_ilp32.rs | 3 ++- .../src/spec/targets/aarch64_unknown_linux_musl.rs | 3 ++- .../src/spec/targets/aarch64_unknown_linux_ohos.rs | 3 ++- .../src/spec/targets/aarch64_unknown_netbsd.rs | 3 ++- .../src/spec/targets/aarch64_unknown_none.rs | 4 +++- .../spec/targets/aarch64_unknown_none_softfloat.rs | 5 ++++- .../src/spec/targets/aarch64_unknown_openbsd.rs | 3 ++- .../src/spec/targets/aarch64_unknown_redox.rs | 3 ++- .../src/spec/targets/aarch64_unknown_teeos.rs | 3 ++- .../src/spec/targets/aarch64_wrs_vxworks.rs | 3 ++- .../src/spec/targets/arm64_32_apple_watchos.rs | 3 ++- .../{x86-stack-probes.rs => stack-probes.rs} | 12 ++++++++---- tests/codegen/stack-probes-inline.rs | 4 +++- tests/ui/abi/stack-probes-lto.rs | 4 +++- tests/ui/abi/stack-probes.rs | 4 +++- 32 files changed, 80 insertions(+), 35 deletions(-) rename tests/assembly/{x86-stack-probes.rs => stack-probes.rs} (68%) diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index 8e6c00b1255d4..421140e648086 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -1,11 +1,12 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("macos", arch); base.cpu = "apple-m1".into(); base.max_atomic_width = Some(128); + base.stack_probes = StackProbeType::Inline; // FIXME: The leak sanitizer currently fails the tests, see #88132. base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index f291ac5458d34..0370e4ce38edf 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; @@ -18,6 +18,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index 78067a138a938..c9e3587c6108b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -1,5 +1,7 @@ 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, StackProbeType, Target, TargetOptions, +}; pub fn target() -> Target { let llvm_target = "arm64-apple-ios14.0-macabi"; @@ -17,6 +19,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a12".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index 41760e9093fa2..6c906cc87bd9c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -18,6 +18,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index e817308b6859d..fc3a9af16af80 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, tvos_llvm_target, Arch}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; @@ -11,6 +11,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("tvos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index c4aa8479279df..db7a9b2661adb 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -11,6 +11,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("tvos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index 96d43e6d27f1c..5c2e32477421e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -15,6 +15,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("watchos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs index bbaa870ec2e89..739a9e4a3dc97 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs @@ -1,5 +1,5 @@ use crate::abi::Endian; -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -10,6 +10,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a,+outline-atomics".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, mcount: "\u{1}_mcount".into(), endian: Endian::Big, ..base::linux_gnu::opts() diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs index 7536e507b3d79..1b87c09e3fe70 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs @@ -1,5 +1,5 @@ use crate::abi::Endian; -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -13,6 +13,7 @@ pub fn target() -> Target { options: TargetOptions { abi: "ilp32".into(), features: "+v8a,+outline-atomics".into(), + stack_probes: StackProbeType::Inline, mcount: "\u{1}_mcount".into(), endian: Endian::Big, ..base diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs index 21de8a71a0df2..02e156f19decd 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs @@ -1,5 +1,5 @@ use crate::abi::Endian; -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -10,6 +10,7 @@ pub fn target() -> Target { options: TargetOptions { mcount: "__mcount".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, endian: Endian::Big, ..base::netbsd::opts() }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs index e5e22fd1ee28f..5b4ffc08a5784 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, RelocModel, Target, TargetOptions}; +use crate::spec::{base, RelocModel, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let base = base::solid::opts("asp3"); @@ -13,6 +13,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, disable_redzone: true, max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, ..base }, } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs index 7c6fed7ab9957..db9a180856027 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, SanitizerSet, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a // for target ABI requirements. @@ -14,6 +14,7 @@ pub fn target() -> Target { // As documented in https://developer.android.com/ndk/guides/cpu-features.html // the neon (ASIMD) and FP must exist on all android aarch64 targets. features: "+v8a,+neon,+fp-armv8".into(), + stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::CFI | SanitizerSet::HWADDRESS | SanitizerSet::MEMTAG diff --git a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs index 02fcc2bb43e9a..5a92225c4969b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, StackProbeType, Target, TargetOptions, +}; const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld"); @@ -16,6 +18,7 @@ pub fn target() -> Target { link_script: Some(LINKER_SCRIPT.into()), os: "horizon".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, panic_strategy: PanicStrategy::Abort, position_independent_executables: true, dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs index 0f95984a31f5b..0ba91a54f1da0 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, SanitizerSet, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -9,6 +9,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::MEMORY diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs index cacc6ea235a3c..430a1c5e7f14d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, SanitizerSet, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -9,6 +9,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::SHADOWCALLSTACK, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs index 3839e0b9c4652..50813b81b8d0d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -9,6 +9,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a,+strict-align,+neon,+fp-armv8".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, ..base::hermit::opts() }, } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs index c0b07db381809..5b3a2ffa5995a 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, SanitizerSet, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -10,6 +10,7 @@ pub fn target() -> Target { features: "+v8a,+outline-atomics".into(), mcount: "\u{1}_mcount".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs index d4c6271b241f5..0ff5c8651e6fb 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -10,6 +10,7 @@ pub fn target() -> Target { abi: "ilp32".into(), features: "+v8a,+outline-atomics".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, mcount: "\u{1}_mcount".into(), ..base::linux_gnu::opts() }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 364df677e44ab..d16ccd803a95c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -1,10 +1,11 @@ -use crate::spec::{base, SanitizerSet, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let mut base = base::linux_musl::opts(); base.max_atomic_width = Some(128); base.supports_xray = true; base.features = "+v8a".into(); + base.stack_probes = StackProbeType::Inline; base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs index 5f3bef63aa653..1be27a511085f 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs @@ -1,5 +1,5 @@ use crate::spec::SanitizerSet; -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let mut base = base::linux_ohos::opts(); @@ -14,6 +14,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+reserve-x18".into(), mcount: "\u{1}_mcount".into(), + stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs index 3194d16ff473b..32a0816cf81c3 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -10,6 +10,7 @@ pub fn target() -> Target { features: "+v8a".into(), mcount: "__mcount".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, ..base::netbsd::opts() }, } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs index 63a8144f69fb4..518597b3811c4 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs @@ -7,7 +7,8 @@ // For example, `-C target-cpu=cortex-a53`. use crate::spec::{ - Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, TargetOptions, + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target, + TargetOptions, }; pub fn target() -> Target { @@ -24,6 +25,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, disable_redzone: true, max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, panic_strategy: PanicStrategy::Abort, ..Default::default() }; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs index 48b79b0b9bace..d56fbdbbe9085 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs @@ -6,7 +6,9 @@ // // For example, `-C target-cpu=cortex-a53`. -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, Target, TargetOptions, +}; pub fn target() -> Target { let opts = TargetOptions { @@ -17,6 +19,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, disable_redzone: true, max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, panic_strategy: PanicStrategy::Abort, ..Default::default() }; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs index e3f5aafc7d442..d5fca5c31a659 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -9,6 +9,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, ..base::openbsd::opts() }, } diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs index de875e29ffdc5..844fed472a268 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs @@ -1,8 +1,9 @@ -use crate::spec::{base, Target}; +use crate::spec::{base, StackProbeType, Target}; pub fn target() -> Target { let mut base = base::redox::opts(); base.max_atomic_width = Some(128); + base.stack_probes = StackProbeType::Inline; base.features = "+v8a".into(); Target { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs index b490e80258ca1..204e9b061cec5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs @@ -1,9 +1,10 @@ -use crate::spec::{base, Target}; +use crate::spec::{base, StackProbeType, Target}; pub fn target() -> Target { let mut base = base::teeos::opts(); base.features = "+strict-align,+neon,+fp-armv8".into(); base.max_atomic_width = Some(128); + base.stack_probes = StackProbeType::Inline; Target { llvm_target: "aarch64-unknown-none".into(), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs index 29f61d857788b..48e142347d7bf 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs @@ -1,4 +1,4 @@ -use crate::spec::{base, Target, TargetOptions}; +use crate::spec::{base, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { Target { @@ -9,6 +9,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, ..base::vxworks::opts() }, } diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index 59e6022d985dd..01c73a93889b8 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, Arch}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let base = opts("watchos", Arch::Arm64_32); @@ -11,6 +11,7 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a,+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), + stack_probes: StackProbeType::Inline, dynamic_linking: false, position_independent_executables: true, ..base diff --git a/tests/assembly/x86-stack-probes.rs b/tests/assembly/stack-probes.rs similarity index 68% rename from tests/assembly/x86-stack-probes.rs rename to tests/assembly/stack-probes.rs index 64a4efc0e1881..6466df3ff7d6d 100644 --- a/tests/assembly/x86-stack-probes.rs +++ b/tests/assembly/stack-probes.rs @@ -1,10 +1,12 @@ -// revisions: x86_64 i686 +// revisions: x86_64 i686 aarch64 // assembly-output: emit-asm -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-gnu +//[i686] compile-flags: --target i686-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //[i686] needs-llvm-components: x86 -// compile-flags: -C llvm-args=-x86-asm-syntax=intel +//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//[aarch64] needs-llvm-components: aarch64 +//[aarch64] min-llvm-version: 18 #![feature(no_core, lang_items)] #![crate_type = "lib"] @@ -28,6 +30,7 @@ pub fn small_stack_probe(x: u8, f: fn(&mut [u8; 8192])) { // CHECK-NOT: __rust_probestack // x86_64: sub rsp, 4096 // i686: sub esp, 4096 + // aarch64: sub sp, sp, #1, lsl #12 f(&mut [x; 8192]); } @@ -37,5 +40,6 @@ pub fn big_stack_probe(x: u8, f: fn(&[u8; 65536])) { // CHECK-NOT: __rust_probestack // x86_64: sub rsp, 4096 // i686: sub esp, 4096 + // aarch64: sub sp, sp, #1, lsl #12 f(&mut [x; 65536]); } diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen/stack-probes-inline.rs index 058c363969f08..34027e918509d 100644 --- a/tests/codegen/stack-probes-inline.rs +++ b/tests/codegen/stack-probes-inline.rs @@ -2,7 +2,9 @@ // or `StackProbeType::InlineOrCall` when running on newer LLVM. // compile-flags: -C no-prepopulate-passes -// revisions: powerpc powerpc64 powerpc64le s390x i686 x86_64 +// revisions: aarch64 powerpc powerpc64 powerpc64le s390x i686 x86_64 +//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//[aarch64] needs-llvm-components: aarch64 //[powerpc] compile-flags: --target powerpc-unknown-linux-gnu //[powerpc] needs-llvm-components: powerpc //[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu diff --git a/tests/ui/abi/stack-probes-lto.rs b/tests/ui/abi/stack-probes-lto.rs index 7282d09706c1a..fb47867175491 100644 --- a/tests/ui/abi/stack-probes-lto.rs +++ b/tests/ui/abi/stack-probes-lto.rs @@ -1,5 +1,7 @@ -// revisions: x32 x64 +// revisions: aarch64 x32 x64 // run-pass +//[aarch64] only-aarch64 +//[aarch64] min-llvm-version: 18 //[x32] only-x86 //[x64] only-x86_64 // ignore-sgx no processes diff --git a/tests/ui/abi/stack-probes.rs b/tests/ui/abi/stack-probes.rs index 4b8a79a4b685a..e5c7a1a680481 100644 --- a/tests/ui/abi/stack-probes.rs +++ b/tests/ui/abi/stack-probes.rs @@ -1,5 +1,7 @@ -// revisions: x32 x64 +// revisions: aarch64 x32 x64 // run-pass +//[aarch64] only-aarch64 +//[aarch64] min-llvm-version: 18 //[x32] only-x86 //[x64] only-x86_64 // ignore-emscripten no processes From 233de9d89eae58bebfb59341bd01bb6be80a80f1 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 12 Dec 2023 17:26:51 -0800 Subject: [PATCH 2/2] Set the `StackProbeType` in `apple::opts` --- compiler/rustc_target/src/spec/base/apple/mod.rs | 13 +++++++++++-- .../src/spec/targets/aarch64_apple_darwin.rs | 3 +-- .../src/spec/targets/aarch64_apple_ios.rs | 3 +-- .../src/spec/targets/aarch64_apple_ios_macabi.rs | 5 +---- .../src/spec/targets/aarch64_apple_ios_sim.rs | 3 +-- .../src/spec/targets/aarch64_apple_tvos.rs | 3 +-- .../src/spec/targets/aarch64_apple_tvos_sim.rs | 3 +-- .../src/spec/targets/aarch64_apple_watchos_sim.rs | 3 +-- .../src/spec/targets/arm64_32_apple_watchos.rs | 3 +-- .../rustc_target/src/spec/targets/i386_apple_ios.rs | 8 ++------ .../src/spec/targets/i686_apple_darwin.rs | 3 +-- .../src/spec/targets/x86_64_apple_darwin.rs | 3 +-- .../src/spec/targets/x86_64_apple_ios.rs | 8 ++------ .../src/spec/targets/x86_64_apple_ios_macabi.rs | 8 ++------ .../src/spec/targets/x86_64_apple_tvos.rs | 8 ++------ .../src/spec/targets/x86_64_apple_watchos_sim.rs | 8 ++------ .../src/spec/targets/x86_64h_apple_darwin.rs | 3 +-- 17 files changed, 32 insertions(+), 56 deletions(-) diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index f32cb06d68f69..afd60b40c3be1 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -1,8 +1,8 @@ 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::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions}; +use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs, LinkerFlavor, Lld}; +use crate::spec::{SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions}; #[cfg(test)] mod tests; @@ -81,6 +81,14 @@ impl Arch { Arm64_sim => "apple-a12", } } + + fn stack_probes(self) -> StackProbeType { + match self { + Armv7k | Armv7s => StackProbeType::None, + Arm64 | Arm64e | Arm64_32 | I386 | I686 | X86_64 | X86_64h | X86_64_sim + | X86_64_macabi | Arm64_macabi | Arm64_sim => StackProbeType::Inline, + } + } } fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs { @@ -147,6 +155,7 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions { abi_return_struct_as_int: true, emit_debug_gdb_scripts: false, eh_frame_header: false, + stack_probes: arch.stack_probes(), debuginfo_kind: DebuginfoKind::DwarfDsym, // The historical default for macOS targets is to run `dsymutil` which diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index 421140e648086..8e6c00b1255d4 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -1,12 +1,11 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("macos", arch); base.cpu = "apple-m1".into(); base.max_atomic_width = Some(128); - base.stack_probes = StackProbeType::Inline; // FIXME: The leak sanitizer currently fails the tests, see #88132. base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index 0370e4ce38edf..f291ac5458d34 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; @@ -18,7 +18,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index c9e3587c6108b..78067a138a938 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -1,7 +1,5 @@ use crate::spec::base::apple::{opts, Arch}; -use crate::spec::{ - Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, -}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let llvm_target = "arm64-apple-ios14.0-macabi"; @@ -19,7 +17,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a12".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index 6c906cc87bd9c..41760e9093fa2 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch}; -use crate::spec::{FramePointer, SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -18,7 +18,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..base }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index fc3a9af16af80..e817308b6859d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, tvos_llvm_target, Arch}; -use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64; @@ -11,7 +11,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("tvos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index db7a9b2661adb..c4aa8479279df 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch}; -use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -11,7 +11,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("tvos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index 5c2e32477421e..96d43e6d27f1c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch}; -use crate::spec::{FramePointer, StackProbeType, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::Arm64_sim; @@ -15,7 +15,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, frame_pointer: FramePointer::NonLeaf, ..opts("watchos", arch) }, diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index 01c73a93889b8..59e6022d985dd 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let base = opts("watchos", Arch::Arm64_32); @@ -11,7 +11,6 @@ pub fn target() -> Target { options: TargetOptions { features: "+v8a,+neon,+fp-armv8,+apple-a7".into(), max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, dynamic_linking: false, position_independent_executables: true, ..base diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs index ce0d604f57c76..13f8b6b5a0a05 100644 --- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::I386; @@ -14,10 +14,6 @@ pub fn target() -> Target { f64:32:64-f80:128-n8:16:32-S128" .into(), arch: arch.target_arch(), - options: TargetOptions { - max_atomic_width: Some(64), - stack_probes: StackProbeType::Inline, - ..opts("ios", arch) - }, + options: TargetOptions { max_atomic_width: Some(64), ..opts("ios", arch) }, } } diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs index c4c9023419d6b..59069fe4e3a92 100644 --- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch}; -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions}; pub fn target() -> Target { // ld64 only understands i386 and not i686 @@ -7,7 +7,6 @@ pub fn target() -> Target { let mut base = opts("macos", arch); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m32"]); - base.stack_probes = StackProbeType::Inline; base.frame_pointer = FramePointer::Always; Target { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index 81173a16f96f7..59df3937ea6ff 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -1,6 +1,6 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64; @@ -8,7 +8,6 @@ pub fn target() -> Target { 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::Inline; base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs index 221635526d104..d0e2ac44a2a26 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch}; -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64_sim; @@ -12,10 +12,6 @@ pub fn target() -> Target { data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" .into(), arch: arch.target_arch(), - options: TargetOptions { - max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, - ..base - }, + options: TargetOptions { max_atomic_width: Some(128), ..base }, } } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs index 5f6b4b500d07b..8ef4b88b8b1cf 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, Arch}; -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let llvm_target = "x86_64-apple-ios14.0-macabi"; @@ -15,10 +15,6 @@ pub fn target() -> Target { data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" .into(), arch: arch.target_arch(), - options: TargetOptions { - max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, - ..base - }, + options: TargetOptions { max_atomic_width: Some(128), ..base }, } } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs index a7d5f28e0e500..17efd437f2fc8 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64_sim; @@ -9,10 +9,6 @@ pub fn target() -> Target { data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" .into(), arch: arch.target_arch(), - options: TargetOptions { - max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, - ..opts("tvos", arch) - }, + options: TargetOptions { max_atomic_width: Some(128), ..opts("tvos", arch) }, } } diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs index 3c5bf30ef5fa3..b1f72ee2f2124 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64_sim; @@ -9,10 +9,6 @@ pub fn target() -> Target { data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" .into(), arch: arch.target_arch(), - options: TargetOptions { - max_atomic_width: Some(128), - stack_probes: StackProbeType::Inline, - ..opts("watchos", arch) - }, + options: TargetOptions { max_atomic_width: Some(128), ..opts("watchos", arch) }, } } diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index 32d15c186787d..0c731e369ebc2 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -1,6 +1,6 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet}; -use crate::spec::{StackProbeType, Target, TargetOptions}; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64h; @@ -8,7 +8,6 @@ pub fn target() -> Target { base.max_atomic_width = Some(128); base.frame_pointer = FramePointer::Always; base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]); - base.stack_probes = StackProbeType::Inline; base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD;