Merge "Use a less hacky way to detect if a module is Fuzzer enabled" am: 2976fa1185

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

Change-Id: I82dec6d355d0b681a4f7ccacb91cfcf5f73cd529
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-06-06 18:01:00 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 1 deletions

View File

@@ -524,6 +524,7 @@ type ModuleContextIntf interface {
isAfdoCompile() bool
isPgoCompile() bool
isCfi() bool
isFuzzer() bool
isNDKStubLibrary() bool
useClangLld(actx ModuleContext) bool
isForPlatform() bool
@@ -1365,6 +1366,13 @@ func (c *Module) isCfi() bool {
return false
}
func (c *Module) isFuzzer() bool {
if sanitize := c.sanitize; sanitize != nil {
return Bool(sanitize.Properties.SanitizeMutated.Fuzzer)
}
return false
}
func (c *Module) isNDKStubLibrary() bool {
if _, ok := c.compiler.(*stubDecorator); ok {
return true
@@ -1660,6 +1668,10 @@ func (ctx *moduleContextImpl) isCfi() bool {
return ctx.mod.isCfi()
}
func (ctx *moduleContextImpl) isFuzzer() bool {
return ctx.mod.isFuzzer()
}
func (ctx *moduleContextImpl) isNDKStubLibrary() bool {
return ctx.mod.isNDKStubLibrary()
}

View File

@@ -74,7 +74,7 @@ func (lto *lto) begin(ctx BaseModuleContext) {
func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
// TODO(b/131771163): Disable LTO when using explicit fuzzing configurations.
// LTO breaks fuzzer builds.
if inList("-fsanitize=fuzzer-no-link", flags.Local.CFlags) {
if ctx.isFuzzer() {
return flags
}