summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2024-06-16 13:05:05 +0900
committer Yi Kong <yikong@google.com> 2024-06-16 13:05:05 +0900
commitae870727b520b631fc8936b09a0eb842dbe3454a (patch)
tree66b82be232a96ca34198773d53b5e5f93a4519f3
parentba80e4c16b1dbb7a458b4356ceaadfe6296a3938 (diff)
Use --lto-O0 for optimizeForSize targets
This is another place where we can trade performance for additional binary size savings. Test: presubmit Change-Id: Icf9600ef2ca4092e4adccc0c26465b542b038f7b
-rw-r--r--cc/lto.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cc/lto.go b/cc/lto.go
index 44441527a..f3af7d278 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -110,7 +110,7 @@ func (lto *lto) flags(ctx ModuleContext, flags Flags) Flags {
var ltoLdFlags []string
// Do not perform costly LTO optimizations for Eng builds.
- if Bool(lto.Properties.Lto_O0) || ctx.Config().Eng() {
+ if Bool(lto.Properties.Lto_O0) || ctx.optimizeForSize() || ctx.Config().Eng() {
ltoLdFlags = append(ltoLdFlags, "-Wl,--lto-O0")
}