llvm: Match aarch64 data layout to new LLVM layout

LLVM has added 3 new address spaces to support special Windows use
cases. These shouldn't trouble us for now, but LLVM requires matching
data layouts.

See llvm/llvm-project#111879 for details
This commit is contained in:
Matthew Maurer 2024-10-15 20:56:20 +00:00
parent a0c2aba29a
commit e985396145
39 changed files with 72 additions and 38 deletions

View file

@ -138,6 +138,16 @@ pub(crate) unsafe fn create_module<'ll>(
}
}
if llvm_version < (20, 0, 0) {
if sess.target.arch == "aarch64" || sess.target.arch.starts_with("arm64") {
// LLVM 20 defines three additional address spaces for alternate
// pointer kinds used in Windows.
// See https://github.com/llvm/llvm-project/pull/111879
target_data_layout =
target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
}
}
// Ensure the data-layout values hardcoded remain the defaults.
{
let tm = crate::back::write::create_informational_target_machine(tcx.sess, false);