Do not build tests with ThinLTO
There's not a great return on investment for spending additional
compilation/link time on tests that may only be run once or very few
times (as compared to actual library code that ships and is run orders
of magnitude more times).
Bug: 195134194
Bug: 203737712
Test: m GLOBAL_THINLTO=true dist device-tests platform_tests
Change-Id: I7149c4140f7c52b22bedbe322f1bf2c81f7ad66b
diff --git a/cc/lto.go b/cc/lto.go
index 6d55579..99598a9 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -137,8 +137,9 @@
func (lto *lto) DefaultThinLTO(ctx BaseModuleContext) bool {
host := ctx.Host()
+ test := ctx.testBinary()
vndk := ctx.isVndk() // b/169217596
- return GlobalThinLTO(ctx) && !lto.Never() && !host && !vndk
+ return GlobalThinLTO(ctx) && !lto.Never() && !host && !test && !vndk
}
func (lto *lto) FullLTO() bool {