Merge "Allow stripping host modules" am: 110d13bef3

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1514992

Change-Id: I7c9ed9b1627806c0f4d8cc415e96bcaaec4dcab8
This commit is contained in:
Colin Cross 2020-12-04 19:32:35 +00:00 committed by Automerger Merge Worker
commit bfbe007c03
1 changed files with 15 additions and 7 deletions

View File

@ -23,19 +23,23 @@ import (
// StripProperties defines the type of stripping applied to the module. // StripProperties defines the type of stripping applied to the module.
type StripProperties struct { type StripProperties struct {
Strip struct { Strip struct {
// whether to disable all stripping. // none forces all stripping to be disabled.
// Device modules default to stripping enabled leaving mini debuginfo.
// Host modules default to stripping disabled, but can be enabled by setting any other
// strip boolean property.
None *bool `android:"arch_variant"` None *bool `android:"arch_variant"`
// whether to strip everything, including the mini debug info. // all forces stripping everything, including the mini debug info.
All *bool `android:"arch_variant"` All *bool `android:"arch_variant"`
// whether to keep the symbols. // keep_symbols enables stripping but keeps all symbols.
Keep_symbols *bool `android:"arch_variant"` Keep_symbols *bool `android:"arch_variant"`
// keeps only the symbols defined here. // keep_symbols_list specifies a list of symbols to keep if keep_symbols is enabled.
// If it is unset then all symbols are kept.
Keep_symbols_list []string `android:"arch_variant"` Keep_symbols_list []string `android:"arch_variant"`
// whether to keep the symbols and the debug frames. // keep_symbols_and_debug_frame enables stripping but keeps all symbols and debug frames.
Keep_symbols_and_debug_frame *bool `android:"arch_variant"` Keep_symbols_and_debug_frame *bool `android:"arch_variant"`
} `android:"arch_variant"` } `android:"arch_variant"`
} }
@ -47,8 +51,12 @@ type Stripper struct {
// NeedsStrip determines if stripping is required for a module. // NeedsStrip determines if stripping is required for a module.
func (stripper *Stripper) NeedsStrip(actx android.ModuleContext) bool { func (stripper *Stripper) NeedsStrip(actx android.ModuleContext) bool {
// TODO(ccross): enable host stripping when Kati is enabled? Make never had support for stripping host binaries. forceDisable := Bool(stripper.StripProperties.Strip.None)
return (!actx.Config().KatiEnabled() || actx.Device()) && !Bool(stripper.StripProperties.Strip.None) defaultEnable := (!actx.Config().KatiEnabled() || actx.Device())
forceEnable := Bool(stripper.StripProperties.Strip.All) ||
Bool(stripper.StripProperties.Strip.Keep_symbols) ||
Bool(stripper.StripProperties.Strip.Keep_symbols_and_debug_frame)
return !forceDisable && (forceEnable || defaultEnable)
} }
func (stripper *Stripper) strip(actx android.ModuleContext, in android.Path, out android.ModuleOutPath, func (stripper *Stripper) strip(actx android.ModuleContext, in android.Path, out android.ModuleOutPath,