about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-07-25 11:24:01 +0200
committerNikita Popov <nikita.ppv@gmail.com>2023-08-07 20:35:55 +0200
commitad7ea8b7e690e6000006b6fde630a2c8c4385019 (patch)
treeb87be64cd0a744d34b0d0d7a488ef86b4f9c326f /compiler/rustc_codegen_llvm/src
parent055dd282c5d17af5495ad125a08ec6b9d66062f1 (diff)
downloadrust-ad7ea8b7e690e6000006b6fde630a2c8c4385019.tar.gz
rust-ad7ea8b7e690e6000006b6fde630a2c8c4385019.zip
Update powerpc data layouts
Function pointer alignment is specified since https://reviews.llvm.org/D147016.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/context.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 2d23be6cd52..b4f7e20e05d 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -145,6 +145,17 @@ pub unsafe fn create_module<'ll>(
             target_data_layout = target_data_layout.replace("-n32:64-", "-n64-");
         }
     }
+    if llvm_version < (17, 0, 0) {
+        if sess.target.arch.starts_with("powerpc") {
+            // LLVM 17 specifies function pointer alignment for ppc:
+            // https://reviews.llvm.org/D147016
+            target_data_layout = target_data_layout
+                .replace("-Fn32", "")
+                .replace("-Fi32", "")
+                .replace("-Fn64", "")
+                .replace("-Fi64", "");
+        }
+    }
 
     // Ensure the data-layout values hardcoded remain the defaults.
     if sess.target.is_builtin {