Loading cc/cc.go +12 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ type ModuleContextIntf interface { getVndkExtendsModuleName() string isAfdoCompile() bool isPgoCompile() bool isCfi() bool isNDKStubLibrary() bool useClangLld(actx ModuleContext) bool isForPlatform() bool Loading Loading @@ -1314,6 +1315,13 @@ func (c *Module) isPgoCompile() bool { return false } func (c *Module) isCfi() bool { if sanitize := c.sanitize; sanitize != nil { return Bool(sanitize.Properties.Sanitize.Cfi) } return false } func (c *Module) isNDKStubLibrary() bool { if _, ok := c.compiler.(*stubDecorator); ok { return true Loading Loading @@ -1592,6 +1600,10 @@ func (ctx *moduleContextImpl) isPgoCompile() bool { return ctx.mod.isPgoCompile() } func (ctx *moduleContextImpl) isCfi() bool { return ctx.mod.isCfi() } func (ctx *moduleContextImpl) isNDKStubLibrary() bool { return ctx.mod.isNDKStubLibrary() } Loading cc/lto.go +8 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading
cc/cc.go +12 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ type ModuleContextIntf interface { getVndkExtendsModuleName() string isAfdoCompile() bool isPgoCompile() bool isCfi() bool isNDKStubLibrary() bool useClangLld(actx ModuleContext) bool isForPlatform() bool Loading Loading @@ -1314,6 +1315,13 @@ func (c *Module) isPgoCompile() bool { return false } func (c *Module) isCfi() bool { if sanitize := c.sanitize; sanitize != nil { return Bool(sanitize.Properties.Sanitize.Cfi) } return false } func (c *Module) isNDKStubLibrary() bool { if _, ok := c.compiler.(*stubDecorator); ok { return true Loading Loading @@ -1592,6 +1600,10 @@ func (ctx *moduleContextImpl) isPgoCompile() bool { return ctx.mod.isPgoCompile() } func (ctx *moduleContextImpl) isCfi() bool { return ctx.mod.isCfi() } func (ctx *moduleContextImpl) isNDKStubLibrary() bool { return ctx.mod.isNDKStubLibrary() } Loading
cc/lto.go +8 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading