Skip to content

Allow the use of syntax extensions when cross-compiling #13584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@ endif
# triples). The associated message will be printed as a warning
# during attempts to run those tests.

CTEST_DISABLE_NONSELFHOST_rpass-full = "run-pass-full suite is unavailable when cross-compiling."

define DEF_CTEST_VARS

# All the per-stage build rules you might want to call from the
Expand Down Expand Up @@ -573,7 +571,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
$$(CTEST_TESTARGS)

CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(2)_H_$(3))
CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<'a> Archive<'a> {
let unixlibname = format!("lib{}.a", name);

let mut rustpath = filesearch::rust_path();
rustpath.push(self.sess.filesearch().get_target_lib_path());
rustpath.push(self.sess.target_filesearch().get_lib_path());
let search = self.sess.opts.addl_lib_search_paths.borrow();
for path in search.iter().chain(rustpath.iter()) {
debug!("looking for {} inside {}", name, path.display());
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ fn link_args(sess: &Session,
// The default library location, we need this to find the runtime.
// The location of crates will be determined as needed.
// FIXME (#9639): This needs to handle non-utf8 paths
let lib_path = sess.filesearch().get_target_lib_path();
let lib_path = sess.target_filesearch().get_lib_path();
let stage: ~str = "-L".to_owned() + lib_path.as_str().unwrap();

let mut args = vec!(stage);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec<~str> {

debug!("preparing the RPATH!");

let sysroot = sess.filesearch().sysroot;
let sysroot = sess.sysroot();
let output = out_filename;
let libs = sess.cstore.get_used_crates(cstore::RequireDynamic);
let libs = libs.move_iter().filter_map(|(_, l)| {
Expand Down
10 changes: 4 additions & 6 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
let time_passes = sess.time_passes();

time(time_passes, "external crate/lib resolution", (), |_|
creader::read_crates(&sess, krate,
session::sess_os_to_meta_os(sess.targ_cfg.os),
token::get_ident_interner()));
creader::read_crates(&sess, krate));

let lang_items = time(time_passes, "language item collection", (), |_|
middle::lang_items::collect_language_items(krate, &sess));
Expand Down Expand Up @@ -794,7 +792,7 @@ pub fn build_target_config(sopts: &session::Options) -> session::Config {
}
}

pub fn host_triple() -> ~str {
pub fn host_triple() -> &'static str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
// actually built. We can't just take LLVM's host triple because they
Expand All @@ -803,7 +801,7 @@ pub fn host_triple() -> ~str {
// Instead of grabbing the host triple (for the current host), we grab (at
// compile time) the target triple that this rustc is built with and
// calling that (at runtime) the host triple.
(env!("CFG_COMPILER_HOST_TRIPLE")).to_owned()
env!("CFG_COMPILER_HOST_TRIPLE")
}

pub fn build_session_options(matches: &getopts::Matches) -> session::Options {
Expand Down Expand Up @@ -895,7 +893,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> session::Options {
}

let sysroot_opt = matches.opt_str("sysroot").map(|m| Path::new(m));
let target = matches.opt_str("target").unwrap_or(host_triple());
let target = matches.opt_str("target").unwrap_or(host_triple().to_owned());
let opt_level = {
if (debugging_opts & session::NO_OPT) != 0 {
No
Expand Down
20 changes: 14 additions & 6 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,25 @@ impl Session {
pub fn show_span(&self) -> bool {
self.debugging_opt(SHOW_SPAN)
}
pub fn filesearch<'a>(&'a self) -> filesearch::FileSearch<'a> {
let sysroot = match self.opts.maybe_sysroot {
Some(ref sysroot) => sysroot,
pub fn sysroot<'a>(&'a self) -> &'a Path {
match self.opts.maybe_sysroot {
Some (ref sysroot) => sysroot,
None => self.default_sysroot.as_ref()
.expect("missing sysroot and default_sysroot in Session")
};
}
}
pub fn target_filesearch<'a>(&'a self) -> filesearch::FileSearch<'a> {
filesearch::FileSearch::new(
sysroot,
self.sysroot(),
self.opts.target_triple,
&self.opts.addl_lib_search_paths)
}
pub fn host_filesearch<'a>(&'a self) -> filesearch::FileSearch<'a> {
filesearch::FileSearch::new(
self.sysroot(),
host_triple(),
&self.opts.addl_lib_search_paths)
}
}

/// Some reasonable defaults
Expand All @@ -343,7 +351,7 @@ pub fn basic_options() -> Options {
output_types: Vec::new(),
addl_lib_search_paths: RefCell::new(HashSet::new()),
maybe_sysroot: None,
target_triple: host_triple(),
target_triple: host_triple().to_owned(),
cfg: Vec::new(),
test: false,
parse_only: false,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc/metadata/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ pub static tag_macro_registrar_fn: uint = 0x8b;
pub static tag_exported_macros: uint = 0x8c;
pub static tag_macro_def: uint = 0x8d;

pub static tag_crate_triple: uint = 0x66;

#[deriving(Clone, Show)]
pub struct LinkMeta {
pub crateid: CrateId,
Expand Down
Loading