void-packages/srcpkgs/rust/patches/0010-Fix-dynamic-linkage-of...

46 lines
2.2 KiB
Diff

From 7e100ca9dad23efa1aafccd8faf86ec5fa85c351 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 3 May 2020 18:02:03 +0200
Subject: [PATCH 10/15] Fix dynamic linkage of musl libc for the libc crate
diff --git a/vendor/libc-0.2.157/src/unix/mod.rs b/vendor/libc-0.2.157/src/unix/mod.rs
index 8b3d988ae..b4ab3db3f 100644
--- a/vendor/libc-0.2.157/src/unix/mod.rs
+++ b/vendor/libc-0.2.157/src/unix/mod.rs
@@ -347,7 +347,14 @@ cfg_if! {
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
+ } else if #[cfg(target_env = "musl")] {
+ #[link(name = "c")]
+ extern {}
+ #[cfg_attr(feature = "rustc-dep-of-std",
+ link(name = "gcc", kind = "static", modifiers = "-bundle",
+ cfg(target_feature = "crt-static")))]
+ extern {}
+ } else if #[cfg(target_env = "ohos")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
diff --git a/vendor/libc-0.2.158/src/unix/mod.rs b/vendor/libc-0.2.158/src/unix/mod.rs
index 8b3d988ae..b4ab3db3f 100644
--- a/vendor/libc-0.2.158/src/unix/mod.rs
+++ b/vendor/libc-0.2.158/src/unix/mod.rs
@@ -347,7 +347,14 @@ cfg_if! {
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
+ } else if #[cfg(target_env = "musl")] {
+ #[link(name = "c")]
+ extern {}
+ #[cfg_attr(feature = "rustc-dep-of-std",
+ link(name = "gcc", kind = "static", modifiers = "-bundle",
+ cfg(target_feature = "crt-static")))]
+ extern {}
+ } else if #[cfg(target_env = "ohos")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]