Merge "Copy prebuilt binaries"
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index ac05df0..976c711 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -116,7 +116,19 @@
 	// TODO(ccross): verify shared library dependencies
 	if len(p.Prebuilt.Properties.Srcs) > 0 {
 		// TODO(ccross): .toc optimization, stripping, packing
-		return p.Prebuilt.Path(ctx)
+
+		// Copy binaries to a name matching the final installed name
+		fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
+		outputFile := android.PathForModuleOut(ctx, fileName)
+
+		ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+			Rule:        android.Cp,
+			Description: "prebuilt",
+			Output:      outputFile,
+			Input:       p.Prebuilt.Path(ctx),
+		})
+
+		return outputFile
 	}
 
 	return nil