Fix ndk x86_64 and mips64 builds

x86_64 and mips64 NDK prebuilt libraries are stored in .../usr/lib64,
but arm64 and all the 32-bit ABIs use .../usr/lib.  Add a 64 suffix to
the path for all 64-bit ABIs except arm64.

Change-Id: I98e87ff6a7f1aa75adbeb37c5b1e7208b953322f
diff --git a/cc/cc.go b/cc/cc.go
index cf4f974..62d77f5 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2321,8 +2321,14 @@
 // than to the system image).
 
 func getNdkLibDir(ctx common.AndroidModuleContext, toolchain Toolchain, version string) common.SourcePath {
-	return common.PathForSource(ctx, fmt.Sprintf("prebuilts/ndk/current/platforms/android-%s/arch-%s/usr/lib",
-		version, toolchain.Name()))
+	suffix := ""
+	// Most 64-bit NDK prebuilts store libraries in "lib64", except for arm64 which is not a
+	// multilib toolchain and stores the libraries in "lib".
+	if toolchain.Is64Bit() && ctx.Arch().ArchType != common.Arm64 {
+		suffix = "64"
+	}
+	return common.PathForSource(ctx, fmt.Sprintf("prebuilts/ndk/current/platforms/android-%s/arch-%s/usr/lib%s",
+		version, toolchain.Name(), suffix))
 }
 
 func ndkPrebuiltModuleToPath(ctx common.AndroidModuleContext, toolchain Toolchain,