diff options
author | 2020-09-29 08:44:45 +0800 | |
---|---|---|
committer | 2020-09-30 01:13:57 +0800 | |
commit | e2577141ba45561b64a161c64ba17db8e027b57c (patch) | |
tree | e37e798e2a4e5a06c3eb03f3502db3e8fb39c3f2 /cc | |
parent | 6c76f18aae0bb56ac25f8cb496282bf32bfb31a3 (diff) |
Do not implicitly turn on lto for static libraries
For global ThinLTO, don't implicitly turn on LTO for static libraries,
but instead rely on mutator to generate correct variants.
Bug: 169004486
Test: GLBOAL_THINLTO=true m
Change-Id: I9cdeea706ec6dd4ad31f55b9e12a96b42176aa89
Diffstat (limited to 'cc')
-rw-r--r-- | cc/lto.go | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -45,8 +45,6 @@ type LTOProperties struct { Thin *bool `android:"arch_variant"` } `android:"arch_variant"` - GlobalThin *bool `blueprint:"mutated"` - // Dep properties indicate that this module needs to be built with LTO // since it is an object dependency of an LTO module. FullDep bool `blueprint:"mutated"` @@ -71,7 +69,13 @@ func (lto *lto) begin(ctx BaseModuleContext) { if ctx.Config().IsEnvTrue("DISABLE_LTO") { lto.Properties.Lto.Never = boolPtr(true) } else if ctx.Config().IsEnvTrue("GLOBAL_THINLTO") { - lto.Properties.GlobalThin = boolPtr(true) + staticLib := ctx.static() && !ctx.staticBinary() + hostBin := ctx.Host() + if !staticLib && !hostBin { + if !lto.Never() && !lto.FullLTO() { + lto.Properties.Lto.Thin = boolPtr(true) + } + } } } @@ -145,12 +149,6 @@ func (lto *lto) FullLTO() bool { } func (lto *lto) ThinLTO() bool { - if Bool(lto.Properties.GlobalThin) { - if !lto.Never() && !lto.FullLTO() { - return true - } - } - return Bool(lto.Properties.Lto.Thin) } |