void-packages/srcpkgs/rust/patches/link-musl-dynamically.patch

50 lines
2.0 KiB
Diff

--- rustc-1.28.0-src/src/bootstrap/compile.rs.orig 2018-07-31 00:15:53.000000000 +0200
+++ rustc-1.28.0-src/src/bootstrap/compile.rs 2018-08-06 09:00:00.011914967 +0200
@@ -78,13 +78,6 @@ impl Step for Std {
});
builder.info(&format!("Uplifting stage1 std ({} -> {})", from.host, target));
- // Even if we're not building std this stage, the new sysroot must
- // still contain the musl startup objects.
- if target.contains("musl") {
- let libdir = builder.sysroot_libdir(compiler, target);
- copy_musl_third_party_objects(builder, target, &libdir);
- }
-
builder.ensure(StdLink {
compiler: from,
target_compiler: compiler,
@@ -93,11 +86,6 @@ impl Step for Std {
return;
}
- if target.contains("musl") {
- let libdir = builder.sysroot_libdir(compiler, target);
- copy_musl_third_party_objects(builder, target, &libdir);
- }
-
let out_dir = builder.cargo_out(compiler, Mode::Std, target);
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler));
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
@@ -119,20 +107,6 @@ impl Step for Std {
}
}
-/// Copies the crt(1,i,n).o startup objects
-///
-/// Since musl supports fully static linking, we can cross link for it even
-/// with a glibc-targeting toolchain, given we have the appropriate startup
-/// files. As those shipped with glibc won't work, copy the ones provided by
-/// musl so we have them on linux-gnu hosts.
-fn copy_musl_third_party_objects(builder: &Builder,
- target: Interned<String>,
- into: &Path) {
- for &obj in &["crt1.o", "crti.o", "crtn.o"] {
- builder.copy(&builder.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
- }
-}
-
/// Configure cargo to compile the standard library, adding appropriate env vars
/// and such.
pub fn std_cargo(builder: &Builder,