about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2024-10-31 20:35:24 +0000
committerMatthew Maurer <mmaurer@google.com>2024-10-31 20:37:54 +0000
commit9caced7badc337ced7ad89eb614621c39bd996e9 (patch)
tree021f1d1ea066043e078b0d416f0f63609494e79c /compiler/rustc_codegen_llvm
parenta0d98ff0e5b6e1f2c63fd26f68484792621b235c (diff)
downloadrust-9caced7badc337ced7ad89eb614621c39bd996e9.tar.gz
rust-9caced7badc337ced7ad89eb614621c39bd996e9.zip
llvm: Match new LLVM 128-bit integer alignment on sparc
LLVM continues to align more 128-bit integers to 128-bits in the data
layout rather than relying on the high level language to do it. Update
SPARC target files to match and add a backcompat replacement for current
LLVMs.

See llvm/llvm-project#106951 for details
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/context.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 313957dda96..13428b109d9 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -148,6 +148,11 @@ pub(crate) unsafe fn create_module<'ll>(
             target_data_layout =
                 target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
         }
+        if sess.target.arch.starts_with("sparc") {
+            // LLVM 20 updates the sparc layout to correctly align 128 bit integers to 128 bit.
+            // See https://github.com/llvm/llvm-project/pull/106951
+            target_data_layout = target_data_layout.replace("-i128:128", "");
+        }
     }
 
     // Ensure the data-layout values hardcoded remain the defaults.