From 133fcb2550c615ffa7772273de06b9e2ebb987a8 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Thu, 28 Jun 2018 13:31:02 +0100 Subject: [PATCH] Warn when defining a 32-bit product on a 64-bit device. Building a 32-bit-app-only product on a 64-bit capable device is likely to be unintentional. Print a warning if this is done implicitly, e.g. via forgetting to define the TARGET_SUPPORTS_64_BIT_APPS variable. Also change existing references to only treat 'true' as a positive value, rather than all non-empty ones. Bug: 110918674 Test: lunched 64-bit-device product that does and doesn't set this var Change-Id: I021157c94ec3ac1c690547c8992768e58c89c287 --- core/config.mk | 10 +++++++++- core/package.mk | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/config.mk b/core/config.mk index 5562fe3a1a..7292f8c94a 100644 --- a/core/config.mk +++ b/core/config.mk @@ -368,10 +368,18 @@ TARGET_PREFER_32_BIT_APPS := true TARGET_PREFER_32_BIT_EXECUTABLES := true endif -ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS)) +ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) TARGET_SUPPORTS_32_BIT_APPS := true endif +# Sanity check to warn about likely cryptic errors later in the build. +ifeq ($(TARGET_IS_64_BIT),true) + ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) + $(warning Building a 32-bit-app-only product on a 64-bit device. \ + If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) + endif +endif + # "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are # comma separated lists of the 32 and 64 bit ABIs (in order of # preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT diff --git a/core/package.mk b/core/package.mk index f3713fcf75..854e0093c6 100644 --- a/core/package.mk +++ b/core/package.mk @@ -8,7 +8,9 @@ my_prefix := TARGET_ include $(BUILD_SYSTEM)/multilib.mk ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) - ifneq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(my_module_multilib),|64) + ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) + my_module_multilib := first + else ifneq ($(my_module_multilib),64) my_module_multilib := first endif endif