rustbuild: fix cross compilation of libstd to i686-unknown-linux-musl
- 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.
This commit is contained in:
parent
c116ae35cf
commit
0b7fc0653b
5 changed files with 24 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue