Load compiler environment for a second arch.
This is the first step to build 32-bit libraries in a 64-bit product.
It will work like this:
1) In the product's BoardConfig.mk, define:
TARGET_2ND_ARCH, TARGET_2ND_ARCH_VARIANT, TARGET_2ND_CPU_VARIANT.
The build system uses those variables to set up an additional compiler
environment for the second arch.
2) When parsing Android.mks, the build system sets up rules to build a
module for both the 1st arch and the 2nd arch, unless it's explicitly
asked to skip so.
Android.mk will be adapted if there is additional rule of generating
source files.
The build system will accept arch-specific LOCAL_ variables, such as
LOCAL_CFLAGS_arm, LOCAL_CFLAGS_armv7-a-neon, LOCAL_CFLAGS_cortex-a15,
LOCAL_CFLAGS_aarch64 etc. Modules use such variables to set up build for
various archs at the same time.
3) Install binary of the 2nd arch by adding "<module_name>:32" to
PRODUCT_PACKAGES. All 2nd-arch libraries linked in by "<module_name>:32"
will be installed automatically.
Bug: 11654773
Change-Id: I2df63cd5463a07bf5358bee2a109f8fb9590fe30
Conflicts:
core/combo/TARGET_linux-arm.mk
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 3b95c5c..c8c75aa 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -30,51 +30,51 @@
# include defines, and compiler settings for the given architecture
# version.
#
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := armv5te
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv5te
endif
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.8
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
else
-TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT))
+$(error Unknown ARM architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
endif
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
-TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
+ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
+$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
+$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
endif
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CXX := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+ $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
else
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+ $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
-TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
-TARGET_arm_CFLAGS := -O2 \
+$(combo_2nd_arch_prefix)TARGET_arm_CFLAGS := -O2 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
# Modules can choose to compile some source as thumb.
-TARGET_thumb_CFLAGS := -mthumb \
+$(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing
@@ -89,13 +89,13 @@
# with -mlong-calls. When built at -O0, those libraries are
# too big for a thumb "BL <label>" to go from one end to the other.
ifeq ($(FORCE_ARM_DEBUGGING),true)
- TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
- TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
+ $(combo_2nd_arch_prefix)TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
+ $(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
endif
android_config_h := $(call select-android-config-h,linux-arm)
-TARGET_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-msoft-float -fpic -fPIE \
-ffunction-sections \
-fdata-sections \
@@ -113,8 +113,8 @@
# "-Wall -Werror" due to a commom idiom "ALOGV(mesg)" where ALOGV is turned
# into no-op in some builds while mesg is defined earlier. So we explicitly
# disable "-Wunused-but-set-variable" here.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $(TARGET_GCC_VERSION)),)
-TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
+ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)),)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
-fno-strict-volatile-bitfields
endif
@@ -126,9 +126,9 @@
# in their exported C++ functions). Also, GCC 4.5 has already
# removed the warning from the compiler.
#
-TARGET_GLOBAL_CFLAGS += -Wno-psabi
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-psabi
-TARGET_GLOBAL_LDFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
@@ -137,12 +137,12 @@
-Wl,--icf=safe \
$(arch_variant_ldflags)
-TARGET_GLOBAL_CFLAGS += -mthumb-interwork
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mthumb-interwork
-TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
# More flags/options can be added here
-TARGET_RELEASE_CFLAGS := \
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \
-DNDEBUG \
-g \
-Wstrict-aliasing=2 \
@@ -157,40 +157,41 @@
## on some hosts, the target cross-compiler is not available so do not run this command
-ifneq ($(wildcard $(TARGET_CC)),)
+ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
# We compile with the global cflags to ensure that
# any flags which affect libgcc are correctly taken
# into account.
-TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+$(combo_2nd_arch_prefix)TARGET_LIBGCC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \
+ $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
+target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
# Define FDO (Feedback Directed Optimization) options.
-TARGET_FDO_CFLAGS:=
-TARGET_FDO_LIB:=
+$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
+$(combo_2nd_arch_prefix)TARGET_FDO_LIB:=
ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
# The profile will be generated on /data/local/tmp/profile on the device.
- TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
else
# If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
- TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)
else
- ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
endif
endif
# If the FDO profile directory can't be found, then FDO is off.
- ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
endif
endif
@@ -199,7 +200,7 @@
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH)
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
-TARGET_C_INCLUDES := \
+$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-arm/include \
$(libc_root)/include \
$(libstdc++_root)/include \
@@ -208,20 +209,20 @@
$(libm_root)/include/arm \
$(libthread_db_root)/include
-TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
-TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
-TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
-TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
-TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
-TARGET_STRIP_MODULE:=true
+$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
-TARGET_CUSTOM_LD_COMMAND := true
+$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
-define transform-o-to-shared-lib-inner
+define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
@@ -245,7 +246,7 @@
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
endef
-define transform-o-to-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
@@ -270,7 +271,7 @@
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
-define transform-o-to-static-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
-Wl,--gc-sections \
-o $@ \
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index c07a096..7819d80 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -65,10 +65,10 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
else
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 4d19216..dea8485 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -60,10 +60,10 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
else
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 56c4335..dcf8819 100755
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -54,10 +54,10 @@
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
else
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
ifneq ($(wildcard $(TARGET_CC)),)
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
index dd19069..22ba09a 100755
--- a/core/combo/TARGET_linux-x86_64.mk
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -56,10 +56,10 @@
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
else
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
ifneq ($(wildcard $(TARGET_CC)),)
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 1105330..53d9220 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -1,10 +1,10 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
-ARCH_ARM_HAVE_ARMV7A := true
-ARCH_ARM_HAVE_VFP := true
-ARCH_ARM_HAVE_VFP_D32 := true
-ARCH_ARM_HAVE_NEON := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP_D32 := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_NEON := true
ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
arch_variant_cflags := -mcpu=cortex-a15
diff --git a/core/combo/arch/arm/armv7-a.mk b/core/combo/arch/arm/armv7-a.mk
index 4a51977..9549478 100644
--- a/core/combo/arch/arm/armv7-a.mk
+++ b/core/combo/arch/arm/armv7-a.mk
@@ -1,8 +1,8 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher
#
-ARCH_ARM_HAVE_ARMV7A := true
-ARCH_ARM_HAVE_VFP := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
# Note: Hard coding the 'tune' value here is probably not ideal,
# and a better solution should be found in the future.
diff --git a/core/combo/select.mk b/core/combo/select.mk
index 7638bc4..ec53423 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -18,43 +18,51 @@
#
# Inputs:
# combo_target -- prefix for final variables (HOST_ or TARGET_)
+# combo_2nd_arch_prefix -- it's defined if this is loaded for TARGET_2ND_ARCH.
#
# Build a target string like "linux-arm" or "darwin-x86".
+ifdef combo_2nd_arch_prefix
+combo_os_arch := $($(combo_target)OS)-$(TARGET_2ND_ARCH)
+else
combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
+endif
+
+combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
# Set reasonable defaults for the various variables
-$(combo_target)CC := $(CC)
-$(combo_target)CXX := $(CXX)
-$(combo_target)AR := $(AR)
-$(combo_target)STRIP := $(STRIP)
+$(combo_var_prefix)CC := $(CC)
+$(combo_var_prefix)CXX := $(CXX)
+$(combo_var_prefix)AR := $(AR)
+$(combo_var_prefix)STRIP := $(STRIP)
-$(combo_target)BINDER_MINI := 0
+$(combo_var_prefix)BINDER_MINI := 0
-$(combo_target)HAVE_EXCEPTIONS := 0
-$(combo_target)HAVE_UNIX_FILE_PATH := 1
-$(combo_target)HAVE_WINDOWS_FILE_PATH := 0
-$(combo_target)HAVE_RTTI := 1
-$(combo_target)HAVE_CALL_STACKS := 1
-$(combo_target)HAVE_64BIT_IO := 1
-$(combo_target)HAVE_CLOCK_TIMERS := 1
-$(combo_target)HAVE_PTHREAD_RWLOCK := 1
-$(combo_target)HAVE_STRNLEN := 1
-$(combo_target)HAVE_STRERROR_R_STRRET := 1
-$(combo_target)HAVE_STRLCPY := 0
-$(combo_target)HAVE_STRLCAT := 0
-$(combo_target)HAVE_KERNEL_MODULES := 0
+$(combo_var_prefix)HAVE_EXCEPTIONS := 0
+$(combo_var_prefix)HAVE_UNIX_FILE_PATH := 1
+$(combo_var_prefix)HAVE_WINDOWS_FILE_PATH := 0
+$(combo_var_prefix)HAVE_RTTI := 1
+$(combo_var_prefix)HAVE_CALL_STACKS := 1
+$(combo_var_prefix)HAVE_64BIT_IO := 1
+$(combo_var_prefix)HAVE_CLOCK_TIMERS := 1
+$(combo_var_prefix)HAVE_PTHREAD_RWLOCK := 1
+$(combo_var_prefix)HAVE_STRNLEN := 1
+$(combo_var_prefix)HAVE_STRERROR_R_STRRET := 1
+$(combo_var_prefix)HAVE_STRLCPY := 0
+$(combo_var_prefix)HAVE_STRLCAT := 0
+$(combo_var_prefix)HAVE_KERNEL_MODULES := 0
-$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
-$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
-$(combo_target)GLOBAL_LDFLAGS :=
-$(combo_target)GLOBAL_ARFLAGS := crsPD
+$(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
+$(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
+$(combo_var_prefix)GLOBAL_CPPFLAGS :=
+$(combo_var_prefix)GLOBAL_LDFLAGS :=
+$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
-$(combo_target)EXECUTABLE_SUFFIX :=
-$(combo_target)SHLIB_SUFFIX := .so
-$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
-$(combo_target)STATIC_LIB_SUFFIX := .a
+$(combo_var_prefix)EXECUTABLE_SUFFIX :=
+$(combo_var_prefix)SHLIB_SUFFIX := .so
+$(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX)
+$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
# Now include the combo for this specific target.
include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
@@ -88,11 +96,11 @@
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
# prepend ccache if necessary
- ifneq ($(ccache),$(firstword $($(combo_target)CC)))
- $(combo_target)CC := $(ccache) $($(combo_target)CC)
+ ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC)))
+ $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC)
endif
- ifneq ($(ccache),$(firstword $($(combo_target)CXX)))
- $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
+ ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX)))
+ $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX)
endif
ccache =
endif
diff --git a/core/config.mk b/core/config.mk
index e5e46df..ee47772 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -208,14 +208,23 @@
endef
combo_target := HOST_
+combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
combo_target := TARGET_
+combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
+# Load the 2nd target arch if it's needed.
+ifdef TARGET_2ND_ARCH
+combo_target := TARGET_
+combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/combo/select.mk
+endif
+
# Compute TARGET_TOOLCHAIN_ROOT from TARGET_TOOLS_PREFIX
# if only TARGET_TOOLS_PREFIX is passed to the make command.
ifndef TARGET_TOOLCHAIN_ROOT
@@ -422,6 +431,19 @@
TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
+ifdef TARGET_2ND_ARCH
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LD_DIRS += -L$($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)
+$(combo_2nd_arch_prefix)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS)
+endif
+
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 34e028f..cd08690 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -106,6 +106,8 @@
ifeq ($(LOCAL_STRIP_MODULE),true)
# Strip the binary
+$(strip_output): PRIVATE_STRIP := $(TARGET_STRIP)
+$(strip_output): PRIVATE_OBJCOPY := $(TARGET_OBJCOPY)
$(strip_output): $(strip_input) | $(TARGET_STRIP)
$(transform-to-stripped)
else
diff --git a/core/envsetup.mk b/core/envsetup.mk
index ab8426e..99ec0cd 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -232,6 +232,12 @@
TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
+# Out for TARGET_2ND_ARCH
+TARGET_2ND_ARCH_VAR_PREFIX := 2ND_
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+
TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES)