From 7fbbc5d20547c8709c9da878583cb3aa3e3d7ae1 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 8 Oct 2015 14:16:39 -0700 Subject: [PATCH] Use libgcov OR libclang_rt.profile, not both. Using both can cause duplicate symbol errors. Change-Id: Id8ee13a81d32e3248ff1cdc468f49a26ecde6b57 --- core/binary.mk | 8 ++++++++ core/definitions.mk | 9 +++------ core/executable_internal.mk | 4 ---- core/shared_library_internal.mk | 4 ---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index b370d20eb..a290eefad 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -346,6 +346,14 @@ else my_native_coverage := false endif +ifeq ($(my_clang),true) + my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT) +else + my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) +endif + +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib) + ########################################################### ## Define PRIVATE_ variables used by multiple module types ########################################################### diff --git a/core/definitions.mk b/core/definitions.mk index 9d6311ef2..5f8fd0643 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1475,8 +1475,7 @@ $(hide) $(PRIVATE_CXX) \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \ $(PRIVATE_TARGET_LIBATOMIC) \ $(PRIVATE_TARGET_LIBGCC) \ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ @@ -1548,8 +1547,7 @@ $(hide) $(PRIVATE_CXX) -pie \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \ $(PRIVATE_TARGET_LIBATOMIC) \ $(PRIVATE_TARGET_LIBGCC) \ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ @@ -1595,8 +1593,7 @@ $(hide) $(PRIVATE_CXX) \ -Wl,--start-group \ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ - $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \ $(PRIVATE_TARGET_LIBATOMIC) \ $(call normalize-target-libraries,$(filter %libcompiler_rt.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(PRIVATE_TARGET_LIBGCC) \ diff --git a/core/executable_internal.mk b/core/executable_internal.mk index 1d576a25c..2105f58da 100644 --- a/core/executable_internal.mk +++ b/core/executable_internal.mk @@ -35,8 +35,6 @@ endif # Define PRIVATE_ variables from global vars my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS) -my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT) -my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) ifeq ($(LOCAL_NO_LIBGCC),true) my_target_libgcc := else @@ -66,8 +64,6 @@ my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o) 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_LIBPROFILE_RT := $(my_target_libprofile_rt) -$(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_DYNAMIC_O := $(my_target_crtbegin_dynamic_o) diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index 075bd02aa..b9a5e3e93 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -40,8 +40,6 @@ 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_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT) -my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) ifeq ($(LOCAL_NO_LIBGCC),true) my_target_libgcc := else @@ -68,8 +66,6 @@ my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o) 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_LIBPROFILE_RT := $(my_target_libprofile_rt) -$(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)