Repack libgcc.a to only include required objects
Previous solution by using objcopy uses a quirky behaviour of the GNU objcopy and there is no equivalent option in llvm-objcopy. Instead of removing symbols, extract and repack libgcc to only include required objects. Bug: 142585047 Test: presubmit Change-Id: I58af74c18838f797e481da38c3265f0624fddf99
This commit is contained in:
@@ -29,6 +29,9 @@ func init() {
|
||||
type toolchainLibraryProperties struct {
|
||||
// the prebuilt toolchain library, as a path from the top of the source tree
|
||||
Src *string `android:"arch_variant"`
|
||||
|
||||
// Repack the archive with only the selected objects.
|
||||
Repack_objects_to_keep []string `android:"arch_variant"`
|
||||
}
|
||||
|
||||
type toolchainLibraryDecorator struct {
|
||||
@@ -90,6 +93,14 @@ func (library *toolchainLibraryDecorator) link(ctx ModuleContext,
|
||||
return outputFile
|
||||
}
|
||||
|
||||
if library.Properties.Repack_objects_to_keep != nil {
|
||||
fileName := ctx.ModuleName() + staticLibraryExtension
|
||||
outputFile := android.PathForModuleOut(ctx, fileName)
|
||||
TransformArchiveRepack(ctx, srcPath, outputFile, library.Properties.Repack_objects_to_keep)
|
||||
|
||||
return outputFile
|
||||
}
|
||||
|
||||
return srcPath
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user