Make -ldl -lrt -lpthread implicit for host builds

Instead of requiring every host module to specify -ldl -lrt -lpthread
and then break the mac build because -lrt doesn't exist, make them
implicit to match the behavior of modules built for the device.

Test: m -j checkbuild
Change-Id: I63c26adef71e71d314b9c9caa31c1aeb1d8f6651
This commit is contained in:
Colin Cross 2017-09-08 12:45:18 -07:00
parent 5349941875
commit c5fdbb842a
1 changed files with 12 additions and 0 deletions

View File

@ -213,6 +213,18 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
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
// builds
flags.LdFlags = append(flags.LdFlags,
"-ldl",
"-lpthread",
)
if !ctx.Darwin() {
flags.LdFlags = append(flags.LdFlags, "-lrt")
}
}
}
}