about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-16 04:01:01 -0700
committerGitHub <noreply@github.com>2016-09-16 04:01:01 -0700
commit8394685b8385156fc4bc31cfbc693867e276d9d7 (patch)
tree1ce201fd010be57e767bd462e67aeaef50c9deb8 /src
parent89500e934134d19b09e51a1f45430ded65e291b4 (diff)
parent5841678f51b9fcb085dba148639a21d95ef91423 (diff)
downloadrust-8394685b8385156fc4bc31cfbc693867e276d9d7.tar.gz
rust-8394685b8385156fc4bc31cfbc693867e276d9d7.zip
Auto merge of #36441 - alexcrichton:rustbuild-target, r=brson
rustbuild: Fix cross-compiles to MinGW on Linux

Closes #36290
Closes #36291
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/compile.rs12
-rw-r--r--src/rtstartup/rsbegin.rs11
-rw-r--r--src/rtstartup/rsend.rs9
-rw-r--r--src/rustc/std_shim/Cargo.lock1
-rw-r--r--src/rustc/std_shim/Cargo.toml1
-rw-r--r--src/rustc/std_shim/lib.rs6
6 files changed, 33 insertions, 7 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index e35f25fa729..9de438cfa7d 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -128,14 +128,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 150abc226e6..b57b7e84321 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<T> 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 915c2355b04..4c48d9af0e1 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<T> 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 747322b32f3..b4602355457 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 693cbe06ba9..58a7bd8a1cb 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 3cf4cfab135..2fc5d8d6e53 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;