Add support for *_CPU_VARIANT_RUNTIME flags
Specified in the BoardConfig, and default to the value of the non
_RUNTIME variants.
These flags do not modify build-time compilation, but get written to
system properties on /vendor and can be inspected at runtime to
run/compile code for the specified cpu.
Migrate the bionic and ART cpu variant flags to use the new variables,
but leave the ART preopting using the non-_RUNTIME variants.
Bug: 120773446
Test: boot downstream device specifying CPU_VARIANT_RUNTIME flags
Test: grep dalvik.vm vendor/default.prop
Change-Id: Idc81110172582f38f84cca87f2eff140c5b5f9ac
diff --git a/core/config.mk b/core/config.mk
index 518e138..5f08f2f 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -298,12 +298,24 @@
$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
# Clean up/verify variables defined by the board config file.
+# TODO: Move this to right after the BoardConfig parsing.
TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
ifeq ($(TARGET_CPU_ABI),)
$(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
endif
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
+TARGET_CPU_VARIANT := $(strip $(TARGET_CPU_VARIANT))
+TARGET_CPU_VARIANT_RUNTIME := $(strip $(TARGET_CPU_VARIANT_RUNTIME))
+
+TARGET_2ND_CPU_ABI := $(strip $(TARGET_2ND_CPU_ABI))
+TARGET_2ND_CPU_ABI2 := $(strip $(TARGET_2ND_CPU_ABI2))
+TARGET_2ND_CPU_VARIANT := $(strip $(TARGET_2ND_CPU_VARIANT))
+TARGET_2ND_CPU_VARIANT_RUNTIME := $(strip $(TARGET_2ND_CPU_VARIANT_RUNTIME))
+
+# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified.
+TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
+TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
@@ -1135,11 +1147,13 @@
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default)
+DEX2OAT_TARGET_CPU_VARIANT_RUNTIME := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_ARCH_VARIANT),default)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH)
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT),$(TARGET_2ND_ARCH_VARIANT),default)
+$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_ARCH_VARIANT),default)
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
endif