Skip to content

Commit db9ff0d

Browse files
authored
Rollup merge of rust-lang#151429 - s390x, r=durin42
s390x: Support aligned stack datalayout LLVM 23 will mark the stack as aligned for more efficient code: llvm/llvm-project#176041 r? durin42 @rustbot label llvm-main
2 parents 0b8a935 + 39296ff commit db9ff0d

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ pub(crate) unsafe fn create_module<'ll>(
221221
target_data_layout = target_data_layout.replace("-m:e", "");
222222
}
223223
}
224+
if llvm_version < (23, 0, 0) {
225+
if sess.target.arch == Arch::S390x {
226+
// LLVM 23 updated the s390x layout to specify the stack alignment: https://github.com/llvm/llvm-project/pull/176041
227+
target_data_layout = target_data_layout.replace("-S64", "");
228+
}
229+
}
224230

225231
// Ensure the data-layout values hardcoded remain the defaults.
226232
{

compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub(crate) fn target() -> Target {
2222
std: Some(true),
2323
},
2424
pointer_width: 64,
25-
data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
25+
data_layout: "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
2626
arch: Arch::S390x,
2727
options: base,
2828
}

compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
2323
std: Some(true),
2424
},
2525
pointer_width: 64,
26-
data_layout: "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
26+
data_layout: "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64".into(),
2727
arch: Arch::S390x,
2828
options: base,
2929
}

0 commit comments

Comments
 (0)