Use prebuilt libclang_rt.profile.
Bug: 17574078 Change-Id: I4838cd5d125a0b2bf76aad2fdaef1ee3122687e8
This commit is contained in:
parent
24a71e1565
commit
343ed674e3
|
@ -294,25 +294,15 @@ endif # LOCAL_IS_HOST_MODULE
|
|||
# clean build of your module after toggling it.
|
||||
ifeq ($(NATIVE_COVERAGE),true)
|
||||
ifeq ($(my_native_coverage),true)
|
||||
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`.
|
||||
# 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_cflags += --coverage -O0
|
||||
my_ldflags += --coverage
|
||||
endif
|
||||
endif
|
||||
else
|
||||
my_native_coverage := false
|
||||
endif
|
||||
|
|
|
@ -76,3 +76,5 @@ $(clang_2nd_arch_prefix)CLANG_HOST_GLOBAL_CPPFLAGS := \
|
|||
$(clang_2nd_arch_prefix)CLANG_HOST_GLOBAL_LDFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a
|
||||
|
|
|
@ -76,3 +76,5 @@ CLANG_HOST_GLOBAL_CPPFLAGS := \
|
|||
CLANG_HOST_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_HOST_EXTRA_LDFLAGS)
|
||||
|
||||
HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64.a
|
||||
|
|
|
@ -64,3 +64,5 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
|
||||
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := armv7-none-linux-gnueabi
|
||||
|
||||
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-arm-android.a
|
||||
|
|
|
@ -62,3 +62,5 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
RS_TRIPLE := aarch64-linux-android
|
||||
RS_TRIPLE_CFLAGS :=
|
||||
RS_COMPAT_TRIPLE := aarch64-linux-android
|
||||
|
||||
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64-android.a
|
||||
|
|
|
@ -63,3 +63,5 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
|
||||
RS_COMPAT_TRIPLE := mipsel-linux-android
|
||||
|
||||
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mipsel-android.a
|
||||
|
|
|
@ -62,3 +62,5 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
RS_TRIPLE := aarch64-linux-android
|
||||
RS_TRIPLE_CFLAGS :=
|
||||
RS_COMPAT_TRIPLE := mips64el-linux-android
|
||||
|
||||
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-mips64el-android.a
|
||||
|
|
|
@ -72,3 +72,5 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -D__i386__
|
||||
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := i686-linux-android
|
||||
|
||||
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686-android.a
|
||||
|
|
|
@ -62,3 +62,5 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \
|
|||
RS_TRIPLE := aarch64-linux-android
|
||||
RS_TRIPLE_CFLAGS := -D__x86_64__
|
||||
RS_COMPAT_TRIPLE := x86_64-linux-android
|
||||
|
||||
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64-android.a
|
||||
|
|
|
@ -8,6 +8,7 @@ endif
|
|||
|
||||
LLVM_PREBUILTS_VERSION := 3.6
|
||||
LLVM_PREBUILTS_PATH := prebuilts/clang/$(BUILD_OS)-x86/host/$(LLVM_PREBUILTS_VERSION)/bin
|
||||
LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib/clang/$(LLVM_PREBUILTS_VERSION)/lib/linux/
|
||||
|
||||
CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
|
||||
CLANG_CXX := $(LLVM_PREBUILTS_PATH)/clang++$(BUILD_EXECUTABLE_SUFFIX)
|
||||
|
|
|
@ -49,7 +49,6 @@ $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CO
|
|||
|
||||
$(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
|
||||
|
||||
|
||||
############################################################
|
||||
## Macros after this line are shared by the 64-bit config.
|
||||
|
||||
|
|
|
@ -1367,6 +1367,7 @@ $(hide) $(PRIVATE_CXX) \
|
|||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
-o $@ \
|
||||
$(PRIVATE_LDLIBS)
|
||||
|
@ -1405,6 +1406,7 @@ $(hide) $(PRIVATE_CXX) \
|
|||
$(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)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
$(PRIVATE_TARGET_LIBGCC) \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
|
@ -1468,6 +1470,7 @@ $(hide) $(PRIVATE_CXX) -pie \
|
|||
$(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)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
$(PRIVATE_TARGET_LIBGCC) \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
|
@ -1513,8 +1516,9 @@ $(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))) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
$(call normalize-target-libraries,$(filter %libcompiler_rt.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
|
||||
$(PRIVATE_TARGET_LIBGCC) \
|
||||
-Wl,--end-group \
|
||||
|
@ -1552,6 +1556,7 @@ $(hide) $(PRIVATE_CXX) \
|
|||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
|
||||
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
|
||||
|
|
|
@ -35,6 +35,7 @@ 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)
|
||||
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
|
||||
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
|
||||
|
@ -55,6 +56,7 @@ 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)
|
||||
|
|
|
@ -27,6 +27,9 @@ ifndef skip_build_from_source
|
|||
|
||||
include $(BUILD_SYSTEM)/binary.mk
|
||||
|
||||
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
|
||||
$(transform-host-o-to-executable)
|
||||
|
||||
|
|
|
@ -40,6 +40,9 @@ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIAT
|
|||
|
||||
include $(BUILD_SYSTEM)/binary.mk
|
||||
|
||||
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
|
||||
$(LOCAL_BUILD_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
|
||||
|
||||
$(LOCAL_BUILT_MODULE): \
|
||||
$(all_objects) \
|
||||
$(all_libraries) \
|
||||
|
|
|
@ -40,6 +40,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_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
|
||||
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)
|
||||
|
@ -58,6 +59,7 @@ 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)
|
||||
|
|
Loading…
Reference in New Issue