s390x: Support aligned stack datalayout

LLVM 23 will mark the stack as aligned for more efficient code:

https://github.com/llvm/llvm-project/pull/176041
This commit is contained in:
Matthew Maurer 2026-01-20 20:11:35 +00:00
parent 5c49c4f7c8
commit 39296ff8f8
3 changed files with 8 additions and 2 deletions

View file

@ -216,6 +216,12 @@ pub(crate) unsafe fn create_module<'ll>(
target_data_layout = target_data_layout.replace("-f64:32:64", "");
}
}
if llvm_version < (23, 0, 0) {
if sess.target.arch == Arch::S390x {
// LLVM 23 updated the s390x layout to specify the stack alignment: https://github.com/llvm/llvm-project/pull/176041
target_data_layout = target_data_layout.replace("-S64", "");
}
}
// Ensure the data-layout values hardcoded remain the defaults.
{

View file

@ -22,7 +22,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
data_layout: "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
arch: Arch::S390x,
options: base,
}

View file

@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
data_layout: "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
arch: Arch::S390x,
options: base,
}