Add -lm to the default libs for Linux & Darwin
libm is a default library for device builds, so default it for host
builds as well.
Also removes duplicate additions of -ldl, -lpthread, -lm and -lrt.
Test: m host
Change-Id: I8f7e799d48a1f427e48dcfb1d0ccba93c5f9780b
diff --git a/cc/linker.go b/cc/linker.go
index 2a6c909..02d3ba5 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -211,11 +211,12 @@
flags.LdFlags = append(flags.LdFlags, linker.Properties.Host_ldlibs...)
if !ctx.Windows() {
- // Add -ldl, -lpthread and -lrt to host builds to match the default behavior of device
+ // Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of device
// builds
flags.LdFlags = append(flags.LdFlags,
"-ldl",
"-lpthread",
+ "-lm",
)
if !ctx.Darwin() {
flags.LdFlags = append(flags.LdFlags, "-lrt")