Use --hash-style=both for NDK binaries

Old devices don't support gnu hashes, use --hash-style=both when
the sdk_version property is set.

Test: m -j checkbuild
Bug: 64608507
Change-Id: Iec5229a08fc192f1c8872466ee4bf866adf50443
This commit is contained in:
Colin Cross 2017-08-11 13:23:57 -07:00
parent c4cab48c26
commit 6774e2893a
1 changed files with 8 additions and 0 deletions

View File

@ -232,6 +232,14 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
}
}
if ctx.sdk() && (ctx.Arch().ArchType != android.Mips && ctx.Arch().ArchType != android.Mips64) {
// The bionic linker now has support gnu style hashes (which are much faster!), but shipping
// to older devices requires the old style hash. Fortunately, we can build with both and
// it'll work anywhere.
// This is not currently supported on MIPS architectures.
flags.LdFlags = append(flags.LdFlags, "-Wl,--hash-style=both")
}
if flags.Clang {
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
} else {