From c7679de4ab746c62c19eefdcefc6ee55ca5817cc Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Mon, 18 Feb 2019 22:23:42 -0800 Subject: [PATCH] Override module's C flags when coverage is enabled Bug: http://b/116873221 Disable -Wframe-larger-than because building without optimization can make frame larger. Building dng_sdk with coverage results in a bigger stack frame than the limit in C flags. Get optimization level back to -O0 if module has a non-default optimization level. Not doing so causes link failures with libneuralnetworks.so. Test: Build with coverage. Change-Id: I36b2979bb6a73023458c8de3241e975845bd36eb --- cc/coverage.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cc/coverage.go b/cc/coverage.go index 054970526..ad2f1e4b3 100644 --- a/cc/coverage.go +++ b/cc/coverage.go @@ -53,6 +53,10 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags { flags.Coverage = true flags.GlobalFlags = append(flags.GlobalFlags, "--coverage", "-O0") cov.linkCoverage = true + + // Override -Wframe-larger-than and non-default optimization + // flags that the module may use. + flags.CFlags = append(flags.CFlags, "-Wno-frame-larger-than=", "-O0") } // Even if we don't have coverage enabled, if any of our object files were compiled