summaryrefslogtreecommitdiffstats
path: root/core/binary.mk
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-24 23:48:47 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-24 23:48:47 +0000
commit0d963dc94fd8c6b1508e3f3115ac72c60f55371c (patch)
tree0b1e173bfdd9a75bca37ebebbebe59417a8513f4 /core/binary.mk
parentb89760a76b2c713f8e9bb4537415d35d51034ec7 (diff)
parentf633e28168a65a0d7a59fed069c90ca54b47de9f (diff)
downloadbuild-0d963dc94fd8c6b1508e3f3115ac72c60f55371c.zip
build-0d963dc94fd8c6b1508e3f3115ac72c60f55371c.tar.gz
build-0d963dc94fd8c6b1508e3f3115ac72c60f55371c.tar.bz2
am f633e281: am 172cd765: Merge "Allow coverage with clang."
* commit 'f633e28168a65a0d7a59fed069c90ca54b47de9f': Allow coverage with clang.
Diffstat (limited to 'core/binary.mk')
-rw-r--r--core/binary.mk30
1 files changed, 16 insertions, 14 deletions
diff --git a/core/binary.mk b/core/binary.mk
index f675814..56f8da8 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -294,20 +294,22 @@ endif # LOCAL_IS_HOST_MODULE
# clean build of your module after toggling it.
ifeq ($(NATIVE_COVERAGE),true)
ifeq ($(my_native_coverage),true)
- # We can't currently generate coverage for clang binaries for two
- # reasons:
- #
- # 1) b/17574078 We currently don't have a prebuilt
- # libclang_rt.profile-<ARCH>.a, which clang is hardcoded to link if
- # --coverage is passed in the link stage. For now we manually link
- # libprofile_rt (which is the name it is built as from
- # external/compiler-rt).
- #
- # 2) b/17583330 Clang doesn't generate .gcno files when using
- # -no-integrated-as. Since most of the assembly in our tree is
- # incompatible with clang's assembler, we can't turn off this flag.
- ifneq ($(my_clang),true)
- my_cflags += --coverage -O0
+ my_cflags += --coverage -O0
+ ifeq ($(my_clang),true)
+ # b/17574078
+ # We currently don't have a prebuilt libclang_rt.profile-<ARCH>.a,
+ # which clang is hardcoded to link if --coverage is passed in the
+ # link stage. For now we manually link libprofile_rt (which is the
+ # name it is built as from external/compiler-rt).
+ #
+ # Note that clang coverage doesn't play nicely with acov out of the
+ # box. Clang apparently generates .gcno files that aren't compatible
+ # with gcov-4.8. This can be solved by installing gcc-4.6 and
+ # invoking lcov with `--gcov-tool /usr/bin/gcov-4.6`.
+ #
+ # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
+ my_static_libraries += libprofile_rt
+ else
my_ldflags += --coverage
endif
endif