rustbuild: Fix cross-compiles to MinGW on Linux

Closes #36290
Closes #36291
This commit is contained in:
Alex Crichton 2016-09-12 22:40:14 -07:00
parent fa9d8cc8ac
commit 5841678f51
6 changed files with 33 additions and 7 deletions

View File

@ -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() {

View File

@ -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]

View File

@ -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 {

View File

@ -2,6 +2,7 @@
name = "std_shim"
version = "0.1.0"
dependencies = [
"core 0.0.0",
"std 0.0.0",
]

View File

@ -41,6 +41,7 @@ debug-assertions = false
[dependencies]
std = { path = "../../libstd" }
core = { path = "../../libcore" }
# Reexport features from std
[features]

View File

@ -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;