Merge "add silvermont x86 architecture"
diff --git a/core/64_bit_blacklist.mk b/core/64_bit_blacklist.mk
index a237935..b7420cd 100644
--- a/core/64_bit_blacklist.mk
+++ b/core/64_bit_blacklist.mk
@@ -1,10 +1,5 @@
 ifneq ($(TARGET_2ND_ARCH),)
 
-# chromium-libpac needs porting to the chromium_org V8 instead of legacy V8.
-_64_bit_directory_blacklist += \
-	external/chromium-libpac \
-	external/v8 \
-
 # misc build errors
 _64_bit_directory_blacklist += \
 	device/generic/goldfish/opengl \
diff --git a/core/clang/arm64.mk b/core/clang/arm64.mk
index e8342bd..9fb3670 100644
--- a/core/clang/arm64.mk
+++ b/core/clang/arm64.mk
@@ -1,8 +1,10 @@
 # Clang flags for arm64 arch, target or host.
 
-CLANG_CONFIG_arm64_EXTRA_ASFLAGS :=
+CLANG_CONFIG_arm64_EXTRA_ASFLAGS := \
+  -no-integrated-as
 
 CLANG_CONFIG_arm64_EXTRA_CFLAGS := \
+  -no-integrated-as
 
 CLANG_CONFIG_arm64_EXTRA_LDFLAGS :=
 
diff --git a/core/clang/config.mk b/core/clang/config.mk
index a79a558..b8f76f2 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -11,10 +11,11 @@
 
 CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
 CLANG_CXX := $(LLVM_PREBUILTS_PATH)/clang++$(BUILD_EXECUTABLE_SUFFIX)
-CLANG_TBLGEN := $(LLVM_PREBUILTS_PATH)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
 LLVM_AS := $(LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
 LLVM_LINK := $(LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
-TBLGEN := $(LLVM_PREBUILTS_PATH)/tblgen$(BUILD_EXECUTABLE_SUFFIX)
+
+CLANG_TBLGEN := $(HOST_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
+TBLGEN := $(HOST_OUT_EXECUTABLES)/tblgen$(BUILD_EXECUTABLE_SUFFIX)
 
 
 # Clang flags for all host or target rules
diff --git a/core/config.mk b/core/config.mk
index 4e65049..9e963d4 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -231,12 +231,13 @@
 include $(BUILD_SYSTEM)/combo/select.mk
 endif
 
-# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
-# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
-# is specified by the board configuration, we use that. If not, we
-# build a list out of the TARGET_CPU_ABIs specified by the config.
-ifeq (,$(TARGET_CPU_ABI_LIST))
-  TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
+ifdef TARGET_PREFER_32_BIT
+TARGET_PREFER_32_BIT_APPS := true
+TARGET_PREFER_32_BIT_EXECUTABLES := true
+endif
+
+ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS))
+  TARGET_SUPPORTS_32_BIT_APPS := true
 endif
 
 # "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
@@ -249,7 +250,7 @@
 # is always 32 bits. If this isn't the case, these variables should
 # be overriden in the boarc configuration.
 ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
-  ifeq (true,$(TARGET_IS_64_BIT))
+  ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
     TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
   endif
 endif
@@ -258,9 +259,23 @@
   ifneq (true,$(TARGET_IS_64_BIT))
     TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
   else
-    # For a 64 bit target, assume that the 2ND_CPU_ABI
-    # is a 32 bit ABI.
-    TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
+    ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
+      # For a 64 bit target, assume that the 2ND_CPU_ABI
+      # is a 32 bit ABI.
+      TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
+    endif
+  endif
+endif
+
+# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
+# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
+# is specified by the board configuration, we use that. If not, we
+# build a list out of the TARGET_CPU_ABIs specified by the config.
+ifeq (,$(TARGET_CPU_ABI_LIST))
+  ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true)
+    TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT)
+  else
+    TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT)
   endif
 endif
 
diff --git a/core/executable.mk b/core/executable.mk
index b67ac36..7a3e08e 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -19,9 +19,9 @@
 LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
 endif
 
-# if TARGET_PREFER_32_BIT is set, try to build 32-bit first
+# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
 ifdef TARGET_2ND_ARCH
