Rebase patches for 1.10.0
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
+++ llvm/src/llvm/include/llvm/CodeGen/CommandFlags.h.orig 2016-01-18 19:18:03.847470845 +0000
|
||||
+++ llvm/src/llvm/include/llvm/CodeGen/CommandFlags.h 2016-01-18 19:18:11.211408270 +0000
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
|
||||
-#include "llvm//MC/SubtargetFeature.h"
|
||||
+#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
@@ -1,7 +1,7 @@
|
||||
From 185c77dbb5708bed7c916b8e01ff867b6c215bfb Mon Sep 17 00:00:00 2001
|
||||
From 69b65762ccdf459143fc273a39b0a0e0c6d8fe3e Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Mon, 2 May 2016 19:57:46 -0400
|
||||
Subject: [PATCH] Add config for musl-based arm builds
|
||||
Subject: [PATCH 01/11] Add config for musl-based arm builds
|
||||
|
||||
---
|
||||
mk/cfg/arm-unknown-linux-musleabi.mk | 26 ++++++++++++++++++++++++++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 3237afb78f960c015025186166f1c0998c00c6a6 Mon Sep 17 00:00:00 2001
|
||||
From 0535c75086a9c170d8d4d99b3030d9136ea6e2c7 Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Tue, 18 Nov 2014 01:40:21 -0500
|
||||
Subject: [PATCH 2/9] Target: add default target.json path:
|
||||
Subject: [PATCH 02/11] Target: add default target.json path:
|
||||
$libdir/rust/targets
|
||||
|
||||
---
|
||||
@@ -11,7 +11,7 @@ Subject: [PATCH 2/9] Target: add default target.json path:
|
||||
3 files changed, 20 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
|
||||
index c4697eb..4cc059b 100644
|
||||
index da5555d..6cd0ea9 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -35,7 +35,7 @@ use getopts;
|
||||
@@ -21,9 +21,9 @@ index c4697eb..4cc059b 100644
|
||||
-use std::path::PathBuf;
|
||||
+use std::path::{Path, PathBuf};
|
||||
|
||||
use llvm;
|
||||
|
||||
@@ -711,8 +711,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
pub struct Config {
|
||||
pub target: Target,
|
||||
@@ -787,8 +787,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
v
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ index c4697eb..4cc059b 100644
|
||||
Err(e) => {
|
||||
panic!(sp.fatal(&format!("Error loading target specification: {}", e)));
|
||||
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
|
||||
index 2f3af1c..6424cff 100644
|
||||
index 907241d..d0e3743 100644
|
||||
--- a/src/librustc/session/mod.rs
|
||||
+++ b/src/librustc/session/mod.rs
|
||||
@@ -429,13 +429,17 @@ pub fn build_session_(sopts: config::Options,
|
||||
@@ -470,13 +470,17 @@ pub fn build_session_(sopts: config::Options,
|
||||
codemap: Rc<codemap::CodeMap>,
|
||||
cstore: Rc<for<'a> CrateStore<'a>>)
|
||||
-> Session {
|
||||
@@ -59,19 +59,19 @@ index 2f3af1c..6424cff 100644
|
||||
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 5114910..636a1aa 100644
|
||||
index 2163a8a..38607f0 100644
|
||||
--- a/src/librustc_back/target/mod.rs
|
||||
+++ b/src/librustc_back/target/mod.rs
|
||||
@@ -49,6 +49,8 @@ use serialize::json::Json;
|
||||
@@ -48,6 +48,8 @@ use serialize::json::Json;
|
||||
use std::default::Default;
|
||||
use std::io::prelude::*;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
+use std::borrow::ToOwned;
|
||||
+use std::path::Path;
|
||||
|
||||
mod android_base;
|
||||
mod apple_base;
|
||||
@@ -366,12 +368,13 @@ impl Target {
|
||||
@@ -477,12 +479,13 @@ impl Target {
|
||||
///
|
||||
/// The error string could come from any of the APIs called, including
|
||||
/// filesystem access and JSON decoding.
|
||||
@@ -85,8 +85,8 @@ index 5114910..636a1aa 100644
|
||||
+ use std::iter::IntoIterator;
|
||||
|
||||
fn load_file(path: &Path) -> Result<Target, String> {
|
||||
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
|
||||
@@ -470,8 +473,14 @@ impl Target {
|
||||
let mut f = File::open(path).map_err(|e| e.to_string())?;
|
||||
@@ -513,8 +516,14 @@ impl Target {
|
||||
.unwrap_or(OsString::new());
|
||||
|
||||
// FIXME 16351: add a sane default search path?
|
||||
@@ -103,5 +103,5 @@ index 5114910..636a1aa 100644
|
||||
if p.is_file() {
|
||||
return load_file(&p);
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
From 3254ad1d84b177eb960219c2bce26f8980a511e1 Mon Sep 17 00:00:00 2001
|
||||
From 4290b8f28222824a558ac4471d26fe88b2889a5b Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Tue, 18 Nov 2014 14:52:56 -0500
|
||||
Subject: [PATCH 3/9] mk: for stage0, use RUSTFLAGS to override target libs dir
|
||||
Subject: [PATCH 03/11] 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 | 30 +++++++++++++-----------------
|
||||
1 file changed, 13 insertions(+), 17 deletions(-)
|
||||
mk/main.mk | 29 ++++++++++++-----------------
|
||||
1 file changed, 12 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/mk/main.mk b/mk/main.mk
|
||||
index 963c12f..04b3e25 100644
|
||||
index c47020c..fcf1409 100644
|
||||
--- a/mk/main.mk
|
||||
+++ b/mk/main.mk
|
||||
@@ -383,32 +383,26 @@ define SREQ
|
||||
@@ -403,32 +403,26 @@ define SREQ
|
||||
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
||||
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
|
||||
|
||||
@@ -59,15 +60,7 @@ index 963c12f..04b3e25 100644
|
||||
# Preqrequisites for using the stageN compiler
|
||||
ifeq ($(1),0)
|
||||
HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
|
||||
@@ -520,6 +514,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))
|
||||
|
||||
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
|
||||
@@ -528,6 +523,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
|
||||
@@ -536,6 +530,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)) \
|
||||
@@ -76,5 +69,5 @@ index 963c12f..04b3e25 100644
|
||||
|
||||
endef
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 004ddead436887fe99bfa9d0d25f6cdaf9f6148b Mon Sep 17 00:00:00 2001
|
||||
From 06b8c4bc8f7056d604d8ef4d699273cc1dd39025 Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Tue, 18 Nov 2014 13:48:14 -0500
|
||||
Subject: [PATCH 4/9] mk: add missing CFG_LIBDIR_RELATIVE
|
||||
Subject: [PATCH 04/11] mk: add missing CFG_LIBDIR_RELATIVE
|
||||
|
||||
---
|
||||
mk/grammar.mk | 4 ++--
|
||||
@@ -23,5 +23,5 @@ index 0d527bd..926f247 100644
|
||||
ifeq ($(CFG_OSTYPE),apple-darwin)
|
||||
FLEX_LDFLAGS=-ll
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 93ef6b8b93c7695280aba7f3541bf8f1ae18c722 Mon Sep 17 00:00:00 2001
|
||||
From 0365e3349e373b95fcf4260ba5bcf70ada6328cf Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Mon, 24 Nov 2014 13:10:15 -0500
|
||||
Subject: [PATCH 5/9] configure: support --bindir, and extend libdir to
|
||||
Subject: [PATCH 05/11] configure: support --bindir, and extend libdir to
|
||||
non-blessed dirs
|
||||
|
||||
Adds --bindir, and:
|
||||
@@ -13,55 +13,61 @@ relative to sysroot, and allows libdir to end in an arbitrary directory
|
||||
Note that this assumes absolute paths start with '/', which may break
|
||||
windows platforms
|
||||
---
|
||||
configure | 44 ++++++++++++++++++++-----
|
||||
configure | 51 ++++++++++++++++++++++++-----
|
||||
mk/host.mk | 6 +++-
|
||||
mk/main.mk | 11 +++++++
|
||||
mk/perf.mk | 4 +--
|
||||
mk/prepare.mk | 27 +++++++---------
|
||||
src/librustc/session/filesearch.rs | 66 ++++++++++++++++----------------------
|
||||
src/librustc_trans/back/link.rs | 3 +-
|
||||
7 files changed, 94 insertions(+), 67 deletions(-)
|
||||
6 files changed, 99 insertions(+), 65 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 287b7b3..7d53a66 100755
|
||||
index d417896..e3b7c20 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -334,6 +334,32 @@ enable_if_not_disabled() {
|
||||
@@ -342,6 +342,39 @@ enable_if_not_disabled() {
|
||||
fi
|
||||
}
|
||||
|
||||
+abspath () {
|
||||
+ case "$1" in
|
||||
+ /*) echo "$1" ;;
|
||||
+ *) echo "$PWD/$1" ;;
|
||||
+ esac
|
||||
+ case "$1" in
|
||||
+ /*) echo "$1" ;;
|
||||
+ *) echo "$PWD/$1" ;;
|
||||
+ esac
|
||||
+}
|
||||
+
|
||||
+relpath () {
|
||||
+ local src=$(abspath "$1")
|
||||
+ local dst=$(abspath "$2")
|
||||
+ local common=$src
|
||||
+ local result=
|
||||
+ local src=$(abspath "$1")
|
||||
+ local dst=$(abspath "$2")
|
||||
+ local common=$src
|
||||
+ local result=
|
||||
+
|
||||
+ # Start by checking if the whole src is common, then strip off pack
|
||||
+ # components until we find the common element.
|
||||
+ while [ "${dst#"$common"}" = "$dst" ]; do
|
||||
+ common=$(dirname "$common")
|
||||
+ result="../$result"
|
||||
+ done
|
||||
+ # Start by checking if the whole src is common, then strip off pack
|
||||
+ # components until we find the common element.
|
||||
+ while [ "${dst#"$common"}" = "$dst" ]; do
|
||||
+ common=$(dirname "$common")
|
||||
+ result="../$result"
|
||||
+ done
|
||||
+
|
||||
+ local down="${dst#"$common"}"
|
||||
+ result="${result}${down#/}"
|
||||
+ echo "$result"
|
||||
+ local down="${dst#"$common"}"
|
||||
+ result="${result}${down#/}"
|
||||
+ echo "$result"
|
||||
+}
|
||||
+
|
||||
+to_llvm_triple() {
|
||||
+ case $1 in
|
||||
+ i686-w64-mingw32) echo i686-pc-windows-gnu ;;
|
||||
+ x86_64-w64-mingw32) echo x86_64-pc-windows-gnu ;;
|
||||
+ *) echo $1 ;;
|
||||
+ esac
|
||||
+}
|
||||
+
|
||||
to_llvm_triple() {
|
||||
to_gnu_triple() {
|
||||
case $1 in
|
||||
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
|
||||
@@ -652,18 +678,19 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
|
||||
CFG_HOST=$(to_llvm_triple $CFG_HOST)
|
||||
CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
|
||||
i686-pc-windows-gnu) echo i686-w64-mingw32 ;;
|
||||
@@ -656,18 +689,19 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
|
||||
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
|
||||
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
||||
|
||||
+CFG_LIBDIR_RELATIVE=lib
|
||||
+
|
||||
@@ -87,7 +93,7 @@ index 287b7b3..7d53a66 100755
|
||||
|
||||
if [ $HELP -eq 1 ]
|
||||
then
|
||||
@@ -1760,6 +1787,7 @@ putvar CFG_PREFIX
|
||||
@@ -1762,6 +1796,7 @@ putvar CFG_PREFIX
|
||||
putvar CFG_HOST
|
||||
putvar CFG_TARGET
|
||||
putvar CFG_LIBDIR_RELATIVE
|
||||
@@ -96,7 +102,7 @@ index 287b7b3..7d53a66 100755
|
||||
putvar CFG_AARCH64_LINUX_ANDROID_NDK
|
||||
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
|
||||
diff --git a/mk/host.mk b/mk/host.mk
|
||||
index 59a0095..b8e8345 100644
|
||||
index d17479b..a95f886 100644
|
||||
--- a/mk/host.mk
|
||||
+++ b/mk/host.mk
|
||||
@@ -59,9 +59,13 @@ endef
|
||||
@@ -115,10 +121,10 @@ index 59a0095..b8e8345 100644
|
||||
|
||||
endef
|
||||
diff --git a/mk/main.mk b/mk/main.mk
|
||||
index 04b3e25..ba11e5e 100644
|
||||
index fcf1409..1c663ee 100644
|
||||
--- a/mk/main.mk
|
||||
+++ b/mk/main.mk
|
||||
@@ -351,7 +351,9 @@ export CFG_RELEASE_CHANNEL
|
||||
@@ -368,7 +368,9 @@ export CFG_RELEASE_CHANNEL
|
||||
export CFG_LLVM_ROOT
|
||||
export CFG_PREFIX
|
||||
export CFG_LIBDIR
|
||||
@@ -128,7 +134,7 @@ index 04b3e25..ba11e5e 100644
|
||||
export CFG_DISABLE_INJECT_STD_VERSION
|
||||
ifdef CFG_DISABLE_UNSTABLE_FEATURES
|
||||
CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
|
||||
@@ -381,7 +383,16 @@ define SREQ
|
||||
@@ -401,7 +403,16 @@ define SREQ
|
||||
|
||||
# Destinations of artifacts for the host compiler
|
||||
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
||||
@@ -145,31 +151,11 @@ index 04b3e25..ba11e5e 100644
|
||||
|
||||
HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE)
|
||||
|
||||
diff --git a/mk/perf.mk b/mk/perf.mk
|
||||
index 16cbaab..f8a354c 100644
|
||||
--- a/mk/perf.mk
|
||||
+++ b/mk/perf.mk
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
|
||||
ifdef CFG_PERF_TOOL
|
||||
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
|
||||
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
|
||||
@$(call E, perf compile: $@)
|
||||
$(PERF_STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
|
||||
-o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1
|
||||
$(Q)rm -f $(LIBRUSTC_GLOB)
|
||||
else
|
||||
-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD))
|
||||
+rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD))
|
||||
$(Q)touch $@
|
||||
endif
|
||||
|
||||
diff --git a/mk/prepare.mk b/mk/prepare.mk
|
||||
index 87a4450..c358bbc 100644
|
||||
index 20e20e9..efaec75 100644
|
||||
--- a/mk/prepare.mk
|
||||
+++ b/mk/prepare.mk
|
||||
@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator, $(TOOLS
|
||||
@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS
|
||||
# $(3) is host
|
||||
# $(4) tag
|
||||
define DEF_PREPARE_HOST_TOOL
|
||||
@@ -189,7 +175,7 @@ index 87a4450..c358bbc 100644
|
||||
+prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)
|
||||
+prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)
|
||||
prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
|
||||
$$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
|
||||
$$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
|
||||
$$(HLIB$(2)_H_$(3))/stamp.$(1) \
|
||||
@@ -138,14 +134,10 @@ endef
|
||||
# $(4) tag
|
||||
@@ -208,7 +194,7 @@ index 87a4450..c358bbc 100644
|
||||
+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(3)/bin
|
||||
+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin
|
||||
prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
|
||||
$$(foreach crate,$$(TARGET_CRATES), \
|
||||
$$(foreach crate,$$(TARGET_CRATES_$(2)), \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
|
||||
@@ -198,9 +190,12 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
|
||||
|
||||
@@ -226,10 +212,10 @@ index 87a4450..c358bbc 100644
|
||||
|
||||
prepare-base-$(1)-target: prepare-target-$(1)
|
||||
diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs
|
||||
index 09c6b54..00736c6 100644
|
||||
index a3eea32..e5e449d 100644
|
||||
--- a/src/librustc/session/filesearch.rs
|
||||
+++ b/src/librustc/session/filesearch.rs
|
||||
@@ -124,7 +124,7 @@ impl<'a> FileSearch<'a> {
|
||||
@@ -123,7 +123,7 @@ impl<'a> FileSearch<'a> {
|
||||
// Returns a list of directories where target-specific tool binaries are located.
|
||||
pub fn get_tools_search_paths(&self) -> Vec<PathBuf> {
|
||||
let mut p = PathBuf::from(self.sysroot);
|
||||
@@ -238,7 +224,7 @@ index 09c6b54..00736c6 100644
|
||||
p.push(&rustlibdir());
|
||||
p.push(&self.triple);
|
||||
p.push("bin");
|
||||
@@ -132,8 +132,8 @@ impl<'a> FileSearch<'a> {
|
||||
@@ -131,8 +131,8 @@ impl<'a> FileSearch<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +235,7 @@ index 09c6b54..00736c6 100644
|
||||
assert!(p.is_relative());
|
||||
p.push(&rustlibdir());
|
||||
p.push(target_triple);
|
||||
@@ -143,7 +143,19 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
|
||||
@@ -142,7 +142,19 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
|
||||
|
||||
fn make_target_lib_path(sysroot: &Path,
|
||||
target_triple: &str) -> PathBuf {
|
||||
@@ -270,7 +256,7 @@ index 09c6b54..00736c6 100644
|
||||
}
|
||||
|
||||
pub fn get_or_default_sysroot() -> PathBuf {
|
||||
@@ -161,44 +173,22 @@ pub fn get_or_default_sysroot() -> PathBuf {
|
||||
@@ -160,44 +172,22 @@ pub fn get_or_default_sysroot() -> PathBuf {
|
||||
}
|
||||
|
||||
match canonicalize(env::current_exe().ok()) {
|
||||
@@ -287,7 +273,7 @@ index 09c6b54..00736c6 100644
|
||||
+ }
|
||||
+ p
|
||||
+ }
|
||||
None => panic!("can't determine value for sysroot")
|
||||
None => bug!("can't determine value for sysroot")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,10 +314,10 @@ index 09c6b54..00736c6 100644
|
||||
// The name of rustc's own place to organize libraries.
|
||||
// Used to be "rustc", now the default is "rustlib"
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index ec1383f..670d637 100644
|
||||
index 53cc031..222d447 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -1042,11 +1042,10 @@ fn link_args(cmd: &mut Linker,
|
||||
@@ -819,11 +819,10 @@ fn link_args(cmd: &mut Linker,
|
||||
// where extern libraries might live, based on the
|
||||
// addl_lib_search_paths
|
||||
if sess.opts.cg.rpath {
|
||||
@@ -345,5 +331,5 @@ index ec1383f..670d637 100644
|
||||
path.push(&tlib);
|
||||
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From 8b088363a61a627fd8a31318d15164113f081660 Mon Sep 17 00:00:00 2001
|
||||
From f7441b3080088d8131d106c59c3543b22c9e8211 Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Wed, 3 Dec 2014 19:15:19 -0500
|
||||
Subject: [PATCH 6/9] std/thread_local: workaround for NULL __dso_handle
|
||||
Subject: [PATCH 06/11] std/thread_local: workaround for NULL __dso_handle
|
||||
|
||||
---
|
||||
src/libstd/thread/local.rs | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
|
||||
index ca0f103..5851127 100644
|
||||
index 6b54ec8..5b41b75 100644
|
||||
--- a/src/libstd/thread/local.rs
|
||||
+++ b/src/libstd/thread/local.rs
|
||||
@@ -324,7 +324,7 @@ pub mod elf {
|
||||
@@ -346,7 +346,7 @@ pub mod elf {
|
||||
#[linkage = "extern_weak"]
|
||||
static __cxa_thread_atexit_impl: *const libc::c_void;
|
||||
}
|
||||
@@ -21,5 +21,5 @@ index ca0f103..5851127 100644
|
||||
arg: *mut u8,
|
||||
dso_handle: *mut u8) -> libc::c_int;
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 1a9ada8070bb9cd293cfb93913721c68ca0b7766 Mon Sep 17 00:00:00 2001
|
||||
From a73a748cd73920380ae1f069be91ff833e99d003 Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Mon, 2 Mar 2015 13:34:59 -0500
|
||||
Subject: [PATCH 7/9] mk/install: use disable-rewrite-paths
|
||||
Subject: [PATCH 07/11] mk/install: use disable-rewrite-paths
|
||||
|
||||
This stops the install scripts from doing work we've already handled.
|
||||
|
||||
@@ -11,7 +11,7 @@ Path rewriting is only useful for prepackaged binary installers.
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/mk/install.mk b/mk/install.mk
|
||||
index af6f3ff..430add7 100644
|
||||
index d2e5449..e67650b 100644
|
||||
--- a/mk/install.mk
|
||||
+++ b/mk/install.mk
|
||||
@@ -12,7 +12,9 @@ RUN_INSTALLER = cd tmp/empty_dir && \
|
||||
@@ -26,5 +26,5 @@ index af6f3ff..430add7 100644
|
||||
install:
|
||||
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
|
||||
--
|
||||
2.4.10
|
||||
2.7.4
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
From 042a5df36597c2c6c23900667ae1b4299279092f Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Wed, 18 Nov 2015 08:33:26 -0500
|
||||
Subject: [PATCH 08/11] Allow overriding crate_hash with -C crate_hash
|
||||
|
||||
The current crate hash is not stable from run-to-run. This causes
|
||||
problems with bitbake; it needs a guarantee that every build with the
|
||||
same input will generate compatible output, otherwise sstate won't work.
|
||||
Using -C crate_hash, we can do that by using the bitbake input hash to
|
||||
determine the crate hash; the bitbake input hash will be stable, but
|
||||
still different for different rust recipes.
|
||||
---
|
||||
src/librustc/session/config.rs | 2 ++
|
||||
src/librustc_trans/back/link.rs | 12 +++++++++++-
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
|
||||
index 6cd0ea9..f90398d 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -585,6 +585,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
||||
"choose the code model to use (llc -code-model for details)"),
|
||||
metadata: Vec<String> = (Vec::new(), parse_list,
|
||||
"metadata to mangle symbol names with"),
|
||||
+ crate_hash: String = ("".to_string(), parse_string,
|
||||
+ "override crate hash with given value"),
|
||||
extra_filename: String = ("".to_string(), parse_string,
|
||||
"extra data to put in each output filename"),
|
||||
codegen_units: usize = (1, parse_uint,
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 222d447..e951476 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -125,12 +125,22 @@ pub fn find_crate_name(sess: Option<&Session>,
|
||||
|
||||
}
|
||||
|
||||
+use std::hash::{Hasher, SipHasher};
|
||||
+use rustc::hir::svh::Svh;
|
||||
+
|
||||
pub fn build_link_meta<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
name: &str)
|
||||
-> LinkMeta {
|
||||
+ let crate_hash = if tcx.sess.opts.cg.crate_hash != "" {
|
||||
+ let mut state = SipHasher::new();
|
||||
+ state.write(tcx.sess.opts.cg.crate_hash.as_bytes());
|
||||
+ Svh::new(state.finish())
|
||||
+ } else {
|
||||
+ tcx.calculate_krate_hash()
|
||||
+ };
|
||||
let r = LinkMeta {
|
||||
crate_name: name.to_owned(),
|
||||
- crate_hash: tcx.calculate_krate_hash(),
|
||||
+ crate_hash: crate_hash,
|
||||
};
|
||||
info!("{:?}", r);
|
||||
return r;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 8e359ae2b44fe2edd863e460346554c73f460ba7 Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Tue, 7 Jul 2015 14:57:42 -0400
|
||||
Subject: [PATCH 9/9] Remove crate metadata from symbol hashing
|
||||
|
||||
---
|
||||
src/librustc_trans/back/link.rs | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 670d637..4e7150e 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -213,11 +213,6 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||
symbol_hasher.reset();
|
||||
symbol_hasher.input_str(&link_meta.crate_name);
|
||||
symbol_hasher.input_str("-");
|
||||
- symbol_hasher.input_str(link_meta.crate_hash.as_str());
|
||||
- for meta in tcx.sess.crate_metadata.borrow().iter() {
|
||||
- symbol_hasher.input_str(&meta[..]);
|
||||
- }
|
||||
- symbol_hasher.input_str("-");
|
||||
symbol_hasher.input(&tcx.sess.cstore.encode_type(tcx, t));
|
||||
// Prefix with 'h' so that it never blends into adjacent digits
|
||||
let mut hash = String::from("h");
|
||||
--
|
||||
2.4.10
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 7abedc46cad6b52d44badaf88350d41ef907cd4c Mon Sep 17 00:00:00 2001
|
||||
From 44ee7a68f44132ebe32ac486355945131c7a2b83 Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Wed, 18 Nov 2015 08:41:17 -0500
|
||||
Subject: [PATCH 12/12] mk/platform.mk: pass -C crate_hash to builds
|
||||
Subject: [PATCH 09/11] mk/platform.mk: pass -C crate_hash to builds
|
||||
|
||||
bitbake recipe will export FORCE_CRATE_HASH
|
||||
---
|
||||
@@ -9,17 +9,17 @@ bitbake recipe will export FORCE_CRATE_HASH
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/mk/platform.mk b/mk/platform.mk
|
||||
index eb693b8..e6317b5 100644
|
||||
index c264462..b959d59 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -187,6 +187,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
@@ -181,6 +181,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
|
||||
LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1))
|
||||
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \
|
||||
-C objcopy=$$(call FIND_COMPILER,$$(OBJCOPY_$(1))) \
|
||||
+ -C crate_hash=$(FORCE_CRATE_HASH) \
|
||||
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
|
||||
|
||||
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
|
||||
--
|
||||
1.9.1
|
||||
2.7.4
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From f3e8bd9ab353d4b3d7432a02e37a22eed24b5e57 Mon Sep 17 00:00:00 2001
|
||||
From 8efc27cfdbebcfb0e544ce1b7ee242955af0f68a Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Thu, 4 Feb 2016 10:44:23 -0500
|
||||
Subject: [PATCH] mk: allow changing the platform configuration source
|
||||
Subject: [PATCH 10/11] mk: allow changing the platform configuration source
|
||||
directory
|
||||
|
||||
---
|
||||
@@ -10,18 +10,18 @@ Subject: [PATCH] mk: allow changing the platform configuration source
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 7d53a66..5d40516 100755
|
||||
index 7747850..f5224ca 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -671,6 +671,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||
@@ -663,6 +663,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||
valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
|
||||
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
|
||||
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
|
||||
+valopt_nosave platform-cfg "${CFG_SRC_DIR}/mk/cfg" "Location platform configuration for non-rust code"
|
||||
|
||||
# Temporarily support old triples until buildbots get updated
|
||||
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
|
||||
@@ -1127,7 +1128,7 @@ CFG_MANDIR=${CFG_MANDIR%/}
|
||||
CFG_LIBDIR_RELATIVE=lib
|
||||
|
||||
@@ -1084,7 +1085,7 @@ CFG_MANDIR=${CFG_MANDIR%/}
|
||||
CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
|
||||
CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
|
||||
CFG_SUPPORTED_TARGET=""
|
||||
@@ -30,7 +30,7 @@ index 7d53a66..5d40516 100755
|
||||
CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)"
|
||||
done
|
||||
|
||||
@@ -1795,6 +1796,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
@@ -1780,6 +1781,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
putvar CFG_NACL_CROSS_PATH
|
||||
putvar CFG_MANDIR
|
||||
putvar CFG_USING_LIBCPP
|
||||
@@ -39,10 +39,10 @@ index 7d53a66..5d40516 100755
|
||||
# Avoid spurious warnings from clang by feeding it original source on
|
||||
# ccache-miss rather than preprocessed input.
|
||||
diff --git a/mk/platform.mk b/mk/platform.mk
|
||||
index e6317b5..68a20e1 100644
|
||||
index b959d59..bddd203 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -114,7 +114,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
|
||||
@@ -97,7 +97,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
|
||||
|
||||
CFG_RLIB_GLOB=lib$(1)-*.rlib
|
||||
|
||||
@@ -52,5 +52,5 @@ index e6317b5..68a20e1 100644
|
||||
define ADD_INSTALLED_OBJECTS
|
||||
INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1))
|
||||
--
|
||||
2.7.0
|
||||
2.7.4
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
From 04eee951641b9d9c580ee21c481bdf979dc2fe30 Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Tue, 7 Jul 2015 16:49:44 -0400
|
||||
Subject: [PATCH 10/12] rustc_trans: make .note.rustc look more like debug info
|
||||
|
||||
Mark the global variable as const and private so the resulting section
|
||||
is not flagged as writable and to avoid putting an unnecessary symbol in
|
||||
the dynamic table of shared objects.
|
||||
|
||||
Unfortunately there doesn't seem to be a way to avoid the section being
|
||||
marked SHF_ALLOC when declared as a variable in LLVM. Hack around that
|
||||
by using objcopy to clear the flags on the section before the final
|
||||
link.
|
||||
|
||||
This places the section at the end of the executable so it can be
|
||||
stripped later without rearranging important code/data sections.
|
||||
---
|
||||
mk/platform.mk | 1 +
|
||||
src/librustc/session/config.rs | 2 ++
|
||||
src/librustc_back/target/mod.rs | 4 ++++
|
||||
src/librustc_trans/back/link.rs | 36 ++++++++++++++++++++++++++++++++++++
|
||||
src/librustc_trans/trans/base.rs | 3 +++
|
||||
5 files changed, 46 insertions(+)
|
||||
|
||||
diff --git a/mk/platform.mk b/mk/platform.mk
|
||||
index 5239086..eb693b8 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -186,6 +186,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
|
||||
LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1))
|
||||
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \
|
||||
+ -C objcopy=$$(call FIND_COMPILER,$$(OBJCOPY_$(1))) \
|
||||
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
|
||||
|
||||
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
|
||||
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
|
||||
index 4cc059b..600cb4b 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -497,6 +497,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
||||
CG_OPTIONS, cg_type_desc, cgsetters,
|
||||
ar: Option<String> = (None, parse_opt_string,
|
||||
"tool to assemble archives with"),
|
||||
+ objcopy: Option<String> = (None, parse_opt_string,
|
||||
+ "system objcopy for manipulating objects"),
|
||||
linker: Option<String> = (None, parse_opt_string,
|
||||
"system linker to link outputs with"),
|
||||
link_args: Option<Vec<String>> = (None, parse_opt_list,
|
||||
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
|
||||
index 636a1aa..1b87a7a 100644
|
||||
--- a/src/librustc_back/target/mod.rs
|
||||
+++ b/src/librustc_back/target/mod.rs
|
||||
@@ -118,6 +118,8 @@ pub struct TargetOptions {
|
||||
/// Linker arguments that are unconditionally passed *after* any
|
||||
/// user-defined libraries.
|
||||
pub post_link_args: Vec<String>,
|
||||
+ /// Path to objcopy. Defaults to "objcopy".
|
||||
+ pub objcopy: String,
|
||||
|
||||
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
|
||||
/// to "default".
|
||||
@@ -213,6 +215,7 @@ impl Default for TargetOptions {
|
||||
ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(),
|
||||
pre_link_args: Vec::new(),
|
||||
post_link_args: Vec::new(),
|
||||
+ objcopy: "objcopy".to_string(),
|
||||
cpu: "generic".to_string(),
|
||||
features: "".to_string(),
|
||||
dynamic_linking: false,
|
||||
@@ -331,6 +334,7 @@ impl Target {
|
||||
key!(cpu);
|
||||
key!(ar);
|
||||
key!(linker);
|
||||
+ key!(objcopy);
|
||||
key!(relocation_model);
|
||||
key!(code_model);
|
||||
key!(dll_prefix);
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 4e7150e..0d8a125 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -394,6 +394,13 @@ fn command_path(sess: &Session) -> OsString {
|
||||
env::join_paths(new_path).unwrap()
|
||||
}
|
||||
|
||||
+pub fn get_objcopy_prog(sess: &Session) -> String {
|
||||
+ match sess.opts.cg.objcopy {
|
||||
+ Some(ref objcopy) => return objcopy.to_string(),
|
||||
+ None => sess.target.target.options.objcopy.clone(),
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
pub fn remove(sess: &Session, path: &Path) {
|
||||
match fs::remove_file(path) {
|
||||
Ok(..) => {}
|
||||
@@ -928,6 +935,32 @@ fn link_natively(sess: &Session, dylib: bool,
|
||||
}
|
||||
}
|
||||
|
||||
+fn fix_meta_section_attributes(sess: &Session, meta_name: &PathBuf) {
|
||||
+ // First, fix up the note section attributes. We want the SHF_ALLOC and
|
||||
+ // SHF_WRITE flags to be unset so the section will get placed near the
|
||||
+ // end along with the debug info. This allows the section to be
|
||||
+ // stripped later without renumbering important sections that
|
||||
+ // contain code and data.
|
||||
+ let objcopy = get_objcopy_prog(sess);
|
||||
+ let mut o_cmd = Command::new(&objcopy);
|
||||
+ o_cmd.arg("--rename-section")
|
||||
+ .arg(".note.rustc=.note.rustc,contents,noload,readonly")
|
||||
+ .arg(&meta_name);
|
||||
+ // Invoke objcopy
|
||||
+ info!("{:?}", o_cmd);
|
||||
+ match o_cmd.status() {
|
||||
+ Ok(exitstatus) => {
|
||||
+ if !exitstatus.success() {
|
||||
+ sess.err(&format!("objcopy failed with exit code {:?}", exitstatus.code()));
|
||||
+ }
|
||||
+ },
|
||||
+ Err(exitstatus) => {
|
||||
+ sess.err(&format!("objcopy failed: {}", exitstatus));
|
||||
+ }
|
||||
+ }
|
||||
+ sess.abort_if_errors();
|
||||
+}
|
||||
+
|
||||
fn link_args(cmd: &mut Linker,
|
||||
sess: &Session,
|
||||
dylib: bool,
|
||||
@@ -960,6 +993,9 @@ fn link_args(cmd: &mut Linker,
|
||||
// executable. This metadata is in a separate object file from the main
|
||||
// object file, so we link that in here.
|
||||
if dylib {
|
||||
+ let meta_name = outputs.with_extension("metadata.o");
|
||||
+
|
||||
+ fix_meta_section_attributes(sess, &meta_name);
|
||||
cmd.add_object(&outputs.with_extension("metadata.o"));
|
||||
}
|
||||
|
||||
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
|
||||
index 4c619f8..2b68767 100644
|
||||
--- a/src/librustc_trans/trans/base.rs
|
||||
+++ b/src/librustc_trans/trans/base.rs
|
||||
@@ -2924,6 +2924,9 @@ pub fn write_metadata<'a, 'tcx>(cx: &SharedCrateContext<'a, 'tcx>,
|
||||
};
|
||||
unsafe {
|
||||
llvm::LLVMSetInitializer(llglobal, llconst);
|
||||
+ llvm::LLVMSetGlobalConstant(llglobal, llvm::True);
|
||||
+ llvm::LLVMSetUnnamedAddr(llglobal, llvm::True);
|
||||
+ llvm::SetLinkage(llglobal, llvm::Linkage::PrivateLinkage);
|
||||
let name =
|
||||
cx.tcx().sess.cstore.metadata_section_name(&cx.sess().target.target);
|
||||
let name = CString::new(name).unwrap();
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
From b6805ab1099ca824bb516da4f1825a7e4ce30153 Mon Sep 17 00:00:00 2001
|
||||
From: Steven Walter <swalter@lexmark.com>
|
||||
Date: Wed, 18 Nov 2015 08:33:26 -0500
|
||||
Subject: [PATCH 11/12] Allow overriding crate_hash with -C crate_hash
|
||||
|
||||
The current crate hash is not stable from run-to-run. This causes
|
||||
problems with bitbake; it needs a guarantee that every build with the
|
||||
same input will generate compatible output, otherwise sstate won't work.
|
||||
Using -C crate_hash, we can do that by using the bitbake input hash to
|
||||
determine the crate hash; the bitbake input hash will be stable, but
|
||||
still different for different rust recipes.
|
||||
---
|
||||
src/librustc/session/config.rs | 2 ++
|
||||
src/librustc_trans/back/link.rs | 28 ++++++++++++++++++++++++++--
|
||||
2 files changed, 28 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
|
||||
index 600cb4b..3570e78 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -537,6 +537,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
||||
"choose the code model to use (llc -code-model for details)"),
|
||||
metadata: Vec<String> = (Vec::new(), parse_list,
|
||||
"metadata to mangle symbol names with"),
|
||||
+ crate_hash: String = ("".to_string(), parse_string,
|
||||
+ "override crate hash with given value"),
|
||||
extra_filename: String = ("".to_string(), parse_string,
|
||||
"extra data to put in each output filename"),
|
||||
codegen_units: usize = (1, parse_uint,
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 0d8a125..9917a1e 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -45,7 +45,7 @@ use std::str;
|
||||
use flate;
|
||||
use serialize::hex::ToHex;
|
||||
use syntax::ast;
|
||||
-use syntax::codemap::Span;
|
||||
+use syntax::codemap::{Span,BytePos,NO_EXPANSION};
|
||||
use syntax::parse::token::{self, InternedString};
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
||||
@@ -186,9 +186,33 @@ pub fn build_link_meta(sess: &Session,
|
||||
krate: &hir::Crate,
|
||||
name: &str)
|
||||
-> LinkMeta {
|
||||
+ use std::collections::BTreeMap;
|
||||
+ let crate_hash = if sess.opts.cg.crate_hash != "" {
|
||||
+ let dummy_span = Span {
|
||||
+ lo: BytePos(0),
|
||||
+ hi: BytePos(0),
|
||||
+ expn_id: NO_EXPANSION
|
||||
+ };
|
||||
+ let dummy_module = hir::Mod {
|
||||
+ inner: dummy_span,
|
||||
+ item_ids: hir::HirVec::new()
|
||||
+ };
|
||||
+ let dummy_krate = hir::Crate {
|
||||
+ module: dummy_module,
|
||||
+ attrs: hir::HirVec::new(),
|
||||
+ config: hir::CrateConfig::new(),
|
||||
+ span: dummy_span,
|
||||
+ exported_macros: hir::HirVec::new(),
|
||||
+ items: BTreeMap::new()
|
||||
+ };
|
||||
+
|
||||
+ Svh::calculate(&vec!(sess.opts.cg.crate_hash.clone()), &dummy_krate)
|
||||
+ } else {
|
||||
+ Svh::calculate(&sess.opts.cg.metadata, krate)
|
||||
+ };
|
||||
let r = LinkMeta {
|
||||
crate_name: name.to_owned(),
|
||||
- crate_hash: Svh::calculate(&sess.opts.cg.metadata, krate),
|
||||
+ crate_hash: crate_hash,
|
||||
};
|
||||
info!("{:?}", r);
|
||||
return r;
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
From 9c76c93de35fb45ed18e75827649e299d8c4e94e Mon Sep 17 00:00:00 2001
|
||||
From: Eduard Burtescu <edy.burt@gmail.com>
|
||||
Date: Sun, 14 Aug 2016 11:16:28 +0300
|
||||
Subject: [PATCH 11/11] Get rid of the .note interpretation of rustc dylib
|
||||
metadata.
|
||||
|
||||
---
|
||||
src/librustc_metadata/loader.rs | 41 ++++++++++++++++++-----------------------
|
||||
src/librustc_trans/base.rs | 13 ++++++++++---
|
||||
2 files changed, 28 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/src/librustc_metadata/loader.rs b/src/librustc_metadata/loader.rs
|
||||
index dc10391..9430b70 100644
|
||||
--- a/src/librustc_metadata/loader.rs
|
||||
+++ b/src/librustc_metadata/loader.rs
|
||||
@@ -875,34 +875,29 @@ fn get_metadata_section_imp(target: &Target, flavor: CrateFlavor, filename: &Pat
|
||||
}
|
||||
|
||||
pub fn meta_section_name(target: &Target) -> &'static str {
|
||||
+ // Historical note:
|
||||
+ //
|
||||
+ // When using link.exe it was seen that the section name `.note.rustc`
|
||||
+ // was getting shortened to `.note.ru`, and according to the PE and COFF
|
||||
+ // specification:
|
||||
+ //
|
||||
+ // > Executable images do not use a string table and do not support
|
||||
+ // > section names longer than 8 characters
|
||||
+ //
|
||||
+ // https://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx
|
||||
+ //
|
||||
+ // As a result, we choose a slightly shorter name! As to why
|
||||
+ // `.note.rustc` works on MinGW, that's another good question...
|
||||
+
|
||||
if target.options.is_like_osx {
|
||||
- "__DATA,__note.rustc"
|
||||
- } else if target.options.is_like_msvc {
|
||||
- // When using link.exe it was seen that the section name `.note.rustc`
|
||||
- // was getting shortened to `.note.ru`, and according to the PE and COFF
|
||||
- // specification:
|
||||
- //
|
||||
- // > Executable images do not use a string table and do not support
|
||||
- // > section names longer than 8 characters
|
||||
- //
|
||||
- // https://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx
|
||||
- //
|
||||
- // As a result, we choose a slightly shorter name! As to why
|
||||
- // `.note.rustc` works on MinGW, that's another good question...
|
||||
- ".rustc"
|
||||
+ "__DATA,.rustc"
|
||||
} else {
|
||||
- ".note.rustc"
|
||||
+ ".rustc"
|
||||
}
|
||||
}
|
||||
|
||||
-pub fn read_meta_section_name(target: &Target) -> &'static str {
|
||||
- if target.options.is_like_osx {
|
||||
- "__note.rustc"
|
||||
- } else if target.options.is_like_msvc {
|
||||
- ".rustc"
|
||||
- } else {
|
||||
- ".note.rustc"
|
||||
- }
|
||||
+pub fn read_meta_section_name(_target: &Target) -> &'static str {
|
||||
+ ".rustc"
|
||||
}
|
||||
|
||||
// A diagnostic function for dumping crate metadata to an output stream
|
||||
diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs
|
||||
index d4f0786..93c9d1a 100644
|
||||
--- a/src/librustc_trans/base.rs
|
||||
+++ b/src/librustc_trans/base.rs
|
||||
@@ -2523,10 +2523,17 @@ pub fn write_metadata<'a, 'tcx>(cx: &SharedCrateContext<'a, 'tcx>,
|
||||
};
|
||||
unsafe {
|
||||
llvm::LLVMSetInitializer(llglobal, llconst);
|
||||
- let name =
|
||||
+ let section_name =
|
||||
cx.tcx().sess.cstore.metadata_section_name(&cx.sess().target.target);
|
||||
- let name = CString::new(name).unwrap();
|
||||
- llvm::LLVMSetSection(llglobal, name.as_ptr())
|
||||
+ let name = CString::new(section_name).unwrap();
|
||||
+ llvm::LLVMSetSection(llglobal, name.as_ptr());
|
||||
+
|
||||
+ // Also generate a .section directive to force no
|
||||
+ // flags, at least for ELF outputs, so that the
|
||||
+ // metadata doesn't get loaded into memory.
|
||||
+ let directive = format!(".section {}", section_name);
|
||||
+ let directive = CString::new(directive).unwrap();
|
||||
+ llvm::LLVMSetModuleInlineAsm(cx.metadata_llmod(), directive.as_ptr())
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
rust: don't block before random pool is initialized
|
||||
|
||||
Upstream-Status: Backport [See https://github.com/rust-lang/rust/pull/33086]
|
||||
|
||||
Signed-off-by: Derek Straka <derek@asterius.io>
|
||||
--- ./src/libstd/rand/os.rs.orig 2016-08-18 13:14:25.908309986 -0400
|
||||
+++ ./src/libstd/rand/os.rs 2016-08-18 13:14:11.316560875 -0400
|
||||
@@ -46,8 +46,10 @@
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
const NR_GETRANDOM: libc::c_long = 278;
|
||||
|
||||
+ const GRND_NONBLOCK: libc::c_uint = 0x0001;
|
||||
+
|
||||
unsafe {
|
||||
- libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
|
||||
+ libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +71,20 @@
|
||||
let err = errno() as libc::c_int;
|
||||
if err == libc::EINTR {
|
||||
continue;
|
||||
- } else {
|
||||
+ } else if err == libc::EAGAIN {
|
||||
+ // if getrandom() returns EAGAIN it would have blocked
|
||||
+ // because the non-blocking pool (urandom) has not
|
||||
+ // initialized in the kernel yet due to a lack of entropy
|
||||
+ // the fallback we do here is to avoid blocking applications
|
||||
+ // which could depend on this call without ever knowing
|
||||
+ // they do and don't have a work around. The PRNG of
|
||||
+ // /dev/urandom will still be used but not over a completely
|
||||
+ // full entropy pool
|
||||
+ let reader = File::open("/dev/urandom").expect("Unable to open /dev/urandom");
|
||||
+ let mut reader_rng = ReaderRng::new(reader);
|
||||
+ reader_rng.fill_bytes(& mut v[read..]);
|
||||
+ read += v.len() as usize;
|
||||
+ } else {
|
||||
panic!("unexpected getrandom error: {}", err);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -8,24 +8,21 @@ inherit shared-source-provide
|
||||
require rust-version.inc
|
||||
require rust-release.inc
|
||||
|
||||
SRC_URI[rust.md5sum] = "15f1c204580017838301c5c8568e8f3f"
|
||||
SRC_URI[rust.sha256sum] = "6df96059d87b718676d9cd879672e4e22418b6093396b4ccb5b5b66df37bf13a"
|
||||
SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db"
|
||||
SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869"
|
||||
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=eb87dba71cb424233bcce88db3ae2f1a"
|
||||
|
||||
SRC_URI_append = "\
|
||||
file://rust/0001-Add-config-for-musl-based-arm-builds.patch \
|
||||
file://rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \
|
||||
file://rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \
|
||||
file://rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
|
||||
file://rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \
|
||||
file://rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \
|
||||
file://rust/0007-mk-install-use-disable-rewrite-paths.patch \
|
||||
file://rust/0009-Remove-crate-metadata-from-symbol-hashing.patch \
|
||||
file://rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch \
|
||||
file://rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch \
|
||||
file://rust/0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch \
|
||||
file://rust/0013-mk-allow-changing-the-platform-configuration-source-.patch \
|
||||
file://rust-llvm/0000-rust-llvm-remove-extra-slash.patch \
|
||||
file://rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \
|
||||
file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \
|
||||
file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \
|
||||
file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \
|
||||
file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \
|
||||
file://rust/0001-Add-config-for-musl-based-arm-builds.patch \
|
||||
file://rust/fix-urandom-during-init.patch \
|
||||
"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Note: if you adjust this, you'll also need to change the hashes in
|
||||
# rust-source.bb
|
||||
SOURCE_NAME = "rust"
|
||||
PV = "1.7.0"
|
||||
PV = "1.10.0"
|
||||
|
||||
LICENSE = "MIT | Apache-2.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ inherit rust-installer
|
||||
require rust-shared-source.inc
|
||||
require rust-snapshot-2015-12-18.inc
|
||||
|
||||
LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=9c5a05eab0ffc3590e50db38c51d1425"
|
||||
LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8"
|
||||
|
||||
SUMMARY = "Rust compiler and runtime libaries"
|
||||
HOMEPAGE = "http://www.rust-lang.org"
|
||||
|
||||
Reference in New Issue
Block a user