Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50dfc16e authored by Yi Kong's avatar Yi Kong Committed by Automerger Merge Worker
Browse files

Merge "Introduce LTO property for -fwhole-program-vtables cflag" am: 52cebe5a am: 6b8931ce

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

Change-Id: I9943b1230638a8563249f66e756a78a7cb70cc28
parents 4bc86bdb 6b8931ce
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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="