Skip to content

Enable stack probes on aarch64 for LLVM 18 #118491

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 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to gate use of StackProbeType::Inline on LLVM 18 or newer? Is this just ignored for unsupported targets on earlier versions of LLVM?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ignored -- or rather goes unchecked and unnoticed. The other times we've concerned ourselves about the version is when we know there are bugs in the implementation.

frame_pointer: FramePointer::NonLeaf,
..base
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
},
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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()
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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");

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, SanitizerSet, Target, TargetOptions};
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, SanitizerSet, Target, TargetOptions};
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, Target, TargetOptions};
use crate::spec::{base, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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()
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, SanitizerSet, Target, TargetOptions};
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, Target, TargetOptions};
use crate::spec::{base, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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()
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, Target, TargetOptions};
use crate::spec::{base, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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()
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, Target, TargetOptions};
use crate::spec::{base, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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()
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{base, Target, TargetOptions};
use crate::spec::{base, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
Target {
Expand All @@ -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()
},
}
Expand Down
Loading