Refactor llvm_config.mk and support the 2nd arch
1. Following the setup of gcc in build/core/combo/, we added the [HOST|TARGET]_<arch>.mk clang config files, and load only the configs needed by the current product. 2. Added support for the 2nd arch. Change-Id: I2a383418a9688a050b39492f8e489d40eeeb5f2d
This commit is contained in:
parent
8b20d5b97e
commit
1f9828387d
|
@ -127,7 +127,7 @@ ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
|
|||
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(WITHOUT_CLANG)),true)
|
||||
ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_CLANG)),true)
|
||||
LOCAL_CLANG :=
|
||||
endif
|
||||
|
||||
|
@ -171,9 +171,9 @@ my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
|
|||
endif # LOCAL_SDK_VERSION
|
||||
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_target_global_cflags := $(CLANG_TARGET_GLOBAL_CFLAGS)
|
||||
my_target_global_cppflags := $(CLANG_TARGET_GLOBAL_CPPFLAGS)
|
||||
my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
|
||||
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
|
||||
else
|
||||
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
|
||||
|
@ -294,8 +294,8 @@ normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
|
|||
arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
|
||||
normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
|
||||
ifeq ($(strip $(LOCAL_CLANG)),true)
|
||||
arm_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
|
||||
normal_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
|
||||
arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
|
||||
normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
|
||||
endif
|
||||
|
||||
else
|
||||
|
@ -795,10 +795,10 @@ endif
|
|||
###########################################################
|
||||
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_cflags := $(call convert-to-$(my_host)clang-flags,$(my_cflags))
|
||||
my_cppflags := $(call convert-to-$(my_host)clang-flags,$(my_cppflags))
|
||||
my_asflags := $(call convert-to-$(my_host)clang-flags,$(my_asflags))
|
||||
my_ldflags := $(call convert-to-$(my_host)clang-flags,$(my_ldflags))
|
||||
my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags))
|
||||
my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags))
|
||||
my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags))
|
||||
my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
|
||||
endif
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/x86.mk
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
|
||||
endif
|
||||
ifeq ($(HOST_OS),darwin)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
|
||||
endif
|
||||
ifeq ($(HOST_OS),windows)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
|
||||
endif
|
||||
|
||||
CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
|
||||
|
||||
CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
|
||||
|
||||
|
||||
define convert-to-host-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-x86-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
CLANG_HOST_GLOBAL_CFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS)
|
||||
|
||||
CLANG_HOST_GLOBAL_CPPFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_HOST_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS)
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/x86_64.mk
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
|
||||
endif
|
||||
ifeq ($(HOST_OS),darwin)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin
|
||||
endif
|
||||
ifeq ($(HOST_OS),windows)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
|
||||
endif
|
||||
|
||||
CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_64_HOST_TRIPLE) \
|
||||
|
||||
CLANG_CONFIG_x86_64_HOST_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_x86_64_HOST_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_x86_64_HOST_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_64_HOST_TRIPLE) \
|
||||
|
||||
|
||||
define convert-to-host-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-x86_64-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
CLANG_HOST_GLOBAL_CFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_HOST_EXTRA_CFLAGS)
|
||||
|
||||
CLANG_HOST_GLOBAL_CPPFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_HOST_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_HOST_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_HOST_EXTRA_LDFLAGS)
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/arm.mk
|
||||
|
||||
CLANG_CONFIG_arm_TARGET_TRIPLE := arm-linux-androideabi
|
||||
CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_arm_TARGET_TRIPLE)/bin
|
||||
|
||||
CLANG_CONFIG_arm_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_arm_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_arm_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_arm_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_arm_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_arm_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_arm_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_arm_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_arm_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_arm_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_arm_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define $(clang_2nd_arch_prefix)convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-arm-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_arm_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_arm_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_arm_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_arm_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/arm64.mk
|
||||
|
||||
CLANG_CONFIG_arm64_TARGET_TRIPLE := aarch64-linux-androideabi
|
||||
CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_arm64_TARGET_TRIPLE)/bin
|
||||
|
||||
CLANG_CONFIG_arm64_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_arm64_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_arm64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_arm64_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_arm64_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_arm64_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_arm64_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_arm64_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_arm64_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_arm64_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_arm64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-arm64-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_arm64_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_arm64_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_arm64_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_arm64_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
$(warning Incorrect arm64 RS_TRIPLE, fix me!)
|
||||
RS_TRIPLE := armv7-none-linux-gnueabi
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/mips.mk
|
||||
|
||||
CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
|
||||
CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_mips_TARGET_TRIPLE)/bin
|
||||
|
||||
CLANG_CONFIG_mips_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_mips_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_mips_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_mips_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_mips_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_mips_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_mips_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_mips_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_mips_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_mips_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_mips_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define $(clang_2nd_arch_prefix)convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-mips-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_mips_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_mips_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$(clang_2nd_arch_prefix)$(TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_mips_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_mips_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE := mipsel-unknown-linux
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/mips64.mk
|
||||
|
||||
CLANG_CONFIG_mips64_TARGET_TRIPLE := mips64el-linux-android
|
||||
CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_mips64_TARGET_TRIPLE)/bin
|
||||
|
||||
CLANG_CONFIG_mips64_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_mips64_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_mips64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_mips64_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_mips64_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_mips64_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_mips64_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_mips64_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_mips64_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_mips64_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_mips64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-mips64-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_mips64_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_mips64_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_mips64_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_mips64_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
RS_TRIPLE := mips64el-unknown-linux
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/x86.mk
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android
|
||||
CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define $(clang_2nd_arch_prefix)convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-x86-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
$(clang_2nd_arch_prefix)RS_TRIPLE := i686-unknown-linux
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
include $(BUILD_SYSTEM)/clang/x86_64.mk
|
||||
|
||||
CLANG_CONFIG_x86_64_TARGET_TRIPLE := x86_64-linux-android
|
||||
CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_x86_64_TARGET_TRIPLE)/bin
|
||||
|
||||
CLANG_CONFIG_x86_64_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_x86_64_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_x86_64_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_CPPFLAGS) \
|
||||
|
||||
CLANG_CONFIG_x86_64_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_x86_64_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_x86_64_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
define convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-x86_64-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
CLANG_TARGET_GLOBAL_CFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_TARGET_EXTRA_CFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_CPPFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_TARGET_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_LDFLAGS := \
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
|
||||
$(CLANG_CONFIG_x86_64_TARGET_EXTRA_LDFLAGS)
|
||||
|
||||
RS_TRIPLE := x86_64-unknown-linux
|
|
@ -0,0 +1,27 @@
|
|||
# Clang flags for arm arch, target or host.
|
||||
|
||||
CLANG_CONFIG_arm_EXTRA_ASFLAGS :=
|
||||
|
||||
CLANG_CONFIG_arm_EXTRA_CFLAGS := \
|
||||
-mllvm -arm-enable-ehabi
|
||||
|
||||
CLANG_CONFIG_arm_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-mthumb-interwork \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-fno-builtin-sin \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fno-align-jumps \
|
||||
-Wa,--noexecstack
|
||||
|
||||
define subst-clang-incompatible-arm-flags
|
||||
$(subst -march=armv5te,-march=armv5t,\
|
||||
$(subst -march=armv5e,-march=armv5,\
|
||||
$(subst -mcpu=cortex-a15,-march=armv7-a,\
|
||||
$(1))))
|
||||
endef
|
|
@ -0,0 +1,29 @@
|
|||
# Clang flags for arm64 arch, target or host.
|
||||
|
||||
$(warning Untested arm64 clang flags, fix me!)
|
||||
|
||||
CLANG_CONFIG_arm64_EXTRA_ASFLAGS :=
|
||||
|
||||
CLANG_CONFIG_arm64_EXTRA_CFLAGS := \
|
||||
-mllvm -arm-enable-ehabi
|
||||
|
||||
CLANG_CONFIG_arm64_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_arm64_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-mthumb-interwork \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-fno-builtin-sin \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fno-align-jumps \
|
||||
-Wa,--noexecstack
|
||||
|
||||
define subst-clang-incompatible-arm64-flags
|
||||
$(subst -march=armv5te,-march=armv5t,\
|
||||
$(subst -march=armv5e,-march=armv5,\
|
||||
$(subst -mcpu=cortex-a15,-march=armv7-a,\
|
||||
$(1))))
|
||||
endef
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
|
||||
CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
|
||||
LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX)
|
||||
LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
# Clang flags for all host or target rules
|
||||
CLANG_CONFIG_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_EXTRA_CPPFLAGS :=
|
||||
CLANG_CONFIG_EXTRA_LDFLAGS :=
|
||||
|
||||
CLANG_CONFIG_EXTRA_CFLAGS := \
|
||||
-D__compiler_offsetof=__builtin_offsetof
|
||||
|
||||
CLANG_CONFIG_UNKNOWN_CFLAGS := \
|
||||
-funswitch-loops \
|
||||
-Wno-psabi \
|
||||
-Wno-unused-but-set-variable \
|
||||
-Wno-unused-but-set-parameter
|
||||
|
||||
# Clang flags for all host rules
|
||||
CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
|
||||
|
||||
# Clang flags for all target rules
|
||||
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
|
||||
CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
|
||||
CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
|
||||
|
||||
# HOST config
|
||||
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
|
||||
|
||||
# TARGET config
|
||||
clang_2nd_arch_prefix :=
|
||||
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
|
||||
|
||||
# TARGET_2ND_ARCH config
|
||||
ifdef TARGET_2ND_ARCH
|
||||
clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
||||
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
|
||||
endif
|
||||
|
||||
|
||||
# Clang compiler-specific libc headers
|
||||
CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := external/clang/lib/include
|
||||
CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
|
||||
|
||||
# Address sanitizer clang config
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
|
||||
|
||||
# This allows us to use the superset of functionality that compiler-rt
|
||||
# provides to Clang (for supporting features like -ftrapv).
|
||||
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
|
|
@ -0,0 +1,28 @@
|
|||
# Clang flags for mips arch, target or host.
|
||||
|
||||
CLANG_CONFIG_mips_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_mips_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_mips_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-EL \
|
||||
-mips32 \
|
||||
-mips32r2 \
|
||||
-mhard-float \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-march=mips32r2 \
|
||||
-mtune=mips32r2 \
|
||||
-march=mips32 \
|
||||
-mtune=mips32 \
|
||||
-msynci \
|
||||
-mno-fused-madd
|
||||
|
||||
# We don't have any mips flags to substitute yet.
|
||||
define subst-clang-incompatible-mips-flags
|
||||
$(1)
|
||||
endef
|
|
@ -0,0 +1,30 @@
|
|||
# Clang flags for mips64 arch, target or host.
|
||||
|
||||
$(warning Untested mips64 clang flags, fix me!)
|
||||
|
||||
CLANG_CONFIG_mips64_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_mips64_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_mips64_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_mips64_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-EL \
|
||||
-mips32 \
|
||||
-mips32r2 \
|
||||
-mhard-float \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-march=mips32r2 \
|
||||
-mtune=mips32r2 \
|
||||
-march=mips32 \
|
||||
-mtune=mips32 \
|
||||
-msynci \
|
||||
-mno-fused-madd
|
||||
|
||||
# We don't have any mips64 flags to substitute yet.
|
||||
define subst-clang-incompatible-mips64-flags
|
||||
$(1)
|
||||
endef
|
|
@ -0,0 +1,19 @@
|
|||
# Clang flags for x86 arch, target or host.
|
||||
|
||||
CLANG_CONFIG_x86_EXTRA_ASFLAGS := \
|
||||
-msse3
|
||||
CLANG_CONFIG_x86_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_x86_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_x86_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-finline-limit=300 \
|
||||
-fno-inline-functions-called-once \
|
||||
-mfpmath=sse \
|
||||
-mbionic
|
||||
|
||||
# We don't have any x86 flags to substitute yet.
|
||||
define subst-clang-incompatible-x86-flags
|
||||
$(1)
|
||||
endef
|
|
@ -0,0 +1,18 @@
|
|||
# Clang flags for x86_64 arch, target or host.
|
||||
|
||||
CLANG_CONFIG_x86_64_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_x86_64_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_x86_64_EXTRA_LDFLAGS :=
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS := \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
|
||||
-finline-limit=300 \
|
||||
-fno-inline-functions-called-once \
|
||||
-mfpmath=sse \
|
||||
-mbionic
|
||||
|
||||
# We don't have any x86_64 flags to substitute yet.
|
||||
define subst-clang-incompatible-x86_64-flags
|
||||
$(1)
|
||||
endef
|
|
@ -455,8 +455,8 @@ ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
|
|||
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
|
||||
endif
|
||||
|
||||
# define llvm tools and global flags
|
||||
include $(BUILD_SYSTEM)/llvm_config.mk
|
||||
# define clang/llvm tools and global flags
|
||||
include $(BUILD_SYSTEM)/clang/config.mk
|
||||
|
||||
# ###############################################################
|
||||
# Collect a list of the SDK versions that we could compile against
|
||||
|
|
|
@ -29,7 +29,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)
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
else
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
|
||||
endif
|
||||
|
|
|
@ -1,196 +0,0 @@
|
|||
CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
|
||||
CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
|
||||
LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX)
|
||||
LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
# Clang flags for all host or target rules
|
||||
CLANG_CONFIG_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_EXTRA_CPPFLAGS :=
|
||||
CLANG_CONFIG_EXTRA_LDFLAGS :=
|
||||
|
||||
CLANG_CONFIG_EXTRA_CFLAGS := \
|
||||
-D__compiler_offsetof=__builtin_offsetof
|
||||
|
||||
CLANG_CONFIG_UNKNOWN_CFLAGS := \
|
||||
-funswitch-loops \
|
||||
-Wno-psabi \
|
||||
-Wno-unused-but-set-variable \
|
||||
-Wno-unused-but-set-parameter
|
||||
|
||||
# Clang flags for all host rules
|
||||
CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
|
||||
CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
|
||||
|
||||
# Clang flags for all target rules
|
||||
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
|
||||
CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
|
||||
CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
|
||||
|
||||
# ARM
|
||||
llvm_arch := arm
|
||||
CLANG_CONFIG_arm_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_arm_EXTRA_CFLAGS := \
|
||||
-mllvm -arm-enable-ehabi
|
||||
CLANG_CONFIG_arm_EXTRA_LDFLAGS :=
|
||||
CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
|
||||
-mthumb-interwork \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-fno-builtin-sin \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fno-align-jumps \
|
||||
-Wa,--noexecstack
|
||||
|
||||
CLANG_CONFIG_arm_HOST_TRIPLE :=
|
||||
CLANG_CONFIG_arm_TARGET_TRIPLE := arm-linux-androideabi
|
||||
|
||||
include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
|
||||
|
||||
# MIPS
|
||||
llvm_arch := mips
|
||||
CLANG_CONFIG_mips_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_mips_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_mips_EXTRA_LDFLAGS :=
|
||||
CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
|
||||
-EL \
|
||||
-mips32 \
|
||||
-mips32r2 \
|
||||
-mhard-float \
|
||||
-fno-strict-volatile-bitfields \
|
||||
-fgcse-after-reload \
|
||||
-frerun-cse-after-loop \
|
||||
-frename-registers \
|
||||
-march=mips32r2 \
|
||||
-mtune=mips32r2 \
|
||||
-march=mips32 \
|
||||
-mtune=mips32 \
|
||||
-msynci \
|
||||
-mno-fused-madd
|
||||
|
||||
CLANG_CONFIG_mips_HOST_TRIPLE :=
|
||||
CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
|
||||
|
||||
include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
|
||||
|
||||
# X86
|
||||
llvm_arch := x86
|
||||
CLANG_CONFIG_x86_EXTRA_ASFLAGS := \
|
||||
-msse3
|
||||
CLANG_CONFIG_x86_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_x86_EXTRA_LDFLAGS :=
|
||||
CLANG_CONFIG_x86_UNKNOWN_CFLAGS := \
|
||||
-finline-limit=300 \
|
||||
-fno-inline-functions-called-once \
|
||||
-mfpmath=sse \
|
||||
-mbionic
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
|
||||
endif
|
||||
ifeq ($(HOST_OS),darwin)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
|
||||
endif
|
||||
ifeq ($(HOST_OS),windows)
|
||||
CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
|
||||
endif
|
||||
|
||||
CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android
|
||||
CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin
|
||||
|
||||
include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
|
||||
|
||||
# X86_64
|
||||
llvm_arch := x86_64
|
||||
CLANG_CONFIG_x86_64_EXTRA_ASFLAGS :=
|
||||
CLANG_CONFIG_x86_64_EXTRA_CFLAGS :=
|
||||
CLANG_CONFIG_x86_64_EXTRA_LDFLAGS :=
|
||||
CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS := \
|
||||
-finline-limit=300 \
|
||||
-fno-inline-functions-called-once \
|
||||
-mfpmath=sse \
|
||||
-mbionic
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
|
||||
endif
|
||||
ifeq ($(HOST_OS),darwin)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin
|
||||
endif
|
||||
ifeq ($(HOST_OS),windows)
|
||||
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
|
||||
endif
|
||||
CLANG_CONFIG_x86_64_TARGET_TRIPLE := x86_64-linux-android
|
||||
|
||||
include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
|
||||
|
||||
# Clang compiler-specific libc headers
|
||||
CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := external/clang/lib/include
|
||||
CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
|
||||
|
||||
# Address sanitizer clang config
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
|
||||
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
|
||||
|
||||
# This allows us to use the superset of functionality that compiler-rt
|
||||
# provides to Clang (for supporting features like -ftrapv).
|
||||
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
|
||||
|
||||
# Macros to convert gcc flags to clang flags
|
||||
define subst-clang-incompatible-flags
|
||||
$(subst -march=armv5te,-march=armv5t,\
|
||||
$(subst -march=armv5e,-march=armv5,\
|
||||
$(subst -mcpu=cortex-a15,-march=armv7-a,\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
define convert-to-host-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_$(HOST_ARCH)_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
define convert-to-clang-flags
|
||||
$(strip \
|
||||
$(call subst-clang-incompatible-flags,\
|
||||
$(filter-out $(CLANG_CONFIG_$(TARGET_ARCH)_UNKNOWN_CFLAGS),\
|
||||
$(1))))
|
||||
endef
|
||||
|
||||
# Define clang global flags
|
||||
define get-clang-host-global-flags
|
||||
$(call convert-to-host-clang-flags,$(HOST_GLOBAL_$(1))) $(CLANG_CONFIG_$(HOST_ARCH)_HOST_EXTRA_$(1))
|
||||
endef
|
||||
|
||||
define get-clang-global-flags
|
||||
$(call convert-to-clang-flags,$(TARGET_GLOBAL_$(1))) $(CLANG_CONFIG_$(TARGET_ARCH)_TARGET_EXTRA_$(1))
|
||||
endef
|
||||
|
||||
CLANG_HOST_GLOBAL_CFLAGS := $(call get-clang-host-global-flags,CFLAGS)
|
||||
CLANG_HOST_GLOBAL_CPPFLAGS := $(call get-clang-host-global-flags,CPPFLAGS)
|
||||
CLANG_HOST_GLOBAL_LDFLAGS := $(call get-clang-host-global-flags,LDFLAGS)
|
||||
|
||||
CLANG_TARGET_GLOBAL_CFLAGS := $(call get-clang-global-flags,CFLAGS)
|
||||
CLANG_TARGET_GLOBAL_CPPFLAGS := $(call get-clang-global-flags,CPPFLAGS)
|
||||
CLANG_TARGET_GLOBAL_LDFLAGS := $(call get-clang-global-flags,LDFLAGS)
|
||||
|
||||
# Renderscript clang target triple
|
||||
ifeq ($(TARGET_ARCH),arm)
|
||||
RS_TRIPLE := armv7-none-linux-gnueabi
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH),mips)
|
||||
RS_TRIPLE := mipsel-unknown-linux
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
RS_TRIPLE := i686-unknown-linux
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH),x86_64)
|
||||
RS_TRIPLE := x86_64-unknown-linux
|
||||
endif
|
|
@ -1,76 +0,0 @@
|
|||
ifeq ($(strip $(llvm_arch)),)
|
||||
$(error "$$(llvm_arch) should be defined.")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)),)
|
||||
$(error "$$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) should be defined.")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)),)
|
||||
CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX := \
|
||||
$(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)/bin
|
||||
endif
|
||||
|
||||
# Include common unknown flags
|
||||
CLANG_CONFIG_$(llvm_arch)_UNKNOWN_CFLAGS += \
|
||||
$(CLANG_CONFIG_UNKNOWN_CFLAGS)
|
||||
|
||||
# Clang extra flags for host
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS)
|
||||
|
||||
ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS += \
|
||||
-target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
|
||||
endif
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS)
|
||||
|
||||
ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
|
||||
CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS += \
|
||||
-target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
|
||||
endif
|
||||
|
||||
# Clang extra flags for target
|
||||
CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS) \
|
||||
-target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS)
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CPPFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
|
||||
|
||||
CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_LDFLAGS := \
|
||||
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
|
||||
$(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS) \
|
||||
-target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
|
||||
-B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
|
||||
|
||||
llvm_arch :=
|
|
@ -41,7 +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)
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
else
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue