Skip to content

Commit 754b26d

Browse files
Rollup merge of #126324 - zmodem:loongarch, r=nikic
Adjust LoongArch64 data layouts for LLVM update The data layout was changed in LLVM 19: llvm/llvm-project#93814
2 parents 7276f34 + 4a06a5b commit 754b26d

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+8
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ pub unsafe fn create_module<'ll>(
142142
}
143143
}
144144

145+
if llvm_version < (19, 0, 0) {
146+
if sess.target.arch == "loongarch64" {
147+
// LLVM 19 updates the LoongArch64 data layout.
148+
// See https://github.com/llvm/llvm-project/pull/93814
149+
target_data_layout = target_data_layout.replace("-n32:64", "-n64");
150+
}
151+
}
152+
145153
// Ensure the data-layout values hardcoded remain the defaults.
146154
{
147155
let tm = crate::back::write::create_informational_target_machine(tcx.sess);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
std: None,
1111
},
1212
pointer_width: 64,
13-
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
13+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
1414
arch: "loongarch64".into(),
1515
options: TargetOptions {
1616
cpu: "generic".into(),

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
std: None,
1111
},
1212
pointer_width: 64,
13-
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
13+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
1414
arch: "loongarch64".into(),
1515
options: TargetOptions {
1616
cpu: "generic".into(),

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
std: None,
1212
},
1313
pointer_width: 64,
14-
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
14+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
1515
arch: "loongarch64".into(),
1616
options: TargetOptions {
1717
cpu: "generic".into(),

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
std: None,
1212
},
1313
pointer_width: 64,
14-
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
14+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
1515
arch: "loongarch64".into(),
1616
options: TargetOptions {
1717
cpu: "generic".into(),

0 commit comments

Comments
 (0)