-ifeq ($(TARGET_PREFER_32_BIT),true)
+ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
 LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
 else
 LOCAL_2ND_ARCH_VAR_PREFIX :=
@@ -45,7 +45,7 @@
 ifdef TARGET_2ND_ARCH
 
 # check if the non-preferred arch is the primary or secondary
-ifeq ($(TARGET_PREFER_32_BIT),true)
+ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
 LOCAL_2ND_ARCH_VAR_PREFIX :=
 else
 LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
diff --git a/core/package.mk b/core/package.mk
index fe4d0e4..c7d68d9 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -40,9 +40,9 @@
 
 LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
 
-# if TARGET_PREFER_32_BIT is set, try to build 32-bit first
+# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
 ifdef TARGET_2ND_ARCH
-ifeq ($(TARGET_PREFER_32_BIT),true)
+ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
 LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
 else
 LOCAL_2ND_ARCH_VAR_PREFIX :=
@@ -56,7 +56,7 @@
 include $(BUILD_SYSTEM)/package_internal.mk
 else ifneq (,$(TARGET_2ND_ARCH))
 # check if the non-preferred arch is the primary or secondary
-ifeq ($(TARGET_PREFER_32_BIT),true)
+ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
 LOCAL_2ND_ARCH_VAR_PREFIX :=
 else
 LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
diff --git a/core/product.mk b/core/product.mk
index cf6fb9a..fd405ad 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -252,7 +252,8 @@
 
 
 _product_stash_var_list += \
-	DEFAULT_SYSTEM_DEV_CERTIFICATE
+	DEFAULT_SYSTEM_DEV_CERTIFICATE \
+	WITH_DEXPREOPT
 
 #
 # Stash values of the variables in _product_stash_var_list.
diff --git a/envsetup.sh b/envsetup.sh
index f75bf88..60726d3 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1401,7 +1401,7 @@
       else
         case `uname -s` in
             Darwin)
-                export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
+                export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
                 ;;
             *)
                 export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 2ed83bb..d0994b0 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -41,7 +41,7 @@
 USE_OPENGL_RENDERER := true
 
 TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 8ff0bd1..e119466 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -19,6 +19,7 @@
 # build quite specifically for the emulator, and might not be
 # entirely appropriate to inherit from for on-device configurations.
 
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
 
diff --git a/target/product/core_64_bit.mk b/target/product/core_64_bit.mk
new file mode 100644
index 0000000..5d7abcb
--- /dev/null
+++ b/target/product/core_64_bit.mk
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Inherit from this product for devices that support 64-bit apps using:
+# $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+# The inheritance for this must come before the inheritance chain that leads
+# to core_minimal.mk
+
+# For now this will allow 64-bit apps, but still compile all apps with JNI
+# for 32-bit only.
+
+# Copy the 32-bit primary, 64-bit secondary zygote startup script
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+
+# Set the zygote property to select the 32-bit primary, 64-bit secondary script
+# This line must be parsed before the one in core_minimal.mk
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32_64
+
+# Temporary hack to prefer launching processes as 32 bit
+# instead of 64 bit.
+#
+# STOPSHIP: Revert this to allow products to select it themselves
+TARGET_PREFER_32_BIT_APPS := true
+
+TARGET_SUPPORTS_32_BIT_APPS := true
+TARGET_SUPPORTS_64_BIT_APPS := true
diff --git a/target/product/full_mips64.mk b/target/product/full_mips64.mk
index 3f171e0..408e81c 100644
--- a/target/product/full_mips64.mk
+++ b/target/product/full_mips64.mk
@@ -19,6 +19,7 @@
 # mips64 build quite specifically for the emulator, and might not be
 # entirely appropriate to inherit from for on-device configurations.
 
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_mips64/device.mk)
 
diff --git a/target/product/full_x86_64.mk b/target/product/full_x86_64.mk
index ce5dcf7..d9c0c1e 100755
--- a/target/product/full_x86_64.mk
+++ b/target/product/full_x86_64.mk
@@ -23,9 +23,7 @@
 # that isn't a wifi connection. This will instruct init.rc to enable the
 # network connection so that you can use it with ADB
 
-# Override and force 64-bit Zygote. Must come first.
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64
-
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)