diff options
author | Colin Cross <ccross@android.com> | 2017-09-08 12:45:18 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-09-08 16:39:05 -0700 |
commit | c5fdbb842a8bf7f3d4f41b2cf90fdd353e42fa6f (patch) | |
tree | 70c0ec84083fa256ef9fe7605b5770fa24f528f1 /cc/linker.go | |
parent | 5349941875ef876d61e1a96cfe2d83a76b84d188 (diff) | |
download | build_soong-c5fdbb842a8bf7f3d4f41b2cf90fdd353e42fa6f.tar.gz build_soong-c5fdbb842a8bf7f3d4f41b2cf90fdd353e42fa6f.tar.bz2 build_soong-c5fdbb842a8bf7f3d4f41b2cf90fdd353e42fa6f.zip |
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
Diffstat (limited to 'cc/linker.go')
-rw-r--r-- | cc/linker.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cc/linker.go b/cc/linker.go index 678b992d..59c979da 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") + } + } } } |