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
This commit is contained in:
Dan Willemsen
2017-09-26 20:23:34 -07:00
parent 1596e6ee11
commit 27991b7652
4 changed files with 2 additions and 9 deletions

View File

@@ -211,11 +211,12 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
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")