Submitted By: Douglas R. Reno Date: 2019-12-30 Initial Package Version: 1.37.0 Upstream Status: Applied Origin: Upstream + Self Description: Fixes rustc to build and run correctly with LLVM-9.0.1. diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/abi.rs rustc-1.37.0-src/src/librustc_codegen_llvm/abi.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/abi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/abi.rs 2019-12-28 16:00:28.268466077 -0600 @@ -34,17 +34,17 @@ trait ArgAttributeExt { impl ArgAttributeExt for ArgAttribute { fn for_each_kind(&self, mut f: F) where F: FnMut(llvm::Attribute) { for_each_kind!(self, f, - ByVal, NoAlias, NoCapture, NonNull, ReadOnly, SExt, StructRet, ZExt, InReg) + NoAlias, NoCapture, NonNull, ReadOnly, SExt, StructRet, ZExt, InReg) } } pub trait ArgAttributesExt { - fn apply_llfn(&self, idx: AttributePlace, llfn: &Value); - fn apply_callsite(&self, idx: AttributePlace, callsite: &Value); + fn apply_llfn(&self, idx: AttributePlace, llfn: &Value, ty: Option<&Type>); + fn apply_callsite(&self, idx: AttributePlace, callsite: &Value, ty: Option<&Type>); } impl ArgAttributesExt for ArgAttributes { - fn apply_llfn(&self, idx: AttributePlace, llfn: &Value) { + fn apply_llfn(&self, idx: AttributePlace, llfn: &Value, ty: Option<&Type>) { let mut regular = self.regular; unsafe { let deref = self.pointee_size.bytes(); @@ -65,11 +65,14 @@ impl ArgAttributesExt for ArgAttributes idx.as_uint(), align.bytes() as u32); } + if regular.contains(ArgAttribute::ByVal) { + llvm::LLVMRustAddByValAttr(llfn, idx.as_uint(), ty.unwrap()); + } regular.for_each_kind(|attr| attr.apply_llfn(idx, llfn)); } } - fn apply_callsite(&self, idx: AttributePlace, callsite: &Value) { + fn apply_callsite(&self, idx: AttributePlace, callsite: &Value, ty: Option<&Type>) { let mut regular = self.regular; unsafe { let deref = self.pointee_size.bytes(); @@ -90,6 +93,9 @@ impl ArgAttributesExt for ArgAttributes idx.as_uint(), align.bytes() as u32); } + if regular.contains(ArgAttribute::ByVal) { + llvm::LLVMRustAddByValCallSiteAttr(callsite, idx.as_uint(), ty.unwrap()); + } regular.for_each_kind(|attr| attr.apply_callsite(idx, callsite)); } } @@ -298,7 +304,7 @@ pub trait FnTypeLlvmExt<'tcx> { fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type; fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type; fn llvm_cconv(&self) -> llvm::CallConv; - fn apply_attrs_llfn(&self, llfn: &'ll Value); + fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value); fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value); } @@ -384,51 +390,51 @@ impl<'tcx> FnTypeLlvmExt<'tcx> for FnTyp } } - fn apply_attrs_llfn(&self, llfn: &'ll Value) { + fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) { let mut i = 0; - let mut apply = |attrs: &ArgAttributes| { - attrs.apply_llfn(llvm::AttributePlace::Argument(i), llfn); + let mut apply = |attrs: &ArgAttributes, ty: Option<&Type>| { + attrs.apply_llfn(llvm::AttributePlace::Argument(i), llfn, ty); i += 1; }; match self.ret.mode { PassMode::Direct(ref attrs) => { - attrs.apply_llfn(llvm::AttributePlace::ReturnValue, llfn); + attrs.apply_llfn(llvm::AttributePlace::ReturnValue, llfn, None); } - PassMode::Indirect(ref attrs, _) => apply(attrs), + PassMode::Indirect(ref attrs, _) => apply(attrs, Some(self.ret.layout.llvm_type(cx))), _ => {} } for arg in &self.args { if arg.pad.is_some() { - apply(&ArgAttributes::new()); + apply(&ArgAttributes::new(), None); } match arg.mode { PassMode::Ignore(_) => {} PassMode::Direct(ref attrs) | - PassMode::Indirect(ref attrs, None) => apply(attrs), + PassMode::Indirect(ref attrs, None) => apply(attrs, Some(arg.layout.llvm_type(cx))), PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => { - apply(attrs); - apply(extra_attrs); + apply(attrs, None); + apply(extra_attrs, None); } PassMode::Pair(ref a, ref b) => { - apply(a); - apply(b); + apply(a, None); + apply(b, None); } - PassMode::Cast(_) => apply(&ArgAttributes::new()), + PassMode::Cast(_) => apply(&ArgAttributes::new(), None), } } } fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value) { let mut i = 0; - let mut apply = |attrs: &ArgAttributes| { - attrs.apply_callsite(llvm::AttributePlace::Argument(i), callsite); + let mut apply = |attrs: &ArgAttributes, ty: Option<&Type>| { + attrs.apply_callsite(llvm::AttributePlace::Argument(i), callsite, ty); i += 1; }; match self.ret.mode { PassMode::Direct(ref attrs) => { - attrs.apply_callsite(llvm::AttributePlace::ReturnValue, callsite); + attrs.apply_callsite(llvm::AttributePlace::ReturnValue, callsite, None); } - PassMode::Indirect(ref attrs, _) => apply(attrs), + PassMode::Indirect(ref attrs, _) => apply(attrs, Some(self.ret.layout.llvm_type(bx))), _ => {} } if let layout::Abi::Scalar(ref scalar) = self.ret.layout.abi { @@ -446,21 +452,21 @@ impl<'tcx> FnTypeLlvmExt<'tcx> for FnTyp } for arg in &self.args { if arg.pad.is_some() { - apply(&ArgAttributes::new()); + apply(&ArgAttributes::new(), None); } match arg.mode { PassMode::Ignore(_) => {} PassMode::Direct(ref attrs) | - PassMode::Indirect(ref attrs, None) => apply(attrs), + PassMode::Indirect(ref attrs, None) => apply(attrs, Some(arg.layout.llvm_type(bx))), PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => { - apply(attrs); - apply(extra_attrs); + apply(attrs, None); + apply(extra_attrs, None); } PassMode::Pair(ref a, ref b) => { - apply(a); - apply(b); + apply(a, None); + apply(b, None); } - PassMode::Cast(_) => apply(&ArgAttributes::new()), + PassMode::Cast(_) => apply(&ArgAttributes::new(), None), } } diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/attributes.rs rustc-1.37.0-src/src/librustc_codegen_llvm/attributes.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/attributes.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/attributes.rs 2019-12-28 15:51:57.992559192 -0600 @@ -119,6 +119,29 @@ pub fn set_probestack(cx: &CodegenCx<'ll const_cstr!("probe-stack"), const_cstr!("__rust_probestack")); } +fn translate_obsolete_target_features(feature: &str) -> &str { + const LLVM9_FEATURE_CHANGES: &[(&str, &str)] = &[ + ("+fp-only-sp", "-fp64"), + ("-fp-only-sp", "+fp64"), + ("+d16", "-d32"), + ("-d16", "+d32"), + ]; + if llvm_util::get_major_version() >= 9 { + for &(old, new) in LLVM9_FEATURE_CHANGES { + if feature == old { + return new; + } + } + } else { + for &(old, new) in LLVM9_FEATURE_CHANGES { + if feature == new { + return old; + } + } + } + feature +} + pub fn llvm_target_features(sess: &Session) -> impl Iterator { const RUSTC_SPECIFIC_FEATURES: &[&str] = &[ "crt-static", @@ -129,6 +152,7 @@ pub fn llvm_target_features(sess: &Sessi sess.target.target.options.features.split(',') .chain(cmdline) .filter(|l| !l.is_empty()) + .map(translate_obsolete_target_features) } pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/common.rs rustc-1.37.0-src/src/librustc_codegen_llvm/common.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/common.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/common.rs 2019-12-28 11:32:33.881902945 -0600 @@ -249,6 +249,10 @@ impl ConstMethods<'tcx> for CodegenCx<'l self.const_uint(self.type_i8(), i as u64) } + fn const_real(&self, t: &'ll Type, val: f64) -> &'ll Value { + unsafe { llvm::LLVMConstReal(t, val) } + } + fn const_struct( &self, elts: &[&'ll Value], diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/context.rs rustc-1.37.0-src/src/librustc_codegen_llvm/context.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/context.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/context.rs 2019-12-28 16:08:15.590628080 -0600 @@ -1,5 +1,6 @@ use crate::attributes; use crate::llvm; +use crate::llvm_util; use crate::debuginfo; use crate::value::Value; use rustc::dep_graph::DepGraphSafe; @@ -140,6 +141,11 @@ pub fn is_pie_binary(sess: &Session) -> !is_any_library(sess) && get_reloc_model(sess) == llvm::RelocMode::PIC } +fn strip_function_ptr_alignment(data_layout: String) -> String { + // FIXME: Make this more general. + data_layout.replace("-Fi8-", "-") +} + pub unsafe fn create_module( tcx: TyCtxt<'_>, llcx: &'ll llvm::Context, @@ -149,14 +155,19 @@ pub unsafe fn create_module( let mod_name = SmallCStr::new(mod_name); let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx); + let mut target_data_layout = sess.target.target.data_layout.clone(); + if llvm_util::get_major_version() < 9 { + target_data_layout = strip_function_ptr_alignment(target_data_layout); + } + // Ensure the data-layout values hardcoded remain the defaults. if sess.target.target.options.is_builtin { let tm = crate::back::write::create_informational_target_machine(&tcx.sess, false); llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); llvm::LLVMRustDisposeTargetMachine(tm); - let data_layout = llvm::LLVMGetDataLayout(llmod); - let data_layout = str::from_utf8(CStr::from_ptr(data_layout).to_bytes()) + let llvm_data_layout = llvm::LLVMGetDataLayout(llmod); + let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes()) .ok().expect("got a non-UTF8 data-layout from LLVM"); // Unfortunately LLVM target specs change over time, and right now we @@ -177,16 +188,16 @@ pub unsafe fn create_module( let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or(""); let custom_llvm_used = cfg_llvm_root.trim() != ""; - if !custom_llvm_used && sess.target.target.data_layout != data_layout { + if !custom_llvm_used && target_data_layout != llvm_data_layout { bug!("data-layout for builtin `{}` target, `{}`, \ differs from LLVM default, `{}`", sess.target.target.llvm_target, - sess.target.target.data_layout, - data_layout); + target_data_layout, + llvm_data_layout); } } - let data_layout = SmallCStr::new(&sess.target.target.data_layout); + let data_layout = SmallCStr::new(&target_data_layout); llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr()); let llvm_target = SmallCStr::new(&sess.target.target.llvm_target); diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/declare.rs rustc-1.37.0-src/src/librustc_codegen_llvm/declare.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/declare.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/declare.rs 2019-12-27 17:45:22.685818771 -0600 @@ -107,7 +107,7 @@ impl DeclareMethods<'tcx> for CodegenCx< llvm::Attribute::NoReturn.apply_llfn(Function, llfn); } - fty.apply_attrs_llfn(llfn); + fty.apply_attrs_llfn(self, llfn); llfn } diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/intrinsic.rs rustc-1.37.0-src/src/librustc_codegen_llvm/intrinsic.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/intrinsic.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/intrinsic.rs 2019-12-28 11:33:58.785281137 -0600 @@ -1663,9 +1663,10 @@ fn generic_simd_intrinsic( acc } else { // unordered arithmetic reductions do not: + let identity_acc = if $name.contains("mul") { 1.0 } else { 0.0 }; match f.bit_width() { - 32 => bx.const_undef(bx.type_f32()), - 64 => bx.const_undef(bx.type_f64()), + 32 => bx.const_real(bx.type_f32(), identity_acc), + 64 => bx.const_real(bx.type_f64(), identity_acc), v => { return_error!(r#" unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_llvm/llvm/ffi.rs rustc-1.37.0-src/src/librustc_codegen_llvm/llvm/ffi.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_llvm/llvm/ffi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_llvm/llvm/ffi.rs 2019-12-28 11:34:51.608526137 -0600 @@ -715,6 +715,7 @@ extern "C" { // Operations on scalar constants pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value; pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value; + pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value; pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong; pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool, high: &mut u64, low: &mut u64) -> bool; @@ -794,6 +795,7 @@ extern "C" { pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32); pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64); pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64); + pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type); pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute); pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value, index: c_uint, @@ -824,6 +826,7 @@ extern "C" { pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64); + pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type); // Operations on load/store instructions (only) pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool); diff -Naurp rustc-1.37.0-src.orig/src/librustc_codegen_ssa/traits/consts.rs rustc-1.37.0-src/src/librustc_codegen_ssa/traits/consts.rs --- rustc-1.37.0-src.orig/src/librustc_codegen_ssa/traits/consts.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_codegen_ssa/traits/consts.rs 2019-12-28 11:35:35.503734751 -0600 @@ -17,6 +17,7 @@ pub trait ConstMethods<'tcx>: BackendTyp fn const_u64(&self, i: u64) -> Self::Value; fn const_usize(&self, i: u64) -> Self::Value; fn const_u8(&self, i: u8) -> Self::Value; + fn const_real(&self, t: Self::Type, val: f64) -> Self::Value; fn const_struct(&self, elts: &[Self::Value], packed: bool) -> Self::Value; diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armebv7r_none_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armebv7r_none_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armebv7r_none_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armebv7r_none_eabihf.rs 2019-12-27 18:23:34.564554281 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "big".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), @@ -21,7 +21,7 @@ pub fn target() -> TargetResult { linker: Some("rust-lld".to_owned()), relocation_model: "static".to_string(), panic_strategy: PanicStrategy::Abort, - features: "+vfp3,+d16,+fp-only-sp".to_string(), + features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), abi_blacklist: super::arm_base::abi_blacklist(), emit_debug_gdb_scripts: false, diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armebv7r_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/armebv7r_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armebv7r_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armebv7r_none_eabi.rs 2019-12-27 18:22:31.007176457 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "big".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: "".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/arm_linux_androideabi.rs rustc-1.37.0-src/src/librustc_target/spec/arm_linux_androideabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/arm_linux_androideabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/arm_linux_androideabi.rs 2019-12-27 18:13:15.094825407 -0600 @@ -11,7 +11,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "android".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs 2019-12-27 18:17:38.152423998 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs 2019-12-27 18:16:48.073121866 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs 2019-12-27 18:20:52.617590015 -0600 @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "musl".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_musleabi.rs rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_musleabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/arm_unknown_linux_musleabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/arm_unknown_linux_musleabi.rs 2019-12-27 18:18:38.341786028 -0600 @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "musl".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs rustc-1.37.0-src/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs 2019-12-27 18:24:36.099919453 -0600 @@ -7,7 +7,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs rustc-1.37.0-src/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs 2019-12-27 18:25:24.545206546 -0600 @@ -7,7 +7,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32:S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs rustc-1.37.0-src/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs 2019-12-27 18:26:33.663615607 -0600 @@ -10,7 +10,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "musl".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv6_unknown_freebsd.rs rustc-1.37.0-src/src/librustc_target/spec/armv6_unknown_freebsd.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv6_unknown_freebsd.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv6_unknown_freebsd.rs 2019-12-27 18:29:17.706824516 -0600 @@ -7,7 +7,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "freebsd".to_string(), target_env: "gnueabihf".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs 2019-12-27 18:30:14.752922022 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "netbsd".to_string(), target_env: "eabihf".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_apple_ios.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_apple_ios.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_apple_ios.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_apple_ios.rs 2019-12-27 18:32:53.676298551 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), + data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), arch: "arm".to_string(), target_os: "ios".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_linux_androideabi.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_linux_androideabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_linux_androideabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_linux_androideabi.rs 2019-12-27 19:40:04.520186183 -0600 @@ -10,7 +10,7 @@ use crate::spec::{LinkerFlavor, Target, pub fn target() -> TargetResult { let mut base = super::android_base::opts(); - base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+d16,-neon".to_string(); + base.features = "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(); base.max_atomic_width = Some(64); base.pre_link_args .get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string()); @@ -20,7 +20,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "android".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7r_none_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv7r_none_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7r_none_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7r_none_eabihf.rs 2019-12-28 11:17:14.951381826 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: "".to_string(), @@ -21,7 +21,7 @@ pub fn target() -> TargetResult { linker: Some("rust-lld".to_owned()), relocation_model: "static".to_string(), panic_strategy: PanicStrategy::Abort, - features: "+vfp3,+d16,+fp-only-sp".to_string(), + features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), abi_blacklist: super::arm_base::abi_blacklist(), emit_debug_gdb_scripts: false, diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7r_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/armv7r_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7r_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7r_none_eabi.rs 2019-12-28 11:16:10.504973399 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: "".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7s_apple_ios.rs rustc-1.37.0-src/src/librustc_target/spec/armv7s_apple_ios.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7s_apple_ios.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7s_apple_ios.rs 2019-12-28 11:18:52.428996886 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), + data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(), arch: "arm".to_string(), target_os: "ios".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs 2019-12-28 11:11:27.634157914 -0600 @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "cloudabi".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_freebsd.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_freebsd.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_freebsd.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_freebsd.rs 2019-12-28 11:12:40.035626815 -0600 @@ -7,7 +7,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "freebsd".to_string(), target_env: "gnueabihf".to_string(), @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), abi_blacklist: super::arm_base::abi_blacklist(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs 2019-12-28 11:13:14.397848221 -0600 @@ -10,7 +10,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), @@ -19,7 +19,7 @@ pub fn target() -> TargetResult { options: TargetOptions { // Info about features at https://wiki.debian.org/ArmHardFloatPort - features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), abi_blacklist: super::arm_base::abi_blacklist(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs 2019-12-28 11:14:02.671158142 -0600 @@ -12,7 +12,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "musl".to_string(), @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { // Most of these settings are copied from the armv7_unknown_linux_gnueabihf // target. options: TargetOptions { - features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), abi_blacklist: super::arm_base::abi_blacklist(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs 2019-12-28 11:15:11.938600805 -0600 @@ -7,7 +7,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "netbsd".to_string(), target_env: "eabihf".to_string(), @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), abi_blacklist: super::arm_base::abi_blacklist(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv6m_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv6m_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv6m_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv6m_none_eabi.rs 2019-12-28 11:19:27.888219910 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs 2019-12-28 11:20:04.976452810 -0600 @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:w-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "windows".to_string(), target_env: "msvc".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7em_none_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7em_none_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7em_none_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7em_none_eabihf.rs 2019-12-28 11:21:38.722040005 -0600 @@ -6,7 +6,7 @@ // Additionally, this target uses the "hard" floating convention (ABI) where floating point values // are passed to/from subroutines via FPU registers (S0, S1, D0, D1, etc.). // -// To opt into double precision hardware support, use the `-C target-feature=-fp-only-sp` flag. +// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; @@ -16,7 +16,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), @@ -26,14 +26,14 @@ pub fn target() -> TargetResult { options: TargetOptions { // `+vfp4` is the lowest common denominator between the Cortex-M4 (vfp4-16) and the // Cortex-M7 (vfp5) - // `+d16` both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers + // `-d32` both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers // available - // `+fp-only-sp` The Cortex-M4 only supports single precision floating point operations + // `-fp64` The Cortex-M4 only supports single precision floating point operations // whereas in the Cortex-M7 double precision is optional // // Reference: // ARMv7-M Architecture Reference Manual - A2.5 The optional floating-point extension - features: "+vfp4,+d16,+fp-only-sp".to_string(), + features: "+vfp4,-d32,-fp64".to_string(), max_atomic_width: Some(32), .. super::thumb_base::opts() } diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7em_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7em_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7em_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7em_none_eabi.rs 2019-12-28 11:20:52.873753079 -0600 @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7m_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7m_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7m_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7m_none_eabi.rs 2019-12-28 11:22:40.339424933 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs 2019-12-28 11:23:29.462731298 -0600 @@ -20,7 +20,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "android".to_string(), target_env: "".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs 2019-12-28 11:24:05.184953819 -0600 @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnu".to_string(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_base_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_base_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_base_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_base_none_eabi.rs 2019-12-28 11:25:05.154326941 -0600 @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs 2019-12-28 11:26:01.488676998 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { // the FPU uses the FPv5 architecture, single-precision instructions // and 16 D registers. // These parameters map to the following LLVM features. - features: "+fp-armv8,+fp-only-sp,+d16".to_string(), + features: "+fp-armv8,-fp64,-d32".to_string(), max_atomic_width: Some(32), .. super::thumb_base::opts() }, diff -Naurp rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_main_none_eabi.rs rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_main_none_eabi.rs --- rustc-1.37.0-src.orig/src/librustc_target/spec/thumbv8m_main_none_eabi.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/librustc_target/spec/thumbv8m_main_none_eabi.rs 2019-12-28 11:25:33.388502444 -0600 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), arch: "arm".to_string(), target_os: "none".to_string(), target_env: String::new(), diff -Naurp rustc-1.37.0-src.orig/src/rustllvm/PassWrapper.cpp rustc-1.37.0-src/src/rustllvm/PassWrapper.cpp --- rustc-1.37.0-src.orig/src/rustllvm/PassWrapper.cpp 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/rustllvm/PassWrapper.cpp 2019-12-28 14:35:34.501864029 -0600 @@ -913,7 +913,10 @@ LLVMRustCreateThinLTOData(LLVMRustThinLT GlobalValue::LinkageTypes NewLinkage) { ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; -#if LLVM_VERSION_GE(8, 0) +#if LLVM_VERSION_GE(9, 0) + thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage, + Ret->GUIDPreservedSymbols); +#elif LLVM_VERSION_GE(8, 0) thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage); #else thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage); diff -Naurp rustc-1.37.0-src.orig/src/rustllvm/RustWrapper.cpp rustc-1.37.0-src/src/rustllvm/RustWrapper.cpp --- rustc-1.37.0-src.orig/src/rustllvm/RustWrapper.cpp 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/rustllvm/RustWrapper.cpp 2019-12-28 15:10:38.483657185 -0600 @@ -237,6 +237,17 @@ extern "C" void LLVMRustAddDereferenceab Call->getContext(), Index, B)); } +extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index, + LLVMTypeRef Ty) { + CallSite Call = CallSite(unwrap(Instr)); +#if LLVM_VERSION_GE(9, 0) + Attribute Attr = Attribute::getWithByValType(Call->getContext(), unwrap(Ty)); +#else + Attribute Attr = Attribute::get(Call->getContext(), Attribute::ByVal); +#endif + Call.addAttribute(Index, Attr); +} + extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, LLVMRustAttribute RustAttr) { Function *A = unwrap(Fn); @@ -271,6 +282,17 @@ extern "C" void LLVMRustAddDereferenceab A->addAttributes(Index, B); } +extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index, + LLVMTypeRef Ty) { + Function *F = unwrap(Fn); +#if LLVM_VERSION_GE(9, 0) + Attribute Attr = Attribute::getWithByValType(F->getContext(), unwrap(Ty)); +#else + Attribute Attr = Attribute::get(F->getContext(), Attribute::ByVal); +#endif + F->addAttribute(Index, Attr); +} + extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, unsigned Index, const char *Name, diff -Naurp rustc-1.37.0-src.orig/src/test/codegen/mainsubprogram.rs rustc-1.37.0-src/src/test/codegen/mainsubprogram.rs --- rustc-1.37.0-src.orig/src/test/codegen/mainsubprogram.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/test/codegen/mainsubprogram.rs 2019-12-28 11:36:56.213128959 -0600 @@ -7,7 +7,7 @@ // compile-flags: -g -C no-prepopulate-passes // CHECK-LABEL: @main -// CHECK: {{.*}}DISubprogram{{.*}}name: "main",{{.*}}DIFlagMainSubprogram{{.*}} +// CHECK: {{.*}}DISubprogram{{.*}}name: "main",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}} pub fn main() { } diff -Naurp rustc-1.37.0-src.orig/src/test/codegen/mainsubprogramstart.rs rustc-1.37.0-src/src/test/codegen/mainsubprogramstart.rs --- rustc-1.37.0-src.orig/src/test/codegen/mainsubprogramstart.rs 2019-08-13 01:27:22.000000000 -0500 +++ rustc-1.37.0-src/src/test/codegen/mainsubprogramstart.rs 2019-12-28 11:37:23.519265146 -0600 @@ -6,7 +6,7 @@ #![feature(start)] // CHECK-LABEL: @main -// CHECK: {{.*}}DISubprogram{{.*}}name: "start",{{.*}}DIFlagMainSubprogram{{.*}} +// CHECK: {{.*}}DISubprogram{{.*}}name: "start",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}} #[start] fn start(_: isize, _: *const *const u8) -> isize {