diff options
author | Yi Kong <yikong@google.com> | 2024-03-27 01:58:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-27 01:58:09 +0000 |
commit | 25900543331a1508110da4926ca45557b4c236da (patch) | |
tree | 6cb76bb5c18df83859e0de1134dab83526ee6e8c | |
parent | 8399758b977b8b54cc3600278bac0cc292321cc0 (diff) | |
parent | 7549990a957c66d1ed29bde27da05be001491f9f (diff) | |
download | soong-25900543331a1508110da4926ca45557b4c236da.tar.gz |
Merge "Revert^2 "Enable full LTO optimization by default"" into main
-rw-r--r-- | cc/lto.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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") } |