From e363a0e0ff7ffc8bd83f72ec1a20d289996b6370 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 3 May 2020 18:02:03 +0200
Subject: [PATCH 12/15] Fix dynamic linkage of musl libc for the libc crate

---
 vendor/libc/src/lib.rs      | 1 +
 vendor/libc/src/unix/mod.rs | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/vendor/libc/src/lib.rs b/vendor/libc/src/lib.rs
index 0b1496af..7f7e85a7 100644
--- a/vendor/libc/src/lib.rs
+++ b/vendor/libc/src/lib.rs
@@ -33,6 +33,7 @@
 #![deny(missing_copy_implementations, safe_packed_borrows)]
 #![no_std]
 #![cfg_attr(feature = "rustc-dep-of-std", no_core)]
+#![cfg_attr(feature = "rustc-dep-of-std", feature(static_nobundle))]
 #![cfg_attr(target_os = "redox", feature(static_nobundle))]
 #![cfg_attr(libc_const_extern_fn, feature(const_extern_fn))]
 
diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs
index 238da24b..ffb05ee7 100644
--- a/vendor/libc/src/unix/mod.rs
+++ b/vendor/libc/src/unix/mod.rs
@@ -299,11 +299,11 @@ cfg_if! {
         // cargo build, don't pull in anything extra as the libstd dep
         // already pulls in all libs.
     } else if #[cfg(target_env = "musl")] {
+        #[link(name = "c")]
+        extern {}
         #[cfg_attr(feature = "rustc-dep-of-std",
-                   link(name = "c", kind = "static",
+                   link(name = "gcc", kind = "static-nobundle",
                         cfg(target_feature = "crt-static")))]
-        #[cfg_attr(feature = "rustc-dep-of-std",
-                   link(name = "c", cfg(not(target_feature = "crt-static"))))]
         extern {}
     } else if #[cfg(target_os = "emscripten")] {
         #[link(name = "c")]
index 0b1496af..7f7e85a7 100644
-- 
2.26.2

