Skip to content

Commit a380581

Browse files
committed
Update data layout for 32-bit msvc targets
https://reviews.llvm.org/D115942 changed the alignment of f80.
1 parent f349141 commit a380581

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ pub unsafe fn create_module<'ll>(
134134
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
135135

136136
let mut target_data_layout = sess.target.data_layout.clone();
137-
if llvm_util::get_version() < (13, 0, 0) {
137+
let llvm_version = llvm_util::get_version();
138+
if llvm_version < (13, 0, 0) {
138139
if sess.target.arch == "powerpc64" {
139140
target_data_layout = target_data_layout.replace("-S128", "");
140141
}
@@ -145,6 +146,15 @@ pub unsafe fn create_module<'ll>(
145146
target_data_layout = "e-m:e-p:64:64-i64:64-n32:64-S128".to_string();
146147
}
147148
}
149+
if llvm_version < (14, 0, 0) {
150+
if sess.target.llvm_target == "i686-pc-windows-msvc"
151+
|| sess.target.llvm_target == "i586-pc-windows-msvc"
152+
{
153+
target_data_layout =
154+
"e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
155+
.to_string();
156+
}
157+
}
148158

149159
// Ensure the data-layout values hardcoded remain the defaults.
150160
if sess.target.is_builtin {

compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> Target {
2424
llvm_target: "i686-pc-windows-msvc".to_string(),
2525
pointer_width: 32,
2626
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
27-
i64:64-f80:32-n8:16:32-a:0:32-S32"
27+
i64:64-f80:128-n8:16:32-a:0:32-S32"
2828
.to_string(),
2929
arch: "x86".to_string(),
3030
options: base,

compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn target() -> Target {
99
llvm_target: "i686-pc-windows-msvc".to_string(),
1010
pointer_width: 32,
1111
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
12-
i64:64-f80:32-n8:16:32-a:0:32-S32"
12+
i64:64-f80:128-n8:16:32-a:0:32-S32"
1313
.to_string(),
1414
arch: "x86".to_string(),
1515
options: base,

0 commit comments

Comments
 (0)