Do not enable ThinLTO for CFI enabled projects

CFI projects already use full LTO.

Test: GLOBAL_THINLTO=true m
Change-Id: I8a57efc237aed977f57dd4040500cc5f84843c3d
This commit is contained in:
Yi Kong
2022-08-19 16:02:45 +08:00
parent 736664571b
commit c702ebd886
2 changed files with 20 additions and 2 deletions

View File

@@ -136,10 +136,16 @@ func (lto *lto) LTO(ctx BaseModuleContext) bool {
}
func (lto *lto) DefaultThinLTO(ctx BaseModuleContext) bool {
// LP32 has many subtle issues and less test coverage.
lib32 := ctx.Arch().ArchType.Multilib == "lib32"
// CFI enables full LTO.
cfi := ctx.isCfi()
// Performance and binary size are less important for host binaries.
host := ctx.Host()
vndk := ctx.isVndk() // b/169217596
return GlobalThinLTO(ctx) && !lto.Never() && !lib32 && !host && !vndk
// FIXME: ThinLTO for VNDK produces different output.
// b/169217596
vndk := ctx.isVndk()
return GlobalThinLTO(ctx) && !lto.Never() && !lib32 && !cfi && !host && !vndk
}
func (lto *lto) FullLTO() bool {