use crate::llvm_util;
use crate::value::Value;
use rustc::dep_graph::DepGraphSafe;
-use rustc::hir;
use crate::type_::Type;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::const_cstr;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::small_c_str::SmallCStr;
+use rustc_hir::Unsafety;
use rustc_target::spec::{HasTargetSpec, Target};
use crate::abi::Abi;
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,
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 {
iter::once(tcx.mk_mut_ptr(tcx.types.u8)),
tcx.types.never,
false,
- hir::Unsafety::Unsafe,
+ Unsafety::Unsafe,
Abi::C,
));