diff options
57 files changed, 559 insertions, 430 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index fef406c..b3239d7 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -247,6 +247,12 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop) # Switch host builds to Clang by default $(call add-clean-step, rm -rf $(OUT_DIR)/host) + +# Adding dalvik.vm.dex2oat-filter +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/binary.mk b/core/binary.mk index 3a53e48..4162a12 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -113,6 +113,17 @@ my_cxx := $(LOCAL_CXX) my_c_includes := $(LOCAL_C_INCLUDES) my_generated_sources := $(LOCAL_GENERATED_SOURCES) +# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because +# all code is position independent, and then those warnings get promoted to +# errors. +ifndef USE_MINGW +ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES) +my_cflags += -fpie +else +my_cflags += -fPIC +endif +endif + my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix)) my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) @@ -122,12 +133,12 @@ my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $ my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix)) my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix)) -my_clang := $(LOCAL_CLANG) +my_clang := $(strip $(LOCAL_CLANG)) ifdef LOCAL_CLANG_$(my_32_64_bit_suffix) -my_clang := $(LOCAL_CLANG_$(my_32_64_bit_suffix)) +my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix))) endif ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) -my_clang := $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) +my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) endif # clang is enabled by default for host builds @@ -140,6 +151,13 @@ ifdef LOCAL_IS_HOST_MODULE endif endif +# Add option to make clang the default for device build +ifeq ($(USE_CLANG_PLATFORM_BUILD),true) + ifeq ($(my_clang),) + my_clang := true + endif +endif + # arch-specific static libraries go first so that generic ones can depend on them my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries) my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries) @@ -294,7 +312,7 @@ else endif ifeq ($(strip $(my_cc)),) - ifeq ($(strip $(my_clang)),true) + ifeq ($(my_clang),true) my_cc := $(CLANG) else my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC) @@ -310,7 +328,7 @@ endif $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc) ifeq ($(strip $(my_cxx)),) - ifeq ($(strip $(my_clang)),true) + ifeq ($(my_clang),true) my_cxx := $(CLANG_CXX) else my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX) @@ -324,6 +342,7 @@ ifneq ($(LOCAL_NO_SYNTAX_CHECK),true) endif endif $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang) # TODO: support a mix of standard extensions so that this isn't necessary LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) @@ -359,7 +378,7 @@ normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) # actually used (although they are usually empty). arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS) normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) -ifeq ($(strip $(my_clang)),true) +ifeq ($(my_clang),true) arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags)) normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags)) endif diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk index 8820854..92058e1 100644 --- a/core/clang/HOST_x86_common.mk +++ b/core/clang/HOST_x86_common.mk @@ -22,34 +22,34 @@ ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),) CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \ -no-integrated-as CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ - -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \ - -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \ -no-integrated-as else CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux/32 \ - -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux/32 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \ -no-integrated-as CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ - -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \ - -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \ -no-integrated-as endif diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk index 595fb56..575b9f9 100644 --- a/core/clang/TARGET_arm.mk +++ b/core/clang/TARGET_arm.mk @@ -53,3 +53,4 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \ $(CLANG_CONFIG_arm_TARGET_EXTRA_LDFLAGS) $(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi +$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk index 98bbeb2..0264321 100644 --- a/core/clang/TARGET_arm64.mk +++ b/core/clang/TARGET_arm64.mk @@ -51,3 +51,4 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \ $(CLANG_CONFIG_arm64_TARGET_EXTRA_LDFLAGS) RS_TRIPLE := aarch64-linux-android +RS_TRIPLE_CFLAGS := diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk index 0107519..011c2a6 100644 --- a/core/clang/TARGET_mips.mk +++ b/core/clang/TARGET_mips.mk @@ -50,4 +50,5 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \ $(CLANG_CONFIG_mips_TARGET_EXTRA_LDFLAGS) -$(clang_2nd_arch_prefix)RS_TRIPLE := mipsel-unknown-linux +$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi +$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk index b2e536c..a5e29d2 100644 --- a/core/clang/TARGET_mips64.mk +++ b/core/clang/TARGET_mips64.mk @@ -50,4 +50,5 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \ $(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \ $(CLANG_CONFIG_mips64_TARGET_EXTRA_LDFLAGS) -RS_TRIPLE := mips64el-unknown-linux +RS_TRIPLE := aarch64-linux-android +RS_TRIPLE_CFLAGS := diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk index 70cb252..da7a223 100644 --- a/core/clang/TARGET_x86.mk +++ b/core/clang/TARGET_x86.mk @@ -52,4 +52,5 @@ $(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \ $(CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS) -$(clang_2nd_arch_prefix)RS_TRIPLE := i686-unknown-linux +$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi +$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -D__i386__ diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk index 14944bd..cc1f59f 100644 --- a/core/clang/TARGET_x86_64.mk +++ b/core/clang/TARGET_x86_64.mk @@ -50,4 +50,5 @@ CLANG_TARGET_GLOBAL_LDFLAGS := \ $(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \ $(CLANG_CONFIG_x86_64_TARGET_EXTRA_LDFLAGS) -RS_TRIPLE := x86_64-unknown-linux +RS_TRIPLE := aarch64-linux-android +RS_TRIPLE_CFLAGS := -D__x86_64__ diff --git a/core/clang/arm.mk b/core/clang/arm.mk index 22c7397..f979409 100644 --- a/core/clang/arm.mk +++ b/core/clang/arm.mk @@ -19,9 +19,15 @@ CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \ -fgcse-after-reload \ -frerun-cse-after-loop \ -frename-registers \ + -fno-align-jumps \ -fno-builtin-sin \ + -fno-caller-saves \ + -fno-early-inlining \ + -fno-move-loop-invariants \ + -fno-partial-inlining \ -fno-strict-volatile-bitfields \ - -fno-align-jumps \ + -fno-tree-copy-prop \ + -fno-tree-loop-optimize \ -Wa,--noexecstack define subst-clang-incompatible-arm-flags diff --git a/core/clang/config.mk b/core/clang/config.mk index 76293c5..0b8590b 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -43,16 +43,18 @@ CLANG_CONFIG_EXTRA_CFLAGS += \ -Werror=int-conversion CLANG_CONFIG_UNKNOWN_CFLAGS := \ - -funswitch-loops \ - -fno-tree-sra \ -finline-limit=64 \ + -fno-canonical-system-headers \ + -fno-tree-sra \ + -funswitch-loops \ + -Wmaybe-uninitialized \ + -Wno-error=maybe-uninitialized \ + -Wno-literal-suffix \ + -Wno-maybe-uninitialized \ + -Wno-old-style-declaration \ -Wno-psabi \ -Wno-unused-but-set-variable \ -Wno-unused-but-set-parameter \ - -Wmaybe-uninitialized \ - -Wno-maybe-uninitialized \ - -Wno-error=maybe-uninitialized \ - -fno-canonical-system-headers \ -Wno-unused-local-typedefs # Clang flags for all host rules diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk index 7db51be..78a9f8e 100644 --- a/core/combo/HOST_linux-x86.mk +++ b/core/combo/HOST_linux-x86.mk @@ -18,14 +18,14 @@ # Included by combo/select.mk ifeq ($(strip $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)),) -$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux- +$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux- endif $(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc $(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)g++ $(combo_2nd_arch_prefix)HOST_AR := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)ar # gcc location for clang; to be updated when clang is updated -$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/ +$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/ # We expect SSE3 floating point math. $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack -march=prescott diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk index 85b0f5b..86877b3 100644 --- a/core/combo/HOST_linux-x86_64.mk +++ b/core/combo/HOST_linux-x86_64.mk @@ -18,14 +18,14 @@ # Included by combo/select.mk ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),) -HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux- +HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux- endif HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++ HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar # gcc location for clang; to be updated when clang is updated -HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/ +HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/ HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack diff --git a/core/combo/HOST_windows-x86.mk b/core/combo/HOST_windows-x86.mk index 4d871d8..766c14a 100644 --- a/core/combo/HOST_windows-x86.mk +++ b/core/combo/HOST_windows-x86.mk @@ -24,7 +24,7 @@ TOOLS_EXE_SUFFIX := .exe # Settings to use MinGW has a cross-compiler under Linux ifneq ($(findstring Linux,$(UNAME)),) -ifneq ($(strip $(USE_MINGW)),) +ifdef USE_MINGW HOST_ACP_UNAVAILABLE := true TOOLS_EXE_SUFFIX := $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW diff --git a/core/combo/HOST_windows-x86_64.mk b/core/combo/HOST_windows-x86_64.mk index c77d82c..bd392ea 100644 --- a/core/combo/HOST_windows-x86_64.mk +++ b/core/combo/HOST_windows-x86_64.mk @@ -24,7 +24,7 @@ TOOLS_EXE_SUFFIX := .exe # Settings to use MinGW has a cross-compiler under Linux ifneq ($(findstring Linux,$(UNAME)),) -ifneq ($(strip $(USE_MINGW)),) +ifdef USE_MINGW HOST_ACP_UNAVAILABLE := true TOOLS_EXE_SUFFIX := HOST_GLOBAL_CFLAGS += -DUSE_MINGW diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk index a06f2dd..7c7f1f4 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -95,7 +95,7 @@ endif android_config_h := $(call select-android-config-h,linux-arm) $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \ - -msoft-float -fpic -fPIE \ + -msoft-float \ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -198,7 +198,7 @@ define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ -nostdlib -Wl,-soname,$(notdir $@) \ -Wl,--gc-sections \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -221,7 +221,7 @@ $(hide) $(PRIVATE_CXX) \ endef define $(combo_2nd_arch_prefix)transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk index f57f695..3cef5e5 100644 --- a/core/combo/TARGET_linux-arm64.mk +++ b/core/combo/TARGET_linux-arm64.mk @@ -73,7 +73,6 @@ TARGET_GLOBAL_CFLAGS += \ android_config_h := $(call select-android-config-h,linux-arm64) TARGET_GLOBAL_CFLAGS += \ - -fpic -fPIE \ -fstack-protector \ -ffunction-sections \ -fdata-sections \ @@ -163,7 +162,7 @@ define transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ -nostdlib -Wl,-soname,$(notdir $@) \ -Wl,--gc-sections \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -186,7 +185,7 @@ $(hide) $(PRIVATE_CXX) \ endef define transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ -Wl,-dynamic-linker,/system/bin/linker64 \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk index 0069bd0..5ec537a 100644 --- a/core/combo/TARGET_linux-mips.mk +++ b/core/combo/TARGET_linux-mips.mk @@ -84,7 +84,6 @@ android_config_h := $(call select-android-config-h,linux-mips) $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \ $(TARGET_mips_CFLAGS) \ -U__unix -U__unix__ -Umips \ - -fpic -fPIE\ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -171,7 +170,7 @@ define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ -nostdlib -Wl,-soname,$(notdir $@) \ -Wl,--gc-sections \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -194,7 +193,7 @@ $(hide) $(PRIVATE_CXX) \ endef define $(combo_2nd_arch_prefix)transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk index 463c7a4..b5555b2 100644 --- a/core/combo/TARGET_linux-mips64.mk +++ b/core/combo/TARGET_linux-mips64.mk @@ -84,7 +84,6 @@ android_config_h := $(call select-android-config-h,linux-mips64) TARGET_GLOBAL_CFLAGS += \ $(TARGET_mips_CFLAGS) \ -U__unix -U__unix__ -Umips \ - -fpic -fPIE\ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -175,7 +174,7 @@ define transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ -nostdlib -Wl,-soname,$(notdir $@) \ -Wl,--gc-sections \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -198,7 +197,7 @@ $(hide) $(PRIVATE_CXX) \ endef define transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ -Wl,-dynamic-linker,/system/bin/linker64 \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index 18331d5..2ebb887 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -154,7 +154,7 @@ define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -nostdlib -Wl,-soname,$(notdir $@) \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -180,7 +180,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -nostdlib -Bdynamic \ -Wl,-z,nocopyreloc \ - -fPIE -pie \ + -pie \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \ diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk index 4482a17..cd9ea76 100644 --- a/core/combo/TARGET_linux-x86_64.mk +++ b/core/combo/TARGET_linux-x86_64.mk @@ -158,7 +158,7 @@ define transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -nostdlib -Wl,-soname,$(notdir $@) \ - -shared \ + $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ $(PRIVATE_ALL_OBJECTS) \ @@ -183,7 +183,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -nostdlib -Bdynamic \ -Wl,-z,nocopyreloc \ - -fPIE -pie \ + -pie \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \ diff --git a/core/combo/arch/x86/haswell.mk b/core/combo/arch/x86/haswell.mk index a00e0a6..0b16b80 100644 --- a/core/combo/arch/x86/haswell.mk +++ b/core/combo/arch/x86/haswell.mk @@ -7,6 +7,8 @@ ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := true # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86/ivybridge.mk b/core/combo/arch/x86/ivybridge.mk index 02dc1e0..a8e66f3 100644 --- a/core/combo/arch/x86/ivybridge.mk +++ b/core/combo/arch/x86/ivybridge.mk @@ -7,6 +7,8 @@ ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := false # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86/sandybridge.mk b/core/combo/arch/x86/sandybridge.mk index dfa540c..8e474a5 100644 --- a/core/combo/arch/x86/sandybridge.mk +++ b/core/combo/arch/x86/sandybridge.mk @@ -2,9 +2,13 @@ # Generating binaries for SandyBridge processors. # ARCH_X86_HAVE_SSSE3 := true +ARCH_X86_HAVE_SSE4 := true ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true +ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := false # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86_64/haswell.mk b/core/combo/arch/x86_64/haswell.mk index 9cf95b3..6067eee 100644 --- a/core/combo/arch/x86_64/haswell.mk +++ b/core/combo/arch/x86_64/haswell.mk @@ -7,6 +7,8 @@ ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := true # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86_64/ivybridge.mk b/core/combo/arch/x86_64/ivybridge.mk index 7b95190..90e23a9 100644 --- a/core/combo/arch/x86_64/ivybridge.mk +++ b/core/combo/arch/x86_64/ivybridge.mk @@ -7,6 +7,8 @@ ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := false # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86_64/sandybridge.mk b/core/combo/arch/x86_64/sandybridge.mk index a443b6b..865548c 100644 --- a/core/combo/arch/x86_64/sandybridge.mk +++ b/core/combo/arch/x86_64/sandybridge.mk @@ -2,9 +2,13 @@ # Generating binaries for SandyBridge processors. # ARCH_X86_HAVE_SSSE3 := true +ARCH_X86_HAVE_SSE4 := true ARCH_X86_HAVE_SSE4_1 := true ARCH_X86_HAVE_SSE4_2 := true +ARCH_X86_HAVE_AES_NI := true ARCH_X86_HAVE_AVX := true +ARCH_X86_HAVE_POPCNT := true +ARCH_X86_HAVE_MOVBE := false # CFLAGS for this arch arch_variant_cflags := \ diff --git a/core/combo/arch/x86_64/x86_64-atom.mk b/core/combo/arch/x86_64/x86_64-atom.mk deleted file mode 100755 index 64b07a0..0000000 --- a/core/combo/arch/x86_64/x86_64-atom.mk +++ /dev/null @@ -1,13 +0,0 @@ -# This file contains feature macro definitions specific to the -# 'x86_64-atom' arch variant. This is an extension of the 'x86_64' base variant -# that adds Atom-specific features. -# -# See build/core/combo/arch/x86_64/x86_64.mk for differences. -# -ARCH_X86_HAVE_SSSE3 := true -ARCH_X86_HAVE_MOVBE := true -ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs - -# CFLAGS for this arch -arch_variant_cflags := \ - -march=atom diff --git a/core/combo/include/arch/darwin-x86/AndroidConfig.h b/core/combo/include/arch/darwin-x86/AndroidConfig.h index 44de4cd..db3f47f 100644 --- a/core/combo/include/arch/darwin-x86/AndroidConfig.h +++ b/core/combo/include/arch/darwin-x86/AndroidConfig.h @@ -42,12 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have the futex syscall? - */ - -/* #define HAVE_FUTEX */ - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -86,11 +80,6 @@ #define HAVE_TERMIO_H /* - * Define this if you have <sys/sendfile.h> - */ -/* #define HAVE_SYS_SENDFILE_H 1 */ - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -117,11 +106,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -/* #define HAVE_IOCTL */ - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -165,18 +149,6 @@ #define HAVE_BACKTRACE 0 /* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -/* #define HAVE_GETTID */ - - -/* * Add any extra platform-specific defines here. */ #define _THREAD_SAFE @@ -221,11 +193,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.dylib" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -248,11 +215,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/linux-arm/AndroidConfig.h b/core/combo/include/arch/linux-arm/AndroidConfig.h index 0eb6c72..c2a2134 100644 --- a/core/combo/include/arch/linux-arm/AndroidConfig.h +++ b/core/combo/include/arch/linux-arm/AndroidConfig.h @@ -42,19 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have pthread_setname_np()? - * - * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with - * the same name but different parameters, so we can't use that here.) - */ -#define HAVE_ANDROID_PTHREAD_SETNAME_NP - -/* - * Do we have the futex syscall? - */ -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -93,11 +80,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -124,11 +106,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -173,17 +150,6 @@ */ #define HAVE_BACKTRACE 0 -/* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -#define HAVE_GETTID - /* * Defined if we have the sched_setscheduler() call */ @@ -258,11 +224,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -283,11 +244,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/linux-arm64/AndroidConfig.h b/core/combo/include/arch/linux-arm64/AndroidConfig.h index bcbda8f..93e034f 100644 --- a/core/combo/include/arch/linux-arm64/AndroidConfig.h +++ b/core/combo/include/arch/linux-arm64/AndroidConfig.h @@ -42,19 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have pthread_setname_np()? - * - * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with - * the same name but different parameters, so we can't use that here.) - */ -#define HAVE_ANDROID_PTHREAD_SETNAME_NP - -/* - * Do we have the futex syscall? - */ -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -93,11 +80,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -124,11 +106,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -169,17 +146,6 @@ #define HAVE_BACKTRACE 0 /* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -#define HAVE_GETTID - -/* * Defined if we have the sched_setscheduler() call */ #define HAVE_SCHED_SETSCHEDULER @@ -253,11 +219,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -278,11 +239,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/linux-mips/AndroidConfig.h b/core/combo/include/arch/linux-mips/AndroidConfig.h index 076d711..4a0ddc1 100644 --- a/core/combo/include/arch/linux-mips/AndroidConfig.h +++ b/core/combo/include/arch/linux-mips/AndroidConfig.h @@ -42,19 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have pthread_setname_np()? - * - * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with - * the same name but different parameters, so we can't use that here.) - */ -#define HAVE_ANDROID_PTHREAD_SETNAME_NP - -/* - * Do we have the futex syscall? - */ -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -93,11 +80,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -124,11 +106,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -179,17 +156,6 @@ #define HAVE_BACKTRACE 0 /* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -#define HAVE_GETTID - -/* * Defined if we have the sched_setscheduler() call */ #define HAVE_SCHED_SETSCHEDULER @@ -275,11 +241,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -300,11 +261,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/linux-mips64/AndroidConfig.h b/core/combo/include/arch/linux-mips64/AndroidConfig.h index 7ded3ce..eb2421a 100644 --- a/core/combo/include/arch/linux-mips64/AndroidConfig.h +++ b/core/combo/include/arch/linux-mips64/AndroidConfig.h @@ -42,19 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have pthread_setname_np()? - * - * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with - * the same name but different parameters, so we can't use that here.) - */ -#define HAVE_ANDROID_PTHREAD_SETNAME_NP - -/* - * Do we have the futex syscall? - */ -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -93,11 +80,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -124,11 +106,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -169,17 +146,6 @@ #define HAVE_BACKTRACE 0 /* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -#define HAVE_GETTID - -/* * Defined if we have the sched_setscheduler() call */ #define HAVE_SCHED_SETSCHEDULER @@ -265,11 +231,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -290,11 +251,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/linux-x86/AndroidConfig.h b/core/combo/include/arch/linux-x86/AndroidConfig.h index ebb95b0..68dbee0 100644 --- a/core/combo/include/arch/linux-x86/AndroidConfig.h +++ b/core/combo/include/arch/linux-x86/AndroidConfig.h @@ -42,12 +42,6 @@ #define HAVE_PTHREADS /* - * Do we have the futex syscall? - */ - -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -86,11 +80,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against MSVCRT.DLL */ /* #define HAVE_MS_C_RUNTIME */ @@ -117,11 +106,6 @@ #define HAVE_GETHOSTBYNAME_R /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -166,17 +150,6 @@ */ #define HAVE_BACKTRACE 1 -/* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -/* #define HAVE_GETTID */ - /* * Defined if we have the sched_setscheduler() call */ @@ -238,11 +211,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -263,11 +231,6 @@ /* #define HAVE_STRLCPY 1 */ /* - * Define if the open_memstream() function exists on the system. - */ -#define HAVE_OPEN_MEMSTREAM 1 - -/* * Define if the BSD funopen() function exists on the system. */ /* #define HAVE_FUNOPEN 1 */ diff --git a/core/combo/include/arch/target_linux-x86/AndroidConfig.h b/core/combo/include/arch/target_linux-x86/AndroidConfig.h index 5b56b51..25b5973 100644 --- a/core/combo/include/arch/target_linux-x86/AndroidConfig.h +++ b/core/combo/include/arch/target_linux-x86/AndroidConfig.h @@ -28,19 +28,6 @@ #define HAVE_PTHREADS /* - * Do we have pthread_setname_np()? - * - * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with - * the same name but different parameters, so we can't use that here.) - */ -#define HAVE_ANDROID_PTHREAD_SETNAME_NP - -/* - * Do we have the futex syscall? - */ -#define HAVE_FUTEX - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -79,11 +66,6 @@ #define HAVE_TERMIO_H 1 /* - * Define this if you have <sys/sendfile.h> - */ -#define HAVE_SYS_SENDFILE_H 1 - -/* * Define this if you build against have Microsoft C runtime (MSVCRT.DLL) */ /* #define HAVE_MS_C_RUNTIME */ @@ -110,11 +92,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -#define HAVE_IOCTL - -/* * Define this if we want to use WinSock. */ /* #define HAVE_WINSOCK */ @@ -162,17 +139,6 @@ */ #define HAVE_BACKTRACE 0 -/* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* - * Defined if we have the gettid() system call. - */ -#define HAVE_GETTID - /* * Defined if we have the sched_setscheduler() call */ @@ -247,11 +213,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.so" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '/' @@ -272,11 +233,6 @@ #define HAVE_STRLCPY 1 /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ #define HAVE_FUNOPEN 1 diff --git a/core/combo/include/arch/windows/AndroidConfig.h b/core/combo/include/arch/windows/AndroidConfig.h index 0a52674..8aa9e7b 100644 --- a/core/combo/include/arch/windows/AndroidConfig.h +++ b/core/combo/include/arch/windows/AndroidConfig.h @@ -64,13 +64,6 @@ #define HAVE_WIN32_THREADS /* - * Do we have the futex syscall? - */ - -/* #define HAVE_FUTEX */ - - -/* * Process creation model. Choose one: * * HAVE_FORKEXEC - use fork() and exec() @@ -119,13 +112,6 @@ #endif /* - * Define this if you have <sys/sendfile.h> - */ -#ifdef __CYGWIN__ -# define HAVE_SYS_SENDFILE_H 1 -#endif - -/* * Define this if you build against MSVCRT.DLL */ #ifndef __CYGWIN__ @@ -151,11 +137,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -/* #define HAVE_IOCTL */ - -/* * Define this if we want to use WinSock. */ #ifndef __CYGWIN__ @@ -207,12 +188,6 @@ #define HAVE_BACKTRACE 0 /* - * Defined if we have the cxxabi.h header for demangling C++ symbols. If - * not defined, stack crawls will be displayed with raw mangled symbols - */ -#define HAVE_CXXABI 0 - -/* * Define if tm struct has tm_gmtoff field */ /* #define HAVE_TM_GMTOFF 1 */ @@ -258,11 +233,6 @@ #define OS_SHARED_LIB_FORMAT_STR "lib%s.dll" /* - * type for the third argument to mincore(). - */ -#define MINCORE_POINTER_TYPE unsigned char * - -/* * The default path separator for the platform */ #define OS_PATH_SEPARATOR '\\' @@ -288,11 +258,6 @@ /* #define HAVE_STRLCPY 1 */ /* - * Define if the open_memstream() function exists on the system. - */ -/* #define HAVE_OPEN_MEMSTREAM 1 */ - -/* * Define if the BSD funopen() function exists on the system. */ /* #define HAVE_FUNOPEN 1 */ diff --git a/core/definitions.mk b/core/definitions.mk index 177dbc7..9b8a299 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -884,7 +884,7 @@ $(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \ -Wl,-rpath,\$$ORIGIN/../lib \ $(dir $@)/$(notdir $(<:.bc=.o)) \ $(RS_PREBUILT_COMPILER_RT) \ - -o $@ -L prebuilts/gcc/ \ + -o $@ $(TARGET_GLOBAL_LDFLAGS) -L prebuilts/gcc/ \ -L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(RS_PREBUILT_LIBPATH) \ -lRSSupport -lm -lc endef @@ -1176,7 +1176,7 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-target-whole-static-lib -@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" +@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]" $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ rm -rf $$ldir; \ mkdir -p $$ldir; \ @@ -1190,8 +1190,16 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs; endef +# $(1): the full path of the source static library. +define extract-and-include-whole-static-libs-first +$(if $(strip $(1)), +@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]" +$(hide) cp $(1) $@) +endef + define extract-and-include-target-whole-static-libs -$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \ +$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES))) +$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \ $(call _extract-and-include-single-target-whole-static-lib, $(lib))) endef @@ -1213,7 +1221,7 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-host-whole-static-lib -@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" +@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]" $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ rm -rf $$ldir; \ mkdir -p $$ldir; \ @@ -1228,7 +1236,8 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs; endef define extract-and-include-host-whole-static-libs -$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \ +$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES))) +$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \ $(call _extract-and-include-single-host-whole-static-lib, $(lib))) endef @@ -1309,7 +1318,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \ -Wl,-rpath,\$$ORIGIN/../lib \ - -shared -Wl,-soname,$(notdir $@) \ + -Wl,-shared -Wl,-soname,$(notdir $@) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(PRIVATE_ALL_OBJECTS) \ @@ -1413,7 +1422,7 @@ endef ifdef BUILD_HOST_static HOST_FPIE_FLAGS := else -HOST_FPIE_FLAGS := -fPIE -pie +HOST_FPIE_FLAGS := -pie endif ifneq ($(HOST_CUSTOM_LD_COMMAND),true) diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 2d9c518..5af2be2 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -90,5 +90,6 @@ $(hide) $(DEX2OATD) \ --oat-file=$(2) \ --android-root=$(PRODUCT_OUT)/system \ --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ - --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) + --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ + --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols endef diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk index 7eefc0b..fe4c5a4 100644 --- a/core/dex_preopt_libart_boot.mk +++ b/core/dex_preopt_libart_boot.mk @@ -53,4 +53,4 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ - --android-root=$(PRODUCT_OUT)/system + --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 613b058..10b41bd 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -32,6 +32,12 @@ endif ifneq (,$(filter $(LOCAL_MODULE),$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA))) LOCAL_DEX_PREOPT := endif +# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip +ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY)) +ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),) +LOCAL_DEX_PREOPT := +endif +endif built_odex := installed_odex := diff --git a/core/envsetup.mk b/core/envsetup.mk index d0b5846..efcad0d 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -58,7 +58,7 @@ BUILD_OS := $(HOST_OS) # Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the # Windows SDK. Only a subset of tools and SDK will manage to build properly. ifeq ($(HOST_OS),linux) -ifneq ($(USE_MINGW),) +ifdef USE_MINGW HOST_OS := windows endif endif @@ -67,13 +67,6 @@ ifeq ($(HOST_OS),) $(error Unable to determine HOST_OS from uname -sm: $(UNAME)!) endif -# TODO: Replace BUILD_HOST_64bit with a flag that forces 32-bit build, -# after we default to 64-bit host build. -ifeq (,$(BUILD_HOST_64bit)) -# Default to 32-bit-by-default multilib host build. -HOST_PREFER_32_BIT := true -endif - # HOST_ARCH ifneq (,$(findstring x86_64,$(UNAME))) HOST_ARCH := x86_64 @@ -81,12 +74,6 @@ ifneq (,$(findstring x86_64,$(UNAME))) HOST_IS_64_BIT := true endif -ifeq ($(HOST_PREFER_32_BIT),true) -SDK_HOST_ARCH := x86 -else -SDK_HOST_ARCH := $(HOST_ARCH) -endif - BUILD_ARCH := $(HOST_ARCH) BUILD_2ND_ARCH := $(HOST_2ND_ARCH) @@ -133,6 +120,17 @@ $(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT)) $(error must be empty or one of: eng user userdebug) endif +# Build host as 32-bit for SDK build. +ifneq ($(filter $(MAKECMDGOALS),win_sdk sdk),) +HOST_PREFER_32_BIT := true +endif +ifdef USE_MINGW +# We only build sdk host tools in the MinGW windows build. +# Build it as 32-bit as well. +HOST_PREFER_32_BIT := true +endif +SDK_HOST_ARCH := x86 + # Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) # or under vendor/*/$(TARGET_DEVICE). Search in both places, but # make sure only one exists. @@ -238,7 +236,11 @@ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES) # The default host library path. # It always points to the path where we build libraries in the default bitness. -HOST_LIBRARY_PATH := $(HOST_OUT)/lib +ifeq ($(HOST_PREFER_32_BIT),true) +HOST_LIBRARY_PATH := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES) +else +HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) +endif TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include diff --git a/core/executable_internal.mk b/core/executable_internal.mk index 2e380b6..3d17eb0 100644 --- a/core/executable_internal.mk +++ b/core/executable_internal.mk @@ -26,6 +26,13 @@ ifndef skip_build_from_source include $(BUILD_SYSTEM)/dynamic_binary.mk +# Check for statically linked libc +ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) +ifneq ($(filter $(my_static_libraries),libc),) +$(error $(LOCAL_PATH): $(LOCAL_MODULE) is statically linking libc to dynamic executable, please remove libc from static libs or set LOCAL_FORCE_STATIC_EXECUTABLE := true) +endif +endif + # Define PRIVATE_ variables from global vars my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS) my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB) diff --git a/core/main.mk b/core/main.mk index be2b300..d719b38 100644 --- a/core/main.mk +++ b/core/main.mk @@ -312,6 +312,11 @@ ifneq ($(filter sdk win_sdk sdk_addon,$(MAKECMDGOALS)),) is_sdk_build := true endif +ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) +ifdef TARGET_2ND_ARCH +ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) +endif + ## user/userdebug ## user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT)) @@ -378,9 +383,9 @@ ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL ro.setupwizard.mode=OPTIONAL endif # Don't even verify the image on eng builds to speed startup -ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-flags=--compiler-filter=verify-none +ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-none # Don't compile apps on eng builds to speed startup -ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dex2oat-flags=--compiler-filter=interpret-only +ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dex2oat-filter=interpret-only endif ## sdk ## diff --git a/core/product.mk b/core/product.mk index fd405ad..dbf49b5 100644 --- a/core/product.mk +++ b/core/product.mk @@ -253,7 +253,8 @@ _product_stash_var_list += \ _product_stash_var_list += \ DEFAULT_SYSTEM_DEV_CERTIFICATE \ - WITH_DEXPREOPT + WITH_DEXPREOPT \ + WITH_DEXPREOPT_BOOT_IMG_ONLY # # Stash values of the variables in _product_stash_var_list. diff --git a/envsetup.sh b/envsetup.sh index 5c66a9e..2cd342c 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1,3 +1,4 @@ +MAKE_UTIL=(`which make`) function hmm() { cat <<EOF Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: @@ -35,7 +36,7 @@ function get_abs_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-abs-$1) + $MAKE_UTIL --no-print-directory -f build/core/config.mk dumpvar-abs-$1) } # Get the exact value of a build variable. @@ -47,7 +48,7 @@ function get_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-$1) + $MAKE_UTIL --no-print-directory -f build/core/config.mk dumpvar-$1) } # check to see if the supplied product is one we can build @@ -1445,6 +1446,36 @@ function pez { return $retval } +function make() +{ + local start_time=$(date +"%s") + $MAKE_UTIL $@ + local ret=$? + local end_time=$(date +"%s") + local tdiff=$(($end_time-$start_time)) + local hours=$(($tdiff / 3600 )) + local mins=$((($tdiff % 3600) / 60)) + local secs=$(($tdiff % 60)) + echo + if [ $ret -eq 0 ] ; then + echo -n -e "\e[0;32m#### make completed successfully " + else + echo -n -e "\e[0;31m#### make failed to build some targets " + fi + if [ $hours -gt 0 ] ; then + printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs + elif [ $mins -gt 0 ] ; then + printf "(%02g:%02g (mm:ss))" $mins $secs + elif [ $secs -gt 0 ] ; then + printf "(%s seconds)" $secs + fi + echo -e " ####\e[00m" + echo + return $ret +} + + + if [ "x$SHELL" != "x/bin/bash" ]; then case `ps -o command -p $$` in *bash*) diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk index 354fb2a..733c83c 100644 --- a/target/board/generic_arm64/device.mk +++ b/target/board/generic_arm64/device.mk @@ -27,6 +27,16 @@ PRODUCT_COPY_FILES := \ device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \ device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml +# The ranchu configuration files are needed to run under qemu-android +PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ + device/generic/goldfish/init.ranchu.rc:root/init.ranchu.rc \ + device/generic/goldfish/fstab.ranchu:root/fstab.ranchu \ + device/generic/goldfish/ueventd.ranchu.rc:root/ueventd.ranchu.rc) + PRODUCT_PACKAGES := \ audio.primary.goldfish \ vibrator.goldfish + +# Adjust the Dalvik heap to be appropriate for a tablet. +$(call inherit-product-if-exists, frameworks/base/build/tablet-dalvik-heap.mk) +$(call inherit-product-if-exists, frameworks/native/build/tablet-dalvik-heap.mk) diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk index e119466..ea8ec06 100644 --- a/target/product/aosp_arm64.mk +++ b/target/product/aosp_arm64.mk @@ -23,8 +23,6 @@ $(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) -PRODUCT_RUNTIMES := runtime_libart_default - include $(SRC_TARGET_DIR)/product/emulator.mk PRODUCT_NAME := aosp_arm64 PRODUCT_DEVICE := generic_arm64 diff --git a/target/product/core_base.mk b/target/product/core_base.mk index 529b5f2..26180da 100644 --- a/target/product/core_base.mk +++ b/target/product/core_base.mk @@ -80,5 +80,4 @@ PRODUCT_BOOT_JARS := \ mms-common \ android.policy \ services \ - apache-xml \ - webviewchromium + apache-xml diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk index b1d6546..4b8b9ef 100644 --- a/target/product/core_minimal.mk +++ b/target/product/core_minimal.mk @@ -72,8 +72,7 @@ PRODUCT_BOOT_JARS := \ framework2 \ android.policy \ services \ - apache-xml \ - webviewchromium + apache-xml PRODUCT_RUNTIMES := runtime_libart_default diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk index 6cb8818..e4200b3 100644 --- a/target/product/runtime_libart.mk +++ b/target/product/runtime_libart.mk @@ -20,12 +20,14 @@ PRODUCT_PACKAGES += \ core-libart \ libart \ dex2oat \ - oatdump + oatdump \ + patchoat PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ dalvik.vm.image-dex2oat-Xms=64m \ dalvik.vm.image-dex2oat-Xmx=64m \ dalvik.vm.dex2oat-Xms=64m \ dalvik.vm.dex2oat-Xmx=512m \ + ro.dalvik.vm.native.bridge=0 \ include $(SRC_TARGET_DIR)/product/runtime_common.mk diff --git a/target/product/sdk_arm64.mk b/target/product/sdk_arm64.mk index 9aa58b3..d724207 100644 --- a/target/product/sdk_arm64.mk +++ b/target/product/sdk_arm64.mk @@ -21,6 +21,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) # Overrides PRODUCT_BRAND := generic_arm64 diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index f179717..b992da3 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -292,6 +292,11 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, "kernel")] + fn = os.path.join(sourcedir, "second") + if os.access(fn, os.F_OK): + cmd.append("--second") + cmd.append(fn) + fn = os.path.join(sourcedir, "cmdline") if os.access(fn, os.F_OK): cmd.append("--cmdline") diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java index e661e50..d020736 100644 --- a/tools/signapk/SignApk.java +++ b/tools/signapk/SignApk.java @@ -621,8 +621,12 @@ class SignApk { this.type = new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()); } + /** + * This should actually return byte[] or something similar, but nothing + * actually checks it currently. + */ public Object getContent() { - throw new UnsupportedOperationException(); + return this; } public ASN1ObjectIdentifier getContentType() { diff --git a/tools/signtos/Android.mk b/tools/signtos/Android.mk new file mode 100644 index 0000000..94ab944 --- /dev/null +++ b/tools/signtos/Android.mk @@ -0,0 +1,25 @@ +# +# 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. +# +LOCAL_PATH := $(call my-dir) + +# the signtos tool - signs Trusty images +# ============================================================ +include $(CLEAR_VARS) +LOCAL_MODULE := signtos +LOCAL_SRC_FILES := SignTos.java +LOCAL_JAR_MANIFEST := SignTos.mf +LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-host bouncycastle-bcpkix-host +include $(BUILD_HOST_JAVA_LIBRARY) diff --git a/tools/signtos/SignTos.java b/tools/signtos/SignTos.java new file mode 100644 index 0000000..485ad2f --- /dev/null +++ b/tools/signtos/SignTos.java @@ -0,0 +1,314 @@ +/* + * Copyright 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. + */ + +package com.android.signtos; + +import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.security.GeneralSecurityException; +import java.security.Key; +import java.security.KeyFactory; +import java.security.MessageDigest; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.PublicKey; +import java.security.Security; +import java.security.Signature; +import java.security.interfaces.ECKey; +import java.security.interfaces.ECPublicKey; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Arrays; + +import javax.crypto.Cipher; +import javax.crypto.EncryptedPrivateKeyInfo; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; + +/** + * Signs Trusty images for use with operating systems that support it. + */ +public class SignTos { + /** Size of the signature footer in bytes. */ + private static final int SIGNATURE_BLOCK_SIZE = 256; + + /** Current signature version code we use. */ + private static final int VERSION_CODE = 1; + + /** Size of the header on the file to skip. */ + private static final int HEADER_SIZE = 512; + + private static BouncyCastleProvider sBouncyCastleProvider; + + /** + * Reads the password from stdin and returns it as a string. + * + * @param keyFile The file containing the private key. Used to prompt the user. + */ + private static String readPassword(File keyFile) { + // TODO: use Console.readPassword() when it's available. + System.out.print("Enter password for " + keyFile + " (password will not be hidden): "); + System.out.flush(); + BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + try { + return stdin.readLine(); + } catch (IOException ex) { + return null; + } + } + + /** + * Decrypt an encrypted PKCS#8 format private key. + * + * Based on ghstark's post on Aug 6, 2006 at + * http://forums.sun.com/thread.jspa?threadID=758133&messageID=4330949 + * + * @param encryptedPrivateKey The raw data of the private key + * @param keyFile The file containing the private key + */ + private static PKCS8EncodedKeySpec decryptPrivateKey(byte[] encryptedPrivateKey, File keyFile) + throws GeneralSecurityException { + EncryptedPrivateKeyInfo epkInfo; + try { + epkInfo = new EncryptedPrivateKeyInfo(encryptedPrivateKey); + } catch (IOException ex) { + // Probably not an encrypted key. + return null; + } + + char[] password = readPassword(keyFile).toCharArray(); + + SecretKeyFactory skFactory = SecretKeyFactory.getInstance(epkInfo.getAlgName()); + Key key = skFactory.generateSecret(new PBEKeySpec(password)); + + Cipher cipher = Cipher.getInstance(epkInfo.getAlgName()); + cipher.init(Cipher.DECRYPT_MODE, key, epkInfo.getAlgParameters()); + + try { + return epkInfo.getKeySpec(cipher); + } catch (InvalidKeySpecException ex) { + System.err.println("signapk: Password for " + keyFile + " may be bad."); + throw ex; + } + } + + /** Read a PKCS#8 format private key. */ + private static PrivateKey readPrivateKey(File file) throws IOException, + GeneralSecurityException { + DataInputStream input = new DataInputStream(new FileInputStream(file)); + try { + byte[] bytes = new byte[(int) file.length()]; + input.read(bytes); + + /* Check to see if this is in an EncryptedPrivateKeyInfo structure. */ + PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file); + if (spec == null) { + spec = new PKCS8EncodedKeySpec(bytes); + } + + /* + * Now it's in a PKCS#8 PrivateKeyInfo structure. Read its Algorithm + * OID and use that to construct a KeyFactory. + */ + ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded())); + PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject()); + String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId(); + + return KeyFactory.getInstance(algOid).generatePrivate(spec); + } finally { + input.close(); + } + } + + /** + * Tries to load a JSE Provider by class name. This is for custom PrivateKey + * types that might be stored in PKCS#11-like storage. + */ + private static void loadProviderIfNecessary(String providerClassName) { + if (providerClassName == null) { + return; + } + + final Class<?> klass; + try { + final ClassLoader sysLoader = ClassLoader.getSystemClassLoader(); + if (sysLoader != null) { + klass = sysLoader.loadClass(providerClassName); + } else { + klass = Class.forName(providerClassName); + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + System.exit(1); + return; + } + + Constructor<?> constructor = null; + for (Constructor<?> c : klass.getConstructors()) { + if (c.getParameterTypes().length == 0) { + constructor = c; + break; + } + } + if (constructor == null) { + System.err.println("No zero-arg constructor found for " + providerClassName); + System.exit(1); + return; + } + + final Object o; + try { + o = constructor.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + return; + } + if (!(o instanceof Provider)) { + System.err.println("Not a Provider class: " + providerClassName); + System.exit(1); + } + + Security.insertProviderAt((Provider) o, 1); + } + + private static String getSignatureAlgorithm(Key key) { + if ("EC".equals(key.getAlgorithm())) { + ECKey ecKey = (ECKey) key; + int curveSize = ecKey.getParams().getOrder().bitLength(); + if (curveSize <= 256) { + return "SHA256withECDSA"; + } else if (curveSize <= 384) { + return "SHA384withECDSA"; + } else { + return "SHA512withECDSA"; + } + } else { + throw new IllegalArgumentException("Unsupported key type " + key.getAlgorithm()); + } + } + + /** + * @param inputFilename + * @param outputFilename + */ + private static void signWholeFile(InputStream input, OutputStream output, PrivateKey signingKey) + throws Exception { + Signature sig = Signature.getInstance(getSignatureAlgorithm(signingKey)); + sig.initSign(signingKey); + + byte[] buffer = new byte[8192]; + + /* Skip the header. */ + int skippedBytes = 0; + while (skippedBytes != HEADER_SIZE) { + int bytesRead = input.read(buffer, 0, HEADER_SIZE - skippedBytes); + output.write(buffer, 0, bytesRead); + skippedBytes += bytesRead; + } + + int totalBytes = 0; + for (;;) { + int bytesRead = input.read(buffer); + if (bytesRead == -1) { + break; + } + totalBytes += bytesRead; + sig.update(buffer, 0, bytesRead); + output.write(buffer, 0, bytesRead); + } + + byte[] sigBlock = new byte[SIGNATURE_BLOCK_SIZE]; + sigBlock[0] = VERSION_CODE; + sig.sign(sigBlock, 1, sigBlock.length - 1); + + output.write(sigBlock); + } + + private static void usage() { + System.err.println("Usage: signtos " + + "[-providerClass <className>] " + + " privatekey.pk8 " + + "input.img output.img"); + System.exit(2); + } + + public static void main(String[] args) throws Exception { + if (args.length < 3) { + usage(); + } + + String providerClass = null; + String providerArg = null; + + int argstart = 0; + while (argstart < args.length && args[argstart].startsWith("-")) { + if ("-providerClass".equals(args[argstart])) { + if (argstart + 1 >= args.length) { + usage(); + } + providerClass = args[++argstart]; + ++argstart; + } else { + usage(); + } + } + + /* + * Should only be "<privatekey> <input> <output>" left. + */ + if (argstart != args.length - 3) { + usage(); + } + + sBouncyCastleProvider = new BouncyCastleProvider(); + Security.addProvider(sBouncyCastleProvider); + + loadProviderIfNecessary(providerClass); + + String keyFilename = args[args.length - 3]; + String inputFilename = args[args.length - 2]; + String outputFilename = args[args.length - 1]; + + PrivateKey privateKey = readPrivateKey(new File(keyFilename)); + + InputStream input = new BufferedInputStream(new FileInputStream(inputFilename)); + OutputStream output = new BufferedOutputStream(new FileOutputStream(outputFilename)); + try { + SignTos.signWholeFile(input, output, privateKey); + } finally { + input.close(); + output.close(); + } + + System.out.println("Successfully signed: " + outputFilename); + } +} diff --git a/tools/signtos/SignTos.mf b/tools/signtos/SignTos.mf new file mode 100644 index 0000000..d860296 --- /dev/null +++ b/tools/signtos/SignTos.mf @@ -0,0 +1 @@ +Main-Class: com.android.signtos.SignTos diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk index 708c8bf..49f9043 100644 --- a/tools/zipalign/Android.mk +++ b/tools/zipalign/Android.mk @@ -24,7 +24,7 @@ ifeq ($(HOST_OS),linux) LOCAL_LDLIBS += -lrt endif -ifneq ($(strip $(USE_MINGW)),) +ifdef USE_MINGW LOCAL_STATIC_LIBRARIES += libz else LOCAL_LDLIBS += -lz |