diff options
Diffstat (limited to 'testing/rust/support-dynamically-linked-musl.patch')
-rw-r--r-- | testing/rust/support-dynamically-linked-musl.patch | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/testing/rust/support-dynamically-linked-musl.patch b/testing/rust/support-dynamically-linked-musl.patch index 69834602cd..7c4e93681b 100644 --- a/testing/rust/support-dynamically-linked-musl.patch +++ b/testing/rust/support-dynamically-linked-musl.patch @@ -1,6 +1,7 @@ From 3abd1f5e2f31b1c95535ef8c3b4bef6ff78b3fa9 Mon Sep 17 00:00:00 2001 From: Samuel Holland <samuel@sholland.org> -Date: Sat, 25 Feb 2017 22:30:15 -0600 +From: Shiz <hi@shiz.me> +Date: Wed, 12 Apr 2017 22:31:06 +0200 Subject: [PATCH] Support dynamically-linked and/or native musl targets These changes allow native compilation on musl-based distributions and the @@ -9,22 +10,7 @@ limitations based on past assumptions about musl targets, while maintaining existing behavior by default. Upstream-Issue: https://github.com/rust-lang/rust/pull/40113 ---- - src/bootstrap/bin/rustc.rs | 11 ++++++++ - src/bootstrap/compile.rs | 7 ++++-- - src/bootstrap/config.rs | 3 +++ - src/bootstrap/lib.rs | 14 +++++++++++ - src/bootstrap/sanity.rs | 11 ++++++-- - src/librustc/session/mod.rs | 29 ++++++++++++++++++++++ - src/librustc_back/target/linux_musl_base.rs | 9 +------ - .../target/mips_unknown_linux_musl.rs | 1 + - .../target/mipsel_unknown_linux_musl.rs | 1 + - src/librustc_driver/target_features.rs | 27 +------------------- - src/librustc_trans/back/link.rs | 22 +++++++++------- - src/libstd/build.rs | 2 +- - src/libunwind/build.rs | 4 +-- - src/libunwind/lib.rs | 6 +++++ - 14 files changed, 97 insertions(+), 50 deletions(-) +See-Also: https://internals.rust-lang.org/t/refining-cross-platform-crt-static-semantics/5085 diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 90fd31ecbd..28520a2c60 100644 @@ -354,31 +340,24 @@ index db41a368a1..b1a86f04ef 100644 - if target.contains("musl") && !target.contains("mips") { - println!("cargo:rustc-link-lib=static=unwind"); + if target.contains("musl") { -+ // musl is handled in lib.rs ++ println!("cargo:rustc-link-lib=unwind"); } else if !target.contains("android") { println!("cargo:rustc-link-lib=gcc_s"); } -diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs -index 7fa2ce650f..b78e762f45 100644 ---- a/src/libunwind/lib.rs -+++ b/src/libunwind/lib.rs -@@ -15,6 +15,7 @@ - #![deny(warnings)] - - #![feature(cfg_target_vendor)] -+#![feature(link_cfg)] - #![feature(staged_api)] - #![feature(unwind_attributes)] - -@@ -27,3 +28,8 @@ extern crate libc; - mod libunwind; - #[cfg(not(target_env = "msvc"))] - pub use libunwind::*; -+ -+#[cfg(target_env = "musl")] -+#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] -+#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] -+extern {} +diff --git a/src/liblibc/src/unix/mod.rs b/src/liblibc/src/unix/mod.rs +--- a/src/liblibc/src/unix/mod.rs ++++ b/src/liblibc/src/unix/mod.rs +@@ -210,8 +210,7 @@ cfg_if! { + // cargo build, don't pull in anything extra as the libstd dep + // already pulls in all libs. +- } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { ++ } else if #[cfg(target_env = "musl")] { +- #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))] +- #[link(name = "c", cfg(not(target_feature = "crt-static")))] ++ #[link(name = "c")] + extern {} + } else if #[cfg(target_os = "emscripten")] { + #[link(name = "c")] -- 2.12.2 |