summaryrefslogtreecommitdiff
path: root/cc/lto.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/lto.go')
-rw-r--r--cc/lto.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cc/lto.go b/cc/lto.go
index a3b28d9a2..94ed32415 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -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"
}