We've tried to switch to component builds in order to resolve issue 701825 (build archive is too large), but then realized that component build has some coverage issues.
------------------------------------------------------------------------
For sancov approach, consider the following examples:
1) static build:
INFO: Loaded 2 modules (248092 guards): 27552 [0x7efd462d5520, 0x7efd462f03a0), 220540 [0x1a90040, 0x1b67630),
<...>
#402 DONE cov: 1869 ft: 1284 corp: 283/87Kb exec/s: 0 rss: 93Mb
Done 402 runs in 0 second(s)
SanitizerCoverage: ./net_parse_ip_pattern_fuzzer.66799.sancov: 1513 PCs written
SanitizerCoverage: ./libc++.so.66799.sancov: 356 PCs written
Assuming that we ignore libc++, we are getting ~5.49% coverage (1513 out of 27552)
2) component build:
INFO: Loaded 12 modules (276921 guards): 73 [0x7fd3cbd17008, 0x7fd3cbd1712c), 17174 [0x7fd3ced977a0, 0x7fd3ceda83f8), 39195 [0x7fd3d0167bc8, 0x7fd3d018e034), 26327 [0x7fd3cf624bf8, 0x7fd3cf63e754), 34458 [0x7fd3cfb52b48, 0x7fd3cfb745b0), 2501 [0x7fd3cee169a8, 0x7fd3cee190bc), 24489 [0x7fd3cf1dda98, 0x7fd3cf1f593c), 1054 [0x7fd3d16dfec8, 0x7fd3d16e0f40), 4103 [0x7fd3d1787788, 0x7fd3d178b7a4), 2546 [0x7fd3d18978c8, 0x7fd3d189a090), 117240 [0x7fd3d15fb9a8, 0x7fd3d166e188), 7761 [0x620148, 0x627a8c),
<...>
#402 DONE cov: 3052 ft: 2538 corp: 373/98Kb exec/s: 0 rss: 132Mb
Done 402 runs in 0 second(s)
SanitizerCoverage: ./net_parse_ip_pattern_fuzzer.54808.sancov: 99 PCs written
SanitizerCoverage: ./libc++.so.54808.sancov: 466 PCs written
SanitizerCoverage: ./libicuuc.so.54808.sancov: 443 PCs written
SanitizerCoverage: ./libicui18n.so.54808.sancov: 168 PCs written
SanitizerCoverage: ./libbase.so.54808.sancov: 1637 PCs written
SanitizerCoverage: ./libnet.so.54808.sancov: 219 PCs written
SanitizerCoverage: ./libprotobuf_lite.so.54808.sancov: 5 PCs written
SanitizerCoverage: ./libbase_i18n.so.54808.sancov: 15 PCs written
We have multiple libs involved, and even if we ignore libc++, we would get ~1.61% (2586 out of 159681), because the libraries have lots of code that our target program does not use.
------------------------------------------------------------------------
For clang coverage, take a look at the following examples: https://paste.googleplex.com/4564498379702272
There is a documentation https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#using-the-profiling-runtime-without-static-initializers that suggests to export "int __llvm_profile_runtime" from each library and some other stuff. That sounds quite complicated for for our scale.
Comment 1 by mmoroz@chromium.org
, Oct 3 2017