Allow customizing stripping behavior with product variable
aosp/3530072 made the default for host modules be to not strip them,
but that increases the size of our build tools prebuilts. Add a flag
that can be enabled on the build-tools build.
Test: Manually
Change-Id: I48173a52fe1a7068731ce0aca2367a0ebee0d068
diff --git a/android/config.go b/android/config.go
index 9ccd099..2a4b927 100644
--- a/android/config.go
+++ b/android/config.go
@@ -200,6 +200,11 @@
return c.config.productVariables.ReleaseAconfigValueSets
}
+// If native modules should have symbols stripped by default. Default false, enabled for build tools
+func (c Config) StripByDefault() bool {
+ return proptools.Bool(c.config.productVariables.StripByDefault)
+}
+
func (c Config) ReleaseAconfigExtraReleaseConfigs() []string {
result := []string{}
if val, ok := c.config.productVariables.BuildFlags["RELEASE_ACONFIG_EXTRA_RELEASE_CONFIGS"]; ok {
diff --git a/android/variable.go b/android/variable.go
index 853d8ef..9905b77 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -554,6 +554,8 @@
OdmManifestFiles []string `json:",omitempty"`
UseSoongNoticeXML *bool `json:",omitempty"`
+
+ StripByDefault *bool `json:",omitempty"`
}
type PartitionQualifiedVariablesType struct {
diff --git a/cc/strip.go b/cc/strip.go
index 32ea38d..42c9137 100644
--- a/cc/strip.go
+++ b/cc/strip.go
@@ -52,7 +52,7 @@
func (stripper *Stripper) NeedsStrip(actx android.ModuleContext) bool {
forceDisable := Bool(stripper.StripProperties.Strip.None)
// Strip is enabled by default for device variants.
- defaultEnable := actx.Device()
+ defaultEnable := actx.Device() || actx.Config().StripByDefault()
forceEnable := Bool(stripper.StripProperties.Strip.All) ||
Bool(stripper.StripProperties.Strip.Keep_symbols) ||
Bool(stripper.StripProperties.Strip.Keep_symbols_and_debug_frame)