summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pirama Arumuga Nainar <pirama@google.com> 2024-06-14 21:54:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-06-14 21:54:50 +0000
commit52436e1574b220bebde3c8d4afb6480b2bf99463 (patch)
tree0bb2136214a306e6727f14d279d53ff30ddcce02
parent7dc42aa7afeb7fa9f630896d27959aba9f0f685b (diff)
parentdf0289bfbdb770d45adcb388c8ebb455eafa81d8 (diff)
Merge "Revert^4 "Enable full LTO optimization by default"" into main
-rw-r--r--cc/lto.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/cc/lto.go b/cc/lto.go
index 60eb4d6b1..44441527a 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -54,6 +54,9 @@ type LTOProperties struct {
// Use -fwhole-program-vtables cflag.
Whole_program_vtables *bool
+
+ // Use --lto-O0 flag.
+ Lto_O0 *bool
}
type lto struct {
@@ -106,12 +109,8 @@ func (lto *lto) flags(ctx ModuleContext, flags Flags) Flags {
ltoCFlags := []string{"-flto=thin", "-fsplit-lto-unit"}
var ltoLdFlags []string
- // The module did not explicitly turn on LTO. Only leverage LTO's
- // better dead code elimination and CFG simplification, but do
- // not perform costly optimizations for a balance between compile
- // time, binary size and performance.
- // Apply the same for Eng builds as well.
- if !lto.ThinLTO() || ctx.Config().Eng() {
+ // Do not perform costly LTO optimizations for Eng builds.
+ if Bool(lto.Properties.Lto_O0) || ctx.Config().Eng() {
ltoLdFlags = append(ltoLdFlags, "-Wl,--lto-O0")
}