diff options
| author | 2023-06-06 17:13:20 +0000 | |
|---|---|---|
| committer | 2023-06-06 17:13:20 +0000 | |
| commit | 2976fa1185488d13b6742f97b38ba886d7cc49bd (patch) | |
| tree | 9bc5e433d199a97b8c959326f2ba81ab130afc00 | |
| parent | aefd27fce656292f83f5e34d94b6f53860c20b4a (diff) | |
| parent | ed79fa382b3b8a3411440e317679f7a961b2cdac (diff) | |
Merge "Use a less hacky way to detect if a module is Fuzzer enabled"
| -rw-r--r-- | cc/cc.go | 12 | ||||
| -rw-r--r-- | cc/lto.go | 2 |
2 files changed, 13 insertions, 1 deletions
@@ -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() } @@ -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 } |