Skip to content

Commit bdd61b4

Browse files
compiler: Override AIX data layout to correctly align f64
1 parent e9a1003 commit bdd61b4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub(crate) unsafe fn create_module<'ll>(
207207
}
208208
}
209209

210-
// Ensure the data-layout values hardcoded remain the defaults.
210+
// Ensure our hardcoded data-layout values remain the defaults.
211211
{
212212
let tm = crate::back::write::create_informational_target_machine(tcx.sess, false);
213213
unsafe {
@@ -219,7 +219,12 @@ pub(crate) unsafe fn create_module<'ll>(
219219
str::from_utf8(unsafe { CStr::from_ptr(llvm_data_layout) }.to_bytes())
220220
.expect("got a non-UTF8 data-layout from LLVM");
221221

222-
if target_data_layout != llvm_data_layout {
222+
if tcx.sess.target.os == "aix" {
223+
// we committed a travesty here
224+
if target_data_layout == llvm_data_layout {
225+
bug!("LLVM got fixed, please remove this exception in cg_llvm!");
226+
}
227+
} else if target_data_layout != llvm_data_layout {
223228
tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {
224229
rustc_target: sess.opts.target_triple.to_string().as_str(),
225230
rustc_layout: target_data_layout.as_str(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ pub(crate) fn target() -> Target {
1717
std: None, // ?
1818
},
1919
pointer_width: 64,
20-
data_layout: "E-m:a-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
20+
data_layout: "E-m:a-Fi64-i64:64-f64:32:64-i128:128-n32:64-S128-v256:256:256-v512:512:512"
21+
.into(),
2122
arch: "powerpc64".into(),
2223
options: base,
2324
}

0 commit comments

Comments
 (0)