Adjust 64-bit ARM data layouts for LLVM update
LLVM has updated data layouts to specify `Fn32` on 64-bit ARM to avoid C++ accidentally underaligning functions when trying to comply with member function ABIs. This should only affect Rust in cases where we had a similar bug (I don't believe we have one), but our data layout must match to generate code. As a compatibility adaptatation, if LLVM is not version 19 yet, `Fn32` gets voided from the data layout. See llvm/llvm-project#90415
This commit is contained in:
parent
25e3949aa1
commit
4d397d33da
41 changed files with 49 additions and 40 deletions
|
@ -133,6 +133,15 @@ pub unsafe fn create_module<'ll>(
|
|||
}
|
||||
}
|
||||
|
||||
if llvm_version < (19, 0, 0) {
|
||||
if sess.target.arch == "aarch64" || sess.target.arch.starts_with("arm64") {
|
||||
// LLVM 19 sets -Fn32 in its data layout string for 64-bit ARM
|
||||
// Earlier LLVMs leave this default, so remove it.
|
||||
// See https://github.com/llvm/llvm-project/pull/90702
|
||||
target_data_layout = target_data_layout.replace("-Fn32", "");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the data-layout values hardcoded remain the defaults.
|
||||
{
|
||||
let tm = crate::back::write::create_informational_target_machine(tcx.sess);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue