Do not enable global ThinLTO for tests

Tests are not shipped, no need to spend extra CPU cycles optimising them
during build.

Test: GLOBAL_THINLTO=true m
Bug: 169004486
Change-Id: I66ede9c01d43b574a7fe9f74f0bc6ba97f51be06
This commit is contained in:
Yi Kong
2022-09-06 16:24:00 +08:00
parent 0228d27943
commit 56fc1b6902
2 changed files with 8 additions and 2 deletions

View File

@@ -140,12 +140,13 @@ func (lto *lto) DefaultThinLTO(ctx BaseModuleContext) bool {
lib32 := ctx.Arch().ArchType.Multilib == "lib32"
// CFI enables full LTO.
cfi := ctx.isCfi()
// Performance and binary size are less important for host binaries.
// Performance and binary size are less important for host binaries and tests.
host := ctx.Host()
test := ctx.testBinary() || ctx.testLibrary()
// FIXME: ThinLTO for VNDK produces different output.
// b/169217596
vndk := ctx.isVndk()
return GlobalThinLTO(ctx) && !lto.Never() && !lib32 && !cfi && !host && !vndk
return GlobalThinLTO(ctx) && !lto.Never() && !lib32 && !cfi && !host && !test && !vndk
}
func (lto *lto) FullLTO() bool {