about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-13 04:01:00 +0000
committerbors <bors@rust-lang.org>2020-01-13 04:01:00 +0000
commite82febc78e5a14356de5f713b904eebef1e86956 (patch)
treee1c8bffd16e5b0f003d8d9d61415cfb72a2549c7 /src/librustc_codegen_llvm
parent3ebcfa1451cfedc13a07e6353d8ade9742dfdc2a (diff)
parentc9e996f05cff70e69240b9a9d2d56e57af21eb3a (diff)
Auto merge of #67900 - nikic:prepare-llvm-10, r=nagisa
Prepare for LLVM 10 upgrade

Split off from #67759, this just adds the necessary compatibility bits and updates codegen tests, without performing the actual LLVM upgrade.

r? @alexcrichton
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/context.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs
index f07601ed383..50a35fe3dcf 100644
--- a/src/librustc_codegen_llvm/context.rs
+++ b/src/librustc_codegen_llvm/context.rs
@@ -143,6 +143,10 @@ fn strip_function_ptr_alignment(data_layout: String) -> String {
     data_layout.replace("-Fi8-", "-")
 }
 
+fn strip_x86_address_spaces(data_layout: String) -> String {
+    data_layout.replace("-p270:32:32-p271:32:32-p272:64:64-", "-")
+}
+
 pub unsafe fn create_module(
     tcx: TyCtxt<'_>,
     llcx: &'ll llvm::Context,
@@ -156,6 +160,11 @@ pub unsafe fn create_module(
     if llvm_util::get_major_version() < 9 {
         target_data_layout = strip_function_ptr_alignment(target_data_layout);
     }
+    if llvm_util::get_major_version() < 10 {
+        if sess.target.target.arch == "x86" || sess.target.target.arch == "x86_64" {
+            target_data_layout = strip_x86_address_spaces(target_data_layout);
+        }
+    }
 
     // Ensure the data-layout values hardcoded remain the defaults.
     if sess.target.target.options.is_builtin {