about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-03-07 13:46:11 +0000
committerbors <bors@rust-lang.org>2016-03-07 13:46:11 +0000
commit2f34986eb0f14b3ce5e17db577abc632a9176380 (patch)
treed3f8fc1f011dfce23ec9b0d21cb5e4eb76d05995 /src/bootstrap
parente079afa00b58f06de8e2a7596073045cd0983b7b (diff)
parentf164433a11bda8b61276f501983462d5dac743aa (diff)
downloadrust-2f34986eb0f14b3ce5e17db577abc632a9176380.tar.gz
rust-2f34986eb0f14b3ce5e17db577abc632a9176380.zip
Auto merge of #32078 - japaric:rustbuild-i686-musl, r=alexcrichton
- make sure we copy the third party objects (crt*.o) to the target stage directory.
- apply the x86_64-musl logic also to the i686-musl target.

---

r? @alexcrichton
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/build/compile.rs13
-rw-r--r--src/bootstrap/build/sanity.rs2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/bootstrap/build/compile.rs b/src/bootstrap/build/compile.rs
index 3be4199352c..fb0a840bfa2 100644
--- a/src/bootstrap/build/compile.rs
+++ b/src/bootstrap/build/compile.rs
@@ -83,6 +83,19 @@ pub fn std_link(build: &Build,
                          libdir.join(staticlib("compiler-rt", target))));
     }
     add_to_sysroot(&out_dir, &libdir);
+
+    if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
+        copy_third_party_objects(build, target, &libdir);
+    }
+}
+
+/// Copies the crt(1,i,n).o startup objects
+///
+/// Only required for musl targets that statically link to libc
+fn copy_third_party_objects(build: &Build, target: &str, into: &Path) {
+    for &obj in &["crt1.o", "crti.o", "crtn.o"] {
+        t!(fs::copy(compiler_file(build.cc(target), obj), into.join(obj)));
+    }
 }
 
 /// Build and prepare startup objects like rsbegin.o and rsend.o
diff --git a/src/bootstrap/build/sanity.rs b/src/bootstrap/build/sanity.rs
index 6ac581a7c69..be4416c697c 100644
--- a/src/bootstrap/build/sanity.rs
+++ b/src/bootstrap/build/sanity.rs
@@ -79,7 +79,7 @@ pub fn check(build: &mut Build) {
         }
 
         // Make sure musl-root is valid if specified
-        if target.contains("musl") && target.contains("x86_64") {
+        if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
             match build.config.musl_root {
                 Some(ref root) => {
                     if fs::metadata(root.join("lib/libc.a")).is_err() {