diff options
author | 2021-06-08 16:05:18 -0700 | |
---|---|---|
committer | 2021-12-13 14:44:32 -0800 | |
commit | 71d697c5cbaa6ad0b2d92ab70f3dd5b91d039582 (patch) | |
tree | c43a51c5aa718d15f3965272baa39cbb315ebf09 /rust/coverage.go | |
parent | 10fed2697ecf736b305dbd1669f22c4fb088d307 (diff) |
Enable memory-mapped coverage instrumentation
Bug: http://b/194128476
Bug: http://b/210012154
- pass -runtime-counter-relocation flag, which is needed to enable
memory-mapped coverage on Linux/Android.
- Include '%c' specifier in -fprofile-instr-generate compiler flag to
default to memory-mapped coverage.
- Disable continuous coverage if instrumentation is on for bionic/libc
(http://b/210012154).
Test: Run few coverage tests on Forrest.
Change-Id: Ie3a912f66470fcd3ffc2ffd73371a4e1d2b15df3
Diffstat (limited to 'rust/coverage.go')
-rw-r--r-- | rust/coverage.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/coverage.go b/rust/coverage.go index 8fdfa2342..91d34acce 100644 --- a/rust/coverage.go +++ b/rust/coverage.go @@ -22,6 +22,7 @@ import ( var CovLibraryName = "libprofile-clang-extras" +// Add '%c' to default specifier after we resolve http://b/210012154 const profileInstrFlag = "-fprofile-instr-generate=/data/misc/trace/clang-%p-%m.profraw" type coverage struct { @@ -70,6 +71,10 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags "-Wl,-z,nostart-stop-gc", ) deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path()) + if cc.EnableContinuousCoverage(ctx) { + flags.RustFlags = append(flags.RustFlags, "-C llvm-args=--runtime-counter-relocation") + flags.LinkFlags = append(flags.LinkFlags, "-Wl,-mllvm,-runtime-counter-relocation") + } } return flags, deps |