Updated to 1.30.0

This commit is contained in:
Алзим 2018-11-07 16:32:38 +03:00
parent 3d78003c09
commit 46889b1ea9
5 changed files with 19 additions and 361 deletions

View file

@ -1,4 +1,4 @@
sources:
rust-1.28.0-i686-unknown-linux-gnu.tar.xz: 9f2d0457eedf0c9c38fa3c16d19b3a112338cea6
rust-1.28.0-x86_64-unknown-linux-gnu.tar.xz: ed58f73ef18907ffd3c3157087bebfb88f4449a0
rustc-1.29.1-src.tar.xz: 3c5ed672a33acf182f2d21c41db03f87a56e00ad
rust-1.29.2-i686-unknown-linux-gnu.tar.xz: 6915fa704cc042dc35450bbf374518354cc73d7c
rust-1.29.2-x86_64-unknown-linux-gnu.tar.xz: c3d34cce54274791c410f8fa27862c5b285d9159
rustc-1.30.0-src.tar.xz: d4db75101105cda139ed73c788474cf7db184c22

View file

@ -1,186 +0,0 @@
From 4b95b1a4fd035a73998dc21b265ce4594e35f8ae Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 16 Aug 2018 13:19:04 -0700
Subject: [PATCH] Set more llvm function attributes for __rust_try
This shim is generated elsewhere in the compiler so this commit adds support to
ensure it goes through similar paths as the rest of the compiler to set llvm
function attributes like target features.
cc #53372
---
src/librustc_codegen_llvm/attributes.rs | 52 +++++++++++++++++++------
src/librustc_codegen_llvm/base.rs | 21 ----------
src/librustc_codegen_llvm/callee.rs | 2 +-
src/librustc_codegen_llvm/intrinsic.rs | 2 +
src/librustc_codegen_llvm/mono_item.rs | 2 +-
5 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs
index 3b5f927d52f0..2a79ce2f2285 100644
--- a/src/librustc_codegen_llvm/attributes.rs
+++ b/src/librustc_codegen_llvm/attributes.rs
@@ -11,7 +11,7 @@
use std::ffi::{CStr, CString};
-use rustc::hir::CodegenFnAttrFlags;
+use rustc::hir::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::session::Session;
use rustc::session::config::Sanitizer;
@@ -123,11 +123,37 @@ pub fn llvm_target_features(sess: &Session) -> impl Iterator<Item = &str> {
/// Composite function which sets LLVM attributes for function depending on its AST (#[attribute])
/// attributes.
-pub fn from_fn_attrs(cx: &CodegenCx, llfn: ValueRef, id: DefId) {
- let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(id);
+pub fn from_fn_attrs(
+ cx: &CodegenCx,
+ llfn: ValueRef,
+ id: Option<DefId>,
+) {
+ let codegen_fn_attrs = id.map(|id| cx.tcx.codegen_fn_attrs(id))
+ .unwrap_or(CodegenFnAttrs::new());
inline(llfn, codegen_fn_attrs.inline);
+ // The `uwtable` attribute according to LLVM is:
+ //
+ // This attribute indicates that the ABI being targeted requires that an
+ // unwind table entry be produced for this function even if we can show
+ // that no exceptions passes by it. This is normally the case for the
+ // ELF x86-64 abi, but it can be disabled for some compilation units.
+ //
+ // Typically when we're compiling with `-C panic=abort` (which implies this
+ // `no_landing_pads` check) we don't need `uwtable` because we can't
+ // generate any exceptions! On Windows, however, exceptions include other
+ // events such as illegal instructions, segfaults, etc. This means that on
+ // Windows we end up still needing the `uwtable` attribute even if the `-C
+ // panic=abort` flag is passed.
+ //
+ // You can also find more info on why Windows is whitelisted here in:
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
+ if !cx.sess().no_landing_pads() ||
+ cx.sess().target.target.options.requires_uwtable {
+ attributes::emit_uwtable(llfn, true);
+ }
+
set_frame_pointer_elimination(cx, llfn);
set_probestack(cx, llfn);
@@ -151,7 +177,7 @@ pub fn from_fn_attrs(cx: &CodegenCx, llfn: ValueRef, id: DefId) {
// *in Rust code* may unwind. Foreign items like `extern "C" {
// fn foo(); }` are assumed not to unwind **unless** they have
// a `#[unwind]` attribute.
- } else if !cx.tcx.is_foreign_item(id) {
+ } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) {
Some(true)
} else {
None
@@ -188,14 +214,16 @@ pub fn from_fn_attrs(cx: &CodegenCx, llfn: ValueRef, id: DefId) {
// Note that currently the `wasm-import-module` doesn't do anything, but
// eventually LLVM 7 should read this and ferry the appropriate import
// module to the output file.
- if cx.tcx.sess.target.target.arch == "wasm32" {
- if let Some(module) = wasm_import_module(cx.tcx, id) {
- llvm::AddFunctionAttrStringValue(
- llfn,
- llvm::AttributePlace::Function,
- cstr("wasm-import-module\0"),
- &module,
- );
+ if let Some(id) = id {
+ if cx.tcx.sess.target.target.arch == "wasm32" {
+ if let Some(module) = wasm_import_module(cx.tcx, id) {
+ llvm::AddFunctionAttrStringValue(
+ llfn,
+ llvm::AttributePlace::Function,
+ cstr("wasm-import-module\0"),
+ &module,
+ );
+ }
}
}
}
diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs
index 223c04f420f3..b0461582ddcb 100644
--- a/src/librustc_codegen_llvm/base.rs
+++ b/src/librustc_codegen_llvm/base.rs
@@ -486,27 +486,6 @@ pub fn codegen_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'
cx.stats.borrow_mut().n_closures += 1;
- // The `uwtable` attribute according to LLVM is:
- //
- // This attribute indicates that the ABI being targeted requires that an
- // unwind table entry be produced for this function even if we can show
- // that no exceptions passes by it. This is normally the case for the
- // ELF x86-64 abi, but it can be disabled for some compilation units.
- //
- // Typically when we're compiling with `-C panic=abort` (which implies this
- // `no_landing_pads` check) we don't need `uwtable` because we can't
- // generate any exceptions! On Windows, however, exceptions include other
- // events such as illegal instructions, segfaults, etc. This means that on
- // Windows we end up still needing the `uwtable` attribute even if the `-C
- // panic=abort` flag is passed.
- //
- // You can also find more info on why Windows is whitelisted here in:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
- if !cx.sess().no_landing_pads() ||
- cx.sess().target.target.options.requires_uwtable {
- attributes::emit_uwtable(lldecl, true);
- }
-
let mir = cx.tcx.instance_mir(instance.def);
mir::codegen_mir(cx, lldecl, &mir, instance, sig);
}
diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs
index 2c01bd42cc77..97f07792ede8 100644
--- a/src/librustc_codegen_llvm/callee.rs
+++ b/src/librustc_codegen_llvm/callee.rs
@@ -97,7 +97,7 @@ pub fn get_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
if instance.def.is_inline(tcx) {
attributes::inline(llfn, attributes::InlineAttr::Hint);
}
- attributes::from_fn_attrs(cx, llfn, instance.def.def_id());
+ attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id()));
let instance_def_id = instance.def_id();
diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs
index 9c5c0f730c16..f69fce15dc55 100644
--- a/src/librustc_codegen_llvm/intrinsic.rs
+++ b/src/librustc_codegen_llvm/intrinsic.rs
@@ -10,6 +10,7 @@
#![allow(non_upper_case_globals)]
+use attributes;
use intrinsics::{self, Intrinsic};
use llvm;
use llvm::{ValueRef};
@@ -936,6 +937,7 @@ fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
Abi::Rust
)));
let llfn = declare::define_internal_fn(cx, name, rust_fn_ty);
+ attributes::from_fn_attrs(cx, llfn, None);
let bx = Builder::new_block(cx, llfn, "entry-block");
codegen(bx);
llfn
diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs
index a528008e3b4b..32d8b24e3c15 100644
--- a/src/librustc_codegen_llvm/mono_item.rs
+++ b/src/librustc_codegen_llvm/mono_item.rs
@@ -183,7 +183,7 @@ fn predefine_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
if instance.def.is_inline(cx.tcx) {
attributes::inline(lldecl, attributes::InlineAttr::Hint);
}
- attributes::from_fn_attrs(cx, lldecl, instance.def.def_id());
+ attributes::from_fn_attrs(cx, lldecl, Some(instance.def.def_id()));
cx.instances.borrow_mut().insert(instance, lldecl);
}
--
2.17.1

