summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2020-09-21 17:01:56 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-09-21 17:01:56 +0000
commit52cebe5aff462355fc7c43b26db20c17de0b204c (patch)
tree4eb2f5285251b41ac85ff83ee5dbbba5fe06546e
parent9d1f85da7a264b9ab9e6f83520e7d94609f8de26 (diff)
parent2d01fe28dffd610ce38aea6fe70d3cc00dc9cf3a (diff)
Merge "Introduce LTO property for -fwhole-program-vtables cflag"
-rw-r--r--cc/lto.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cc/lto.go b/cc/lto.go
index 9868cdfb9..e03433731 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -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="