Add prefix_symbols support to cc_object

Test: add cc_object with prefix_symbols, use objdump to check
Change-Id: I15eb47e6888eb1c4837734a44a7ad86205a48c02
diff --git a/cc/cc.go b/cc/cc.go
index ea523ca..0e1d896 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -140,6 +140,9 @@
 type ObjectLinkerProperties struct {
 	// names of other cc_object modules to link into this module using partial linking
 	Objs []string `android:"arch_variant"`
+
+	// if set, add an extra objcopy --prefix-symbols= step
+	Prefix_symbols string
 }
 
 // Properties used to compile all C or C++ modules
diff --git a/cc/object.go b/cc/object.go
index 3cc089c..59d523d 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -78,12 +78,29 @@
 	objs = objs.Append(deps.Objs)
 
 	var outputFile android.Path
+	builderFlags := flagsToBuilderFlags(flags)
+
 	if len(objs.objFiles) == 1 {
 		outputFile = objs.objFiles[0]
+
+		if object.Properties.Prefix_symbols != "" {
+			output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
+			TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, outputFile,
+				builderFlags, output)
+			outputFile = output
+		}
 	} else {
 		output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension)
-		TransformObjsToObj(ctx, objs.objFiles, flagsToBuilderFlags(flags), output)
 		outputFile = output
+
+		if object.Properties.Prefix_symbols != "" {
+			input := android.PathForModuleOut(ctx, "unprefixed", ctx.ModuleName()+objectExtension)
+			TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, input,
+				builderFlags, output)
+			output = input
+		}
+
+		TransformObjsToObj(ctx, objs.objFiles, builderFlags, output)
 	}
 
 	ctx.CheckbuildFile(outputFile)