Merge "Support to extract JNI libs from prebuilt APK"
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index 7860f4d..6bb3754 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -38,7 +38,7 @@
TARGET_NDK_GCC_VERSION := 4.8
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.9
+TARGET_GCC_VERSION := 4.8
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -73,9 +73,13 @@
android_config_h := $(call select-android-config-h,linux-arm64)
+# HACK: globally disable -fstack-protector until the toolchain supports it
+TARGET_GLOBAL_UNSUPPORTED_CFLAGS := \
+ -fstack-protector \
+ -fstack-protector-all \
+
TARGET_GLOBAL_CFLAGS += \
-fpic -fPIE \
- -fstack-protector \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -159,7 +163,6 @@
define transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
- -Wl,--gc-sections \
-Wl,-shared,-Bsymbolic \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
@@ -183,7 +186,6 @@
define transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker64 \
- -Wl,--gc-sections \
-Wl,-z,nocopyreloc \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
@@ -207,7 +209,6 @@
define transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
- -Wl,--gc-sections \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_STATIC_O)) \
diff --git a/core/config.mk b/core/config.mk
index 79911de..e11a7a3 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -496,9 +496,24 @@
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
endif
+# Flags for DEX2OAT
+DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
+DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
-ifneq (,$(filter $(TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait))
-DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
+
+# If for a 64bit build we have a 2nd architecture but the zygote isn't 64bit,
+# assume DEX2OAT should DEXPREOPT for the 2nd architecture.
+ifdef TARGET_2ND_ARCH
+ ifeq (true,$(TARGET_IS_64_BIT))
+ ifeq ($(filter ro.zygote=zygote64,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)),)
+ DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH)
+ DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_2ND_CPU_VARIANT)
+ endif
+ endif
+endif
+
+ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait))
+ DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
endif
# define clang/llvm tools and global flags
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 7809c13..73e8494 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -69,7 +69,8 @@
--oat-file=$(patsubst %.art,%.oat,$@) \
--oat-location=$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) \
--image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
- --instruction-set=$(TARGET_ARCH) --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
+ --instruction-set=$(DEX2OAT_TARGET_ARCH) \
+ --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
--android-root=$(PRODUCT_OUT)/system
@@ -90,6 +91,6 @@
--dex-location=$(3) \
--oat-file=$(4) \
--android-root=$(PRODUCT_OUT)/system \
- --instruction-set=$(TARGET_ARCH) \
+ --instruction-set=$(DEX2OAT_TARGET_ARCH) \
--instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endef