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

Commit ed79fa38 authored by Yi Kong's avatar Yi Kong
Browse files

Use a less hacky way to detect if a module is Fuzzer enabled

Bug: 169004486
Test: presubmit
Change-Id: I7fad86041622979b9befb7c86897a13f604bdf3d
parent 48fa309a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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()
}
+1 −1
Original line number Diff line number Diff line
@@ -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
	}