Merge "Make -ldl -lrt -lpthread implicit for host builds"
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")
+ }
+ }
}
}