Merge "Add opt-in option to turn on ThinLTO caching" am: 04a0fe3245
am: 341f92df33
Change-Id: Ic69ee703e467ea3570fb22102261105599e716ac
This commit is contained in:
commit
155ee3fcf9
15
cc/lto.go
15
cc/lto.go
|
@ -74,12 +74,27 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
|
|||
var ltoFlag string
|
||||
if Bool(lto.Properties.Lto.Thin) {
|
||||
ltoFlag = "-flto=thin"
|
||||
|
||||
} else {
|
||||
ltoFlag = "-flto"
|
||||
}
|
||||
|
||||
flags.CFlags = append(flags.CFlags, ltoFlag)
|
||||
flags.LdFlags = append(flags.LdFlags, ltoFlag)
|
||||
|
||||
if ctx.Config().IsEnvTrue("USE_THINLTO_CACHE") && Bool(lto.Properties.Lto.Thin) {
|
||||
// Set appropriate ThinLTO cache policy
|
||||
cacheDirFormat := "-Wl,-plugin-opt,cache-dir="
|
||||
cacheDir := android.PathForOutput(ctx, "thinlto-cache").String()
|
||||
flags.LdFlags = append(flags.LdFlags, cacheDirFormat+cacheDir)
|
||||
|
||||
// Limit the size of the ThinLTO cache to the lesser of 10% of available
|
||||
// disk space and 10GB.
|
||||
cachePolicyFormat := "-Wl,-plugin-opt,cache-policy="
|
||||
policy := "cache_size=10%:cache_size_bytes=10g"
|
||||
flags.LdFlags = append(flags.LdFlags, cachePolicyFormat+policy)
|
||||
}
|
||||
|
||||
if ctx.Device() {
|
||||
// Work around bug in Clang that doesn't pass correct emulated
|
||||
// TLS option to target. See b/72706604 or
|
||||
|
|
Loading…
Reference in New Issue