about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorUrgau <3616612+Urgau@users.noreply.github.com>2024-10-16 12:03:43 +0200
committerGitHub <noreply@github.com>2024-10-16 12:03:43 +0200
commit6b27c3057df4ff501862c3793366df52ca4dcd53 (patch)
treeebd69816e86770e37e6c4ff5ff6af63e1f375666 /compiler/rustc_codegen_llvm/src
parent329e5704604ca677562a8f8e69b18c008f8cca15 (diff)
parente9853961452b56997cc127b51308879b9cd09482 (diff)
downloadrust-6b27c3057df4ff501862c3793366df52ca4dcd53.tar.gz
rust-6b27c3057df4ff501862c3793366df52ca4dcd53.zip
Rollup merge of #131760 - maurer:data-layout-aarch64, r=nikic
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/context.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index c836dd5473f..2f830d6f941 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -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);