diff --git a/.gitignore b/.gitignore index 1ced8d9..7934d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,12 @@ /rust-1.22.0-powerpc64-unknown-linux-gnu.tar.xz /rust-1.22.0-s390x-unknown-linux-gnu.tar.xz /rust-1.22.0-x86_64-unknown-linux-gnu.tar.xz +/rustc-1.24.0-src.tar.xz +/rust-1.23.0-aarch64-unknown-linux-gnu.tar.xz +/rust-1.23.0-armv7-unknown-linux-gnueabihf.tar.xz +/rust-1.23.0-i686-unknown-linux-gnu.tar.xz +/rust-1.23.0-powerpc64le-unknown-linux-gnu.tar.xz +/rust-1.23.0-powerpc64-unknown-linux-gnu.tar.xz +/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 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 new file mode 100644 index 0000000..b3626cc --- /dev/null +++ b/0001-Enable-stack-probe-tests-with-system-LLVM-5.0.patch @@ -0,0 +1,67 @@ +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-Ignore-run-pass-sse2-when-using-system-LLVM.patch b/0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch new file mode 100644 index 0000000..bf8eedd --- /dev/null +++ b/0001-Ignore-run-pass-sse2-when-using-system-LLVM.patch @@ -0,0 +1,27 @@ +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/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch b/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch new file mode 100644 index 0000000..6003804 --- /dev/null +++ b/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch @@ -0,0 +1,341 @@ +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 new file mode 100644 index 0000000..b21fcfb --- /dev/null +++ b/rust-pr46592-bootstrap-libdir.patch @@ -0,0 +1,159 @@ +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 new file mode 100644 index 0000000..71714a9 --- /dev/null +++ b/rust-pr48362-libdir-relative.patch @@ -0,0 +1,64 @@ +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 24d444f..d88f080 100644 --- a/rust.spec +++ b/rust.spec @@ -25,7 +25,7 @@ %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM -# is insufficient. Rust currently requires LLVM 3.7+. +# is insufficient. Rust currently requires LLVM 3.9+. %if 0%{?rhel} && !0%{?epel} %bcond_without bundled_llvm %else @@ -47,8 +47,8 @@ Name: rust -Version: 1.24.0 -Release: 0.beta.11%{?dist} +Version: 1.24.1 +Release: 1%{?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) @@ -62,14 +62,26 @@ 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/47610 -Patch1: 0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch +Patch2: 0001-Update-DW_OP_plus-to-DW_OP_plus_uconst.patch # https://github.com/rust-lang/rust/pull/47688 -Patch2: 0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch +Patch3: 0001-Let-LLVM-5-add-DW_OP_deref-to-indirect-args-itself.patch -# https://github.com/WebAssembly/binaryen/pull/1400 -Patch3: 0001-Fix-Wcatch-value-from-GCC-8.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 # Get the Rust triple for any arch. %{lua: function rust_triple(arch) @@ -124,9 +136,15 @@ BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: ncurses-devel BuildRequires: zlib-devel -BuildRequires: python2 BuildRequires: curl +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global python python2 +%else +%global python python3 +%endif +BuildRequires: %{python} + %if %with bundled_llvm BuildRequires: cmake3 >= 3.4.3 Provides: bundled(llvm) = 4.0 @@ -158,10 +176,10 @@ BuildRequires: procps-ng BuildRequires: gdb # TODO: work on unbundling these! -Provides: bundled(hoedown) = 3.0.5 +Provides: bundled(hoedown) = 3.0.7 Provides: bundled(jquery) = 2.1.4 Provides: bundled(libbacktrace) = 6.1.0 -Provides: bundled(miniz) = 1.14 +Provides: bundled(miniz) = 1.16~beta+r1 # Virtual provides for folks who attempt "dnf install rustc" Provides: rustc = %{version}-%{release} @@ -245,7 +263,7 @@ Summary: LLDB pretty printers for Rust #BuildArch: noarch Requires: lldb -Requires: python-lldb +Requires: python2-lldb Requires: %{name}-debugger-common = %{version}-%{release} %description lldb @@ -288,13 +306,22 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} -%patch1 -p1 -b .DW_OP_plus_uconst -%patch2 -p1 -b .DW_OP_deref - pushd src/binaryen -%patch3 -p1 -b .catch-value +%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 + +%if "%{python}" == "python3" +sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure +%endif + # We're disabling jemalloc, but rust-src still wants it. # rm -rf src/jemalloc/ @@ -363,8 +390,8 @@ find src/vendor -name .cargo-checksum.json \ --enable-vendor \ --release-channel=%{channel} -./x.py build -./x.py doc +%{python} ./x.py build +%{python} ./x.py doc %install @@ -372,8 +399,8 @@ find src/vendor -name .cargo-checksum.json \ %{?library_path:export LIBRARY_PATH="%{library_path}"} %{?rustflags:export RUSTFLAGS="%{rustflags}"} -DESTDIR=%{buildroot} ./x.py install -DESTDIR=%{buildroot} ./x.py install src +DESTDIR=%{buildroot} %{python} ./x.py install +DESTDIR=%{buildroot} %{python} ./x.py install src # Make sure the shared libraries are in the proper libdir @@ -391,8 +418,12 @@ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ # library loading if we keep them in libdir, but we do need them in rustlib/ # to support dynamic linking for compiler plugins, so we'll symlink. (cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && - find ../../../../%{_lib} -maxdepth 1 -name '*.so' \ - -exec ln -v -f -s -t . '{}' '+') + find ../../../../%{_lib} -maxdepth 1 -name '*.so' | + while read lib; do + # make sure they're actually identical! + cmp "$lib" "${lib##*/}" + ln -v -f -s -t . "$lib" + done) # Remove installer artifacts (manifests, uninstall scripts, etc.) find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' @@ -422,7 +453,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %{?rustflags:export RUSTFLAGS="%{rustflags}"} # The results are not stable on koji, so mask errors and just log it. -./x.py test --no-fail-fast || : +%{python} ./x.py test --no-fail-fast || : %ldconfig_scriptlets @@ -487,11 +518,27 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %changelog -* Mon Feb 05 2018 Josh Stone - 1.24.0-0.beta.11 -- beta test +* Thu Mar 01 2018 Josh Stone - 1.24.1-1 +- Update to 1.24.1. -* Fri Feb 02 2018 Josh Stone - 1.24.0-0.beta.8 -- beta test, use LLVM 5 where available +* Wed Feb 21 2018 Josh Stone - 1.24.0-3 +- Backport a rebuild fix for rust#48308. + +* Mon Feb 19 2018 Josh Stone - 1.24.0-2 +- rhbz1546541: drop full-bootstrap; cmp libs before symlinking. +- Backport pr46592 to fix local_rebuild bootstrapping. +- Backport pr48362 to fix relative/absolute libdir. + +* Thu Feb 15 2018 Josh Stone - 1.24.0-1 +- Update to 1.24.0. + +* Mon Feb 12 2018 Iryna Shcherbina - 1.23.0-4 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Tue Feb 06 2018 Josh Stone - 1.23.0-3 +- Use full-bootstrap to work around a rebuild issue. +- Patch binaryen for GCC 8 * Thu Feb 01 2018 Igor Gnatenko - 1.23.0-2 - Switch to %%ldconfig_scriptlets diff --git a/sources b/sources index f5b3446..edb69e6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rustc-1.23.0-src.tar.xz) = 2e605121dd5152c1a898b263d634b0ac55c7ea79c7fbc9f72c432e68fb397618a267283f3dfb0f77d5e189720d788b1937e8114a1f71bdb10ddd4cbaae92fa80 +SHA512 (rustc-1.24.1-src.tar.xz) = 5f1fa594f55278f512b70af1f0e5a5ac377cab23ea7fb12d4f4982b5424f993a1f53bbfca28af8168d19ff95b56e107aaa0f684ecaa3264195a274cc5b10caf6 diff --git a/sources-bootstrap b/sources-bootstrap index 8a5a2b8..a57beb7 100644 --- a/sources-bootstrap +++ b/sources-bootstrap @@ -1,8 +1,8 @@ -SHA512 (rustc-1.23.0-src.tar.xz) = 2e605121dd5152c1a898b263d634b0ac55c7ea79c7fbc9f72c432e68fb397618a267283f3dfb0f77d5e189720d788b1937e8114a1f71bdb10ddd4cbaae92fa80 -SHA512 (rust-1.22.0-aarch64-unknown-linux-gnu.tar.xz) = 9fbf60153e375746d665e23a273ea3bd9c0fc5f3116bb40dcfb385d8d519f67a07712f0b28371854b2d00f4bcd8e174f6182d3c3fbfd88c9901fff4d59f117b5 -SHA512 (rust-1.22.0-armv7-unknown-linux-gnueabihf.tar.xz) = 2deeca2cc96506b270c54395c2f4a9f649c06d1042f51947fab1048092f746c6f9aa5025a5d322f5a1591675d21438496de72ea389270e89c7f3e98a11b14dae -SHA512 (rust-1.22.0-i686-unknown-linux-gnu.tar.xz) = 76aa4dbbfd4c1a9efe84c2cb062462747d41caed505aebad3e51cd8ce9fa4470a06640fc202a6d46dc17c31e7f2b396442b15c3ae5462d6de19dd65a5d544603 -SHA512 (rust-1.22.0-powerpc64le-unknown-linux-gnu.tar.xz) = 9bce8585933a843b3703bd2f3fe7420ec81730b38d8d0d2418178eed7c6bf51d15979ddbd21f598615ac54cc73d3a943a535b6bf5d62627027c8edbe04c1d1d7 -SHA512 (rust-1.22.0-powerpc64-unknown-linux-gnu.tar.xz) = a11261081626d87b5cdf6b7c6fdce4ebadcfa42550dfcf6fe149a3af2e6f99b81aa71de46096a3744f9dd96e0d1c33c0b8c89384b41f059e556b4880b74f3618 -SHA512 (rust-1.22.0-s390x-unknown-linux-gnu.tar.xz) = a61bf086fbdec4c444420e0562969ed37bc0fa00e864ac5eccb13fc13e3dd9a36da3ac6a036143f4e1f3b04dcdab22f971558cfa23327fc789e31f9bb69e062b -SHA512 (rust-1.22.0-x86_64-unknown-linux-gnu.tar.xz) = d3be6fbed7e421a454b819ae14b1ab1de0930f00bea510f78f080cfd0ae12e5675c874d89d699a9af7f1a4cc0859c43a84a072d03d40204d6e3c43ea284276b7 +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