From 22c971c2fa3f89cb1e752896854a92f43c71b518 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 27 Jan 2017 16:38:19 -0600 Subject: [PATCH] bump to Rust 1.14.0 --- recipes-devtools/rust/compiler-rt_1.14.0.bb | 2 + ...lt-target.json-path-libdir-rust-targ.patch | 106 ++++++++++++++++++ ...e-RUSTFLAGS-to-override-target-libs-.patch | 72 ++++++++++++ ...cal-workaround-for-NULL-__dso_handle.patch | 25 +++++ recipes-devtools/rust/libstd-rs.inc | 3 + recipes-devtools/rust/libstd-rs_1.14.0.bb | 2 + recipes-devtools/rust/rust-cross_1.14.0.bb | 2 + recipes-devtools/rust/rust-llvm_1.14.0.bb | 16 +++ recipes-devtools/rust/rust-source-1.14.0.inc | 20 ++++ recipes-devtools/rust/rust_1.14.0.bb | 17 +++ 10 files changed, 265 insertions(+) create mode 100644 recipes-devtools/rust/compiler-rt_1.14.0.bb create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch create mode 100644 recipes-devtools/rust/libstd-rs_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-cross_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-llvm_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-source-1.14.0.inc create mode 100644 recipes-devtools/rust/rust_1.14.0.bb diff --git a/recipes-devtools/rust/compiler-rt_1.14.0.bb b/recipes-devtools/rust/compiler-rt_1.14.0.bb new file mode 100644 index 0000000..8e08013 --- /dev/null +++ b/recipes-devtools/rust/compiler-rt_1.14.0.bb @@ -0,0 +1,2 @@ +require compiler-rt.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch new file mode 100644 index 0000000..df6e0d8 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -0,0 +1,106 @@ +From 24b71f1ce87c1247d0e573d3dcba4686f237c817 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 01:40:21 -0500 +Subject: [PATCH 1/3] Target: add default target.json path: + $libdir/rust/targets + +--- + src/librustc/session/config.rs | 6 +++--- + src/librustc/session/mod.rs | 8 ++++++-- + src/librustc_back/target/mod.rs | 12 ++++++++++-- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index 63eabd5..6d002d0 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -42,7 +42,7 @@ use std::fmt; + use std::hash::Hasher; + use std::collections::hash_map::DefaultHasher; + use std::iter::FromIterator; +-use std::path::PathBuf; ++use std::path::{Path, PathBuf}; + + pub struct Config { + pub target: Target, +@@ -1002,8 +1002,8 @@ pub fn build_configuration(sess: &Session, + v + } + +-pub fn build_target_config(opts: &Options, sp: &Handler) -> Config { +- let target = match Target::search(&opts.target_triple) { ++pub fn build_target_config(sysroot: &Path, opts: &Options, sp: &Handler) -> Config { ++ let target = match Target::search(sysroot, &opts.target_triple[..]) { + Ok(t) => t, + Err(e) => { + sp.struct_fatal(&format!("Error loading target specification: {}", e)) +diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs +index b4dadbf..72fa269 100644 +--- a/src/librustc/session/mod.rs ++++ b/src/librustc/session/mod.rs +@@ -564,13 +564,17 @@ pub fn build_session_(sopts: config::Options, + codemap: Rc, + cstore: Rc CrateStore<'a>>) + -> Session { +- let host = match Target::search(config::host_triple()) { ++ let sysroot = match sopts.maybe_sysroot { ++ Some(ref x) => PathBuf::from(x), ++ None => filesearch::get_or_default_sysroot() ++ }; ++ let host = match Target::search(&sysroot, config::host_triple()) { + Ok(t) => t, + Err(e) => { + panic!(span_diagnostic.fatal(&format!("Error loading host specification: {}", e))); + } + }; +- let target_cfg = config::build_target_config(&sopts, &span_diagnostic); ++ let target_cfg = config::build_target_config(&sysroot, &sopts, &span_diagnostic); + let p_s = parse::ParseSess::with_span_handler(span_diagnostic, codemap); + let default_sysroot = match sopts.maybe_sysroot { + Some(_) => None, +diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs +index 4d9315a..12aadab 100644 +--- a/src/librustc_back/target/mod.rs ++++ b/src/librustc_back/target/mod.rs +@@ -51,6 +51,7 @@ use std::io::prelude::*; + use syntax::abi::{Abi, lookup as lookup_abi}; + + use PanicStrategy; ++use std::path::Path; + + mod android_base; + mod apple_base; +@@ -604,12 +605,13 @@ impl Target { + /// + /// The error string could come from any of the APIs called, including + /// filesystem access and JSON decoding. +- pub fn search(target: &str) -> Result { ++ pub fn search(sysroot: &Path, target: &str) -> Result { + use std::env; + use std::ffi::OsString; + use std::fs::File; + use std::path::{Path, PathBuf}; + use serialize::json; ++ use std::iter::IntoIterator; + + fn load_file(path: &Path) -> Result { + let mut f = File::open(path).map_err(|e| e.to_string())?; +@@ -640,8 +642,14 @@ impl Target { + .unwrap_or(OsString::new()); + + // FIXME 16351: add a sane default search path? ++ let mut default_path = sysroot.to_owned(); ++ default_path.push(env!("CFG_LIBDIR_RELATIVE")); ++ default_path.push("rustlib"); + +- for dir in env::split_paths(&target_path) { ++ let paths = env::split_paths(&target_path) ++ .chain(Some(default_path).into_iter()); ++ ++ for dir in paths { + let p = dir.join(&path); + if p.is_file() { + return load_file(&p); +-- +2.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch new file mode 100644 index 0000000..f4a983b --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -0,0 +1,72 @@ +From 52fa8537ae9073b81340a974c8eebb1b2fc2e1aa Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 14:52:56 -0500 +Subject: [PATCH 2/3] mk: for stage0, use RUSTFLAGS to override target libs dir + +Setting HLIB specially for stage0 (and even more specially for windows) +also affects the location we place TLIB. To keep the TLIBs we build in +the place requested by configure, use '-L' and '--sysroot' to point +stage0-rustc at the appropriate location. +--- + mk/main.mk | 29 ++++++++++++----------------- + 1 file changed, 12 insertions(+), 17 deletions(-) + +diff --git a/mk/main.mk b/mk/main.mk +index fd0464a..755bf09 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -403,32 +403,26 @@ define SREQ + HROOT$(1)_H_$(3) = $(3)/stage$(1) + HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin + +-ifeq ($$(CFG_WINDOWSY_$(3)),1) +-# On Windows we always store host runtime libraries in the 'bin' directory because +-# there's no rpath. Target libraries go under $CFG_LIBDIR_RELATIVE (usually 'lib'). +-HLIB_RELATIVE$(1)_H_$(3) = bin +-TROOT$(1)_T_$(2)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)/rustlib/$(2) +-# Remove the next 3 lines after a snapshot +-ifeq ($(1),0) +-RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib +-endif +- +-else +- +-ifeq ($(1),0) +-HLIB_RELATIVE$(1)_H_$(3) = lib +-else + HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE) +-endif ++ + TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) + +-endif + HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(HLIB_RELATIVE$(1)_H_$(3)) + + # Destinations of artifacts for target architectures + TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin + TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib + ++# Don't trust stage0, be explicit about libraries ++# TODO: rather than specifying sysroot, we really want to tell which libdir to ++# use (ie: the dir containing 'rustlib'). This would allow us to avoid ++# passing the '-L' options. ++ifeq ($(1),0) ++RUSTFLAGS_S_$(1)_T_$(2)_H_$(3) += --sysroot "$$(HROOT$(1)_H_$(3))" \ ++ -L "$$(TLIB$(1)_T_$(2)_H_$(3))" ++endif ++ ++ + # Preqrequisites for using the stageN compiler + ifeq ($(1),0) + HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) +@@ -548,6 +542,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \ + $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ + --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ + $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ ++ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \ + $$(RUSTC_FLAGS_$(2)) + + endef +-- +2.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch new file mode 100644 index 0000000..77b4054 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -0,0 +1,25 @@ +From 719526b7227609733bc4400651e9919545934905 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Wed, 3 Dec 2014 19:15:19 -0500 +Subject: [PATCH 3/3] std/thread_local: workaround for NULL __dso_handle + +--- + src/libstd/sys/unix/fast_thread_local.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs +index 0c625e7..31e7146 100644 +--- a/src/libstd/sys/unix/fast_thread_local.rs ++++ b/src/libstd/sys/unix/fast_thread_local.rs +@@ -110,7 +110,7 @@ unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { + #[linkage = "extern_weak"] + static __cxa_thread_atexit_impl: *const libc::c_void; + } +- if !__cxa_thread_atexit_impl.is_null() { ++ if !__cxa_thread_atexit_impl.is_null() && !__dso_handle.is_null() { + type F = unsafe extern fn(dtor: unsafe extern fn(*mut u8), + arg: *mut u8, + dso_handle: *mut u8) -> libc::c_int; +-- +2.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/libstd-rs.inc b/recipes-devtools/rust/libstd-rs.inc index 185ed63..0dafce5 100644 --- a/recipes-devtools/rust/libstd-rs.inc +++ b/recipes-devtools/rust/libstd-rs.inc @@ -23,7 +23,10 @@ S = "${WORKDIR}/rustc-${PV}" do_compile_prepend () { cd ${S}/src/rustc/std_shim export CARGO_TARGET_DIR="${B}" + # For Rust 1.12.1 and lower export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" + # For Rust 1.13.0 and newer + export RUSTC_BOOTSTRAP="1" } do_install () { diff --git a/recipes-devtools/rust/libstd-rs_1.14.0.bb b/recipes-devtools/rust/libstd-rs_1.14.0.bb new file mode 100644 index 0000000..3c12c86 --- /dev/null +++ b/recipes-devtools/rust/libstd-rs_1.14.0.bb @@ -0,0 +1,2 @@ +require libstd-rs.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust-cross_1.14.0.bb b/recipes-devtools/rust/rust-cross_1.14.0.bb new file mode 100644 index 0000000..ddc25d3 --- /dev/null +++ b/recipes-devtools/rust/rust-cross_1.14.0.bb @@ -0,0 +1,2 @@ +require rust-cross.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust-llvm_1.14.0.bb b/recipes-devtools/rust/rust-llvm_1.14.0.bb new file mode 100644 index 0000000..12dd8e9 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.14.0.bb @@ -0,0 +1,16 @@ +require rust-llvm.inc +require rust-source-${PV}.inc + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=43fdaa303c1c5589ad60f4ffc6a0b9ce" + +do_install_prepend () { + # the install does a sed on this without installing the file + # we don't need it for anything + mkdir -p "${D}/usr/share/llvm/cmake" + touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake" +} + +do_install_append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} diff --git a/recipes-devtools/rust/rust-source-1.14.0.inc b/recipes-devtools/rust/rust-source-1.14.0.inc new file mode 100644 index 0000000..1a55687 --- /dev/null +++ b/recipes-devtools/rust/rust-source-1.14.0.inc @@ -0,0 +1,20 @@ +# Specifics for Rust 1.14.0 + +## This is information on the rust-snapshot (binary) used to build our current release. +## snapshot info is taken from rust/src/stage0.txt +## TODO: find a way to add additional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_VERSION = "1.13.0" + +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_SYS}" + +# These are x86_64-unknown-linux-gnu hashes, how can we add more? +SRC_URI[rust-snapshot.md5sum] = "1400262e1529f94a12d2f5c77cc67782" +SRC_URI[rust-snapshot.sha256sum] = "0b092ba6750be89aad32b231ad9c625a11b040fae3cad5aa3ef32aaf213332d4" + +SRC_URI += "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " +SRC_URI[rust.md5sum] = "00b6bb5b465e7bd89c541eea99876cdc" +SRC_URI[rust.sha256sum] = "c790edd2e915bd01bea46122af2942108479a2fda9a6f76d1094add520ac3b6b" + diff --git a/recipes-devtools/rust/rust_1.14.0.bb b/recipes-devtools/rust/rust_1.14.0.bb new file mode 100644 index 0000000..704f66f --- /dev/null +++ b/recipes-devtools/rust/rust_1.14.0.bb @@ -0,0 +1,17 @@ +require rust.inc +require rust-source-${PV}.inc + +SRC_URI += " \ + file://rust-${PV}/0001-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://rust-${PV}/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://rust-${PV}/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + " + +DEPENDS += "rust-llvm (=${PV})" + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS_class-native = "1" +# We don't need to depend on gcc-native because yocto assumes it exists +PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust" + +BBCLASSEXTEND = "native"