summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Chiovoloni <thom@shift.click>2022-10-06 21:05:29 -0700
committerThom Chiovoloni <thom@shift.click>2022-10-06 21:05:29 -0700
commit8a045af255a7cb0d1516fe8c21fdf73f704d3548 (patch)
tree15d94d801bb505113ecd726cca6f62a1db28c223
parent2dfe1ab9eed52d0f46983414028fe5ec49e0d5e0 (diff)
downloadrust-libc-8a045af255a7cb0d1516fe8c21fdf73f704d3548.tar.gz
Don't link against iconv on apple targets when used by `std`
-rw-r--r--src/unix/bsd/apple/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index a9438ef57a..0662e81fc6 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -5873,7 +5873,10 @@ cfg_if! {
}
}
-#[link(name = "iconv")]
+// These require a dependency on `libiconv`, and including this when built as
+// part of `std` means every Rust program gets it. Ideally we would have a link
+// modifier to only include these if they are used, but we do not.
+#[cfg_attr(not(feature = "rustc-dep-of-std"), link(name = "iconv"))]
extern "C" {
pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
pub fn iconv(