diff options
Diffstat (limited to 'cc/lto.go')
-rw-r--r-- | cc/lto.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -16,6 +16,8 @@ package cc import ( "android/soong/android" + "android/soong/cc/config" + "strings" ) // LTO (link-time optimization) allows the compiler to optimize and generate @@ -101,7 +103,13 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags { if lto.LTO() { var ltoFlag string if lto.ThinLTO() { - ltoFlag = "-flto=thin -fsplit-lto-unit" + // TODO(b/129607781) sdclang does not currently support + // the "-fsplit-lto-unit" option + if flags.Sdclang && !strings.Contains(config.SDClangPath, "9.0") { + ltoFlag = "-flto=thin" + } else { + ltoFlag = "-flto=thin -fsplit-lto-unit" + } } else { ltoFlag = "-flto" } |