Skip to content

Commit 382dba5

Browse files
committed
v8a as default aarch64 target
After llvm/llvm-project@8689f5e landed, LLVM takes the intersection of v8a and v8r as default. This commit brings back v8a support by explicitly specifying v8a in the feature list. This should solve #97724.
1 parent 8a09420 commit 382dba5

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+5
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
491491
.flatten();
492492
features.extend(feats);
493493

494+
// FIXME: Move v8a to target definition list when earliest supported LLVM is 14.
495+
if get_version() >= (14, 0, 0) && sess.target.arch == "aarch64" {
496+
features.push("+v8a".into());
497+
}
498+
494499
if diagnostics && let Some(f) = check_tied_features(sess, &featsmap) {
495500
sess.emit_err(TargetFeatureDisableOrEnable {
496501
features: f,
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// assembly-output: emit-asm
2+
// compile-flags: --target aarch64-unknown-linux-gnu
3+
// needs-llvm-components: aarch64
4+
5+
#![feature(no_core, lang_items, rustc_attrs)]
6+
#![crate_type = "rlib"]
7+
#![no_core]
8+
9+
#[rustc_builtin_macro]
10+
macro_rules! asm {
11+
() => {};
12+
}
13+
14+
#[lang = "sized"]
15+
trait Sized {}
16+
17+
// CHECK-LABEL: ttbr0_el2:
18+
#[no_mangle]
19+
pub fn ttbr0_el2() {
20+
// CHECK: //APP
21+
// CHECK-NEXT: msr TTBR0_EL2, x0
22+
// CHECK-NEXT: //NO_APP
23+
unsafe {
24+
asm!("msr ttbr0_el2, x0");
25+
}
26+
}
27+
28+
// CHECK-LABEL: vttbr_el2:
29+
#[no_mangle]
30+
pub fn vttbr_el2() {
31+
// CHECK: //APP
32+
// CHECK-NEXT: msr VTTBR_EL2, x0
33+
// CHECK-NEXT: //NO_APP
34+
unsafe {
35+
asm!("msr vttbr_el2, x0");
36+
}
37+
}

0 commit comments

Comments
 (0)