Rebase patches for rust version 1.7.0
Signed-off-by: Derek Straka <derek@asterius.io>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 632d71477fdecb18852812d86b8e2ee1e33c521b Mon Sep 17 00:00:00 2001
|
||||
From 3237afb78f960c015025186166f1c0998c00c6a6 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:
|
||||
@@ -7,14 +7,14 @@ Subject: [PATCH 2/9] Target: add default target.json path:
|
||||
---
|
||||
src/librustc/session/config.rs | 6 +++---
|
||||
src/librustc/session/mod.rs | 8 ++++++--
|
||||
src/librustc_back/target/mod.rs | 14 +++++++++++---
|
||||
3 files changed, 20 insertions(+), 8 deletions(-)
|
||||
src/librustc_back/target/mod.rs | 13 +++++++++++--
|
||||
3 files changed, 20 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
|
||||
index 7e8104d..ecb38d4 100644
|
||||
index c4697eb..4cc059b 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -36,7 +36,7 @@ use getopts;
|
||||
@@ -35,7 +35,7 @@ use getopts;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::fmt;
|
||||
@@ -23,24 +23,24 @@ index 7e8104d..ecb38d4 100644
|
||||
|
||||
use llvm;
|
||||
|
||||
@@ -653,8 +653,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
@@ -711,8 +711,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
v
|
||||
}
|
||||
|
||||
-pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
|
||||
-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: &SpanHandler) -> Config {
|
||||
+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.handler().fatal(&format!("Error loading target specification: {}", 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 0a1df25..ad223d5 100644
|
||||
index 2f3af1c..6424cff 100644
|
||||
--- a/src/librustc/session/mod.rs
|
||||
+++ b/src/librustc/session/mod.rs
|
||||
@@ -412,14 +412,18 @@ pub fn build_session_(sopts: config::Options,
|
||||
local_crate_source_file: Option<PathBuf>,
|
||||
span_diagnostic: diagnostic::SpanHandler)
|
||||
@@ -429,13 +429,17 @@ pub fn build_session_(sopts: config::Options,
|
||||
codemap: Rc<codemap::CodeMap>,
|
||||
cstore: Rc<for<'a> CrateStore<'a>>)
|
||||
-> Session {
|
||||
- let host = match Target::search(config::host_triple()) {
|
||||
+ let sysroot = match sopts.maybe_sysroot {
|
||||
@@ -50,29 +50,28 @@ index 0a1df25..ad223d5 100644
|
||||
+ let host = match Target::search(&sysroot, config::host_triple()) {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
span_diagnostic.handler()
|
||||
.fatal(&format!("Error loading host specification: {}", 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);
|
||||
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 6ae7435..3ffa484 100644
|
||||
index 5114910..636a1aa 100644
|
||||
--- a/src/librustc_back/target/mod.rs
|
||||
+++ b/src/librustc_back/target/mod.rs
|
||||
@@ -49,6 +49,8 @@ use serialize::json::Json;
|
||||
use std::default::Default;
|
||||
use std::io::prelude::*;
|
||||
use syntax::{diagnostic, abi};
|
||||
use syntax::abi;
|
||||
+use std::borrow::ToOwned;
|
||||
+use std::path::Path;
|
||||
|
||||
mod android_base;
|
||||
mod apple_base;
|
||||
@@ -346,12 +348,13 @@ impl Target {
|
||||
@@ -366,12 +368,13 @@ impl Target {
|
||||
///
|
||||
/// The error string could come from any of the APIs called, including
|
||||
/// filesystem access and JSON decoding.
|
||||
@@ -87,11 +86,10 @@ index 6ae7435..3ffa484 100644
|
||||
|
||||
fn load_file(path: &Path) -> Result<Target, String> {
|
||||
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
|
||||
@@ -447,9 +450,14 @@ impl Target {
|
||||
let target_path = env::var_os("RUST_TARGET_PATH")
|
||||
@@ -470,8 +473,14 @@ impl Target {
|
||||
.unwrap_or(OsString::new());
|
||||
|
||||
- // FIXME 16351: add a sane default search path?
|
||||
// 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");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From b544f5bfa38d5932db23214e168988d05cbc5620 Mon Sep 17 00:00:00 2001
|
||||
From 3254ad1d84b177eb960219c2bce26f8980a511e1 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
|
||||
@@ -8,29 +8,41 @@ 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 | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
mk/main.mk | 30 +++++++++++++-----------------
|
||||
1 file changed, 13 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/mk/main.mk b/mk/main.mk
|
||||
index 34f8247..896c1df 100644
|
||||
index 963c12f..04b3e25 100644
|
||||
--- a/mk/main.mk
|
||||
+++ b/mk/main.mk
|
||||
@@ -376,21 +376,22 @@ define SREQ
|
||||
# Destinations of artifacts for the host compiler
|
||||
@@ -383,32 +383,26 @@ define SREQ
|
||||
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
||||
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
|
||||
|
||||
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
|
||||
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
||||
-else
|
||||
-# 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)
|
||||
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
|
||||
-RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib
|
||||
-endif
|
||||
-
|
||||
-else
|
||||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
||||
-
|
||||
-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
|
||||
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
|
||||
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
|
||||
|
||||
@@ -42,11 +54,12 @@ index 34f8247..896c1df 100644
|
||||
+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))
|
||||
@@ -502,6 +503,7 @@ STAGE$(1)_T_$(2)_H_$(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)) \
|
||||
@@ -54,7 +67,7 @@ index 34f8247..896c1df 100644
|
||||
$$(RUSTC_FLAGS_$(2))
|
||||
|
||||
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
|
||||
@@ -510,6 +512,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
|
||||
@@ -528,6 +523,7 @@ PERF_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)) \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1197d6ec82df147e8bbe0d42017fe1ee75804369 Mon Sep 17 00:00:00 2001
|
||||
From 93ef6b8b93c7695280aba7f3541bf8f1ae18c722 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
|
||||
@@ -13,20 +13,20 @@ 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 | 49 ++++++++++++++++------
|
||||
mk/host.mk | 6 ++-
|
||||
mk/main.mk | 11 +++++
|
||||
mk/perf.mk | 4 +-
|
||||
mk/prepare.mk | 4 +-
|
||||
src/librustc/metadata/filesearch.rs | 84 ++++++++++++++-----------------------
|
||||
src/librustc_trans/back/link.rs | 3 +-
|
||||
7 files changed, 90 insertions(+), 71 deletions(-)
|
||||
configure | 44 ++++++++++++++++++++-----
|
||||
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(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 60d3661..01c447b 100755
|
||||
index 287b7b3..7d53a66 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -334,6 +334,31 @@ enable_if_not_disabled() {
|
||||
@@ -334,6 +334,32 @@ enable_if_not_disabled() {
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -54,28 +54,20 @@ index 60d3661..01c447b 100755
|
||||
+ result="${result}${down#/}"
|
||||
+ echo "$result"
|
||||
+}
|
||||
+
|
||||
+
|
||||
to_llvm_triple() {
|
||||
case $1 in
|
||||
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
|
||||
@@ -632,6 +657,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
|
||||
@@ -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)
|
||||
|
||||
+CFG_LIBDIR_RELATIVE=lib
|
||||
+
|
||||
# On windows we just store the libraries in the bin directory because
|
||||
# there's no rpath. This is where the build system itself puts libraries;
|
||||
# --libdir is used to configure the installation directory.
|
||||
@@ -639,24 +666,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
|
||||
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
|
||||
then
|
||||
CFG_LIBDIR_RELATIVE=bin
|
||||
-else
|
||||
- CFG_LIBDIR_RELATIVE=lib
|
||||
fi
|
||||
|
||||
-valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)"
|
||||
# On Windows this determines root of the subtree for target libraries.
|
||||
# Host runtime libs always go to 'bin'.
|
||||
-valopt libdir "${CFG_PREFIX}/lib" "install libraries"
|
||||
+valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
|
||||
|
||||
-case "$CFG_LIBDIR" in
|
||||
@@ -93,15 +85,9 @@ index 60d3661..01c447b 100755
|
||||
+CFG_BINDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_BINDIR}")
|
||||
+CFG_LIBDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_LIBDIR}")
|
||||
|
||||
if ( [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] ) \
|
||||
- && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then
|
||||
- err "libdir on windows should be set to 'bin'"
|
||||
+ && [ "$CFG_LIBDIR_RELATIVE" != "$CFG_BINDIR_RELATIVE" ]; then
|
||||
+ err "Windows builds currently require that LIBDIR == BINDIR (we have libdir{$CFG_LIBDIR_RELATIVE} != bindir{$CFG_BINDIR_RELATIVE} )"
|
||||
fi
|
||||
|
||||
if [ $HELP -eq 1 ]
|
||||
@@ -1733,6 +1757,7 @@ putvar CFG_PREFIX
|
||||
then
|
||||
@@ -1760,6 +1787,7 @@ putvar CFG_PREFIX
|
||||
putvar CFG_HOST
|
||||
putvar CFG_TARGET
|
||||
putvar CFG_LIBDIR_RELATIVE
|
||||
@@ -129,10 +115,10 @@ index 59a0095..b8e8345 100644
|
||||
|
||||
endef
|
||||
diff --git a/mk/main.mk b/mk/main.mk
|
||||
index 896c1df..ab12166 100644
|
||||
index 04b3e25..ba11e5e 100644
|
||||
--- a/mk/main.mk
|
||||
+++ b/mk/main.mk
|
||||
@@ -345,7 +345,9 @@ export CFG_RELEASE_CHANNEL
|
||||
@@ -351,7 +351,9 @@ export CFG_RELEASE_CHANNEL
|
||||
export CFG_LLVM_ROOT
|
||||
export CFG_PREFIX
|
||||
export CFG_LIBDIR
|
||||
@@ -142,7 +128,7 @@ index 896c1df..ab12166 100644
|
||||
export CFG_DISABLE_INJECT_STD_VERSION
|
||||
ifdef CFG_DISABLE_UNSTABLE_FEATURES
|
||||
CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
|
||||
@@ -375,7 +377,16 @@ define SREQ
|
||||
@@ -381,7 +383,16 @@ define SREQ
|
||||
|
||||
# Destinations of artifacts for the host compiler
|
||||
HROOT$(1)_H_$(3) = $(3)/stage$(1)
|
||||
@@ -156,9 +142,9 @@ index 896c1df..ab12166 100644
|
||||
+HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE)
|
||||
+endif
|
||||
+
|
||||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
|
||||
|
||||
# Destinations of artifacts for target architectures
|
||||
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
|
||||
@@ -180,46 +166,70 @@ index 16cbaab..f8a354c 100644
|
||||
endif
|
||||
|
||||
diff --git a/mk/prepare.mk b/mk/prepare.mk
|
||||
index e263a6d..45590ab 100644
|
||||
index 87a4450..c358bbc 100644
|
||||
--- a/mk/prepare.mk
|
||||
+++ b/mk/prepare.mk
|
||||
@@ -186,10 +186,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
|
||||
@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator, $(TOOLS
|
||||
# $(3) is host
|
||||
# $(4) tag
|
||||
define DEF_PREPARE_HOST_TOOL
|
||||
-prepare-host-tool-$(1)-$(2)-$(3)-$(4): \
|
||||
- PREPARE_SOURCE_BIN_DIR=$$(HBIN$(2)_H_$(3))
|
||||
prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
|
||||
$$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
|
||||
$$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
|
||||
@@ -117,10 +115,8 @@ PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1))
|
||||
# $(3) is host
|
||||
# $(4) tag
|
||||
define DEF_PREPARE_HOST_LIB
|
||||
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
|
||||
- PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3))
|
||||
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
|
||||
- PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3)))
|
||||
+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)) \
|
||||
$$(HLIB$(2)_H_$(3))/stamp.$(1) \
|
||||
@@ -138,14 +134,10 @@ endef
|
||||
# $(4) tag
|
||||
define DEF_PREPARE_TARGET_N
|
||||
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
|
||||
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
|
||||
- PREPARE_WORKING_SOURCE_LIB_DIR=$$(TLIB$(1)_T_$(2)_H_$(3))
|
||||
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
|
||||
- PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
|
||||
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
|
||||
- PREPARE_SOURCE_BIN_DIR=$$(TBIN$(1)_T_$(2)_H_$(3))
|
||||
-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_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib
|
||||
+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
|
||||
+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), \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
|
||||
@@ -198,9 +190,12 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
|
||||
|
||||
define DEF_PREPARE
|
||||
|
||||
prepare-base-$(1)-%: PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
|
||||
-prepare-base-$(1)-%: PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/bin
|
||||
+prepare-base-$(1)-%: PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
|
||||
+prepare-base-$(1)-%: PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_BINDIR_RELATIVE)
|
||||
prepare-base-$(1)-%: PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE)
|
||||
+prepare-base-$(1)-%: PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE)
|
||||
prepare-base-$(1)-%: PREPARE_SOURCE_MAN_DIR=$$(S)/man
|
||||
-prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
|
||||
-prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE))
|
||||
+prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_BINDIR_RELATIVE)
|
||||
prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
|
||||
+prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
|
||||
prepare-base-$(1)-%: PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
|
||||
|
||||
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
|
||||
index 311ab1c..1b03b1a 100644
|
||||
--- a/src/librustc/metadata/filesearch.rs
|
||||
+++ b/src/librustc/metadata/filesearch.rs
|
||||
@@ -68,8 +68,7 @@ impl<'a> FileSearch<'a> {
|
||||
if !found {
|
||||
let rustpath = rust_path();
|
||||
for path in &rustpath {
|
||||
- let tlib_path = make_rustpkg_lib_path(
|
||||
- self.sysroot, path, self.triple);
|
||||
+ let tlib_path = make_rustpkg_lib_path(path, self.triple);
|
||||
debug!("is {} in visited_dirs? {}", tlib_path.display(),
|
||||
visited_dirs.contains(&tlib_path));
|
||||
|
||||
@@ -96,7 +95,7 @@ impl<'a> FileSearch<'a> {
|
||||
where F: FnMut(&Path, PathKind) -> FileMatch
|
||||
{
|
||||
self.for_each_lib_search_path(|lib_search_path, kind| {
|
||||
- debug!("searching {}", lib_search_path.display());
|
||||
+ info!("searching {}", lib_search_path.display());
|
||||
match fs::read_dir(lib_search_path) {
|
||||
Ok(files) => {
|
||||
let files = files.filter_map(|p| p.ok().map(|s| s.path()))
|
||||
@@ -157,7 +156,7 @@ impl<'a> FileSearch<'a> {
|
||||
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
|
||||
--- a/src/librustc/session/filesearch.rs
|
||||
+++ b/src/librustc/session/filesearch.rs
|
||||
@@ -124,7 +124,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);
|
||||
@@ -228,7 +238,7 @@ index 311ab1c..1b03b1a 100644
|
||||
p.push(&rustlibdir());
|
||||
p.push(&self.triple);
|
||||
p.push("bin");
|
||||
@@ -165,8 +164,8 @@ impl<'a> FileSearch<'a> {
|
||||
@@ -132,8 +132,8 @@ impl<'a> FileSearch<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,24 +249,14 @@ index 311ab1c..1b03b1a 100644
|
||||
assert!(p.is_relative());
|
||||
p.push(&rustlibdir());
|
||||
p.push(target_triple);
|
||||
@@ -176,17 +175,28 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
|
||||
@@ -143,7 +143,19 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf
|
||||
|
||||
fn make_target_lib_path(sysroot: &Path,
|
||||
target_triple: &str) -> PathBuf {
|
||||
- sysroot.join(&relative_target_lib_path(sysroot, target_triple))
|
||||
+ sysroot.join(&relative_target_lib_path(target_triple))
|
||||
}
|
||||
|
||||
-fn make_rustpkg_lib_path(sysroot: &Path,
|
||||
- dir: &Path,
|
||||
+fn make_rustpkg_lib_path(dir: &Path,
|
||||
triple: &str) -> PathBuf {
|
||||
- let mut p = dir.join(&find_libdir(sysroot));
|
||||
+ let mut p = dir.join(libdir_str());
|
||||
p.push(triple);
|
||||
p
|
||||
}
|
||||
|
||||
+}
|
||||
+
|
||||
+pub fn bindir_relative_str() -> &'static str {
|
||||
+ env!("CFG_BINDIR_RELATIVE")
|
||||
+}
|
||||
@@ -267,12 +267,10 @@ index 311ab1c..1b03b1a 100644
|
||||
+
|
||||
+pub fn libdir_str() -> &'static str {
|
||||
+ env!("CFG_LIBDIR_RELATIVE")
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
pub fn get_or_default_sysroot() -> PathBuf {
|
||||
// Follow symlinks. If the resolved path is relative, make it absolute.
|
||||
fn canonicalize(path: Option<PathBuf>) -> Option<PathBuf> {
|
||||
@@ -202,7 +212,18 @@ pub fn get_or_default_sysroot() -> PathBuf {
|
||||
@@ -161,44 +173,22 @@ pub fn get_or_default_sysroot() -> PathBuf {
|
||||
}
|
||||
|
||||
match canonicalize(env::current_exe().ok()) {
|
||||
@@ -292,13 +290,8 @@ index 311ab1c..1b03b1a 100644
|
||||
None => panic!("can't determine value for sysroot")
|
||||
}
|
||||
}
|
||||
@@ -257,47 +278,6 @@ pub fn rust_path() -> Vec<PathBuf> {
|
||||
env_rust_path
|
||||
}
|
||||
|
||||
-// The name of the directory rustc expects libraries to be located.
|
||||
-// On Unix should be "lib", on windows "bin"
|
||||
-#[cfg(unix)]
|
||||
-fn find_libdir(sysroot: &Path) -> String {
|
||||
- // FIXME: This is a quick hack to make the rustc binary able to locate
|
||||
- // Rust libraries in Linux environments where libraries might be installed
|
||||
@@ -331,20 +324,14 @@ index 311ab1c..1b03b1a 100644
|
||||
- "lib".to_string()
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-#[cfg(windows)]
|
||||
-fn find_libdir(_sysroot: &Path) -> String {
|
||||
- "bin".to_string()
|
||||
-}
|
||||
-
|
||||
|
||||
// The name of rustc's own place to organize libraries.
|
||||
// Used to be "rustc", now the default is "rustlib"
|
||||
pub fn rustlibdir() -> String {
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 6171ff1..32f41ff 100644
|
||||
index ec1383f..670d637 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -1033,11 +1033,10 @@ fn link_args(cmd: &mut Linker,
|
||||
@@ -1042,11 +1042,10 @@ fn link_args(cmd: &mut Linker,
|
||||
// where extern libraries might live, based on the
|
||||
// addl_lib_search_paths
|
||||
if sess.opts.cg.rpath {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 68662f758244a476b64b0772d93c7a1731e9d1ad Mon Sep 17 00:00:00 2001
|
||||
From 8b088363a61a627fd8a31318d15164113f081660 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
|
||||
@@ -8,10 +8,10 @@ Subject: [PATCH 6/9] std/thread_local: workaround for NULL __dso_handle
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
|
||||
index c204f79..b2f6f1d 100644
|
||||
index ca0f103..5851127 100644
|
||||
--- a/src/libstd/thread/local.rs
|
||||
+++ b/src/libstd/thread/local.rs
|
||||
@@ -338,7 +338,7 @@ mod imp {
|
||||
@@ -324,7 +324,7 @@ pub mod elf {
|
||||
#[linkage = "extern_weak"]
|
||||
static __cxa_thread_atexit_impl: *const libc::c_void;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From be3663fcd9ae11a207b3c1649917bfff3c69b1c4 Mon Sep 17 00:00:00 2001
|
||||
From 1a9ada8070bb9cd293cfb93913721c68ca0b7766 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
|
||||
@@ -11,10 +11,10 @@ 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 8b81702..4fed072 100644
|
||||
index af6f3ff..430add7 100644
|
||||
--- a/mk/install.mk
|
||||
+++ b/mk/install.mk
|
||||
@@ -12,7 +12,9 @@ RUN_INSALLER = cd tmp/empty_dir && \
|
||||
@@ -12,7 +12,9 @@ RUN_INSTALLER = cd tmp/empty_dir && \
|
||||
sh ../../tmp/dist/$(1)/install.sh \
|
||||
--prefix="$(DESTDIR)$(CFG_PREFIX)" \
|
||||
--libdir="$(DESTDIR)$(CFG_LIBDIR)" \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From d7aa5e6824e8658c01f702259eebac02553fb7b8 Mon Sep 17 00:00:00 2001
|
||||
From 2e6a496cb978e3bf885e4e2c3032a02b418c790d Mon Sep 17 00:00:00 2001
|
||||
From: Cody P Schafer <dev@codyps.com>
|
||||
Date: Tue, 26 May 2015 12:09:36 -0400
|
||||
Subject: [PATCH 8/9] install: disable ldconfig
|
||||
@@ -8,10 +8,10 @@ Subject: [PATCH 8/9] install: disable ldconfig
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/mk/install.mk b/mk/install.mk
|
||||
index 4fed072..92e66cd 100644
|
||||
index 430add7..6735dc7 100644
|
||||
--- a/mk/install.mk
|
||||
+++ b/mk/install.mk
|
||||
@@ -13,8 +13,9 @@ RUN_INSALLER = cd tmp/empty_dir && \
|
||||
@@ -13,8 +13,9 @@ RUN_INSTALLER = cd tmp/empty_dir && \
|
||||
--prefix="$(DESTDIR)$(CFG_PREFIX)" \
|
||||
--libdir="$(DESTDIR)$(CFG_LIBDIR)" \
|
||||
--mandir="$(DESTDIR)$(CFG_MANDIR)" \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From e6888f9b888911bdbd52e2ee7c37914ee4cee0e2 Mon Sep 17 00:00:00 2001
|
||||
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
|
||||
@@ -8,10 +8,10 @@ Subject: [PATCH 9/9] Remove crate metadata from symbol hashing
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 32f41ff..2a87cd7 100644
|
||||
index 670d637..4e7150e 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -212,11 +212,6 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||
@@ -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("-");
|
||||
@@ -20,7 +20,7 @@ index 32f41ff..2a87cd7 100644
|
||||
- symbol_hasher.input_str(&meta[..]);
|
||||
- }
|
||||
- symbol_hasher.input_str("-");
|
||||
symbol_hasher.input(&encoder::encoded_ty(tcx, t));
|
||||
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");
|
||||
--
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1bd3ab55ce24b2a54e021ba471a5f934b3b9ad6b Mon Sep 17 00:00:00 2001
|
||||
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
|
||||
@@ -18,15 +18,15 @@ 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 | 38 ++++++++++++++++++++++++++++++++++++++
|
||||
src/librustc_trans/back/link.rs | 36 ++++++++++++++++++++++++++++++++++++
|
||||
src/librustc_trans/trans/base.rs | 3 +++
|
||||
5 files changed, 48 insertions(+)
|
||||
5 files changed, 46 insertions(+)
|
||||
|
||||
diff --git a/mk/platform.mk b/mk/platform.mk
|
||||
index 0c90632..4681783 100644
|
||||
index 5239086..eb693b8 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -181,6 +181,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
@@ -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))) \
|
||||
@@ -35,10 +35,10 @@ index 0c90632..4681783 100644
|
||||
|
||||
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 ecb38d4..b74b3c4 100644
|
||||
index 4cc059b..600cb4b 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -460,6 +460,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
||||
@@ -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"),
|
||||
@@ -48,19 +48,19 @@ index ecb38d4..b74b3c4 100644
|
||||
"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 3ffa484..d52e67c 100644
|
||||
index 636a1aa..1b87a7a 100644
|
||||
--- a/src/librustc_back/target/mod.rs
|
||||
+++ b/src/librustc_back/target/mod.rs
|
||||
@@ -110,6 +110,8 @@ pub struct TargetOptions {
|
||||
/// sysroot folder.
|
||||
pub pre_link_objects: Vec<String>,
|
||||
pub post_link_objects: Vec<String>,
|
||||
@@ -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".
|
||||
pub cpu: String,
|
||||
@@ -198,6 +200,7 @@ impl Default for TargetOptions {
|
||||
@@ -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(),
|
||||
@@ -68,7 +68,7 @@ index 3ffa484..d52e67c 100644
|
||||
cpu: "generic".to_string(),
|
||||
features: "".to_string(),
|
||||
dynamic_linking: false,
|
||||
@@ -314,6 +317,7 @@ impl Target {
|
||||
@@ -331,6 +334,7 @@ impl Target {
|
||||
key!(cpu);
|
||||
key!(ar);
|
||||
key!(linker);
|
||||
@@ -77,10 +77,10 @@ index 3ffa484..d52e67c 100644
|
||||
key!(code_model);
|
||||
key!(dll_prefix);
|
||||
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
|
||||
index 2a87cd7..53fa913 100644
|
||||
index 4e7150e..0d8a125 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -393,6 +393,13 @@ fn command_path(sess: &Session) -> OsString {
|
||||
@@ -394,6 +394,13 @@ fn command_path(sess: &Session) -> OsString {
|
||||
env::join_paths(new_path).unwrap()
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ index 2a87cd7..53fa913 100644
|
||||
pub fn remove(sess: &Session, path: &Path) {
|
||||
match fs::remove_file(path) {
|
||||
Ok(..) => {}
|
||||
@@ -919,6 +926,34 @@ fn link_natively(sess: &Session, dylib: bool,
|
||||
@@ -928,6 +935,32 @@ fn link_natively(sess: &Session, dylib: bool,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,12 +115,10 @@ index 2a87cd7..53fa913 100644
|
||||
+ Ok(exitstatus) => {
|
||||
+ if !exitstatus.success() {
|
||||
+ sess.err(&format!("objcopy failed with exit code {:?}", exitstatus.code()));
|
||||
+ sess.note(&format!("{:?}", &o_cmd));
|
||||
+ }
|
||||
+ },
|
||||
+ Err(exitstatus) => {
|
||||
+ sess.err(&format!("objcopy failed: {}", exitstatus));
|
||||
+ sess.note(&format!("{:?}", &o_cmd));
|
||||
+ }
|
||||
+ }
|
||||
+ sess.abort_if_errors();
|
||||
@@ -129,7 +127,7 @@ index 2a87cd7..53fa913 100644
|
||||
fn link_args(cmd: &mut Linker,
|
||||
sess: &Session,
|
||||
dylib: bool,
|
||||
@@ -951,6 +986,9 @@ fn link_args(cmd: &mut Linker,
|
||||
@@ -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 {
|
||||
@@ -140,19 +138,19 @@ index 2a87cd7..53fa913 100644
|
||||
}
|
||||
|
||||
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
|
||||
index 14fea61..df019f7 100644
|
||||
index 4c619f8..2b68767 100644
|
||||
--- a/src/librustc_trans/trans/base.rs
|
||||
+++ b/src/librustc_trans/trans/base.rs
|
||||
@@ -2560,6 +2560,9 @@ pub fn write_metadata(cx: &SharedCrateContext, krate: &hir::Crate,
|
||||
@@ -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 = loader::meta_section_name(&cx.sess().target.target);
|
||||
let name =
|
||||
cx.tcx().sess.cstore.metadata_section_name(&cx.sess().target.target);
|
||||
let name = CString::new(name).unwrap();
|
||||
llvm::LLVMSetSection(llglobal, name.as_ptr())
|
||||
--
|
||||
1.9.1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 128a81ede6b188637743a37a582b2267a49d0a32 Mon Sep 17 00:00:00 2001
|
||||
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
|
||||
@@ -11,14 +11,14 @@ 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 | 26 ++++++++++++++++++++++++--
|
||||
2 files changed, 26 insertions(+), 2 deletions(-)
|
||||
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 b74b3c4..a11cb90 100644
|
||||
index 600cb4b..3570e78 100644
|
||||
--- a/src/librustc/session/config.rs
|
||||
+++ b/src/librustc/session/config.rs
|
||||
@@ -500,6 +500,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
|
||||
@@ -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"),
|
||||
@@ -28,10 +28,10 @@ index b74b3c4..a11cb90 100644
|
||||
"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 53fa913..83619ae 100644
|
||||
index 0d8a125..9917a1e 100644
|
||||
--- a/src/librustc_trans/back/link.rs
|
||||
+++ b/src/librustc_trans/back/link.rs
|
||||
@@ -46,7 +46,7 @@ use std::str;
|
||||
@@ -45,7 +45,7 @@ use std::str;
|
||||
use flate;
|
||||
use serialize::hex::ToHex;
|
||||
use syntax::ast;
|
||||
@@ -40,10 +40,11 @@ index 53fa913..83619ae 100644
|
||||
use syntax::parse::token::{self, InternedString};
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
||||
@@ -185,9 +185,31 @@ pub fn find_crate_name(sess: Option<&Session>,
|
||||
|
||||
pub fn build_link_meta(sess: &Session, krate: &hir::Crate,
|
||||
name: &str) -> LinkMeta {
|
||||
@@ -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),
|
||||
@@ -52,14 +53,15 @@ index 53fa913..83619ae 100644
|
||||
+ };
|
||||
+ let dummy_module = hir::Mod {
|
||||
+ inner: dummy_span,
|
||||
+ items: vec!()
|
||||
+ item_ids: hir::HirVec::new()
|
||||
+ };
|
||||
+ let dummy_krate = hir::Crate {
|
||||
+ module: dummy_module,
|
||||
+ attrs: vec!(),
|
||||
+ config: vec!(),
|
||||
+ attrs: hir::HirVec::new(),
|
||||
+ config: hir::CrateConfig::new(),
|
||||
+ span: dummy_span,
|
||||
+ exported_macros: vec!()
|
||||
+ exported_macros: hir::HirVec::new(),
|
||||
+ items: BTreeMap::new()
|
||||
+ };
|
||||
+
|
||||
+ Svh::calculate(&vec!(sess.opts.cg.crate_hash.clone()), &dummy_krate)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From d0fa41075317425b01262dd539c01e87e2eaf5f4 Mon Sep 17 00:00:00 2001
|
||||
From 7abedc46cad6b52d44badaf88350d41ef907cd4c 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
|
||||
@@ -9,10 +9,10 @@ bitbake recipe will export FORCE_CRATE_HASH
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/mk/platform.mk b/mk/platform.mk
|
||||
index 4681783..59aa560 100644
|
||||
index eb693b8..e6317b5 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -182,6 +182,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
@@ -187,6 +187,7 @@ define CFG_MAKE_TOOLCHAIN
|
||||
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))) \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1fbfa088007054c655741e547bb3e72f1d5f1746 Mon Sep 17 00:00:00 2001
|
||||
From f3e8bd9ab353d4b3d7432a02e37a22eed24b5e57 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
|
||||
@@ -10,10 +10,10 @@ Subject: [PATCH] mk: allow changing the platform configuration source
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 01c447b..0f004cf 100755
|
||||
index 7d53a66..5d40516 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -650,6 +650,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||
@@ -671,6 +671,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"
|
||||
@@ -21,7 +21,7 @@ index 01c447b..0f004cf 100755
|
||||
|
||||
# Temporarily support old triples until buildbots get updated
|
||||
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
|
||||
@@ -1110,7 +1111,7 @@ CFG_MANDIR=${CFG_MANDIR%/}
|
||||
@@ -1127,7 +1128,7 @@ CFG_MANDIR=${CFG_MANDIR%/}
|
||||
CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
|
||||
CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
|
||||
CFG_SUPPORTED_TARGET=""
|
||||
@@ -30,19 +30,19 @@ index 01c447b..0f004cf 100755
|
||||
CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)"
|
||||
done
|
||||
|
||||
@@ -1763,6 +1764,7 @@ putvar CFG_AARCH64_LINUX_ANDROID_NDK
|
||||
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
|
||||
putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
@@ -1795,6 +1796,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK
|
||||
putvar CFG_NACL_CROSS_PATH
|
||||
putvar CFG_MANDIR
|
||||
putvar CFG_USING_LIBCPP
|
||||
+putvar CFG_PLATFORM_CFG
|
||||
|
||||
# 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 59aa560..a964d6f 100644
|
||||
index e6317b5..68a20e1 100644
|
||||
--- a/mk/platform.mk
|
||||
+++ b/mk/platform.mk
|
||||
@@ -112,7 +112,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
|
||||
@@ -114,7 +114,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
|
||||
|
||||
CFG_RLIB_GLOB=lib$(1)-*.rlib
|
||||
|
||||
@@ -50,7 +50,7 @@ index 59aa560..a964d6f 100644
|
||||
+include $(wildcard $(CFG_PLATFORM_CFG)/*.mk)
|
||||
|
||||
define ADD_INSTALLED_OBJECTS
|
||||
INSTALLED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
|
||||
INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1))
|
||||
--
|
||||
2.7.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user