about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-06-12 14:26:28 -0400
committerGitHub <noreply@github.com>2024-06-12 14:26:28 -0400
commit754b26d882e410a6fd67b79132b5456f1e7241c1 (patch)
tree2625ab91f76902e1b080c5669c9e3023ca6b20c6 /compiler/rustc_codegen_llvm/src
parent7276f34a85fa867f4afca299d68029e8e621b5c4 (diff)
parent4a06a5bc7ad259023e4373e794687adfce252dac (diff)
downloadrust-754b26d882e410a6fd67b79132b5456f1e7241c1.tar.gz
rust-754b26d882e410a6fd67b79132b5456f1e7241c1.zip
Rollup merge of #126324 - zmodem:loongarch, r=nikic
Adjust LoongArch64 data layouts for LLVM update

The data layout was changed in LLVM 19: llvm/llvm-project#93814
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/context.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 53a098d178e..7d92888feee 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -142,6 +142,14 @@ pub unsafe fn create_module<'ll>(
         }
     }
 
+    if llvm_version < (19, 0, 0) {
+        if sess.target.arch == "loongarch64" {
+            // LLVM 19 updates the LoongArch64 data layout.
+            // See https://github.com/llvm/llvm-project/pull/93814
+            target_data_layout = target_data_layout.replace("-n32:64", "-n64");
+        }
+    }
+
     // Ensure the data-layout values hardcoded remain the defaults.
     {
         let tm = crate::back::write::create_informational_target_machine(tcx.sess);