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
diff --git a/cc/linker.go b/cc/linker.go
index 678b992..59c979d 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -213,6 +213,18 @@
 			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")
+				}
+			}
 		}
 	}