summaryrefslogtreecommitdiffstats
path: root/core/combo/TARGET_linux-mips.mk
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-09-19 14:25:57 -0700
committerDan Albert <danalbert@google.com>2014-09-23 15:19:02 -0700
commit4bbc6c790bd3b0a4894cc844059e73b5721a28fd (patch)
treeb346f99e1a19714f769236eb7dcfbad2df0553b0 /core/combo/TARGET_linux-mips.mk
parent98f7742a7f5bdc69913ba5e15bba2e60ae5cf724 (diff)
downloadbuild-4bbc6c790bd3b0a4894cc844059e73b5721a28fd.zip
build-4bbc6c790bd3b0a4894cc844059e73b5721a28fd.tar.gz
build-4bbc6c790bd3b0a4894cc844059e73b5721a28fd.tar.bz2
Add option for generating coverage info.
To enable building with coverage, the environment variable NATIVE_COVERAGE must be set to true. Set `LOCAL_NATIVE_COVERAGE := true` to generate coverage information for a given component. This is currently not supported for clang (b/17574078, b/17583330). If static library A is included in a binary B (dynamic or static executable, or shared library), and A is built with coverage information, B is required to link with libgcov.a. Since the make does not offer a good way to track this dependency, link libgcov.a even if LOCAL_NATIVE_COVERAGE is not set (but still guarded by NATIVE_COVERAGE). This ensures that all of the libgcov dependencies will always be resolved, and causes no change in the resulting binary if coverage is not used. Bug: 10134489 Change-Id: Id5a19f2c215e4be80e6eae27ecc19b582f2f6813
Diffstat (limited to 'core/combo/TARGET_linux-mips.mk')
-rw-r--r--core/combo/TARGET_linux-mips.mk5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 92ad21a..b260073 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -136,7 +136,7 @@ LIBGCC_EH := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_pre
ifneq ($(LIBGCC_EH),libgcc_eh.a)
$(combo_2nd_arch_prefix)TARGET_LIBGCC += $(LIBGCC_EH)
endif
-target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
+$(combo_2nd_arch_prefix)TARGET_LIBGCOV := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
--print-file-name=libgcov.a)
endif
@@ -185,6 +185,7 @@ $(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
$(PRIVATE_LDLIBS)
@@ -212,6 +213,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
$(PRIVATE_LDLIBS)
@@ -235,6 +237,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))