summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2018-07-06 17:41:55 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2018-07-08 18:31:40 +0100
commit920cfeace9918c47cdd42214fda545f4a284cded (patch)
tree31759df23023ceb6b3ede91c7637e89ee125fd10 /src/unix
parent460fb1310a5ec1951e730b4c668b922eb6ecb521 (diff)
downloadrust-libc-920cfeace9918c47cdd42214fda545f4a284cded.tar.gz
Link to libgcc when statically linking musl
Diffstat (limited to 'src/unix')
-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")))]