summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-09 02:18:30 +0000
committerbors <bors@rust-lang.org>2022-10-09 02:18:30 +0000
commit8501d724da7859275f405d0effb76f570456b4f3 (patch)
tree8fee5e7c5130ca7ebe8adf1bb78a0a058b277b45
parenta0ff4d25d8a2aacb48116ee3b24201da16317d4b (diff)
parent8a045af255a7cb0d1516fe8c21fdf73f704d3548 (diff)
downloadrust-libc-8501d724da7859275f405d0effb76f570456b4f3.tar.gz
Auto merge of #2944 - thomcc:apple-iconv, r=JohnTitor
Don't link against iconv on apple targets when used by `std` See https://github.com/rust-lang/libc/issues/2870 (and specifically my, erm, rant in https://github.com/rust-lang/libc/issues/2870#issuecomment-1271104762). I think we should probably remove it outright, but we definitely shouldn't have it in every Rust program by giving it to `std`. FIxes https://github.com/rust-lang/libc/issues/2870
-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(