Include objs from whole static libs before local objs

This matches the make behavior.

Change-Id: I8265fb481424734062b0fca944cdbbe283b7236d
diff --git a/cc/cc.go b/cc/cc.go
index db2066a..e650435 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1540,16 +1540,16 @@
 func (library *libraryLinker) linkStatic(ctx ModuleContext,
 	flags Flags, deps PathDeps, objFiles common.Paths) common.Path {
 
-	objFiles = append(objFiles, deps.WholeStaticLibObjFiles...)
-	library.objFiles = objFiles
+	library.objFiles = append(common.Paths{}, deps.WholeStaticLibObjFiles...)
+	library.objFiles = append(library.objFiles, objFiles...)
 
 	outputFile := common.PathForModuleOut(ctx,
 		ctx.ModuleName()+library.Properties.VariantName+staticLibraryExtension)
 
 	if ctx.Darwin() {
-		TransformDarwinObjToStaticLib(ctx, objFiles, flagsToBuilderFlags(flags), outputFile)
+		TransformDarwinObjToStaticLib(ctx, library.objFiles, flagsToBuilderFlags(flags), outputFile)
 	} else {
-		TransformObjToStaticLib(ctx, objFiles, flagsToBuilderFlags(flags), outputFile)
+		TransformObjToStaticLib(ctx, library.objFiles, flagsToBuilderFlags(flags), outputFile)
 	}
 
 	library.wholeStaticMissingDeps = ctx.GetMissingDependencies()