summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cc/linker.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cc/linker.go b/cc/linker.go
index 678b992d1..59c979dab 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -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")
+ }
+ }
}
}