View file

@ -1,122 +0,0 @@
From f4e8d57b6ad6f599de54c020ba185db83cb011a3 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 16 Aug 2018 11:26:27 -0700
Subject: [PATCH] std: stop backtracing when the frames are full
---
src/libstd/sys/cloudabi/backtrace.rs | 18 ++++++++++--------
src/libstd/sys/redox/backtrace/tracing.rs | 18 ++++++++++--------
src/libstd/sys/unix/backtrace/tracing/gcc_s.rs | 18 ++++++++++--------
3 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/src/libstd/sys/cloudabi/backtrace.rs b/src/libstd/sys/cloudabi/backtrace.rs
index 1b970187558c..2c43b5937ce5 100644
--- a/src/libstd/sys/cloudabi/backtrace.rs
+++ b/src/libstd/sys/cloudabi/backtrace.rs
@@ -64,6 +64,10 @@ extern "C" fn trace_fn(
arg: *mut libc::c_void,
) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe { uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void };
if !ip.is_null() && ip_before_insn == 0 {
@@ -73,14 +77,12 @@ extern "C" fn trace_fn(
}
let symaddr = unsafe { uw::_Unwind_FindEnclosingFunction(ip) };
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
diff --git a/src/libstd/sys/redox/backtrace/tracing.rs b/src/libstd/sys/redox/backtrace/tracing.rs
index bb70ca360370..c0414b78f8d6 100644
--- a/src/libstd/sys/redox/backtrace/tracing.rs
+++ b/src/libstd/sys/redox/backtrace/tracing.rs
@@ -68,6 +68,10 @@ pub fn unwind_backtrace(frames: &mut [Frame])
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe {
uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void
@@ -94,14 +98,12 @@ extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
unsafe { uw::_Unwind_FindEnclosingFunction(ip) }
};
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
index 1b92fc0e6ad0..6e8415686792 100644
--- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
+++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
@@ -68,6 +68,10 @@ pub fn unwind_backtrace(frames: &mut [Frame])
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe {
uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void
@@ -94,14 +98,12 @@ extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
unsafe { uw::_Unwind_FindEnclosingFunction(ip) }
};
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
--
2.17.1

View file

@ -1,26 +0,0 @@
From 1ea2765918d1212a07e1359537470c477d82a681 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 30 Jul 2018 13:08:56 -0700
Subject: [PATCH] run-pass/const-endianness: negate before to_le()
`const LE_I128` needs parentheses to negate the value *before* calling
`to_le()`, otherwise it doesn't match the operations performed in the
black-boxed part of the test. This only makes a tangible difference on
big-endian targets.
---
src/test/run-pass/const-endianess.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/run-pass/const-endianess.rs b/src/test/run-pass/const-endianess.rs
index fa34b49210a6..95c738d3ec49 100644
--- a/src/test/run-pass/const-endianess.rs
+++ b/src/test/run-pass/const-endianess.rs
@@ -25,7 +25,7 @@ fn main() {
#[cfg(not(target_arch = "asmjs"))]
{
const BE_U128: u128 = 999999u128.to_be();
- const LE_I128: i128 = -999999i128.to_le();
+ const LE_I128: i128 = (-999999i128).to_le();
assert_eq!(BE_U128, b(999999u128).to_be());
assert_eq!(LE_I128, b(-999999i128).to_le());
}

View file

@ -1,3 +1,5 @@
# https://src.fedoraproject.org/rpms/rust
# ALL Rust libraries are private, because they don't keep an ABI.
%define _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
%define __provides_exclude ^(%{_privatelibs})$
@ -23,11 +25,11 @@
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%define bootstrap_rust 1.28.0
%define bootstrap_cargo 1.28.0
%define bootstrap_date 2018-08-02
%define bootstrap_rust 1.29.2
%define bootstrap_cargo 1.29.0
%define bootstrap_date 2018-10-12
%bcond_with bootstrap
%bcond_without bootstrap
%if %{without bootstrap}
%define bootstrap_arches %{nil}
@ -45,10 +47,10 @@
# Some sub-packages are versioned independently of the rust compiler and runtime itself.
# Also beware that if any of these are not changed in a version bump, then the release
# number should still increase, not be reset to 1!
%define rustc_version 1.29.1
%define cargo_version 1.29.0
%define rustfmt_version 0.99.1
%define rls_version 0.130.0
%define rustc_version 1.30.0
%define cargo_version 1.30.0
%define rustfmt_version 0.99.4
%define rls_version 0.130.5
%define clippy_version 0.0.212
%ifarch x86_64
@ -67,7 +69,7 @@
Summary: The Rust Programming Language
Name: rust
Version: %{rustc_version}
Release: 2
Release: 1
License: (ASL 2.0 or MIT) and (BSD and MIT)
Group: Development/Rust
# ^ written as: (rust itself) and (bundled libraries)
@ -77,13 +79,6 @@ Source0: https://static.rust-lang.org/dist/rustc-%{rustc_version}-src.tar.xz
Source1: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
Source2: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
Source10: rust.rpmlintrc
# https://github.com/rust-lang/rust/pull/52876
Patch1: rust-52876-const-endianess.patch
# https://github.com/rust-lang/rust/pull/53436
Patch2: 0001-std-stop-backtracing-when-the-frames-are-full.patch
# https://github.com/rust-lang/rust/pull/53437
Patch3: 0001-Set-more-llvm-function-attributes-for-__rust_try.patch
BuildRequires: ncurses-devel
BuildRequires: curl
BuildRequires: pkgconfig(libcurl)
@ -343,9 +338,6 @@ test -f '%{local_rust_root}/bin/rustc'
%endif
%setup -qn rustc-%{rustc_version}-src
%patch1 -p1
%patch2 -p1
%patch3 -p1
# python3
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
@ -358,15 +350,15 @@ rm -rf src/llvm/
# We never enable emscripten.
rm -rf src/llvm-emscripten/
# We never enable other LLVM tools.
rm -rf src/tools/clang
rm -rf src/tools/lld
rm -rf src/tools/lldb
# extract bundled licenses for packaging
sed -e '/*\//q' src/libbacktrace/backtrace.h \
>src/libbacktrace/LICENSE-libbacktrace
# This tests a problem of exponential growth, which seems to be less-reliably
# fixed when running on older LLVM and/or some arches. Just skip it for now.
sed -i.ignore -e '1i // ignore-test may still be exponential...' \
src/test/run-pass/issue-41696.rs
%if %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486