diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index e87669ba08ca9..618fa3805b37f 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -117,14 +117,16 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) { return } let compiler = Compiler::new(0, &build.config.build); - let compiler = build.compiler_path(&compiler); + let compiler_path = build.compiler_path(&compiler); for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) { let file = t!(file); - build.run(Command::new(&compiler) - .arg("--emit=obj") - .arg("--out-dir").arg(into) - .arg(file.path())); + let mut cmd = Command::new(&compiler_path); + build.add_bootstrap_key(&compiler, &mut cmd); + build.run(cmd.arg("--target").arg(target) + .arg("--emit=obj") + .arg("--out-dir").arg(into) + .arg(file.path())); } for obj in ["crt2.o", "dllcrt2.o"].iter() { diff --git a/src/rtstartup/rsbegin.rs b/src/rtstartup/rsbegin.rs index 150abc226e685..b57b7e8432167 100644 --- a/src/rtstartup/rsbegin.rs +++ b/src/rtstartup/rsbegin.rs @@ -22,10 +22,19 @@ // object (usually called `crtX.o), which then invokes initialization callbacks // of other runtime components (registered via yet another special image section). +#![feature(no_core, lang_items)] #![crate_type="rlib"] -#![no_std] +#![no_core] #![allow(non_camel_case_types)] +#[lang = "sized"] +trait Sized {} +#[lang = "sync"] +trait Sync {} +#[lang = "copy"] +trait Copy {} +impl Sync for T {} + #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames { #[no_mangle] diff --git a/src/rtstartup/rsend.rs b/src/rtstartup/rsend.rs index 915c2355b0484..4c48d9af0e1f4 100644 --- a/src/rtstartup/rsend.rs +++ b/src/rtstartup/rsend.rs @@ -10,8 +10,15 @@ // See rsbegin.rs for details. +#![feature(no_core, lang_items)] #![crate_type="rlib"] -#![no_std] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "sync"] +trait Sync {} +impl Sync for T {} #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frames { diff --git a/src/rustc/std_shim/Cargo.lock b/src/rustc/std_shim/Cargo.lock index d47b541b4c3bc..fb0885c132d5e 100644 --- a/src/rustc/std_shim/Cargo.lock +++ b/src/rustc/std_shim/Cargo.lock @@ -2,6 +2,7 @@ name = "std_shim" version = "0.1.0" dependencies = [ + "core 0.0.0", "std 0.0.0", ] diff --git a/src/rustc/std_shim/Cargo.toml b/src/rustc/std_shim/Cargo.toml index 693cbe06ba987..58a7bd8a1cb75 100644 --- a/src/rustc/std_shim/Cargo.toml +++ b/src/rustc/std_shim/Cargo.toml @@ -41,6 +41,7 @@ debug-assertions = false [dependencies] std = { path = "../../libstd" } +core = { path = "../../libcore" } # Reexport features from std [features] diff --git a/src/rustc/std_shim/lib.rs b/src/rustc/std_shim/lib.rs index 3cf4cfab135fd..2fc5d8d6e5321 100644 --- a/src/rustc/std_shim/lib.rs +++ b/src/rustc/std_shim/lib.rs @@ -9,3 +9,9 @@ // except according to those terms. // See comments in Cargo.toml for why this exists + +// There's a bug right now where if we pass --extern std=... and we're cross +// compiling then this doesn't work with `#[macro_use] extern crate std;`. Work +// around this by not having `#[macro_use] extern crate std;` +#![no_std] +extern crate std;