summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-25 16:20:57 -0800
committerDan Albert <danalbert@google.com>2015-04-01 19:03:22 -0700
commit343ed674e35ae0911542abe67dca3fb3a1cccf95 (patch)
treeed945008efc80e6f54672120398999962744c186 /core
parent24a71e1565d48d6b5f9cdbd12e4cb279ae7e18bb (diff)
downloadbuild-343ed674e35ae0911542abe67dca3fb3a1cccf95.zip
build-343ed674e35ae0911542abe67dca3fb3a1cccf95.tar.gz
build-343ed674e35ae0911542abe67dca3fb3a1cccf95.tar.bz2
Use prebuilt libclang_rt.profile.
Bug: 17574078 Change-Id: I4838cd5d125a0b2bf76aad2fdaef1ee3122687e8
Diffstat (limited to 'core')
-rw-r--r--core/binary.mk24
-rw-r--r--core/clang/HOST_x86.mk2
-rw-r--r--core/clang/HOST_x86_64.mk2
-rw-r--r--core/clang/TARGET_arm.mk2
-rw-r--r--core/clang/TARGET_arm64.mk2
-rw-r--r--core/clang/TARGET_mips.mk2
-rw-r--r--core/clang/TARGET_mips64.mk2
-rw-r--r--core/clang/TARGET_x86.mk2
-rw-r--r--core/clang/TARGET_x86_64.mk2
-rw-r--r--core/clang/config.mk1
-rw-r--r--core/combo/HOST_linux-x86.mk1
-rw-r--r--core/definitions.mk7
-rw-r--r--core/executable_internal.mk2
-rw-r--r--core/host_executable_internal.mk3
-rw-r--r--core/host_shared_library_internal.mk3
-rw-r--r--core/shared_library_internal.mk2
16 files changed, 40 insertions, 19 deletions
diff --git a/core/binary.mk b/core/binary.mk
index 92b08fa..15d5d1e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -294,24 +294,14 @@ endif # LOCAL_IS_HOST_MODULE
# clean build of your module after toggling it.
ifeq ($(NATIVE_COVERAGE),true)
ifeq ($(my_native_coverage),true)
+ # 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_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
+ my_ldflags += --coverage
endif
else
my_native_coverage := false
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index 35cfe60..f14a9c3 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -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
diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk
index c546715..1211e73 100644
--- a/core/clang/HOST_x86_64.mk
+++ b/core/clang/HOST_x86_64.mk
@@ -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
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
index 993755f..6f6d624 100644
--- a/core/clang/TARGET_arm.mk
+++ b/core/clang/TARGET_arm.mk
@@ -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
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
index ba6e5f1..b67d458 100644
--- a/core/clang/TARGET_arm64.mk
+++ b/core/clang/TARGET_arm64.mk
@@ -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
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
index 2360181..19bbaf2 100644
--- a/core/clang/TARGET_mips.mk
+++ b/core/clang/TARGET_mips.mk
@@ -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
diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk
index 742be4b..104fb70 100644
--- a/core/clang/TARGET_mips64.mk
+++ b/core/clang/TARGET_mips64.mk
@@ -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
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
index 3ba34ae..4e9e8be 100644
--- a/core/clang/TARGET_x86.mk
+++ b/core/clang/TARGET_x86.mk
@@ -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
diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk
index 9f8e8b0..e44382d 100644
--- a/core/clang/TARGET_x86_64.mk
+++ b/core/clang/TARGET_x86_64.mk
@@ -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
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 60889e7..ba48f63 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -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)
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 93a1287..5f62400 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -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.
diff --git a/core/definitions.mk b/core/definitions.mk
index c601d86..d7aa477 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -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)) \
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index ebb6867..2684d51 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -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)
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index ffb35d2..0c0ac3d 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -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)
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
index f1b3311..645098a 100644
--- a/core/host_shared_library_internal.mk
+++ b/core/host_shared_library_internal.mk
@@ -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) \
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 1fda794..2487fbb0 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -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)