about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-31 17:50:44 -0700
committerGitHub <noreply@github.com>2024-10-31 17:50:44 -0700
commitacd839d99258ca1a060882e79377c3e9a9528c30 (patch)
treee0686612d638f2a064c8825d35a649af9c2cca7d /compiler/rustc_codegen_llvm/src
parenta25ab33770f9430640f6de8d44489a50df5a2031 (diff)
parent9caced7badc337ced7ad89eb614621c39bd996e9 (diff)
downloadrust-acd839d99258ca1a060882e79377c3e9a9528c30.tar.gz
rust-acd839d99258ca1a060882e79377c3e9a9528c30.zip
Rollup merge of #132422 - maurer:sparc-layout, r=durin42
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

`@rustbot` label: +llvm-main

r? `@durin42`

(Please wait for the LLVM CI to come back before approving), creating this PR to get it tested there.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-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.