Skip to content

Commit 9975ad0

Browse files
committed
rustc: Add comments about linking to libm
1 parent b54c76c commit 9975ad0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rustc/back/link.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,12 @@ fn link_binary(sess: session,
636636
// On linux librt and libdl are an indirect dependencies via rustrt,
637637
// and binutils 2.22+ won't add them automatically
638638
if sess.targ_cfg.os == session::os_linux {
639-
cc_args += ["-lrt", "-ldl", "-lm"];
639+
cc_args += ["-lrt", "-ldl"];
640+
641+
// LLVM implements the `frem` instruction as a call to `fmod`,
642+
// which lives in libm. Similar to above, on some linuxes we
643+
// have to be explicit about linking to it. See #2510
644+
cc_args += ["-lm"];
640645
}
641646

642647
if sess.targ_cfg.os == session::os_freebsd {

0 commit comments

Comments
 (0)