summaryrefslogtreecommitdiffstats
path: root/core/shared_library_internal.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/shared_library_internal.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/shared_library_internal.mk')
-rw-r--r--core/shared_library_internal.mk2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index abef11f..29b7d44 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -41,6 +41,7 @@ include $(BUILD_SYSTEM)/dynamic_binary.mk
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
+my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
@@ -59,6 +60,7 @@ endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
+$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)