Skip to content

Commit 9130fc0

Browse files
Gaslight LLVM about datalayouts
Co-authored-by: beetrees <[email protected]>
1 parent db9acf1 commit 9130fc0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_codegen_llvm/src/context.rs

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

210+
if sess.target.os == "aix" {
211+
// See https://github.com/llvm/llvm-project/issues/133599
212+
target_data_layout = target_data_layout.replace("-f64:32:64", "");
213+
}
214+
210215
// Ensure our hardcoded data-layout values remain the defaults.
211216
{
212217
let tm = crate::back::write::create_informational_target_machine(tcx.sess, false);
@@ -219,7 +224,7 @@ pub(crate) unsafe fn create_module<'ll>(
219224
str::from_utf8(unsafe { CStr::from_ptr(llvm_data_layout) }.to_bytes())
220225
.expect("got a non-UTF8 data-layout from LLVM");
221226

222-
if tcx.sess.target.os == "aix" {
227+
if target_data_layout != llvm_data_layout {
223228
// FIXME(workingjubilee): Currently skipping this logic for testing purposes
224229
} else if target_data_layout != llvm_data_layout {
225230
tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {

0 commit comments

Comments
 (0)