Add environment variable to globally disable LTO
Allow developers to disable LTO to reduce build time.
Test: m checkbuild
Test: DISABLE_LTO=true m checkbuild
Bug: 62839002
Change-Id: I30642e3cfff60c4874a2f8797d08105b4e07cc6d
diff --git a/cc/lto.go b/cc/lto.go
index b1e7cfa..7bc22ec 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -60,6 +60,9 @@
}
func (lto *lto) begin(ctx BaseModuleContext) {
+ if ctx.Config().IsEnvTrue("DISABLE_LTO") {
+ lto.Properties.Lto.Never = boolPtr(true)
+ }
}
func (lto *lto) deps(ctx BaseModuleContext, deps Deps) Deps {