mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Adjust 64-bit ARM data layouts for LLVM update
LLVM has updated data layouts to specify `Fn32` on 64-bit ARM to avoid C++ accidentally underaligning functions when trying to comply with member function ABIs. This should only affect Rust in cases where we had a similar bug (I don't believe we have one), but our data layout must match to generate code. As a compatibility adaptatation, if LLVM is not version 19 yet, `Fn32` gets voided from the data layout. See llvm/llvm-project#90415
This commit is contained in:
parent
25e3949aa1
commit
4d397d33da
@ -133,6 +133,15 @@ pub unsafe fn create_module<'ll>(
|
||||
}
|
||||
}
|
||||
|
||||
if llvm_version < (19, 0, 0) {
|
||||
if sess.target.arch == "aarch64" || sess.target.arch.starts_with("arm64") {
|
||||
// LLVM 19 sets -Fn32 in its data layout string for 64-bit ARM
|
||||
// Earlier LLVMs leave this default, so remove it.
|
||||
// See https://github.com/llvm/llvm-project/pull/90702
|
||||
target_data_layout = target_data_layout.replace("-Fn32", "");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the data-layout values hardcoded remain the defaults.
|
||||
{
|
||||
let tm = crate::back::write::create_informational_target_machine(tcx.sess);
|
||||
|
@ -22,7 +22,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
mcount: "\u{1}mcount".into(),
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a12".into(),
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -12,7 +12,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -12,7 +12,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: Some(false),
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a16".into(),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: Some(false),
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a16".into(),
|
||||
|
@ -12,7 +12,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a,+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -16,7 +16,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a,+outline-atomics".into(),
|
||||
|
@ -14,7 +14,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
abi: "ilp32".into(),
|
||||
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
mcount: "__mcount".into(),
|
||||
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
linker: Some("aarch64-kmc-elf-gcc".into()),
|
||||
|
@ -13,7 +13,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: Some(128),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -11,7 +11,7 @@ pub fn target() -> Target {
|
||||
},
|
||||
pointer_width: 64,
|
||||
arch: "aarch64".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
|
||||
max_atomic_width: Some(128),
|
||||
|
@ -18,7 +18,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a,+outline-atomics".into(),
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
abi: "ilp32".into(),
|
||||
|
@ -21,7 +21,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions { mcount: "\u{1}_mcount".into(), ..base },
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+reserve-x18".into(),
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -38,7 +38,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: opts,
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: opts,
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
// i128:128 = 128-bit-integer, minimum_alignment=128, preferred_alignment=128
|
||||
// n32:64 = 32 and 64 are native integer widths; Elements of this set are considered to support most general arithmetic operations efficiently.
|
||||
// S128 = 128 bits are the natural alignment of the stack in bits.
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a".into(),
|
||||
|
@ -13,7 +13,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8a,+neon,+fp-armv8,+apple-a7".into(),
|
||||
|
@ -22,7 +22,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
mcount: "\u{1}mcount".into(),
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: arch.target_arch(),
|
||||
options: TargetOptions {
|
||||
features: "+neon,+fp-armv8,+apple-a12,+v8.3a,+pauth".into(),
|
||||
|
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
std: None,
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".into(),
|
||||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "arm64ec".into(),
|
||||
options: base,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user