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

@@ -81,6 +81,7 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
if !library.static() {
ctx.subAndroidMk(ret, &library.stripper)
ctx.subAndroidMk(ret, &library.relocationPacker)
}
if library.static() {
@@ -181,6 +182,15 @@ func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMk
})
}
func (packer *relocationPacker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
if packer.Properties.PackingRelocations {
fmt.Fprintln(w, "LOCAL_PACK_MODULE_RELOCATIONS := true")
}
return nil
})
}
func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
path := installer.path.RelPathString()