From 2e4d8937f2ca395ae6e1476f173e3b1818edb130 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 29 Mar 2018 11:04:58 -0700 Subject: [PATCH 1/5] Update to 1.25.0. --- .gitignore | 8 + ...ling-rustfmt-without-config.extended.patch | 27 ++ ...ack-probe-tests-with-system-LLVM-5.0.patch | 67 ---- 0001-Fix-Wcatch-value-from-GCC-8.patch | 57 --- ...run-pass-sse2-when-using-system-LLVM.patch | 27 -- ...ck-probes-tests-on-powerpc-s390x-too.patch | 54 +++ ...-DW_OP_deref-to-indirect-args-itself.patch | 53 --- ...date-DW_OP_plus-to-DW_OP_plus_uconst.patch | 67 ---- ...-to-identify-SIGSEGV-in-stack-guards.patch | 341 ------------------ rust-pr46592-bootstrap-libdir.patch | 159 -------- rust-pr48362-libdir-relative.patch | 64 ---- rust.spec | 99 ++--- sources | 2 +- sources-bootstrap | 16 +- 14 files changed, 150 insertions(+), 891 deletions(-) create mode 100644 0001-Allow-installing-rustfmt-without-config.extended.patch delete mode 100644 0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch delete mode 100644 0001-Fix-Wcatch-value-from-GCC-8.patch delete mode 100644 0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch create mode 100644 0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch delete mode 100644 0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch delete mode 100644 0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch delete mode 100644 0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch delete mode 100644 rust-pr46592-bootstrap-libdir.patch delete mode 100644 rust-pr48362-libdir-relative.patch diff --git a/.gitignore b/.gitignore index 7934d2c..d39e79a 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,11 @@ /rust-1.23.0-s390x-unknown-linux-gnu.tar.xz /rust-1.23.0-x86_64-unknown-linux-gnu.tar.xz /rustc-1.24.1-src.tar.xz +/rustc-1.25.0-src.tar.xz +/rust-1.24.0-aarch64-unknown-linux-gnu.tar.xz +/rust-1.24.0-armv7-unknown-linux-gnueabihf.tar.xz +/rust-1.24.0-i686-unknown-linux-gnu.tar.xz +/rust-1.24.0-powerpc64le-unknown-linux-gnu.tar.xz +/rust-1.24.0-powerpc64-unknown-linux-gnu.tar.xz +/rust-1.24.0-s390x-unknown-linux-gnu.tar.xz +/rust-1.24.0-x86_64-unknown-linux-gnu.tar.xz diff --git a/0001-Allow-installing-rustfmt-without-config.extended.patch b/0001-Allow-installing-rustfmt-without-config.extended.patch new file mode 100644 index 0000000..531761f --- /dev/null +++ b/0001-Allow-installing-rustfmt-without-config.extended.patch @@ -0,0 +1,27 @@ +From 86f7d8939d19d42e21d4e794e648f0aef14eeec9 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 22 Mar 2018 18:31:32 -0700 +Subject: [PATCH] Allow installing rustfmt without config.extended + +This assertion was preventing `./x.py install rustfmt` if attempted +without an "extended" build configuration, but it actually builds and +installs just fine. +--- + src/bootstrap/dist.rs | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs +index eca06eac7f30..142296b20958 100644 +--- a/src/bootstrap/dist.rs ++++ b/src/bootstrap/dist.rs +@@ -1186,7 +1186,6 @@ impl Step for Rustfmt { + let build = builder.build; + let stage = self.stage; + let target = self.target; +- assert!(build.config.extended); + + println!("Dist Rustfmt stage{} ({})", stage, target); + let src = build.src.join("src/tools/rustfmt"); +-- +2.14.3 + diff --git a/0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch b/0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch deleted file mode 100644 index b3626cc..0000000 --- a/0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8a1f3d066d9c6f97a55958f8d638ae98957e8962 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 30 Jan 2018 16:47:30 -0800 -Subject: [PATCH 1/2] Enable stack-probe tests with system LLVM >= 5.0 - ---- - src/test/codegen/stack-probes.rs | 2 +- - src/test/run-pass/stack-probes-lto.rs | 2 +- - src/test/run-pass/stack-probes.rs | 2 +- - src/tools/compiletest/src/header.rs | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs -index 5b26dade9aff..4a489f1edb3b 100644 ---- a/src/test/codegen/stack-probes.rs -+++ b/src/test/codegen/stack-probes.rs -@@ -15,7 +15,7 @@ - // ignore-wasm - // ignore-emscripten - // ignore-windows --// no-system-llvm -+// min-system-llvm-version 5.0 - // compile-flags: -C no-prepopulate-passes - - #![crate_type = "lib"] -diff --git a/src/test/run-pass/stack-probes-lto.rs b/src/test/run-pass/stack-probes-lto.rs -index 78a1019578e3..33d4c63582e8 100644 ---- a/src/test/run-pass/stack-probes-lto.rs -+++ b/src/test/run-pass/stack-probes-lto.rs -@@ -14,7 +14,7 @@ - // ignore-emscripten no processes - // ignore-musl FIXME #31506 - // ignore-pretty --// no-system-llvm -+// min-system-llvm-version 5.0 - // compile-flags: -C lto - // no-prefer-dynamic - -diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs -index bb9471e1b48b..6fbb85dda15a 100644 ---- a/src/test/run-pass/stack-probes.rs -+++ b/src/test/run-pass/stack-probes.rs -@@ -13,7 +13,7 @@ - // ignore-wasm - // ignore-emscripten no processes - // ignore-musl FIXME #31506 --// no-system-llvm -+// min-system-llvm-version 5.0 - - use std::mem; - use std::process::Command; -diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs -index 1f736e33c8b2..6908f3b5cf28 100644 ---- a/src/tools/compiletest/src/header.rs -+++ b/src/tools/compiletest/src/header.rs -@@ -163,7 +163,7 @@ impl EarlyProps { - .expect("Malformed llvm version directive"); - // Ignore if using system LLVM and actual version - // is smaller the minimum required version -- !(config.system_llvm && &actual_version[..] < min_version) -+ config.system_llvm && &actual_version[..] < min_version - } else { - false - } --- -2.14.3 - diff --git a/0001-Fix-Wcatch-value-from-GCC-8.patch b/0001-Fix-Wcatch-value-from-GCC-8.patch deleted file mode 100644 index 49d037b..0000000 --- a/0001-Fix-Wcatch-value-from-GCC-8.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 327c3d06258576cc9d9f2e5c0861abc72ebd10ef Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 2 Feb 2018 16:23:04 -0800 -Subject: [PATCH] Fix -Wcatch-value from GCC 8 - -These instances may simply be caught by reference instead. ---- - src/tools/asm2wasm.cpp | 2 +- - src/tools/s2wasm.cpp | 2 +- - src/wasm/wasm-s-parser.cpp | 4 ++-- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp -index 75a2c4d15e2e..6d14067d240f 100644 ---- a/src/tools/asm2wasm.cpp -+++ b/src/tools/asm2wasm.cpp -@@ -87,7 +87,7 @@ int main(int argc, const char *argv[]) { - [&trapMode](Options *o, const std::string &argument) { - try { - trapMode = trapModeFromString(argument); -- } catch (std::invalid_argument e) { -+ } catch (std::invalid_argument &e) { - std::cerr << "Error: " << e.what() << "\n"; - exit(EXIT_FAILURE); - } -diff --git a/src/tools/s2wasm.cpp b/src/tools/s2wasm.cpp -index 32af57dba5bf..c5e1d52b8d96 100644 ---- a/src/tools/s2wasm.cpp -+++ b/src/tools/s2wasm.cpp -@@ -92,7 +92,7 @@ int main(int argc, const char *argv[]) { - [&trapMode](Options *o, const std::string &argument) { - try { - trapMode = trapModeFromString(argument); -- } catch (std::invalid_argument e) { -+ } catch (std::invalid_argument &e) { - std::cerr << "Error: " << e.what() << "\n"; - exit(EXIT_FAILURE); - } -diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp -index 0de3edf3f6b4..78a150f8146c 100644 ---- a/src/wasm/wasm-s-parser.cpp -+++ b/src/wasm/wasm-s-parser.cpp -@@ -1408,9 +1408,9 @@ Name SExpressionWasmBuilder::getLabel(Element& s) { - uint64_t offset; - try { - offset = std::stoll(s.c_str(), nullptr, 0); -- } catch (std::invalid_argument) { -+ } catch (std::invalid_argument&) { - throw ParseException("invalid break offset"); -- } catch (std::out_of_range) { -+ } catch (std::out_of_range&) { - throw ParseException("out of range break offset"); - } - if (offset > nameMapper.labelStack.size()) throw ParseException("invalid label", s.line, s.col); --- -2.14.3 - diff --git a/0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch b/0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch deleted file mode 100644 index bf8eedd..0000000 --- a/0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ebca82f1fc8103830727bda970468ca8eae55d82 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 30 Jan 2018 10:18:54 -0800 -Subject: [PATCH] Ignore run-pass/sse2 when using system LLVM - -This is a test of `target_feature`, which needs a rust-specific patch to -LLVM to add `MCSubtargetInfo::getFeatureTable()`. ---- - src/test/run-pass/sse2.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/test/run-pass/sse2.rs b/src/test/run-pass/sse2.rs -index c27f83011cb1..858a53cb3836 100644 ---- a/src/test/run-pass/sse2.rs -+++ b/src/test/run-pass/sse2.rs -@@ -7,7 +7,7 @@ - // , at your - // option. This file may not be copied, modified, or distributed - // except according to those terms. --// min-llvm-version 4.0 -+// no-system-llvm -- needs MCSubtargetInfo::getFeatureTable() - - #![feature(cfg_target_feature)] - --- -2.14.3 - diff --git a/0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch b/0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch new file mode 100644 index 0000000..c6d83cc --- /dev/null +++ b/0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch @@ -0,0 +1,54 @@ +From b404ec4b4880db7f6aea23ebf778869dfd6ecf99 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 29 Mar 2018 10:25:32 -0700 +Subject: [PATCH] Ignore stack-probes tests on powerpc/s390x too + +We only support stack probes on x86 and x86_64. +Other arches are already ignored. +--- + src/test/codegen/stack-probes.rs | 1 + + src/test/run-pass/stack-probes-lto.rs | 2 ++ + src/test/run-pass/stack-probes.rs | 2 ++ + 3 files changed, 5 insertions(+) + +diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs +index af400ff3bcbd..51ebc42a0dd6 100644 +--- a/src/test/codegen/stack-probes.rs ++++ b/src/test/codegen/stack-probes.rs +@@ -11,6 +11,7 @@ + // ignore-arm + // ignore-aarch64 + // ignore-powerpc ++// ignore-s390x + // ignore-aarch64 + // ignore-wasm + // ignore-emscripten +diff --git a/src/test/run-pass/stack-probes-lto.rs b/src/test/run-pass/stack-probes-lto.rs +index e7fa3bc0a75c..d1cb75909c15 100644 +--- a/src/test/run-pass/stack-probes-lto.rs ++++ b/src/test/run-pass/stack-probes-lto.rs +@@ -10,6 +10,8 @@ + + // ignore-arm + // ignore-aarch64 ++// ignore-powerpc ++// ignore-s390x + // ignore-wasm + // ignore-cloudabi no processes + // ignore-emscripten no processes +diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs +index 67b3962ee5fb..78c5782be383 100644 +--- a/src/test/run-pass/stack-probes.rs ++++ b/src/test/run-pass/stack-probes.rs +@@ -10,6 +10,8 @@ + + // ignore-arm + // ignore-aarch64 ++// ignore-powerpc ++// ignore-s390x + // ignore-wasm + // ignore-cloudabi no processes + // ignore-emscripten no processes +-- +2.14.3 + diff --git a/0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch b/0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch deleted file mode 100644 index 3e8a4be..0000000 --- a/0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 7eb7d45c0b0a9dc0454c5f3a3c5e911c7900bbea Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 23 Jan 2018 13:53:01 -0800 -Subject: [PATCH] Let LLVM 5 add DW_OP_deref to indirect args itself - -We needed to manually added the `DW_OP_deref` ourselves in earlier LLVM, -but starting with [D31439] in LLVM 5, it appears that LLVM will always -handle this itself. When we were still adding this manually, the -resulting `.debug_loc` had too many derefs, and this failed test -`debuginfo/by-value-self-argument-in-trait-impl.rs`. - -[D31439]: https://reviews.llvm.org/D31439 - -Fixes #47611. -cc @alexcrichton -r? @michaelwoerister ---- - src/librustc_trans/mir/mod.rs | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs -index b367eb6548d0..da01592d9118 100644 ---- a/src/librustc_trans/mir/mod.rs -+++ b/src/librustc_trans/mir/mod.rs -@@ -487,16 +487,18 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, - // The Rust ABI passes indirect variables using a pointer and a manual copy, so we - // need to insert a deref here, but the C ABI uses a pointer and a copy using the - // byval attribute, for which LLVM does the deref itself, so we must not add it. -+ // Starting with D31439 in LLVM 5, it *always* does the deref itself. - let mut variable_access = VariableAccess::DirectVariable { - alloca: place.llval - }; -- -- if let PassMode::Indirect(ref attrs) = arg.mode { -- if !attrs.contains(ArgAttribute::ByVal) { -- variable_access = VariableAccess::IndirectVariable { -- alloca: place.llval, -- address_operations: &deref_op, -- }; -+ if unsafe { llvm::LLVMRustVersionMajor() < 5 } { -+ if let PassMode::Indirect(ref attrs) = arg.mode { -+ if !attrs.contains(ArgAttribute::ByVal) { -+ variable_access = VariableAccess::IndirectVariable { -+ alloca: place.llval, -+ address_operations: &deref_op, -+ }; -+ } - } - } - --- -2.14.3 - diff --git a/0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch b/0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch deleted file mode 100644 index f975051..0000000 --- a/0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch +++ /dev/null @@ -1,67 +0,0 @@ -From e2f6b280ea13e48bff86254549988e61eee37139 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 19 Jan 2018 21:43:53 -0800 -Subject: [PATCH] Update DW_OP_plus to DW_OP_plus_uconst - -LLVM <= 4.0 used a non-standard interpretation of `DW_OP_plus`. In the -DWARF standard, this adds two items on the expressions stack. LLVM's -behavior was more like DWARF's `DW_OP_plus_uconst` -- adding a constant -that follows the op. The patch series starting with [D33892] switched -to the standard DWARF interpretation, so we need to follow. - -[D33892]: https://reviews.llvm.org/D33892 ---- - src/librustc_llvm/ffi.rs | 2 +- - src/librustc_trans/mir/mod.rs | 2 +- - src/rustllvm/RustWrapper.cpp | 9 ++++++++- - 3 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs -index b97e37f4c8fb..f51e51a88b10 100644 ---- a/src/librustc_llvm/ffi.rs -+++ b/src/librustc_llvm/ffi.rs -@@ -1546,7 +1546,7 @@ extern "C" { - InlinedAt: MetadataRef) - -> ValueRef; - pub fn LLVMRustDIBuilderCreateOpDeref() -> i64; -- pub fn LLVMRustDIBuilderCreateOpPlus() -> i64; -+ pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64; - - pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef); - pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef); -diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs -index 3064e2f7c7af..b367eb6548d0 100644 ---- a/src/librustc_trans/mir/mod.rs -+++ b/src/librustc_trans/mir/mod.rs -@@ -547,7 +547,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, - - let ops = unsafe { - [llvm::LLVMRustDIBuilderCreateOpDeref(), -- llvm::LLVMRustDIBuilderCreateOpPlus(), -+ llvm::LLVMRustDIBuilderCreateOpPlusUconst(), - byte_offset_of_var_in_env as i64, - llvm::LLVMRustDIBuilderCreateOpDeref()] - }; -diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp -index 95130d596e16..0fe533d447bc 100644 ---- a/src/rustllvm/RustWrapper.cpp -+++ b/src/rustllvm/RustWrapper.cpp -@@ -866,7 +866,14 @@ extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() { - return dwarf::DW_OP_deref; - } - --extern "C" int64_t LLVMRustDIBuilderCreateOpPlus() { return dwarf::DW_OP_plus; } -+extern "C" int64_t LLVMRustDIBuilderCreateOpPlusUconst() { -+#if LLVM_VERSION_GE(5, 0) -+ return dwarf::DW_OP_plus_uconst; -+#else -+ // older LLVM used `plus` to behave like `plus_uconst`. -+ return dwarf::DW_OP_plus; -+#endif -+} - - extern "C" void LLVMRustWriteTypeToString(LLVMTypeRef Ty, RustStringRef Str) { - RawRustStringOstream OS(Str); --- -2.14.3 - diff --git a/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch b/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch deleted file mode 100644 index 6003804..0000000 --- a/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch +++ /dev/null @@ -1,341 +0,0 @@ -From 36fcfd117373283de7c052cf361a705d611d47fa Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Wed, 31 Jan 2018 11:41:29 -0800 -Subject: [PATCH 2/2] Use a range to identify SIGSEGV in stack guards -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Previously, the `guard::init()` and `guard::current()` functions were -returning a `usize` address representing the top of the stack guard, -respectively for the main thread and for spawned threads. The `SIGSEGV` -handler on `unix` targets checked if a fault was within one page below -that address, if so reporting it as a stack overflow. - -Now `unix` targets report a `Range` representing the guard -memory, so it can cover arbitrary guard sizes. Non-`unix` targets which -always return `None` for guards now do so with `Option`, so they -don't pay any overhead. - -For `linux-gnu` in particular, the previous guard upper-bound was -`stackaddr + guardsize`, as the protected memory was *inside* the stack. -This was a glibc bug, and starting from 2.27 they are moving the guard -*past* the end of the stack. However, there's no simple way for us to -know where the guard page actually lies, so now we declare it as the -whole range of `stackaddr ± guardsize`, and any fault therein will be -called a stack overflow. This fixes #47863. ---- - src/libstd/sys/redox/thread.rs | 5 +- - src/libstd/sys/unix/stack_overflow.rs | 9 +-- - src/libstd/sys/unix/thread.rs | 115 +++++++++++++++++++++------------- - src/libstd/sys/wasm/thread.rs | 5 +- - src/libstd/sys/windows/thread.rs | 5 +- - src/libstd/sys_common/thread_info.rs | 9 +-- - 6 files changed, 86 insertions(+), 62 deletions(-) - -diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs -index c4aad8d86f8b..c4719a94c7e9 100644 ---- a/src/libstd/sys/redox/thread.rs -+++ b/src/libstd/sys/redox/thread.rs -@@ -88,6 +88,7 @@ impl Thread { - } - - pub mod guard { -- pub unsafe fn current() -> Option { None } -- pub unsafe fn init() -> Option { None } -+ pub type Guard = !; -+ pub unsafe fn current() -> Option { None } -+ pub unsafe fn init() -> Option { None } - } -diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs -index 51adbc24ae04..40453f9b8a15 100644 ---- a/src/libstd/sys/unix/stack_overflow.rs -+++ b/src/libstd/sys/unix/stack_overflow.rs -@@ -57,9 +57,6 @@ mod imp { - use sys_common::thread_info; - - -- // This is initialized in init() and only read from after -- static mut PAGE_SIZE: usize = 0; -- - #[cfg(any(target_os = "linux", target_os = "android"))] - unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize { - #[repr(C)] -@@ -102,12 +99,12 @@ mod imp { - _data: *mut libc::c_void) { - use sys_common::util::report_overflow; - -- let guard = thread_info::stack_guard().unwrap_or(0); -+ let guard = thread_info::stack_guard().unwrap_or(0..0); - let addr = siginfo_si_addr(info); - - // If the faulting address is within the guard page, then we print a - // message saying so and abort. -- if guard != 0 && guard - PAGE_SIZE <= addr && addr < guard { -+ if guard.start <= addr && addr < guard.end { - report_overflow(); - rtabort!("stack overflow"); - } else { -@@ -123,8 +120,6 @@ mod imp { - static mut MAIN_ALTSTACK: *mut libc::c_void = ptr::null_mut(); - - pub unsafe fn init() { -- PAGE_SIZE = ::sys::os::page_size(); -- - let mut action: sigaction = mem::zeroed(); - action.sa_flags = SA_SIGINFO | SA_ONSTACK; - action.sa_sigaction = signal_handler as sighandler_t; -diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs -index cb249af42540..72cdb9440b8e 100644 ---- a/src/libstd/sys/unix/thread.rs -+++ b/src/libstd/sys/unix/thread.rs -@@ -205,8 +205,10 @@ impl Drop for Thread { - not(target_os = "solaris")))] - #[cfg_attr(test, allow(dead_code))] - pub mod guard { -- pub unsafe fn current() -> Option { None } -- pub unsafe fn init() -> Option { None } -+ use ops::Range; -+ pub type Guard = Range; -+ pub unsafe fn current() -> Option { None } -+ pub unsafe fn init() -> Option { None } - } - - -@@ -222,14 +224,43 @@ pub mod guard { - use libc; - use libc::mmap; - use libc::{PROT_NONE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED}; -+ use ops::Range; - use sys::os; - -- #[cfg(any(target_os = "macos", -- target_os = "bitrig", -- target_os = "openbsd", -- target_os = "solaris"))] -+ // This is initialized in init() and only read from after -+ static mut PAGE_SIZE: usize = 0; -+ -+ pub type Guard = Range; -+ -+ #[cfg(target_os = "solaris")] -+ unsafe fn get_stack_start() -> Option<*mut libc::c_void> { -+ let mut current_stack: libc::stack_t = ::mem::zeroed(); -+ assert_eq!(libc::stack_getbounds(&mut current_stack), 0); -+ Some(current_stack.ss_sp) -+ } -+ -+ #[cfg(target_os = "macos")] - unsafe fn get_stack_start() -> Option<*mut libc::c_void> { -- current().map(|s| s as *mut libc::c_void) -+ let stackaddr = libc::pthread_get_stackaddr_np(libc::pthread_self()) as usize - -+ libc::pthread_get_stacksize_np(libc::pthread_self()); -+ Some(stackaddr as *mut libc::c_void) -+ } -+ -+ #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] -+ unsafe fn get_stack_start() -> Option<*mut libc::c_void> { -+ let mut current_stack: libc::stack_t = ::mem::zeroed(); -+ assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), -+ &mut current_stack), 0); -+ -+ let extra = if cfg!(target_os = "bitrig") {3} else {1} * PAGE_SIZE; -+ let stackaddr = if libc::pthread_main_np() == 1 { -+ // main thread -+ current_stack.ss_sp as usize - current_stack.ss_size + extra -+ } else { -+ // new thread -+ current_stack.ss_sp as usize - current_stack.ss_size -+ }; -+ Some(stackaddr as *mut libc::c_void) - } - - #[cfg(any(target_os = "android", target_os = "freebsd", -@@ -253,8 +284,9 @@ pub mod guard { - ret - } - -- pub unsafe fn init() -> Option { -- let psize = os::page_size(); -+ pub unsafe fn init() -> Option { -+ PAGE_SIZE = os::page_size(); -+ - let mut stackaddr = get_stack_start()?; - - // Ensure stackaddr is page aligned! A parent process might -@@ -263,9 +295,9 @@ pub mod guard { - // stackaddr < stackaddr + stacksize, so if stackaddr is not - // page-aligned, calculate the fix such that stackaddr < - // new_page_aligned_stackaddr < stackaddr + stacksize -- let remainder = (stackaddr as usize) % psize; -+ let remainder = (stackaddr as usize) % PAGE_SIZE; - if remainder != 0 { -- stackaddr = ((stackaddr as usize) + psize - remainder) -+ stackaddr = ((stackaddr as usize) + PAGE_SIZE - remainder) - as *mut libc::c_void; - } - -@@ -280,60 +312,42 @@ pub mod guard { - // Instead, we'll just note where we expect rlimit to start - // faulting, so our handler can report "stack overflow", and - // trust that the kernel's own stack guard will work. -- Some(stackaddr as usize) -+ let stackaddr = stackaddr as usize; -+ Some(stackaddr - PAGE_SIZE..stackaddr) - } else { - // Reallocate the last page of the stack. - // This ensures SIGBUS will be raised on - // stack overflow. -- let result = mmap(stackaddr, psize, PROT_NONE, -+ let result = mmap(stackaddr, PAGE_SIZE, PROT_NONE, - MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0); - - if result != stackaddr || result == MAP_FAILED { - panic!("failed to allocate a guard page"); - } - -+ let guardaddr = stackaddr as usize; - let offset = if cfg!(target_os = "freebsd") { - 2 - } else { - 1 - }; - -- Some(stackaddr as usize + offset * psize) -+ Some(guardaddr..guardaddr + offset * PAGE_SIZE) - } - } - -- #[cfg(target_os = "solaris")] -- pub unsafe fn current() -> Option { -- let mut current_stack: libc::stack_t = ::mem::zeroed(); -- assert_eq!(libc::stack_getbounds(&mut current_stack), 0); -- Some(current_stack.ss_sp as usize) -- } -- -- #[cfg(target_os = "macos")] -- pub unsafe fn current() -> Option { -- Some((libc::pthread_get_stackaddr_np(libc::pthread_self()) as usize - -- libc::pthread_get_stacksize_np(libc::pthread_self()))) -- } -- -- #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] -- pub unsafe fn current() -> Option { -- let mut current_stack: libc::stack_t = ::mem::zeroed(); -- assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), -- &mut current_stack), 0); -- -- let extra = if cfg!(target_os = "bitrig") {3} else {1} * os::page_size(); -- Some(if libc::pthread_main_np() == 1 { -- // main thread -- current_stack.ss_sp as usize - current_stack.ss_size + extra -- } else { -- // new thread -- current_stack.ss_sp as usize - current_stack.ss_size -- }) -+ #[cfg(any(target_os = "macos", -+ target_os = "bitrig", -+ target_os = "openbsd", -+ target_os = "solaris"))] -+ pub unsafe fn current() -> Option { -+ let stackaddr = get_stack_start()? as usize; -+ Some(stackaddr - PAGE_SIZE..stackaddr) - } - - #[cfg(any(target_os = "android", target_os = "freebsd", - target_os = "linux", target_os = "netbsd", target_os = "l4re"))] -- pub unsafe fn current() -> Option { -+ pub unsafe fn current() -> Option { - let mut ret = None; - let mut attr: libc::pthread_attr_t = ::mem::zeroed(); - assert_eq!(libc::pthread_attr_init(&mut attr), 0); -@@ -352,12 +366,23 @@ pub mod guard { - assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, - &mut size), 0); - -+ let stackaddr = stackaddr as usize; - ret = if cfg!(target_os = "freebsd") { -- Some(stackaddr as usize - guardsize) -+ // FIXME does freebsd really fault *below* the guard addr? -+ let guardaddr = stackaddr - guardsize; -+ Some(guardaddr - PAGE_SIZE..guardaddr) - } else if cfg!(target_os = "netbsd") { -- Some(stackaddr as usize) -+ Some(stackaddr - guardsize..stackaddr) -+ } else if cfg!(all(target_os = "linux", target_env = "gnu")) { -+ // glibc used to include the guard area within the stack, as noted in the BUGS -+ // section of `man pthread_attr_getguardsize`. This has been corrected starting -+ // with glibc 2.27, and in some distro backports, so the guard is now placed at the -+ // end (below) the stack. There's no easy way for us to know which we have at -+ // runtime, so we'll just match any fault in the range right above or below the -+ // stack base to call that fault a stack overflow. -+ Some(stackaddr - guardsize..stackaddr + guardsize) - } else { -- Some(stackaddr as usize + guardsize) -+ Some(stackaddr..stackaddr + guardsize) - }; - } - assert_eq!(libc::pthread_attr_destroy(&mut attr), 0); -diff --git a/src/libstd/sys/wasm/thread.rs b/src/libstd/sys/wasm/thread.rs -index 13980e0cc19d..6a066509b492 100644 ---- a/src/libstd/sys/wasm/thread.rs -+++ b/src/libstd/sys/wasm/thread.rs -@@ -43,6 +43,7 @@ impl Thread { - } - - pub mod guard { -- pub unsafe fn current() -> Option { None } -- pub unsafe fn init() -> Option { None } -+ pub type Guard = !; -+ pub unsafe fn current() -> Option { None } -+ pub unsafe fn init() -> Option { None } - } -diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs -index 74786d092855..43abfbb1f645 100644 ---- a/src/libstd/sys/windows/thread.rs -+++ b/src/libstd/sys/windows/thread.rs -@@ -93,6 +93,7 @@ impl Thread { - - #[cfg_attr(test, allow(dead_code))] - pub mod guard { -- pub unsafe fn current() -> Option { None } -- pub unsafe fn init() -> Option { None } -+ pub type Guard = !; -+ pub unsafe fn current() -> Option { None } -+ pub unsafe fn init() -> Option { None } - } -diff --git a/src/libstd/sys_common/thread_info.rs b/src/libstd/sys_common/thread_info.rs -index 7970042b1d67..6a2b6742367a 100644 ---- a/src/libstd/sys_common/thread_info.rs -+++ b/src/libstd/sys_common/thread_info.rs -@@ -11,10 +11,11 @@ - #![allow(dead_code)] // stack_guard isn't used right now on all platforms - - use cell::RefCell; -+use sys::thread::guard::Guard; - use thread::Thread; - - struct ThreadInfo { -- stack_guard: Option, -+ stack_guard: Option, - thread: Thread, - } - -@@ -38,11 +39,11 @@ pub fn current_thread() -> Option { - ThreadInfo::with(|info| info.thread.clone()) - } - --pub fn stack_guard() -> Option { -- ThreadInfo::with(|info| info.stack_guard).and_then(|o| o) -+pub fn stack_guard() -> Option { -+ ThreadInfo::with(|info| info.stack_guard.clone()).and_then(|o| o) - } - --pub fn set(stack_guard: Option, thread: Thread) { -+pub fn set(stack_guard: Option, thread: Thread) { - THREAD_INFO.with(|c| assert!(c.borrow().is_none())); - THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{ - stack_guard, --- -2.14.3 - diff --git a/rust-pr46592-bootstrap-libdir.patch b/rust-pr46592-bootstrap-libdir.patch deleted file mode 100644 index b21fcfb..0000000 --- a/rust-pr46592-bootstrap-libdir.patch +++ /dev/null @@ -1,159 +0,0 @@ -commit 6cf081c8c54e92702f350fa30d77561540324401 (from 6eff103aa1f93cbc07b1e5684e695635993c9752) -Merge: 6eff103aa1f9 472f4e1cc8c3 -Author: bors -Date: Sat Jan 13 05:02:04 2018 +0000 - - Auto merge of #46592 - o01eg:fix-45345, r=alexcrichton - - Fix 45345 - - There is a fix for https://github.com/rust-lang/rust/issues/45345 - - It re-introduces `CFG_LIBDIR_RELATIVE` which was broken when migration from `configure` script to `x.py`. - - Other commits fix errors which happen after rustbuild cleanups. - -diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs -index 62037590853c..389b504c64cd 100644 ---- a/src/bootstrap/bin/rustdoc.rs -+++ b/src/bootstrap/bin/rustdoc.rs -@@ -23,10 +23,17 @@ use std::path::PathBuf; - fn main() { - let args = env::args_os().skip(1).collect::>(); - let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set"); -- let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set"); -+ let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set"); - let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set"); - let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); - -+ use std::str::FromStr; -+ -+ let verbose = match env::var("RUSTC_VERBOSE") { -+ Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"), -+ Err(_) => 0, -+ }; -+ - let mut dylib_path = bootstrap::util::dylib_path(); - dylib_path.insert(0, PathBuf::from(libdir)); - -@@ -63,6 +70,10 @@ fn main() { - cmd.arg("--deny-render-differences"); - } - -+ if verbose > 1 { -+ eprintln!("rustdoc command: {:?}", cmd); -+ } -+ - std::process::exit(match cmd.status() { - Ok(s) => s.code().unwrap_or(1), - Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e), -diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs -index ce30d1f4cec4..a660b5cf852a 100644 ---- a/src/bootstrap/builder.rs -+++ b/src/bootstrap/builder.rs -@@ -357,8 +357,8 @@ impl<'a> Builder<'a> { - - fn run(self, builder: &Builder) -> Interned { - let compiler = self.compiler; -- let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() { -- builder.build.config.libdir_relative.clone().unwrap() -+ let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() { -+ builder.build.config.libdir.clone().unwrap() - } else { - PathBuf::from("lib") - }; -@@ -416,7 +416,7 @@ impl<'a> Builder<'a> { - let compiler = self.compiler(self.top_stage, host); - cmd.env("RUSTC_STAGE", compiler.stage.to_string()) - .env("RUSTC_SYSROOT", self.sysroot(compiler)) -- .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build)) -+ .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build)) - .env("CFG_RELEASE_CHANNEL", &self.build.config.channel) - .env("RUSTDOC_REAL", self.rustdoc(host)) - .env("RUSTDOC_CRATE_VERSION", self.build.rust_version()) -@@ -496,6 +496,9 @@ impl<'a> Builder<'a> { - if let Some(target_linker) = self.build.linker(target) { - cargo.env("RUSTC_TARGET_LINKER", target_linker); - } -+ if cmd != "build" { -+ cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build))); -+ } - - if mode != Mode::Tool { - // Tools don't get debuginfo right now, e.g. cargo and rls don't -diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs -index cc9be3cec347..ed110762cb3c 100644 ---- a/src/bootstrap/check.rs -+++ b/src/bootstrap/check.rs -@@ -1166,7 +1166,7 @@ impl Step for Crate { - } - Mode::Librustc => { - builder.ensure(compile::Rustc { compiler, target }); -- compile::rustc_cargo(build, &compiler, target, &mut cargo); -+ compile::rustc_cargo(build, target, &mut cargo); - ("librustc", "rustc-main") - } - _ => panic!("can only test libraries"), -diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs -index c8e500a4f68c..c6adfc7ffae4 100644 ---- a/src/bootstrap/compile.rs -+++ b/src/bootstrap/compile.rs -@@ -485,7 +485,7 @@ impl Step for Rustc { - build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target)); - - let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build"); -- rustc_cargo(build, &compiler, target, &mut cargo); -+ rustc_cargo(build, target, &mut cargo); - run_cargo(build, - &mut cargo, - &librustc_stamp(build, compiler, target)); -@@ -500,7 +500,6 @@ impl Step for Rustc { - - /// Same as `std_cargo`, but for libtest - pub fn rustc_cargo(build: &Build, -- compiler: &Compiler, - target: Interned, - cargo: &mut Command) { - cargo.arg("--features").arg(build.rustc_features()) -@@ -514,13 +513,9 @@ pub fn rustc_cargo(build: &Build, - .env("CFG_VERSION", build.rust_version()) - .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); - -- if compiler.stage == 0 { -- cargo.env("CFG_LIBDIR_RELATIVE", "lib"); -- } else { -- let libdir_relative = -- build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); -- cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); -- } -+ let libdir_relative = -+ build.config.libdir.clone().unwrap_or(PathBuf::from("lib")); -+ cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); - - // If we're not building a compiler with debugging information then remove - // these two env vars which would be set otherwise. -diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs -index f3ffe9a27611..72e75fddc194 100644 ---- a/src/bootstrap/config.rs -+++ b/src/bootstrap/config.rs -@@ -121,7 +121,6 @@ pub struct Config { - pub docdir: Option, - pub bindir: Option, - pub libdir: Option, -- pub libdir_relative: Option, - pub mandir: Option, - pub codegen_tests: bool, - pub nodejs: Option, -diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs -index 832da24c994d..178d60dd7df7 100644 ---- a/src/bootstrap/doc.rs -+++ b/src/bootstrap/doc.rs -@@ -616,7 +616,7 @@ impl Step for Rustc { - t!(symlink_dir_force(&my_out, &out_dir)); - - let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc"); -- compile::rustc_cargo(build, &compiler, target, &mut cargo); -+ compile::rustc_cargo(build, target, &mut cargo); - - if build.config.compiler_docs { - // src/rustc/Cargo.toml contains a bin crate called rustc which diff --git a/rust-pr48362-libdir-relative.patch b/rust-pr48362-libdir-relative.patch deleted file mode 100644 index 71714a9..0000000 --- a/rust-pr48362-libdir-relative.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs -index 66a1c9724620..fcb78c479fa2 100644 ---- a/src/bootstrap/builder.rs -+++ b/src/bootstrap/builder.rs -@@ -444,10 +444,11 @@ impl<'a> Builder<'a> { - - fn run(self, builder: &Builder) -> Interned { - let compiler = self.compiler; -- let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() { -- builder.build.config.libdir.clone().unwrap() -+ let config = &builder.build.config; -+ let lib = if compiler.stage >= 1 && config.libdir_relative().is_some() { -+ builder.build.config.libdir_relative().unwrap() - } else { -- PathBuf::from("lib") -+ Path::new("lib") - }; - let sysroot = builder.sysroot(self.compiler).join(lib) - .join("rustlib").join(self.target).join("lib"); -diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs -index 2dcc0e0e7cd9..c85b04ddc024 100644 ---- a/src/bootstrap/compile.rs -+++ b/src/bootstrap/compile.rs -@@ -516,8 +516,7 @@ fn rustc_cargo_env(build: &Build, cargo: &mut Command) { - .env("CFG_VERSION", build.rust_version()) - .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); - -- let libdir_relative = -- build.config.libdir.clone().unwrap_or(PathBuf::from("lib")); -+ let libdir_relative = build.config.libdir_relative().unwrap_or(Path::new("lib")); - cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); - - // If we're not building a compiler with debugging information then remove -diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs -index 812ca6d64fb6..3cf8f36df25e 100644 ---- a/src/bootstrap/config.rs -+++ b/src/bootstrap/config.rs -@@ -17,7 +17,7 @@ use std::collections::{HashMap, HashSet}; - use std::env; - use std::fs::File; - use std::io::prelude::*; --use std::path::PathBuf; -+use std::path::{Path, PathBuf}; - use std::process; - use std::cmp; - -@@ -564,6 +564,17 @@ impl Config { - config - } - -+ /// Try to find the relative path of `libdir`. -+ pub fn libdir_relative(&self) -> Option<&Path> { -+ let libdir = self.libdir.as_ref()?; -+ if libdir.is_relative() { -+ Some(libdir) -+ } else { -+ // Try to make it relative to the prefix. -+ libdir.strip_prefix(self.prefix.as_ref()?).ok() -+ } -+ } -+ - pub fn verbose(&self) -> bool { - self.verbose > 0 - } diff --git a/rust.spec b/rust.spec index e8d3dd7..d1ef686 100644 --- a/rust.spec +++ b/rust.spec @@ -8,20 +8,15 @@ # To bootstrap from scratch, set the channel and date from src/stage0.txt # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD -%global bootstrap_rust 1.23.0 -%global bootstrap_cargo 0.24.0 +%global bootstrap_rust 1.24.0 +%global bootstrap_cargo 0.25.0 %global bootstrap_channel %{bootstrap_rust} -%global bootstrap_date 2018-01-04 +%global bootstrap_date 2018-02-15 # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} -# We generally don't want llvm-static present at all, since llvm-config will -# make us link statically. But we can opt in, e.g. to aid LLVM rebases. -# FIXME: LLVM 3.9 prefers shared linking now! Which is good, but next time we -# *want* static we'll have to force it with "llvm-config --link-static". -# See also https://github.com/rust-lang/rust/issues/36854 -# The new rustbuild accepts `--enable-llvm-link-shared`, else links static. +# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM @@ -47,7 +42,7 @@ Name: rust -Version: 1.24.1 +Version: 1.25.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and ISC and MIT) @@ -62,26 +57,11 @@ ExclusiveArch: %{rust_arches} %endif Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz -# https://github.com/WebAssembly/binaryen/pull/1400 -Patch1: 0001-Fix-Wcatch-value-from-GCC-8.patch +# https://github.com/rust-lang/rust/pull/49290 +Patch1: 0001-Allow-installing-rustfmt-without-config.extended.patch -# https://github.com/rust-lang/rust/pull/47610 -Patch2: 0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch - -# https://github.com/rust-lang/rust/pull/47688 -Patch3: 0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch - -# https://github.com/rust-lang/rust/pull/47884 -Patch4: 0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch - -# https://github.com/rust-lang/rust/pull/47912 -Patch5: 0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch -Patch6: 0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch - -# fix for https://github.com/rust-lang/rust/issues/47469 -# via https://github.com/rust-lang/rust/pull/46592 -Patch7: rust-pr46592-bootstrap-libdir.patch -Patch8: rust-pr48362-libdir-relative.patch +# https://github.com/rust-lang/rust/pull/49484 +Patch2: 0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -126,8 +106,12 @@ end} Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust} %else BuildRequires: cargo >= %{bootstrap_cargo} +%if 0%{?fedora} >= 27 +BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) +%else BuildRequires: %{name} >= %{bootstrap_rust} BuildConflicts: %{name} > %{version} +%endif %global local_rust_root %{_prefix} %endif @@ -147,10 +131,10 @@ BuildRequires: %{python} %if %with bundled_llvm BuildRequires: cmake3 >= 3.4.3 -Provides: bundled(llvm) = 4.0 +Provides: bundled(llvm) = 6.0 %else BuildRequires: cmake >= 2.8.7 -%if 0%{?epel} || 0%{?fedora} >= 28 +%if 0%{?epel} %global llvm llvm5.0 %endif %if %defined llvm @@ -159,13 +143,10 @@ BuildRequires: cmake >= 2.8.7 %global llvm llvm %global llvm_root %{_prefix} %endif -BuildRequires: %{llvm}-devel >= 3.7 +BuildRequires: %{llvm}-devel >= 3.9 %if %with llvm_static BuildRequires: %{llvm}-static BuildRequires: libffi-devel -%else -# Make sure llvm-config doesn't see it. -BuildConflicts: %{llvm}-static %endif %endif @@ -285,6 +266,20 @@ This package includes HTML documentation for the Rust programming language and its standard library. +%package -n rustfmt-preview +Summary: Tool to find and fix Rust formatting issues +Version: 0.3.8 +Requires: cargo + +# Despite the lower version, our rustfmt-preview is newer than rustfmt-0.9. +# It's expected to stay "preview" until it's released as 1.0. +Obsoletes: rustfmt <= 0.9.0 +Provides: rustfmt = %{version} + +%description -n rustfmt-preview +A tool for formatting Rust code according to style guidelines. + + %package src Summary: Sources for the Rust standard library BuildArch: noarch @@ -306,17 +301,8 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} -pushd src/binaryen -%patch1 -p1 -b .catch-value -popd - -%patch2 -p1 -b .DW_OP_plus_uconst -%patch3 -p1 -b .DW_OP_deref -%patch4 -p1 -b .sse2 -%patch5 -p1 -b .out-of-stack -%patch6 -p1 -b .out-of-stack -%patch7 -p1 -b .bootstrap-libdir -%patch8 -p1 -b .bootstrap-libdir-relative +%patch1 -p1 -b .dist-rustfmt +%patch2 -p1 -b .ignore-ibm %if "%{python}" == "python3" sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure @@ -329,6 +315,9 @@ sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure rm -rf src/llvm/ %endif +# We never enable emscripten. +rm -rf src/llvm-emscripten/ + # extract bundled licenses for packaging cp src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown sed -e '/*\//q' src/libbacktrace/backtrace.h \ @@ -381,7 +370,7 @@ find src/vendor -name .cargo-checksum.json \ %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ - --enable-local-rust --local-rust-root=%{local_rust_root} \ + --local-rust-root=%{local_rust_root} \ %{!?with_bundled_llvm: --llvm-root=%{llvm_root} --disable-codegen-tests \ %{!?with_llvm_static: --enable-llvm-link-shared } } \ --disable-jemalloc \ @@ -391,6 +380,7 @@ find src/vendor -name .cargo-checksum.json \ --release-channel=%{channel} %{python} ./x.py build +%{python} ./x.py build src/tools/rustfmt %{python} ./x.py doc @@ -400,6 +390,7 @@ find src/vendor -name .cargo-checksum.json \ %{?rustflags:export RUSTFLAGS="%{rustflags}"} DESTDIR=%{buildroot} %{python} ./x.py install +DESTDIR=%{buildroot} %{python} ./x.py install rustfmt DESTDIR=%{buildroot} %{python} ./x.py install src @@ -436,6 +427,7 @@ rm -f %{buildroot}%{_docdir}/%{name}/README.md rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT +rm -f %{buildroot}%{_docdir}/%{name}/*.old # Sanitize the HTML documentation find %{buildroot}%{_docdir}/%{name}/html -empty -delete @@ -454,6 +446,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* # The results are not stable on koji, so mask errors and just log it. %{python} ./x.py test --no-fail-fast || : +%{python} ./x.py test --no-fail-fast src/tools/rustfmt || : %ldconfig_scriptlets @@ -473,6 +466,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %dir %{rustlibdir}/%{rust_triple} %dir %{rustlibdir}/%{rust_triple}/lib %{rustlibdir}/%{rust_triple}/lib/*.so +%{rustlibdir}/%{rust_triple}/codegen-backends/ %files std-static @@ -508,16 +502,27 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %{_docdir}/%{name}/html/*.html %{_docdir}/%{name}/html/*.css %{_docdir}/%{name}/html/*.js +%{_docdir}/%{name}/html/*.svg %{_docdir}/%{name}/html/*.woff %license %{_docdir}/%{name}/html/*.txt +%files -n rustfmt-preview +%{_bindir}/rustfmt +%{_bindir}/cargo-fmt +%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md +%license src/tools/rustfmt/LICENSE-{APACHE,MIT} + + %files src %dir %{rustlibdir} %{rustlibdir}/src %changelog +* Thu Mar 29 2018 Josh Stone - 1.25.0-1 +- Update to 1.25.0. + * Thu Mar 01 2018 Josh Stone - 1.24.1-1 - Update to 1.24.1. diff --git a/sources b/sources index edb69e6..f314e88 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rustc-1.24.1-src.tar.xz) = 5f1fa594f55278f512b70af1f0e5a5ac377cab23ea7fb12d4f4982b5424f993a1f53bbfca28af8168d19ff95b56e107aaa0f684ecaa3264195a274cc5b10caf6 +SHA512 (rustc-1.25.0-src.tar.xz) = 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2 diff --git a/sources-bootstrap b/sources-bootstrap index a57beb7..9c4838f 100644 --- a/sources-bootstrap +++ b/sources-bootstrap @@ -1,8 +1,8 @@ -SHA512 (rustc-1.24.1-src.tar.xz) = 5f1fa594f55278f512b70af1f0e5a5ac377cab23ea7fb12d4f4982b5424f993a1f53bbfca28af8168d19ff95b56e107aaa0f684ecaa3264195a274cc5b10caf6 -SHA512 (rust-1.23.0-aarch64-unknown-linux-gnu.tar.xz) = 1d0fbf800a5ede9101570507d6cca4ef79445f2df3ace194ce74702eb507d7de5fe7f4a30dd5e5561faa2bfa205c237dee98eca6eefc8b652d21c0c373099ca6 -SHA512 (rust-1.23.0-armv7-unknown-linux-gnueabihf.tar.xz) = 2ef07187d78060005e99676cf1f168e7a8861e9f104c95056cfe8784a7fa35b14f0b69ba4adc8be4173ef8d4ce7554f92487385a09602343ab65fcf749fbe35c -SHA512 (rust-1.23.0-i686-unknown-linux-gnu.tar.xz) = 6863a512100ae0369d0a5c4242d45fda9b83a2ad6c3e6691f4f0d1e071dca7003c55873cc03a9d09305adae24667e654bda66a8ad3246f4df2d7a2fc0fc4d7a7 -SHA512 (rust-1.23.0-powerpc64le-unknown-linux-gnu.tar.xz) = d17acdbed5d7007fade8d85492d1f6f3d46bb63f98d76e0313967175d6be0752d4643a26d8e3a1319e7f7782117ccbb76c6c891f9bb3cf3e6e2ab0f61d63574d -SHA512 (rust-1.23.0-powerpc64-unknown-linux-gnu.tar.xz) = 19b7e734741fbe1318fffbd3698d3d208fbe978698d8f8e8b9f136d4f954821e94bec0979d4d3871e49acd589c67c0457f9320ac69fabea70a6839c2928c8d2a -SHA512 (rust-1.23.0-s390x-unknown-linux-gnu.tar.xz) = c47e4750b02ffd7ffc423db12e8974d16384187938f5ab263a23cedb17f4b27a08acbc927365a1a23b4ee1b12e3ce2f15fdc059b6fe3932ef61798747cb9ddf7 -SHA512 (rust-1.23.0-x86_64-unknown-linux-gnu.tar.xz) = a5a3aa11d04e81305d33ed50fe657dcebb8c3a1f71a0a2b54372439ff6b1b4b7d2abd9c579b27950be67921cbb41586346824faf71495fb4f3f505ed8a48ccc9 +SHA512 (rustc-1.25.0-src.tar.xz) = 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2 +SHA512 (rust-1.24.0-aarch64-unknown-linux-gnu.tar.xz) = c8be9bd2929d5a9ac96524bdbbc3b137c703a54d6bdf19a8abee69fcb2cf7d11693a79c520571da021fb0c059de5f759f6c0336d4e42f278584c0ec3783983ce +SHA512 (rust-1.24.0-armv7-unknown-linux-gnueabihf.tar.xz) = 57383893b1015377857509f9d485629fc181408089c577b725e52577e5cc44a69f557c8311324473008d879e7917105077045591e72c7d09b4b57bcf020fd39d +SHA512 (rust-1.24.0-i686-unknown-linux-gnu.tar.xz) = d7e4ae046bea9c8fd5709fc316965bd0422afc1b7cf2b35bebc8899524bb5e12c1e685dc395e96f43957ab9b6ab3039fa0c0306751b6f1771bd6550d559e66a8 +SHA512 (rust-1.24.0-powerpc64le-unknown-linux-gnu.tar.xz) = f1a6ad1b66ce4e928a7f7aed8476fedc9ef93ef8520aa34781a5e7e8e2ab2ac3b13fc325d37bd30bc9cc3dc709b2286436b6c68eae1748c434860b51643afa1b +SHA512 (rust-1.24.0-powerpc64-unknown-linux-gnu.tar.xz) = 0a2fbe4017c2c69e5fc2b35591f40fa45cf03be93ed0c03c56fb10d76dd78f7a86c40552afb60e360aa05447faf278e2988a9a0056a21950ba05daad1bf070a1 +SHA512 (rust-1.24.0-s390x-unknown-linux-gnu.tar.xz) = 252342cad4d41f7f972aec7a96e2ed0c8044af9a8c02bfdb36e47b591fad33df4234c141b7532e62f33d7f57af2191cbfb88606e2c59e927b08e41d9f0f8d2a5 +SHA512 (rust-1.24.0-x86_64-unknown-linux-gnu.tar.xz) = 876e5d66b5531a5dd1c42b8b2f073bc463a6dead348d5857f43b0047a4f6b101d26c7b29d6bbe1c1ea64cb6ca8c36d0159ff4dc75418e4216e7e585b169276ff From be4334fc3c4fcfec07e47a9e7a292bfabbad516d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Apr 2018 12:48:50 -0700 Subject: [PATCH 2/5] Filter codegen-backends from Provides too. --- rust.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index d1ef686..464d3e0 100644 --- a/rust.spec +++ b/rust.spec @@ -43,7 +43,7 @@ Name: rust Version: 1.25.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and ISC and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -175,7 +175,7 @@ Requires: %{name}-std-static%{?_isa} = %{version}-%{release} Requires: /usr/bin/cc # ALL Rust libraries are private, because they don't keep an ABI. -%global _privatelibs lib.*-[[:xdigit:]]*[.]so.* +%global _privatelibs lib(.*-[[:xdigit:]]*|rustc.*)[.]so.* %global __provides_exclude ^(%{_privatelibs})$ %global __requires_exclude ^(%{_privatelibs})$ %global __provides_exclude_from ^%{_docdir}/.*$ @@ -520,6 +520,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %changelog +* Tue Apr 10 2018 Josh Stone - 1.25.0-2 +- Filter codegen-backends from Provides too. + * Thu Mar 29 2018 Josh Stone - 1.25.0-1 - Update to 1.25.0. From 4fd41d0a2976d23777c4e53d4d61b7cde99f3fd1 Mon Sep 17 00:00:00 2001 From: Dan Callaghan Date: Mon, 16 Apr 2018 13:47:49 +1000 Subject: [PATCH 3/5] Add cargo, rls, and analysis --- pull-49959.patch | 195 +++++++++++++++++++++++++++++++++++++++++++++++ rust.spec | 178 +++++++++++++++++++++++++++++++++++------- 2 files changed, 346 insertions(+), 27 deletions(-) create mode 100644 pull-49959.patch diff --git a/pull-49959.patch b/pull-49959.patch new file mode 100644 index 0000000..be2ed9f --- /dev/null +++ b/pull-49959.patch @@ -0,0 +1,195 @@ +From f89f1b496c0c3b96aa8e41bef882131008dac6c3 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 13 Apr 2018 16:52:54 -0700 +Subject: [PATCH 1/3] rustbuild: allow building tools with debuginfo + +Debugging information for the extended tools is currently disabled for +concerns about the size. This patch adds `--enable-debuginfo-tools` to +let one opt into having that debuginfo. + +This is useful for debugging the tools in distro packages. We always +strip debuginfo into separate packages anyway, so the extra size is not +a concern in regular use. +--- + CONTRIBUTING.md | 1 + + config.toml.example | 4 ++++ + src/bootstrap/builder.rs | 12 ++++++++---- + src/bootstrap/config.rs | 5 +++++ + src/bootstrap/configure.py | 1 + + 5 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md +index 70376c120f..fcd995b703 100644 +--- a/CONTRIBUTING.md ++++ b/CONTRIBUTING.md +@@ -121,6 +121,7 @@ configuration used in the build process. Some options to note: + #### `[rust]`: + - `debuginfo = true` - Build a compiler with debuginfo. Makes building rustc slower, but then you can use a debugger to debug `rustc`. + - `debuginfo-lines = true` - An alternative to `debuginfo = true` that doesn't let you use a debugger, but doesn't make building rustc slower and still gives you line numbers in backtraces. ++- `debuginfo-tools = true` - Build the extended tools with debuginfo. + - `debug-assertions = true` - Makes the log output of `debug!` work. + - `optimize = false` - Disable optimizations to speed up compilation of stage1 rust, but makes the stage1 compiler x100 slower. + +diff --git a/config.toml.example b/config.toml.example +index f153562a53..64e2f1b424 100644 +--- a/config.toml.example ++++ b/config.toml.example +@@ -259,6 +259,10 @@ + # standard library. + #debuginfo-only-std = false + ++# Enable debuginfo for the extended tools: cargo, rls, rustfmt ++# Adding debuginfo increases their sizes by a factor of 3-4. ++#debuginfo-tools = false ++ + # Whether or not jemalloc is built and enabled + #use-jemalloc = true + +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs +index fcb78c479f..584c0cbe75 100644 +--- a/src/bootstrap/builder.rs ++++ b/src/bootstrap/builder.rs +@@ -603,10 +603,14 @@ impl<'a> Builder<'a> { + cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build))); + } + +- if mode != Mode::Tool { +- // Tools don't get debuginfo right now, e.g. cargo and rls don't +- // get compiled with debuginfo. +- // Adding debuginfo increases their sizes by a factor of 3-4. ++ if mode == Mode::Tool { ++ // Tools like cargo and rls don't get debuginfo by default right now, but this can be ++ // enabled in the config. Adding debuginfo increases their sizes by a factor of 3-4. ++ if self.config.rust_debuginfo_tools { ++ cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()); ++ cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()); ++ } ++ } else { + cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()); + cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()); + cargo.env("RUSTC_FORCE_UNSTABLE", "1"); +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index f3810ac869..ac64e6e8e3 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -88,6 +88,7 @@ pub struct Config { + pub rust_debuginfo: bool, + pub rust_debuginfo_lines: bool, + pub rust_debuginfo_only_std: bool, ++ pub rust_debuginfo_tools: bool, + pub rust_rpath: bool, + pub rustc_parallel_queries: bool, + pub rustc_default_linker: Option, +@@ -271,6 +272,7 @@ struct Rust { + debuginfo: Option, + debuginfo_lines: Option, + debuginfo_only_std: Option, ++ debuginfo_tools: Option, + experimental_parallel_queries: Option, + debug_jemalloc: Option, + use_jemalloc: Option, +@@ -425,6 +427,7 @@ impl Config { + let mut llvm_assertions = None; + let mut debuginfo_lines = None; + let mut debuginfo_only_std = None; ++ let mut debuginfo_tools = None; + let mut debug = None; + let mut debug_jemalloc = None; + let mut debuginfo = None; +@@ -462,6 +465,7 @@ impl Config { + debuginfo = rust.debuginfo; + debuginfo_lines = rust.debuginfo_lines; + debuginfo_only_std = rust.debuginfo_only_std; ++ debuginfo_tools = rust.debuginfo_tools; + optimize = rust.optimize; + ignore_git = rust.ignore_git; + debug_jemalloc = rust.debug_jemalloc; +@@ -553,6 +557,7 @@ impl Config { + config.rust_thinlto = thinlto.unwrap_or(true); + config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default); + config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default); ++ config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(default); + + let default = debug == Some(true); + config.debug_jemalloc = debug_jemalloc.unwrap_or(default); +diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py +index 99a3ee4e4c..689dd905fb 100755 +--- a/src/bootstrap/configure.py ++++ b/src/bootstrap/configure.py +@@ -78,6 +78,7 @@ def v(*args): + o("debuginfo", "rust.debuginfo", "build with debugger metadata") + o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata") + o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information") ++o("debuginfo-tools", "rust.debuginfo-tools", "build extended tools with debugging information") + o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill") + v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file") + +-- +2.14.3 + + +From f0a43d3a9a4c28ea45d6bed430b1d9d561944e16 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 13 Apr 2018 21:57:53 -0700 +Subject: [PATCH 2/3] Avoid specific claims about debuginfo size + +--- + config.toml.example | 2 +- + src/bootstrap/builder.rs | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config.toml.example b/config.toml.example +index 64e2f1b424..46be1ecab7 100644 +--- a/config.toml.example ++++ b/config.toml.example +@@ -260,7 +260,7 @@ + #debuginfo-only-std = false + + # Enable debuginfo for the extended tools: cargo, rls, rustfmt +-# Adding debuginfo increases their sizes by a factor of 3-4. ++# Adding debuginfo makes them several times larger. + #debuginfo-tools = false + + # Whether or not jemalloc is built and enabled +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs +index 584c0cbe75..627a695884 100644 +--- a/src/bootstrap/builder.rs ++++ b/src/bootstrap/builder.rs +@@ -605,7 +605,7 @@ impl<'a> Builder<'a> { + + if mode == Mode::Tool { + // Tools like cargo and rls don't get debuginfo by default right now, but this can be +- // enabled in the config. Adding debuginfo increases their sizes by a factor of 3-4. ++ // enabled in the config. Adding debuginfo makes them several times larger. + if self.config.rust_debuginfo_tools { + cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()); + cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()); +-- +2.14.3 + + +From 7ddb573a2ea41ad3c35f927b7b90fd545a6ab9da Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 13 Apr 2018 21:58:21 -0700 +Subject: [PATCH 3/3] Make debuginfo-tools always default false + +--- + src/bootstrap/config.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index ac64e6e8e3..06443ae6cd 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -557,7 +557,7 @@ impl Config { + config.rust_thinlto = thinlto.unwrap_or(true); + config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default); + config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default); +- config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(default); ++ config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false); + + let default = debug == Some(true); + config.debug_jemalloc = debug_jemalloc.unwrap_or(default); +-- +2.14.3 + diff --git a/rust.spec b/rust.spec index 464d3e0..a9e58df 100644 --- a/rust.spec +++ b/rust.spec @@ -39,11 +39,15 @@ %bcond_with lldb %endif - +# Some sub-packages are versioned independently of the rust compiler and runtime itself. +%global rustc_version 1.25.0 +%global cargo_version 0.26.0 +%global rustfmt_version 0.3.8 +%global rls_version 0.125.1 Name: rust -Version: 1.25.0 -Release: 2%{?dist} +Version: %{rustc_version} +Release: 3%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and ISC and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -51,17 +55,17 @@ URL: https://www.rust-lang.org ExclusiveArch: %{rust_arches} %if "%{channel}" == "stable" -%global rustc_package rustc-%{version}-src +%global rustc_package rustc-%{rustc_version}-src %else %global rustc_package rustc-%{channel}-src %endif Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz -# https://github.com/rust-lang/rust/pull/49290 -Patch1: 0001-Allow-installing-rustfmt-without-config.extended.patch - # https://github.com/rust-lang/rust/pull/49484 -Patch2: 0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch +Patch1: 0001-Ignore-stack-probes-tests-on-powerpc-s390x-too.patch + +# https://github.com/rust-lang/rust/pull/49959 +Patch2: pull-49959.patch # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -107,10 +111,10 @@ Provides: bundled(%{name}-bootstrap) = %{bootstrap_rust} %else BuildRequires: cargo >= %{bootstrap_cargo} %if 0%{?fedora} >= 27 -BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{version}) +BuildRequires: (%{name} >= %{bootstrap_rust} with %{name} <= %{rustc_version}) %else BuildRequires: %{name} >= %{bootstrap_rust} -BuildConflicts: %{name} > %{version} +BuildConflicts: %{name} > %{rustc_version} %endif %global local_rust_root %{_prefix} %endif @@ -119,8 +123,12 @@ BuildRequires: make BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: ncurses-devel -BuildRequires: zlib-devel BuildRequires: curl +BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(liblzma) +BuildRequires: pkgconfig(libssh2) +BuildRequires: pkgconfig(openssl) +BuildRequires: pkgconfig(zlib) %if 0%{?rhel} && 0%{?rhel} <= 7 %global python python2 @@ -163,11 +171,11 @@ Provides: bundled(libbacktrace) = 6.1.0 Provides: bundled(miniz) = 1.16~beta+r1 # Virtual provides for folks who attempt "dnf install rustc" -Provides: rustc = %{version}-%{release} -Provides: rustc%{?_isa} = %{version}-%{release} +Provides: rustc = %{rustc_version}-%{release} +Provides: rustc%{?_isa} = %{rustc_version}-%{release} # Always require our exact standard library -Requires: %{name}-std-static%{?_isa} = %{version}-%{release} +Requires: %{name}-std-static%{?_isa} = %{rustc_version}-%{release} # The C compiler is needed at runtime just for linking. Someday rustc might # invoke the linker directly, and then we'll only need binutils. @@ -228,7 +236,7 @@ This package includes the common functionality for %{name}-gdb and %{name}-lldb. Summary: GDB pretty printers for Rust BuildArch: noarch Requires: gdb -Requires: %{name}-debugger-common = %{version}-%{release} +Requires: %{name}-debugger-common = %{rustc_version}-%{release} %description gdb This package includes the rust-gdb script, which allows easier debugging of Rust @@ -245,7 +253,7 @@ Summary: LLDB pretty printers for Rust Requires: lldb Requires: python2-lldb -Requires: %{name}-debugger-common = %{version}-%{release} +Requires: %{name}-debugger-common = %{rustc_version}-%{release} %description lldb This package includes the rust-lldb script, which allows easier debugging of Rust @@ -266,20 +274,68 @@ This package includes HTML documentation for the Rust programming language and its standard library. +%package -n cargo +Summary: Rust's package manager and build tool +Version: %{cargo_version} +%if %with bundled_libgit2 +Provides: bundled(libgit2) = 0.26.0 +%else +BuildRequires: pkgconfig(libgit2) >= 0.24 +%endif +# For tests: +BuildRequires: git +# Cargo is not much use without Rust +Requires: rust + +%description -n cargo +Cargo is a tool that allows Rust projects to declare their various dependencies +and ensure that you'll always get a repeatable build. + + +%package -n cargo-doc +Summary: Documentation for Cargo +Version: %{cargo_version} +BuildArch: noarch +# Cargo no longer builds its own documentation +# https://github.com/rust-lang/cargo/pull/4904 +Requires: rust-doc + +%description -n cargo-doc +This package includes HTML documentation for Cargo. + + %package -n rustfmt-preview Summary: Tool to find and fix Rust formatting issues -Version: 0.3.8 +Version: %{rustfmt_version} Requires: cargo # Despite the lower version, our rustfmt-preview is newer than rustfmt-0.9. # It's expected to stay "preview" until it's released as 1.0. Obsoletes: rustfmt <= 0.9.0 -Provides: rustfmt = %{version} +Provides: rustfmt = %{rustfmt_version} %description -n rustfmt-preview A tool for formatting Rust code according to style guidelines. +%package -n rls-preview +Summary: Rust Language Server for IDE integration +Version: %{rls_version} +Provides: rls = %{rls_version} +%if %with bundled_libgit2 +Provides: bundled(libgit2) = 0.26.0 +%endif +Requires: rust-analysis +# /usr/bin/rls is dynamically linked against internal rustc libs +Requires: %{name}%{?_isa} = %{rustc_version}-%{release} + +%description -n rls-preview +The Rust Language Server provides a server that runs in the background, +providing IDEs, editors, and other tools with information about Rust programs. +It supports functionality such as 'goto definition', symbol search, +reformatting, and code completion, and enables renaming and refactorings. + + %package src Summary: Sources for the Rust standard library BuildArch: noarch @@ -289,6 +345,16 @@ This package includes source files for the Rust standard library. It may be useful as a reference for code completion tools in various editors. +%package analysis +Summary: Compiler analysis data for the Rust standard library +Requires: rust-std-static%{?_isa} = %{rustc_version}-%{release} + +%description analysis +This package contains analysis data files produced with rustc's -Zsave-analysis +feature for the Rust standard library. The RLS (Rust Language Server) uses this +data to provide information about the Rust standard library. + + %prep %ifarch %{bootstrap_arches} @@ -301,8 +367,8 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} -%patch1 -p1 -b .dist-rustfmt -%patch2 -p1 -b .ignore-ibm +%patch1 -p1 -b .ignore-ibm +%patch2 -p1 %if "%{python}" == "python3" sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure @@ -350,6 +416,11 @@ find src/vendor -name .cargo-checksum.json \ %build +%if %without bundled_libgit2 +# convince libgit2-sys to use the distro libgit2 +export LIBGIT2_SYS_USE_PKG_CONFIG=1 +%endif + %{?cmake_path:export PATH=%{cmake_path}:$PATH} %{?library_path:export LIBRARY_PATH="%{library_path}"} %{?rustflags:export RUSTFLAGS="%{rustflags}"} @@ -362,9 +433,9 @@ find src/vendor -name .cargo-checksum.json \ %ifarch %{arm} # full debuginfo is exhausting memory; just do libstd for now # https://github.com/rust-lang/rust/issues/45854 -%define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-lines +%define enable_debuginfo --enable-debuginfo --enable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines %else -%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-lines +%define enable_debuginfo --enable-debuginfo --disable-debuginfo-only-std --enable-debuginfo-tools --disable-debuginfo-lines %endif %configure --disable-option-checking \ @@ -376,11 +447,11 @@ find src/vendor -name .cargo-checksum.json \ --disable-jemalloc \ --disable-rpath \ %{enable_debuginfo} \ + --enable-extended \ --enable-vendor \ --release-channel=%{channel} %{python} ./x.py build -%{python} ./x.py build src/tools/rustfmt %{python} ./x.py doc @@ -390,9 +461,6 @@ find src/vendor -name .cargo-checksum.json \ %{?rustflags:export RUSTFLAGS="%{rustflags}"} DESTDIR=%{buildroot} %{python} ./x.py install -DESTDIR=%{buildroot} %{python} ./x.py install rustfmt -DESTDIR=%{buildroot} %{python} ./x.py install src - # Make sure the shared libraries are in the proper libdir %if "%{_libdir}" != "%{common_libdir}" @@ -427,12 +495,38 @@ rm -f %{buildroot}%{_docdir}/%{name}/README.md rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT +rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY rm -f %{buildroot}%{_docdir}/%{name}/*.old # Sanitize the HTML documentation find %{buildroot}%{_docdir}/%{name}/html -empty -delete find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' +# Create the path for crate-devel packages +mkdir -p %{buildroot}%{_datadir}/cargo/registry + +# Cargo no longer builds its own documentation +# https://github.com/rust-lang/cargo/pull/4904 +mkdir -p %{buildroot}%{_docdir}/cargo/html +cat < %{buildroot}%{_docdir}/cargo/html/index.html + + + + + + + cargo-doc redirection + + + Cargo documentation has been moved to the rust-doc package. + If you are not redirected automatically, please follow this + link. + + +EOF + %if %without lldb rm -f %{buildroot}%{_bindir}/rust-lldb rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* @@ -446,7 +540,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* # The results are not stable on koji, so mask errors and just log it. %{python} ./x.py test --no-fail-fast || : -%{python} ./x.py test --no-fail-fast src/tools/rustfmt || : +%{python} ./x.py test --no-fail-fast cargo || : +%{python} ./x.py test --no-fail-fast rls || : +%{python} ./x.py test --no-fail-fast rustfmt || : %ldconfig_scriptlets @@ -507,6 +603,21 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %license %{_docdir}/%{name}/html/*.txt +%files -n cargo +%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY +%doc src/tools/cargo/README.md +%{_bindir}/cargo +%{_mandir}/man1/cargo*.1* +%{_sysconfdir}/bash_completion.d/cargo +%{_datadir}/zsh/site-functions/_cargo +%dir %{_datadir}/cargo +%dir %{_datadir}/cargo/registry + + +%files -n cargo-doc +%{_docdir}/cargo/html + + %files -n rustfmt-preview %{_bindir}/rustfmt %{_bindir}/cargo-fmt @@ -514,12 +625,25 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %license src/tools/rustfmt/LICENSE-{APACHE,MIT} +%files -n rls-preview +%{_bindir}/rls +%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} +%license src/tools/rls/LICENSE-{APACHE,MIT} + + %files src %dir %{rustlibdir} %{rustlibdir}/src +%files analysis +%{rustlibdir}/%{rust_triple}/analysis/ + + %changelog +* Mon Apr 16 2018 Dan Callaghan - 1.25.0-3 +- Add cargo, rls, and analysis + * Tue Apr 10 2018 Josh Stone - 1.25.0-2 - Filter codegen-backends from Provides too. From 661ac15382cf0d91e174adb2a6e4b333962d39f1 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 18 Apr 2018 13:12:26 -0700 Subject: [PATCH 4/5] remove unused patch --- ...ling-rustfmt-without-config.extended.patch | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 0001-Allow-installing-rustfmt-without-config.extended.patch diff --git a/0001-Allow-installing-rustfmt-without-config.extended.patch b/0001-Allow-installing-rustfmt-without-config.extended.patch deleted file mode 100644 index 531761f..0000000 --- a/0001-Allow-installing-rustfmt-without-config.extended.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 86f7d8939d19d42e21d4e794e648f0aef14eeec9 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Thu, 22 Mar 2018 18:31:32 -0700 -Subject: [PATCH] Allow installing rustfmt without config.extended - -This assertion was preventing `./x.py install rustfmt` if attempted -without an "extended" build configuration, but it actually builds and -installs just fine. ---- - src/bootstrap/dist.rs | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs -index eca06eac7f30..142296b20958 100644 ---- a/src/bootstrap/dist.rs -+++ b/src/bootstrap/dist.rs -@@ -1186,7 +1186,6 @@ impl Step for Rustfmt { - let build = builder.build; - let stage = self.stage; - let target = self.target; -- assert!(build.config.extended); - - println!("Dist Rustfmt stage{} ({})", stage, target); - let src = build.src.join("src/tools/rustfmt"); --- -2.14.3 - From 8ccb9826819a1c64a81b10bd031b9ebae1774f2d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 18 Apr 2018 13:14:57 -0700 Subject: [PATCH 5/5] Add a %bcond for libgit2 --- rust.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust.spec b/rust.spec index a9e58df..0e827dd 100644 --- a/rust.spec +++ b/rust.spec @@ -27,6 +27,13 @@ %bcond_with bundled_llvm %endif +# Some targets don't have libgit2 +%if 0%{?rhel} && !0%{?epel} +%bcond_without bundled_libgit2 +%else +%bcond_with bundled_libgit2 +%endif + # LLDB only works on some architectures %ifarch %{arm} aarch64 %{ix86} x86_64 # LLDB isn't available everywhere...