summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-09 14:12:23 +0000
committerbors <bors@rust-lang.org>2018-07-09 14:12:23 +0000
commit37e3a22feb3d75695ebfd1dd63e0e27c46e62120 (patch)
treeb93057a0ecac3427ab28f9635337980f03de7494
parent9f54322c06515bb39e1d339e16641eb0ba5620fc (diff)
parent920cfeace9918c47cdd42214fda545f4a284cded (diff)
downloadrust-libc-37e3a22feb3d75695ebfd1dd63e0e27c46e62120.tar.gz
Auto merge of #1034 - Amanieu:musl_libgcc, r=alexcrichton
Link to libgcc when statically linking musl On some architectures (e.g. aarch64) musl depends on some libgcc functions (`__addtf3`, `__multf3`, `__subtf3`) for `long double` arithmetic that it uses internally. Unfortunately we don't provide these functions in compiler-builtins, so we instead need to get them from libgcc. Fixes: https://github.com/rust-lang/rust/issues/46651 https://github.com/rust-lang-nursery/compiler-builtins/issues/201 https://github.com/rust-lang-nursery/compiler-builtins/issues/217
-rw-r--r--src/unix/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 15c7821fa1..6360e1565f 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -285,6 +285,18 @@ 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")] {
+ // On some architectures (e.g. aarch64) musl depends on some libgcc
+ // functions (__addtf3, __multf3, __subtf3) for long double arithmetic
+ // that it uses internally. Unfortunately we don't provide these
+ // functions in compiler-builtins, so we instead need to get them from
+ // libgcc.
+ //
+ // This is not a problem if we are linking to libc dynamically since the
+ // libgcc dependency will automatically get picked up by the linker
+ // then.
+ #[cfg_attr(feature = "stdbuild",
+ link(name = "gcc", kind = "static",
+ cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "stdbuild",
link(name = "c", kind = "static",
cfg(target_feature = "crt-static")))]