Add support for AArch64 XOM binaries.

Adds build system support for generating AArch64 binaries with
execute-only memory layouts via a new LOCAL_XOM property. Also adds
support for an ENABLE_XOM build flag for global builds.

Bug: 77958880
Test: make -j ENABLE_XOM=true
Change-Id: I6af9e3615d0a9fdff802eae50e6ad94311ec8046
This commit is contained in:
Ivan Lozano 2018-11-21 09:04:18 -08:00
parent 12fa690ff6
commit fda9a6f38e
5 changed files with 32 additions and 0 deletions

View File

@ -73,6 +73,30 @@ else
my_native_coverage := false
endif
ifeq ($(strip $(ENABLE_XOM)),true)
ifndef LOCAL_IS_HOST_MODULE
my_xom := true
# Disable XOM in excluded paths.
combined_xom_exclude_paths := $(XOM_EXCLUDE_PATHS) \
$(PRODUCT_XOM_EXCLUDE_PATHS)
ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_xom_exclude_paths)),\
$(filter $(dir)%,$(LOCAL_PATH)))),)
my_xom := false
endif
# Allow LOCAL_XOM to override the above
ifdef LOCAL_XOM
my_xom := $(LOCAL_XOM)
endif
ifeq ($(strip $(my_xom)),true)
ifeq (arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_ldflags += -Wl,-execute-only
endif
endif
endif
endif
my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
ifdef SANITIZE_HOST
ifdef LOCAL_IS_HOST_MODULE

View File

@ -302,6 +302,7 @@ LOCAL_VTS_INCLUDES:=
LOCAL_VTS_MODE:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
LOCAL_XOM:=
LOCAL_YACCFLAGS:=
# TODO: deprecate, it does nothing
OVERRIDE_BUILT_MODULE_PATH:=

View File

@ -212,6 +212,7 @@ _product_var_list := \
PRODUCT_USE_DYNAMIC_PARTITIONS \
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
PRODUCT_XOM_EXCLUDE_PATHS \
define dump-product
$(info ==== $(1) ====)\

View File

@ -501,6 +501,10 @@ PRODUCT_CFI_EXCLUDE_PATHS := \
PRODUCT_CFI_INCLUDE_PATHS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_CFI_INCLUDE_PATHS))
# Whether any paths are excluded from being set XOM when ENABLE_XOM=true
PRODUCT_XOM_EXCLUDE_PATHS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_XOM_EXCLUDE_PATHS))
# which Soong namespaces to export to Make
PRODUCT_SOONG_NAMESPACES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SOONG_NAMESPACES))

View File

@ -82,6 +82,8 @@ $(call add_json_bool, Safestack, $(filter true,$(USE_SAF
$(call add_json_bool, EnableCFI, $(call invert_bool,$(filter false,$(ENABLE_CFI))))
$(call add_json_list, CFIExcludePaths, $(CFI_EXCLUDE_PATHS) $(PRODUCT_CFI_EXCLUDE_PATHS))
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
$(call add_json_bool, EnableXOM, $(filter true,$(ENABLE_XOM)))
$(call add_json_list, XOMExcludePaths, $(XOM_EXCLUDE_PATHS) $(PRODUCT_XOM_EXCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))