Add Relocation Packer support

This only applies to shared libraries on the device, and like stripping,
we'll let make do the actual packing if we're embedded in Make.

Change-Id: I1585d74ecfc41e18dcbb5ffb70005adf007cc941
diff --git a/cc/library.go b/cc/library.go
index 5119c90..cc5ff15 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -151,6 +151,7 @@
 
 	flagExporter
 	stripper
+	relocationPacker
 
 	// If we're used as a whole_static_lib, our missing dependencies need
 	// to be given
@@ -177,7 +178,8 @@
 	return append(props,
 		&library.Properties,
 		&library.flagExporter.Properties,
-		&library.stripper.StripProperties)
+		&library.stripper.StripProperties,
+		&library.relocationPacker.Properties)
 }
 
 func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
@@ -289,6 +291,8 @@
 	library.baseInstaller.location = location
 
 	library.baseLinker.linkerInit(ctx)
+
+	library.relocationPacker.packingInit(ctx)
 }
 
 func (library *libraryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
@@ -386,6 +390,12 @@
 
 	builderFlags := flagsToBuilderFlags(flags)
 
+	if library.relocationPacker.needsPacking(ctx) {
+		packedOutputFile := outputFile
+		outputFile = android.PathForModuleOut(ctx, "unpacked", fileName)
+		library.relocationPacker.pack(ctx, outputFile, packedOutputFile, builderFlags)
+	}
+
 	if library.stripper.needsStrip(ctx) {
 		strippedOutputFile := outputFile
 		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)