Merge "Introduce LTO property for -fwhole-program-vtables cflag" am: 52cebe5aff am: 6b8931ce48 am: 50dfc16e17

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1429862

Change-Id: If57f85310f690e937c7a4f6138b5b8b533ad57c9
This commit is contained in:
Yi Kong
2020-09-21 18:43:25 +00:00
committed by Automerger Merge Worker

View File

@@ -52,6 +52,9 @@ type LTOProperties struct {
// Use clang lld instead of gnu ld.
Use_clang_lld *bool
// Use -fwhole-program-vtables cflag.
Whole_program_vtables *bool
}
type lto struct {
@@ -97,6 +100,10 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
flags.Local.CFlags = append(flags.Local.CFlags, ltoFlag)
flags.Local.LdFlags = append(flags.Local.LdFlags, ltoFlag)
if Bool(lto.Properties.Whole_program_vtables) {
flags.Local.CFlags = append(flags.Local.CFlags, "-fwhole-program-vtables")
}
if ctx.Config().IsEnvTrue("USE_THINLTO_CACHE") && Bool(lto.Properties.Lto.Thin) && lto.useClangLld(ctx) {
// Set appropriate ThinLTO cache policy
cacheDirFormat := "-Wl,--thinlto-cache-dir="