Merge "Do not implicitly turn on lto for static libraries" am: 21de510915
am: a5e515b85a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1440495 Change-Id: Id9e27f78cf41608a2ede17038cc40a1980ad1886
This commit is contained in:
16
cc/lto.go
16
cc/lto.go
@@ -45,8 +45,6 @@ type LTOProperties struct {
|
|||||||
Thin *bool `android:"arch_variant"`
|
Thin *bool `android:"arch_variant"`
|
||||||
} `android:"arch_variant"`
|
} `android:"arch_variant"`
|
||||||
|
|
||||||
GlobalThin *bool `blueprint:"mutated"`
|
|
||||||
|
|
||||||
// Dep properties indicate that this module needs to be built with LTO
|
// Dep properties indicate that this module needs to be built with LTO
|
||||||
// since it is an object dependency of an LTO module.
|
// since it is an object dependency of an LTO module.
|
||||||
FullDep bool `blueprint:"mutated"`
|
FullDep bool `blueprint:"mutated"`
|
||||||
@@ -71,7 +69,13 @@ func (lto *lto) begin(ctx BaseModuleContext) {
|
|||||||
if ctx.Config().IsEnvTrue("DISABLE_LTO") {
|
if ctx.Config().IsEnvTrue("DISABLE_LTO") {
|
||||||
lto.Properties.Lto.Never = boolPtr(true)
|
lto.Properties.Lto.Never = boolPtr(true)
|
||||||
} else if ctx.Config().IsEnvTrue("GLOBAL_THINLTO") {
|
} 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 {
|
func (lto *lto) ThinLTO() bool {
|
||||||
if Bool(lto.Properties.GlobalThin) {
|
|
||||||
if !lto.Never() && !lto.FullLTO() {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Bool(lto.Properties.Lto.Thin)
|
return Bool(lto.Properties.Lto.Thin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user