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: I6a07e12053090eb6997b79d4091c28ac9a9022de
diff --git a/core/binary.mk b/core/binary.mk
index 6a58c6c..2c715ea 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -291,10 +291,10 @@
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
else # LOCAL_IS_HOST_MODULE
- # Add -ldl, -lpthread and -lrt to host builds to match the default behavior of
+ # Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of
# device builds
ifneq ($($(my_prefix)OS),windows)
- my_ldlibs += -ldl -lpthread
+ my_ldlibs += -ldl -lpthread -lm
ifneq ($(HOST_OS),darwin)
my_ldlibs += -lrt
endif