Hello community, here is the log from the commit of package rust for openSUSE:Leap:15.2 checked in at 2020-05-29 18:49:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/rust (Old) and /work/SRC/openSUSE:Leap:15.2/.rust.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rust" Fri May 29 18:49:17 2020 rev:44 rq:796261 version:1.36.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/rust/rust.changes 2020-01-15 16:00:48.547842422 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.rust.new.3606/rust.changes 2020-05-29 18:49:22.248236017 +0200 @@ -1,0 +2,13 @@ +Fri Mar 20 10:44:46 UTC 2020 - Antonio Larrosa <alarr...@suse.com> + +- Add patches from upstream to fix build with llvm9 (boo#1164454): + * 0001-Pass-GUIDPreservedSymbols-to-thinLTOResolvePrevailingInIndex.patch + * 0002-Pass-type-to-byval-attributes.patch + * 0003-Translate-target-features-for-LLVM9.patch + * 0004-Use-new-feature-names-in-target-feature-lists.patch + * 0005-Add-functio-pointer-alignment-to-ARM_Thumb-data-layout.patch + * 0006-Strip-functio-pointer-alignment-for-older-LLVM-versions.patch + * 0007-Fix-float-add-mul-reduction-codegen.patch + * 0008-Adjust-codegen-tests-for-DISPFlagMainSubprogram.patch + +------------------------------------------------------------------- New: ---- 0001-Pass-GUIDPreservedSymbols-to-thinLTOResolvePrevailingInIndex.patch 0002-Pass-type-to-byval-attributes.patch 0003-Translate-target-features-for-LLVM9.patch 0004-Use-new-feature-names-in-target-feature-lists.patch 0005-Add-functio-pointer-alignment-to-ARM_Thumb-data-layout.patch 0006-Strip-functio-pointer-alignment-for-older-LLVM-versions.patch 0007-Fix-float-add-mul-reduction-codegen.patch 0008-Adjust-codegen-tests-for-DISPFlagMainSubprogram.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rust.spec ++++++ --- /var/tmp/diff_new_pack.nGECbu/_old 2020-05-29 18:49:30.120258608 +0200 +++ /var/tmp/diff_new_pack.nGECbu/_new 2020-05-29 18:49:30.120258608 +0200 @@ -124,6 +124,23 @@ Patch0: ignore-Wstring-conversion.patch # PATCH-FIX-UPSTREAM: Revert changes which cause llvm to rebuild - https://github.com/rust-lang/rust/issues/61206 Patch1: rust-revert-llvm-build-info.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch2: 0001-Pass-GUIDPreservedSymbols-to-thinLTOResolvePrevailingInIndex.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch3: 0002-Pass-type-to-byval-attributes.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch4: 0003-Translate-target-features-for-LLVM9.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch5: 0004-Use-new-feature-names-in-target-feature-lists.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch6: 0005-Add-functio-pointer-alignment-to-ARM_Thumb-data-layout.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch7: 0006-Strip-functio-pointer-alignment-for-older-LLVM-versions.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch8: 0007-Fix-float-add-mul-reduction-codegen.patch +# PATCH-FIX-UPSTREAM: Prepare for LLVM 9 update - https://github.com/rust-lang/rust/pull/62474 +Patch9: 0008-Adjust-codegen-tests-for-DISPFlagMainSubprogram.patch + BuildRequires: ccache # Leap 42 to 42.3, SLE12 SP1, SP2 %if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120200 @@ -374,6 +391,16 @@ %patch0 -p1 %patch1 -p1 +%if %{?pkg_vcmp:%{pkg_vcmp llvm-devel >= 9.0}}%{!?pkg_vcmp:0} +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%endif # use python3 sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py ++++++ 0001-Pass-GUIDPreservedSymbols-to-thinLTOResolvePrevailingInIndex.patch ++++++ >From 04304fcd16e40c936dc5ba71c9ac3c445597f8bb Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sat, 6 Jul 2019 19:02:48 +0200 Subject: [PATCH] Pass GUIDPreservedSymbols to thinLTOResolvePrevailingInIndex() Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/rustllvm/PassWrapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 0ebef82d3768..cea88f14dcc6 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -913,7 +913,10 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, 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); ++++++ 0002-Pass-type-to-byval-attributes.patch ++++++ >From eb338220911fbcf0661e4f8802b23d0bd4e5d077 Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sat, 6 Jul 2019 21:52:25 +0200 Subject: [PATCH] Pass type to byval attributes Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_codegen_llvm/abi.rs | 64 +++++++++++++++------------ src/librustc_codegen_llvm/declare.rs | 2 +- src/librustc_codegen_llvm/llvm/ffi.rs | 2 + src/rustllvm/RustWrapper.cpp | 22 +++++++++ 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 38d4b7e3f9d8..ff87afe0c444 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -34,17 +34,17 @@ trait ArgAttributeExt { impl ArgAttributeExt for ArgAttribute { fn for_each_kind<F>(&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 FnType<'tcx, Ty<'tcx>> { } } - 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 FnType<'tcx, Ty<'tcx>> { } 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 --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index bcb14b8899ec..62eab0f3d4e6 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -107,7 +107,7 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> { llvm::Attribute::NoReturn.apply_llfn(Function, llfn); } - fty.apply_attrs_llfn(llfn); + fty.apply_attrs_llfn(self, llfn); llfn } diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index a5c295cd4525..75f639ec3eca 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -794,6 +794,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 +825,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 --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 66453c08a66e..16d08ee534ed 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -237,6 +237,17 @@ extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr, Call->getContext(), Index, B)); } +extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index, + LLVMTypeRef Ty) { + CallSite Call = CallSite(unwrap<Instruction>(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<Function>(Fn); @@ -271,6 +282,17 @@ extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn, A->addAttributes(Index, B); } +extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index, + LLVMTypeRef Ty) { + Function *F = unwrap<Function>(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, ++++++ 0003-Translate-target-features-for-LLVM9.patch ++++++ >From b57c499ea227a973fc3eb319cbe6d5019948d86c Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 17:44:00 +0200 Subject: [PATCH] Translate target features for LLVM 9 Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_codegen_llvm/attributes.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 94abf1796d36..33b50401b22f 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -119,6 +119,29 @@ pub fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { 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<Item = &str> { const RUSTC_SPECIFIC_FEATURES: &[&str] = &[ "crt-static", @@ -129,6 +152,7 @@ pub fn llvm_target_features(sess: &Session) -> impl Iterator<Item = &str> { 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) { ++++++ 0004-Use-new-feature-names-in-target-feature-lists.patch ++++++ >From 3170b62cca5693d355e702a26777679316647b20 Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 18:10:12 +0200 Subject: [PATCH] Use new feature names in target feature lists Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_target/spec/armebv7r_none_eabihf.rs | 2 +- src/librustc_target/spec/armv7_linux_androideabi.rs | 2 +- src/librustc_target/spec/armv7_unknown_freebsd.rs | 2 +- src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs | 2 +- .../spec/armv7_unknown_linux_musleabihf.rs | 2 +- src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs | 2 +- src/librustc_target/spec/armv7r_none_eabihf.rs | 2 +- src/librustc_target/spec/thumbv7em_none_eabihf.rs | 8 ++++---- src/librustc_target/spec/thumbv8m_main_none_eabihf.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/librustc_target/spec/armebv7r_none_eabihf.rs b/src/librustc_target/spec/armebv7r_none_eabihf.rs index 50ee76414ef9..ff8e43100e2c 100644 --- a/src/librustc_target/spec/armebv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armebv7r_none_eabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7_linux_androideabi.rs b/src/librustc_target/spec/armv7_linux_androideabi.rs index 92f1a55e024d..4c13c6669c3f 100644 --- a/src/librustc_target/spec/armv7_linux_androideabi.rs +++ b/src/librustc_target/spec/armv7_linux_androideabi.rs @@ -10,7 +10,7 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; 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()); diff --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs index ca7ab474bef8..0509ddab048e 100644 --- a/src/librustc_target/spec/armv7_unknown_freebsd.rs +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs index f0952cccb208..ff34fda75028 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs index a9974f6b80c9..de22fbbaa4c8 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs index e2d55e9317b7..a654e40d0ae5 100644 --- a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7r_none_eabihf.rs b/src/librustc_target/spec/armv7r_none_eabihf.rs index 06ef9f3ec4e3..24772475e047 100644 --- a/src/librustc_target/spec/armv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armv7r_none_eabihf.rs @@ -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 --git a/src/librustc_target/spec/thumbv7em_none_eabihf.rs b/src/librustc_target/spec/thumbv7em_none_eabihf.rs index e4358bdd7991..5c386a00ba4e 100644 --- a/src/librustc_target/spec/thumbv7em_none_eabihf.rs +++ b/src/librustc_target/spec/thumbv7em_none_eabihf.rs @@ -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}; @@ -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 --git a/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs index 6a3d8e61d7fe..7dc30e76dccd 100644 --- a/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs +++ b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs @@ -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() }, ++++++ 0005-Add-functio-pointer-alignment-to-ARM_Thumb-data-layout.patch ++++++ >From 5324b42a59d9af002e4103ffb410f6345cbdeb7b Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 18:18:02 +0200 Subject: [PATCH] Add function pointer alignment to ARM/Thumb data layout Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_target/spec/arm_linux_androideabi.rs | 2 +- src/librustc_target/spec/arm_unknown_linux_gnueabi.rs | 2 +- src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs | 2 +- src/librustc_target/spec/arm_unknown_linux_musleabi.rs | 2 +- src/librustc_target/spec/arm_unknown_linux_musleabihf.rs | 2 +- src/librustc_target/spec/armebv7r_none_eabi.rs | 2 +- src/librustc_target/spec/armebv7r_none_eabihf.rs | 2 +- src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs | 2 +- src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs | 2 +- src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs | 2 +- src/librustc_target/spec/armv6_unknown_freebsd.rs | 2 +- src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs | 2 +- src/librustc_target/spec/armv7_apple_ios.rs | 2 +- src/librustc_target/spec/armv7_linux_androideabi.rs | 2 +- src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs | 2 +- src/librustc_target/spec/armv7_unknown_freebsd.rs | 2 +- src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs | 2 +- src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs | 2 +- src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs | 2 +- src/librustc_target/spec/armv7r_none_eabi.rs | 2 +- src/librustc_target/spec/armv7r_none_eabihf.rs | 2 +- src/librustc_target/spec/armv7s_apple_ios.rs | 2 +- src/librustc_target/spec/thumbv6m_none_eabi.rs | 2 +- src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs | 2 +- src/librustc_target/spec/thumbv7em_none_eabi.rs | 2 +- src/librustc_target/spec/thumbv7em_none_eabihf.rs | 2 +- src/librustc_target/spec/thumbv7m_none_eabi.rs | 2 +- src/librustc_target/spec/thumbv7neon_linux_androideabi.rs | 2 +- src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs | 2 +- src/librustc_target/spec/thumbv8m_base_none_eabi.rs | 2 +- src/librustc_target/spec/thumbv8m_main_none_eabi.rs | 2 +- src/librustc_target/spec/thumbv8m_main_none_eabihf.rs | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/librustc_target/spec/arm_linux_androideabi.rs b/src/librustc_target/spec/arm_linux_androideabi.rs index bb066dc9ad83..c02edabd886f 100644 --- a/src/librustc_target/spec/arm_linux_androideabi.rs +++ b/src/librustc_target/spec/arm_linux_androideabi.rs @@ -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 --git a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs index 2f835420148f..1d5751c1f713 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs @@ -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 --git a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs index cd4b2e1c9225..8eb19a6518a3 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs @@ -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 --git a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs index 606c3f190603..5c40b6fb89fd 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs @@ -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 --git a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs index d22156bc328e..496a0c4a43a7 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs @@ -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 --git a/src/librustc_target/spec/armebv7r_none_eabi.rs b/src/librustc_target/spec/armebv7r_none_eabi.rs index 86c62daa6180..0b41b920e584 100644 --- a/src/librustc_target/spec/armebv7r_none_eabi.rs +++ b/src/librustc_target/spec/armebv7r_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/armebv7r_none_eabihf.rs b/src/librustc_target/spec/armebv7r_none_eabihf.rs index ff8e43100e2c..5f1bfdce355c 100644 --- a/src/librustc_target/spec/armebv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armebv7r_none_eabihf.rs @@ -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(), diff --git a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs index e7da24843cc0..264bf8d871d7 100644 --- a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs @@ -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 --git a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs index ea586f42c269..d0f1222d87a5 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs @@ -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 --git a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs index dae5c8c3d750..9c08a7741a65 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs @@ -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 --git a/src/librustc_target/spec/armv6_unknown_freebsd.rs b/src/librustc_target/spec/armv6_unknown_freebsd.rs index a90590a39e75..efbbee959ed9 100644 --- a/src/librustc_target/spec/armv6_unknown_freebsd.rs +++ b/src/librustc_target/spec/armv6_unknown_freebsd.rs @@ -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 --git a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs index b056776bdfb8..b76c39ac75b8 100644 --- a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7_apple_ios.rs b/src/librustc_target/spec/armv7_apple_ios.rs index 2052d17403df..c1e1caf8e2e7 100644 --- a/src/librustc_target/spec/armv7_apple_ios.rs +++ b/src/librustc_target/spec/armv7_apple_ios.rs @@ -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 --git a/src/librustc_target/spec/armv7_linux_androideabi.rs b/src/librustc_target/spec/armv7_linux_androideabi.rs index 4c13c6669c3f..e22a853814a0 100644 --- a/src/librustc_target/spec/armv7_linux_androideabi.rs +++ b/src/librustc_target/spec/armv7_linux_androideabi.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs index c03f4b544ed0..7065d30a5beb 100644 --- a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs index 0509ddab048e..219b06362f3f 100644 --- a/src/librustc_target/spec/armv7_unknown_freebsd.rs +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -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 --git a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs index ff34fda75028..1dd53b1b4229 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs @@ -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(), diff --git a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs index de22fbbaa4c8..ee8e48e3e751 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs @@ -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(), diff --git a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs index a654e40d0ae5..1d63b0261c1a 100644 --- a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs @@ -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(), diff --git a/src/librustc_target/spec/armv7r_none_eabi.rs b/src/librustc_target/spec/armv7r_none_eabi.rs index 19d332467dec..814ca1d77ac7 100644 --- a/src/librustc_target/spec/armv7r_none_eabi.rs +++ b/src/librustc_target/spec/armv7r_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/armv7r_none_eabihf.rs b/src/librustc_target/spec/armv7r_none_eabihf.rs index 24772475e047..decf1a01e0b1 100644 --- a/src/librustc_target/spec/armv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armv7r_none_eabihf.rs @@ -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 --git a/src/librustc_target/spec/armv7s_apple_ios.rs b/src/librustc_target/spec/armv7s_apple_ios.rs index 29e290285e4a..55e2a876865e 100644 --- a/src/librustc_target/spec/armv7s_apple_ios.rs +++ b/src/librustc_target/spec/armv7s_apple_ios.rs @@ -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 --git a/src/librustc_target/spec/thumbv6m_none_eabi.rs b/src/librustc_target/spec/thumbv6m_none_eabi.rs index 2ab61b57f6bb..28353552fc71 100644 --- a/src/librustc_target/spec/thumbv6m_none_eabi.rs +++ b/src/librustc_target/spec/thumbv6m_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs index 310fac31c0c5..886e31882726 100644 --- a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs +++ b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs @@ -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 --git a/src/librustc_target/spec/thumbv7em_none_eabi.rs b/src/librustc_target/spec/thumbv7em_none_eabi.rs index 97114c342cdc..4e2f9b91b0d5 100644 --- a/src/librustc_target/spec/thumbv7em_none_eabi.rs +++ b/src/librustc_target/spec/thumbv7em_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv7em_none_eabihf.rs b/src/librustc_target/spec/thumbv7em_none_eabihf.rs index 5c386a00ba4e..c510be519c0a 100644 --- a/src/librustc_target/spec/thumbv7em_none_eabihf.rs +++ b/src/librustc_target/spec/thumbv7em_none_eabihf.rs @@ -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(), diff --git a/src/librustc_target/spec/thumbv7m_none_eabi.rs b/src/librustc_target/spec/thumbv7m_none_eabi.rs index daf25b16d58d..9c9868ef37c3 100644 --- a/src/librustc_target/spec/thumbv7m_none_eabi.rs +++ b/src/librustc_target/spec/thumbv7m_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs index e248b930e6e4..f3142ef60023 100644 --- a/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs +++ b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs index bef62b0a2ebe..5524bc9ab662 100644 --- a/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs @@ -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 --git a/src/librustc_target/spec/thumbv8m_base_none_eabi.rs b/src/librustc_target/spec/thumbv8m_base_none_eabi.rs index be8a476db4db..0b4750093cc2 100644 --- a/src/librustc_target/spec/thumbv8m_base_none_eabi.rs +++ b/src/librustc_target/spec/thumbv8m_base_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv8m_main_none_eabi.rs b/src/librustc_target/spec/thumbv8m_main_none_eabi.rs index 49ab643d484b..acce424136db 100644 --- a/src/librustc_target/spec/thumbv8m_main_none_eabi.rs +++ b/src/librustc_target/spec/thumbv8m_main_none_eabi.rs @@ -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 --git a/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs index 7dc30e76dccd..455d56b095bf 100644 --- a/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs +++ b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs @@ -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(), ++++++ 0006-Strip-functio-pointer-alignment-for-older-LLVM-versions.patch ++++++ >From 8789c9e59596c5f89c6be6b82a880e016d6c2f31 Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 18:41:28 +0200 Subject: [PATCH] Strip function pointer alignment for older LLVM versions Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_codegen_llvm/context.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 6a61b180de43..2b68eb53a4ab 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -1,5 +1,6 @@ use crate::attributes; use crate::llvm; +use crate::llvm_util; use crate::debuginfo; use crate::monomorphize::Instance; use crate::value::Value; # use rustc::dep_graph::DepGraphSafe; @@ -140,6 +141,11 @@ pub fn is_pie_binary(sess: &Session) -> bool { !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<'_>, 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); ++++++ 0007-Fix-float-add-mul-reduction-codegen.patch ++++++ >From 5c95f5fa6b6024ea0b8ed162e5d2c46c41aea1b0 Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 19:08:40 +0200 Subject: [PATCH] Fix float add/mul reduction codegen The accumulator is now respected for unordered reductions. Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/librustc_codegen_llvm/common.rs | 4 ++++ src/librustc_codegen_llvm/intrinsic.rs | 5 +++-- src/librustc_codegen_llvm/llvm/ffi.rs | 1 + src/librustc_codegen_ssa/traits/consts.rs | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 3b2701b893bb..e9f25e6344b0 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -249,6 +249,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { 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 --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 69f8356f6692..dd6cfd7e29e4 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -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 --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 75f639ec3eca..4bf0faa1ec32 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -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; diff --git a/src/librustc_codegen_ssa/traits/consts.rs b/src/librustc_codegen_ssa/traits/consts.rs index 46286b5329e4..248fadfaf0f2 100644 --- a/src/librustc_codegen_ssa/traits/consts.rs +++ b/src/librustc_codegen_ssa/traits/consts.rs @@ -17,6 +17,7 @@ pub trait ConstMethods<'tcx>: BackendTypes { 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; ++++++ 0008-Adjust-codegen-tests-for-DISPFlagMainSubprogram.patch ++++++ >From ac560258e36659d542850651fc1b79e4db2eb29d Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita....@gmail.com> Date: Sun, 7 Jul 2019 20:22:56 +0200 Subject: [PATCH] Adjust codegen tests for DISPFlagMainSubprogram Part of: Prepare for LLVM 9 update https://github.com/rust-lang/rust/pull/62474 --- src/test/codegen/mainsubprogram.rs | 2 +- src/test/codegen/mainsubprogramstart.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/codegen/mainsubprogram.rs b/src/test/codegen/mainsubprogram.rs index 7f1b0e17f871..790db33437b0 100644 --- a/src/test/codegen/mainsubprogram.rs +++ b/src/test/codegen/mainsubprogram.rs @@ -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 --git a/src/test/codegen/mainsubprogramstart.rs b/src/test/codegen/mainsubprogramstart.rs index b03290af0e3b..d4de9f59ac27 100644 --- a/src/test/codegen/mainsubprogramstart.rs +++ b/src/test/codegen/mainsubprogramstart.rs @@ -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 {