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
This commit is contained in:
Dan Willemsen
2016-09-14 15:04:48 -07:00
parent 391cdde1da
commit 394e9dc876
5 changed files with 108 additions and 3 deletions

View File

@@ -151,6 +151,7 @@ type libraryDecorator struct {
flagExporter
stripper
relocationPacker
// If we're used as a whole_static_lib, our missing dependencies need
// to be given
@@ -177,7 +178,8 @@ func (library *libraryDecorator) linkerProps() []interface{} {
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 @@ func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
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 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
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)