Merge "Add USE_CLANG_LLD and LOCAL_USE_CLANG_LLD" am: a72e1518e7

am: db18e11b86

Change-Id: I7f8fafc80a9be06fad05f801edad4510be2ed3f8
This commit is contained in:
Chih-hung Hsieh 2018-04-13 12:44:10 -07:00 committed by android-build-merger
commit 4991178be2
6 changed files with 35 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
include $(BUILD_SYSTEM)/use_lld_setup.mk
#######################################
##################################################
@ -516,7 +517,11 @@ ifeq ($(my_clang),true)
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
ifeq ($(my_use_clang_lld),true)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
else
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
endif # my_use_clang_lld
else
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)

View File

@ -269,6 +269,7 @@ LOCAL_TIDY_FLAGS:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_USE_AAPT2:=$(USE_AAPT2)
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_R8:=
LOCAL_USE_VNDK:=
LOCAL_VENDOR_MODULE:=

View File

@ -67,6 +67,11 @@ ifneq ($(HOST_OS),linux)
my_pack_module_relocations := false
endif
# Relocation packer does not work with LLD yet.
ifeq ($(my_use_clang_lld),true)
my_pack_module_relocations := false
endif
ifeq (true,$(my_pack_module_relocations))
# Pack relocations
$(relocation_packer_output): $(relocation_packer_input)

View File

@ -6,6 +6,8 @@
##
###########################################################
include $(BUILD_SYSTEM)/use_lld_setup.mk
ifneq ($(LOCAL_PREBUILT_LIBS),)
$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
endif
@ -70,6 +72,12 @@ ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
ifeq ($(DISABLE_RELOCATION_PACKER),true)
my_pack_module_relocations := false
endif
# Relocation packer does not work with LLD yet.
# my_use_clang_lld might be used befor set up in binary.mk
ifeq ($(my_use_clang_lld),true)
my_pack_module_relocations := false
endif
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)

View File

@ -99,6 +99,7 @@ $(call add_json_list, CFIExcludePaths, $(CFI_EXCLUDE_PATHS) $(
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
$(call add_json_bool, UseClangLld, $(filter 1 true,$(USE_CLANG_LLD)))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))

14
core/use_lld_setup.mk Normal file
View File

@ -0,0 +1,14 @@
#############################################################
## Set up flags based on USE_CLANG_LLD and LOCAL_USE_CLANG_LLD.
## Input variables: USE_CLANG_LLD,LOCAL_USE_CLANG_LLD.
## Output variables: my_use_clang_lld
#############################################################
# Use LLD only if it's not disabled by LOCAL_USE_CLANG_LLD,
# and enabled by LOCAL_USE_CLANG_LLD or USE_CLANG_LLD.
my_use_clang_lld := false
ifeq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
ifneq (,$(filter 1 true,$(LOCAL_USE_CLANG_LLD) $(USE_CLANG_LLD)))
my_use_clang_lld := true
endif
endif