Auto merge of #36144 - japaric:rustbuild-musl, r=alexcrichton
rustbuild: fix building std for musl targets closes #36143 r? @alexcrichton
This commit is contained in:
@@ -93,16 +93,16 @@ pub fn std_link(build: &Build,
|
|||||||
add_to_sysroot(&out_dir, &libdir);
|
add_to_sysroot(&out_dir, &libdir);
|
||||||
|
|
||||||
if target.contains("musl") && !target.contains("mips") {
|
if target.contains("musl") && !target.contains("mips") {
|
||||||
copy_third_party_objects(build, target, &libdir);
|
copy_musl_third_party_objects(build, &libdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Copies the crt(1,i,n).o startup objects
|
/// Copies the crt(1,i,n).o startup objects
|
||||||
///
|
///
|
||||||
/// Only required for musl targets that statically link to libc
|
/// Only required for musl targets that statically link to libc
|
||||||
fn copy_third_party_objects(build: &Build, target: &str, into: &Path) {
|
fn copy_musl_third_party_objects(build: &Build, into: &Path) {
|
||||||
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
|
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
|
||||||
copy(&compiler_file(build.cc(target), obj), &into.join(obj));
|
copy(&build.config.musl_root.as_ref().unwrap().join("lib").join(obj), &into.join(obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ fn main() {
|
|||||||
println!("cargo:rustc-link-lib=dl");
|
println!("cargo:rustc-link-lib=dl");
|
||||||
println!("cargo:rustc-link-lib=log");
|
println!("cargo:rustc-link-lib=log");
|
||||||
println!("cargo:rustc-link-lib=gcc");
|
println!("cargo:rustc-link-lib=gcc");
|
||||||
} else {
|
} else if !target.contains("musl") || target.contains("mips") {
|
||||||
println!("cargo:rustc-link-lib=dl");
|
println!("cargo:rustc-link-lib=dl");
|
||||||
println!("cargo:rustc-link-lib=rt");
|
println!("cargo:rustc-link-lib=rt");
|
||||||
println!("cargo:rustc-link-lib=pthread");
|
println!("cargo:rustc-link-lib=pthread");
|
||||||
|
|||||||
Reference in New Issue
Block a user