diff options
56 files changed, 643 insertions, 618 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index f348692..07b3ece 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -284,6 +284,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system) +# 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) diff --git a/core/Makefile b/core/Makefile index d3fc6cc..ffa3544 100644 --- a/core/Makefile +++ b/core/Makefile @@ -726,7 +726,7 @@ recovery_sepolicy := $(call intermediates-dir-for,ETC,sepolicy.recovery)/sepolic recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) -recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery +recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery,,,$(TARGET_PREFER_32_BIT))/recovery recovery_resources_common := $(call include-path-for, recovery)/res # Set recovery_density to the density bucket of the device. @@ -1275,11 +1275,11 @@ define package_files-copy-root endef built_ota_tools := \ - $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ - $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \ - $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \ - $(call intermediates-dir-for,EXECUTABLES,sqlite3)/sqlite3 \ - $(call intermediates-dir-for,EXECUTABLES,updater)/updater + $(call intermediates-dir-for,EXECUTABLES,applypatch,,,$(TARGET_PREFER_32_BIT))/applypatch \ + $(call intermediates-dir-for,EXECUTABLES,applypatch_static,,,$(TARGET_PREFER_32_BIT))/applypatch_static \ + $(call intermediates-dir-for,EXECUTABLES,check_prereq,,,$(TARGET_PREFER_32_BIT))/check_prereq \ + $(call intermediates-dir-for,EXECUTABLES,sqlite3,,,$(TARGET_PREFER_32_BIT))/sqlite3 \ + $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION) diff --git a/core/binary.mk b/core/binary.mk index d339317..507a7db 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -107,16 +107,18 @@ my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) my_cflags := $(LOCAL_CFLAGS) my_cppflags := $(LOCAL_CPPFLAGS) my_ldflags := $(LOCAL_LDFLAGS) +my_ldlibs := $(LOCAL_LDLIBS) my_asflags := $(LOCAL_ASFLAGS) my_cc := $(LOCAL_CC) my_cxx := $(LOCAL_CXX) my_c_includes := $(LOCAL_C_INCLUDES) my_generated_sources := $(LOCAL_GENERATED_SOURCES) +my_native_coverage := $(LOCAL_NATIVE_COVERAGE) # 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. -ifeq ($(strip $(USE_MINGW)),) +ifndef USE_MINGW ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES) my_cflags += -fpie else @@ -133,12 +135,29 @@ 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 +# enable it unless we've specifically disabled clang above +ifdef LOCAL_IS_HOST_MODULE + ifneq ($(HOST_OS),windows) + ifeq ($(my_clang),) + my_clang := true + endif + 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 @@ -147,11 +166,66 @@ my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCA my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags)) +# Only around for development purposes. Will be removed soon. +my_libcxx_is_default := false + +# Select the appropriate C++ STL +ifeq ($(strip $(LOCAL_CXX_STL)),default) + ifndef LOCAL_SDK_VERSION + ifeq ($(strip $(my_libcxx_is_default)),true) + # Platform code. Select the appropriate STL. + my_cxx_stl := libc++ + else + my_cxx_stl := bionic + endif + else + my_cxx_stl := ndk + endif +else + my_cxx_stl := $(strip $(LOCAL_CXX_STL)) +endif -# Replace libstdc++ with libc++ if it's seen -my_libcxx := $(filter libc++, $(my_shared_libraries)) -ifdef my_libcxx -my_system_shared_libraries := $(filter-out libstdc++, $(my_system_shared_libraries)) +ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),) + my_cflags += -D_USING_LIBCXX + my_c_includes += external/libcxx/include + ifeq ($(my_cxx_stl),libc++) + my_shared_libraries += libc++ + else + my_static_libraries += libc++_static + endif + + ifdef LOCAL_IS_HOST_MODULE + my_cppflags += -nostdinc++ + my_ldflags += -nodefaultlibs + my_ldlibs += -lc -lm + endif +else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),) + my_c_includes += external/stlport/stlport bionic/libstdc++/include bionic + ifeq ($(my_cxx_stl),stlport) + my_shared_libraries += libstdc++ libstlport + else + my_static_libraries += libstdc++ libstlport_static + endif +else ifeq ($(my_cxx_stl),ndk) + # Using an NDK STL. Handled farther up in this file. + ifndef LOCAL_IS_HOST_MODULE + my_system_shared_libraries += libstdc++ + endif +else ifeq ($(my_cxx_stl),bionic) + # Using bionic's basic libstdc++. Not actually an STL. Only around until the + # tree is in good enough shape to not need it. + ifndef LOCAL_IS_HOST_MODULE + my_c_includes += bionic/libstdc++/include + my_system_shared_libraries += libstdc++ + endif + # Host builds will use GNU libstdc++. +else ifeq ($(my_cxx_stl),none) + ifdef LOCAL_IS_HOST_MODULE + my_cppflags += -nostdinc++ + my_ldflags += -nodefaultlibs -lc -lm + endif +else + $(error $(my_cxx_stl) is not a supported STL.) endif # Add static HAL libraries @@ -250,6 +324,31 @@ my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAG my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS) endif # my_clang +# If the global flag NATIVE_COVERAGE is set, my_native_coverage will be true +# unless the module explicitly sets my_native_coverage := false. +ifeq ($(NATIVE_COVERAGE),true) + ifeq ($(my_native_coverage),true) + # We can't currently generate coverage for clang binaries for two + # reasons: + # + # 1) b/17574078 We currently don't have a prebuilt + # libclang_rt.profile-<ARCH>.a, which clang is hardcoded to link if + # --coverage is passed in the link stage. For now we manually link + # libprofile_rt (which is the name it is built as from + # external/compiler-rt). + # + # 2) b/17583330 Clang doesn't generate .gcno files when using + # -no-integrated-as. Since most of the assembly in our tree is + # incompatible with clang's assembler, we can't turn off this flag. + ifneq ($(my_clang),true) + my_target_global_cflags += --coverage + my_target_global_ldflags += --coverage + endif + endif +else + my_native_coverage := false +endif + $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) @@ -297,7 +396,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) @@ -313,7 +412,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) @@ -363,7 +462,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 @@ -917,6 +1016,10 @@ endif ########################################################### ifeq ($(my_clang),true) +my_cflags += $(LOCAL_CLANG_CFLAGS) +my_cpplags += $(LOCAL_CLANG_CPPFLAGS) +my_asflags += $(LOCAL_CLANG_ASFLAGS) +my_ldflags += $(LOCAL_CLANG_LDFLAGS) my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags)) my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags)) my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags)) @@ -933,7 +1036,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LIBCXX := $(my_libcxx) diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk index 510a74d..fb5cbf4 100644 --- a/core/clang/HOST_x86.mk +++ b/core/clang/HOST_x86.mk @@ -11,6 +11,10 @@ CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA endif ifeq ($(HOST_OS),darwin) CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS) endif ifeq ($(HOST_OS),windows) CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32 diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk index 6b94525..5f70678 100644 --- a/core/clang/HOST_x86_64.mk +++ b/core/clang/HOST_x86_64.mk @@ -11,6 +11,10 @@ CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EX endif ifeq ($(HOST_OS),darwin) CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS) endif ifeq ($(HOST_OS),windows) CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64 diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk index 0241cb6..92058e1 100644 --- a/core/clang/HOST_x86_common.mk +++ b/core/clang/HOST_x86_common.mk @@ -1,7 +1,11 @@ # Shared by HOST_x86.mk and HOST_x86_64.mk. ifeq ($(HOST_OS),darwin) -# nothing required here yet +CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS := \ + -integrated-as + +CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS := \ + -integrated-as endif ifeq ($(HOST_OS),linux) @@ -18,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/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 c1625f2..b58d264 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -43,16 +43,19 @@ 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 CLANG_CONFIG_HOST_EXTRA_ASFLAGS := diff --git a/core/clear_vars.mk b/core/clear_vars.mk index f23c4a6..8692e73 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -46,11 +46,15 @@ LOCAL_YACCFLAGS:= LOCAL_ASFLAGS:= LOCAL_CFLAGS:= LOCAL_CPPFLAGS:= +LOCAL_CLANG_ASFLAGS:= +LOCAL_CLANG_CFLAGS:= +LOCAL_CLANG_CPPFLAGS:= LOCAL_CONLYFLAGS:= LOCAL_RTTI_FLAG:= LOCAL_C_INCLUDES:= LOCAL_EXPORT_C_INCLUDE_DIRS:= LOCAL_LDFLAGS:= +LOCAL_CLANG_LDFLAGS:= LOCAL_LDLIBS:= LOCAL_AAPT_FLAGS:= LOCAL_AAPT_INCLUDE_ALL_RESOURCES:= @@ -144,6 +148,7 @@ LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true LOCAL_DONT_DELETE_JAR_META_INF:= LOCAL_ADDITIONAL_CERTIFICATES:= LOCAL_PREBUILT_MODULE_FILE:= +LOCAL_POST_LINK_CMD:= LOCAL_POST_INSTALL_CMD:= LOCAL_DIST_BUNDLED_BINARIES:= LOCAL_HAL_STATIC_LIBRARIES:= @@ -157,6 +162,9 @@ LOCAL_MODULE_TARGET_ARCH_WARN:= LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:= LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:= LOCAL_MODULE_HOST_ARCH:= +LOCAL_NO_FPIE := +LOCAL_CXX_STL := default +LOCAL_NATIVE_COVERAGE := # arch specific variables LOCAL_SRC_FILES_$(TARGET_ARCH):= diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk index 4a2bfe3..c2b80de 100644 --- a/core/combo/HOST_darwin-x86.mk +++ b/core/combo/HOST_darwin-x86.mk @@ -33,8 +33,6 @@ include $(BUILD_COMBOS)/mac_version.mk $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1 $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version) -# Don't do anything if the toolchain is not there -ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-gcc))) $(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++ ifeq ($(mac_sdk_version),10.8) @@ -42,10 +40,6 @@ ifeq ($(mac_sdk_version),10.8) host_toolchain_header := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header) endif -else -$(combo_2nd_arch_prefix)HOST_CC := gcc -$(combo_2nd_arch_prefix)HOST_CXX := g++ -endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists # gcc location for clang; to be updated when clang is updated # HOST_TOOLCHAIN_ROOT is a Darwin-specific define diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk index 0bc0227..1ea3310 100644 --- a/core/combo/HOST_darwin-x86_64.mk +++ b/core/combo/HOST_darwin-x86_64.mk @@ -33,8 +33,6 @@ include $(BUILD_COMBOS)/mac_version.mk HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1 HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version) -# Don't do anything if the toolchain is not there -ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc))) HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++ ifeq ($(mac_sdk_version),10.8) @@ -42,10 +40,6 @@ ifeq ($(mac_sdk_version),10.8) host_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header) endif -else -HOST_CC := gcc -HOST_CXX := g++ -endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists # gcc location for clang; to be updated when clang is updated # HOST_TOOLCHAIN_ROOT is a Darwin-specific define diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk index 3ca7443..78a9f8e 100644 --- a/core/combo/HOST_linux-x86.mk +++ b/core/combo/HOST_linux-x86.mk @@ -18,17 +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 -# Don't do anything if the toolchain is not there -ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc))) $(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 -endif # $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc exists # 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 53a3ae8..86877b3 100644 --- a/core/combo/HOST_linux-x86_64.mk +++ b/core/combo/HOST_linux-x86_64.mk @@ -18,17 +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 -# Don't do anything if the toolchain is not there -ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc))) HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++ HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar -endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists # 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 df81cd5..d9fbd2f 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -153,7 +153,6 @@ $(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \ libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ ## on some hosts, the target cross-compiler is not available so do not run this command @@ -165,6 +164,8 @@ $(combo_2nd_arch_prefix)TARGET_LIBGCC := $(shell $($(combo_2nd_arch_prefix)TARGE $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name) $(combo_2nd_arch_prefix)TARGET_LIBATOMIC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \ $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libatomic.a) +$(combo_2nd_arch_prefix)TARGET_LIBGCOV := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \ + $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libgcov.a) endif KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi @@ -174,7 +175,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) $(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \ $(libc_root)/arch-arm/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/arm \ @@ -188,7 +188,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O $(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true -$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm +$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true @@ -212,6 +212,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \ $(PRIVATE_LDLIBS) @@ -238,6 +239,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -260,6 +262,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk index 07d3984..34eb274 100644 --- a/core/combo/TARGET_linux-arm64.mk +++ b/core/combo/TARGET_linux-arm64.mk @@ -126,12 +126,13 @@ TARGET_RELEASE_CFLAGS := \ libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \ -print-libgcc-file-name) TARGET_LIBATOMIC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \ -print-file-name=libatomic.a) +TARGET_LIBGCOV := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \ + -print-file-name=libgcov.a) KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH) @@ -140,7 +141,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) TARGET_C_INCLUDES := \ $(libc_root)/arch-arm64/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/arm64 \ @@ -154,7 +154,7 @@ TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o TARGET_STRIP_MODULE:=true -TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm +TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm TARGET_CUSTOM_LD_COMMAND := true @@ -178,6 +178,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \ $(PRIVATE_LDLIBS) @@ -204,6 +205,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -226,6 +228,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk index 995e63c..9abee7a 100644 --- a/core/combo/TARGET_linux-mips.mk +++ b/core/combo/TARGET_linux-mips.mk @@ -121,7 +121,6 @@ $(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \ libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ ## on some hosts, the target cross-compiler is not available so do not run this command @@ -137,6 +136,8 @@ LIBGCC_EH := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_pre ifneq ($(LIBGCC_EH),libgcc_eh.a) $(combo_2nd_arch_prefix)TARGET_LIBGCC += $(LIBGCC_EH) endif +$(combo_2nd_arch_prefix)TARGET_LIBGCOV := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \ + --print-file-name=libgcov.a) endif KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi @@ -146,7 +147,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) $(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \ $(libc_root)/arch-mips/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/mips \ @@ -160,7 +160,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O $(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true -$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm +$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true @@ -184,6 +184,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \ $(PRIVATE_LDLIBS) @@ -210,6 +211,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -232,6 +234,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk index 4511b47..2b37606 100644 --- a/core/combo/TARGET_linux-mips64.mk +++ b/core/combo/TARGET_linux-mips64.mk @@ -121,7 +121,6 @@ TARGET_RELEASE_CFLAGS := \ libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ libthread_db_root := bionic/libthread_db @@ -138,6 +137,8 @@ LIBGCC_EH := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libgc ifneq ($(LIBGCC_EH),libgcc_eh.a) TARGET_LIBGCC += $(LIBGCC_EH) endif +TARGET_LIBGCOV := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \ + --print-file-name=libgcov.a) endif KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi @@ -148,7 +149,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) TARGET_C_INCLUDES := \ $(libc_root)/arch-mips64/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/mips \ @@ -188,6 +188,7 @@ $(hide) $(PRIVATE_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \ $(PRIVATE_LDLIBS) @@ -214,6 +215,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -236,6 +238,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index 0af3948..c65df54 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -62,13 +62,14 @@ $(combo_2nd_arch_prefix)TARGET_LIBGCC := \ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcc.a) $(combo_2nd_arch_prefix)TARGET_LIBATOMIC := \ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libatomic.a) +$(combo_2nd_arch_prefix)TARGET_LIBGCOV := \ + $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcov.a) endif $(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64. @@ -128,7 +129,6 @@ $(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections $(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \ $(libc_root)/arch-x86/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/i387 \ @@ -142,7 +142,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O $(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true -$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm +$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm $(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner @@ -164,6 +164,7 @@ $(hide) $(PRIVATE_CXX) \ -o $@ \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \ $(PRIVATE_LDLIBS) @@ -190,6 +191,7 @@ $(hide) $(PRIVATE_CXX) \ -o $@ \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -210,6 +212,7 @@ $(hide) $(PRIVATE_CXX) \ -Wl,--start-group \ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk index 33d6a56..556190e 100644 --- a/core/combo/TARGET_linux-x86_64.mk +++ b/core/combo/TARGET_linux-x86_64.mk @@ -62,13 +62,14 @@ TARGET_LIBGCC := \ $(shell $(TARGET_CC) -m64 -print-file-name=libgcc.a) TARGET_LIBATOMIC := \ $(shell $(TARGET_CC) -m64 -print-file-name=libatomic.a) +TARGET_LIBGCOV := \ + $(shell $(TARGET_CC) -m64 -print-file-name=libgcov.a) endif TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined libc_root := bionic/libc libm_root := bionic/libm -libstdc++_root := bionic/libstdc++ KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64. @@ -133,7 +134,6 @@ TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections TARGET_C_INCLUDES := \ $(libc_root)/arch-x86_64/include \ $(libc_root)/include \ - $(libstdc++_root)/include \ $(KERNEL_HEADERS) \ $(libm_root)/include \ $(libm_root)/include/amd64 \ @@ -147,7 +147,7 @@ TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o TARGET_STRIP_MODULE:=true -TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm +TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm TARGET_CUSTOM_LD_COMMAND := true define transform-o-to-shared-lib-inner @@ -169,6 +169,7 @@ $(hide) $(PRIVATE_CXX) \ -o $@ \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) endef @@ -194,6 +195,7 @@ $(hide) $(PRIVATE_CXX) \ -o $@ \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \ $(PRIVATE_LDLIBS) @@ -214,6 +216,7 @@ $(hide) $(PRIVATE_CXX) \ -Wl,--start-group \ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ $(PRIVATE_TARGET_LIBATOMIC) \ + $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_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 54f3750..eeda5d0 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() @@ -56,16 +50,6 @@ #define HAVE_FORKEXEC /* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_MACOSX_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -79,11 +63,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 */ @@ -110,11 +89,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 */ @@ -146,11 +120,6 @@ #define _LARGEFILE_SOURCE 1 /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -/* #define HAVE_OFF64_T */ - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. @@ -158,18 +127,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 @@ -214,11 +171,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 '/' @@ -241,11 +193,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 c06c8bc..1ca244c 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() @@ -63,16 +50,6 @@ #define HAVE_FORKEXEC /* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_ANDROID_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -86,11 +63,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 +89,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 */ @@ -132,11 +99,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -155,28 +117,12 @@ /* #define _LARGEFILE_SOURCE 1 */ /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. */ #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 */ @@ -251,11 +197,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 '/' @@ -276,11 +217,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..8cf6c79 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() @@ -63,23 +50,6 @@ #define HAVE_FORKEXEC /* - * Process out-of-memory adjustment. Set if running on Linux, - * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory - * badness adjustment. - */ -#define HAVE_OOM_ADJ - -/* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_ANDROID_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -93,11 +63,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 +89,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 */ @@ -139,11 +99,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -157,11 +112,6 @@ /* #define _LARGEFILE_SOURCE 1 */ /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. @@ -169,17 +119,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 +192,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 +212,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 bb3dc95..45bff09 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() @@ -63,16 +50,6 @@ #define HAVE_FORKEXEC /* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_ANDROID_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -86,11 +63,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 +89,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 */ @@ -132,11 +99,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -160,11 +122,6 @@ /* #define _LARGEFILE_SOURCE 1 */ /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. @@ -172,17 +129,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 @@ -268,11 +214,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 '/' @@ -293,11 +234,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..f66830a 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() @@ -63,23 +50,6 @@ #define HAVE_FORKEXEC /* - * Process out-of-memory adjustment. Set if running on Linux, - * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory - * badness adjustment. - */ -#define HAVE_OOM_ADJ - -/* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_ANDROID_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -93,11 +63,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 +89,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 */ @@ -139,11 +99,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -157,11 +112,6 @@ /* #define _LARGEFILE_SOURCE 1 */ /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. @@ -169,17 +119,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 +204,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 +224,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 5523e49..a8d74fd 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() @@ -56,16 +50,6 @@ #define HAVE_FORKEXEC /* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_SYSV_IPC - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -79,11 +63,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 */ @@ -110,11 +89,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 */ @@ -125,11 +99,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -148,28 +117,12 @@ #define _LARGEFILE_SOURCE 1 /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. */ #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 */ @@ -231,11 +184,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 '/' @@ -256,11 +204,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 c267b2b..260f518 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() @@ -49,16 +36,6 @@ #define HAVE_FORKEXEC /* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ -#define HAVE_ANDROID_IPC 1 - -/* * Memory-mapping model. Choose one: * * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h @@ -72,11 +49,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 */ @@ -103,11 +75,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 */ @@ -119,11 +86,6 @@ #define HAVE_POSIX_CLOCKS /* - * Define this if we have linux style epoll() - */ -#define HAVE_EPOLL - -/* * Endianness of the target machine. Choose one: * * HAVE_ENDIAN_H -- have endian.h header we can include. @@ -144,28 +106,12 @@ /* #define _LARGEFILE_SOURCE 1 */ /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. */ #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 */ @@ -240,11 +186,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 '/' @@ -265,11 +206,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 204740d..c80c201 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() @@ -82,14 +75,7 @@ # define HAVE_WIN32_PROC #endif -/* - * IPC model. Choose one: - * - * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget). - * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap). - * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping). - * HAVE_ANDROID_IPC - use Android versions (?, mmap). - */ +/* TODO: replace references to this. */ #define HAVE_WIN32_IPC /* @@ -112,13 +98,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__ @@ -144,11 +123,6 @@ /* #define HAVE_GETHOSTBYNAME_R */ /* - * Define this if we have ioctl(). - */ -/* #define HAVE_IOCTL */ - -/* * Define this if we want to use WinSock. */ #ifndef __CYGWIN__ @@ -188,11 +162,6 @@ #define _LARGEFILE_SOURCE 1 /* - * Define if platform has off64_t (and lseek64 and other xxx64 functions) - */ -#define HAVE_OFF64_T - -/* * Defined if we have the backtrace() call for retrieving a stack trace. * Needed for CallStack to operate; if not defined, CallStack is * non-functional. @@ -200,12 +169,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 */ @@ -251,11 +214,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 '\\' @@ -281,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/definitions.mk b/core/definitions.mk index 3bded9f..b4ce2c3 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -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 @@ -1432,7 +1441,6 @@ $(hide) $(PRIVATE_CXX) \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \ - $(HOST_FPIE_FLAGS) \ ) \ $(PRIVATE_LDFLAGS) \ -o $@ \ diff --git a/core/envsetup.mk b/core/envsetup.mk index 124a91b..cfc9650 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) @@ -143,6 +130,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. diff --git a/core/executable_internal.mk b/core/executable_internal.mk index 9325287..ebb6867 100644 --- a/core/executable_internal.mk +++ b/core/executable_internal.mk @@ -35,6 +35,7 @@ endif # Define PRIVATE_ variables from global vars my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS) +my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC) my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC) my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O) @@ -54,6 +55,7 @@ my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o) endif $(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs) $(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) +$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov) $(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc) $(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic) $(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o) @@ -62,8 +64,10 @@ $(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o) $(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES) ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) +$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD) $(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(transform-o-to-static-executable) + $(PRIVATE_POST_LINK_CMD) else $(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(transform-o-to-executable) diff --git a/core/host_executable.mk b/core/host_executable.mk index bf3cde1..0091f3f 100644 --- a/core/host_executable.mk +++ b/core/host_executable.mk @@ -13,6 +13,10 @@ endif endif endif +ifeq ($(LOCAL_NO_FPIE),) +LOCAL_LDFLAGS += $(HOST_FPIE_FLAGS) +endif + ifeq ($(my_module_multilib),both) ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),) $(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) diff --git a/core/main.mk b/core/main.mk index fcddf89..666bd21 100644 --- a/core/main.mk +++ b/core/main.mk @@ -325,9 +325,6 @@ ifneq (,$(user_variant)) ifeq ($(user_variant),userdebug) # Pick up some extra useful tools tags_to_install += debug - - # Enable Dalvik lock contention logging for userdebug builds. - ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500 else # Disable debugging in plain user builds. enable_target_debugging := @@ -361,6 +358,8 @@ endif # !user_variant ifeq (true,$(strip $(enable_target_debugging))) # Target is more debuggable and adbd is on by default ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 + # Enable Dalvik lock contention logging. + ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500 # Include the debugging/testing OTA keys in this build. INCLUDE_TEST_OTA_KEYS := true else # !enable_target_debugging @@ -769,10 +768,6 @@ ifdef is_sdk_build $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \ $(if $(strip $(ALL_MODULES.$(m).INSTALLED) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).INSTALLED)),,\ $(eval dangling_modules += $(m)))) - ifneq ($(TARGET_IS_64_BIT),true) - # We know those 64-bit modules don't exist in the 32-bit SDK build. - dangling_modules := $(filter-out %64,$(dangling_modules)) - endif ifneq ($(dangling_modules),) $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!) endif diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index c01be37..baedb3b 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -40,6 +40,7 @@ include $(BUILD_SYSTEM)/dynamic_binary.mk # Define PRIVATE_ variables from global vars my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS) +my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC) my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC) my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O) @@ -57,6 +58,7 @@ my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o) endif $(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs) $(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) +$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov) $(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc) $(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic) $(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o) diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk index 95d4159..65def9c 100644 --- a/core/target_test_internal.mk +++ b/core/target_test_internal.mk @@ -5,7 +5,17 @@ LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING LOCAL_C_INCLUDES += external/gtest/include -ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),) + +my_test_libcxx := false +ifndef LOCAL_SDK_VERSION +ifeq (,$(TARGET_BUILD_APPS)) +ifeq ($(strip $(LOCAL_CXX_STL)),libc++) +my_test_libcxx := true +endif +endif +endif + +ifeq ($(my_test_libcxx),true) LOCAL_STATIC_LIBRARIES += libgtest_libc++ libgtest_main_libc++ else LOCAL_STATIC_LIBRARIES += libgtest libgtest_main @@ -14,8 +24,7 @@ ifndef LOCAL_SDK_VERSION LOCAL_C_INCLUDES += bionic \ bionic/libstdc++/include \ external/stlport/stlport -LOCAL_SHARED_LIBRARIES += libstlport -LOCAL_STATIC_LIBRARIES += libstdc++ +LOCAL_SHARED_LIBRARIES += libstlport libstdc++ endif endif diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk index 11a6a31..62dfa1b 100644 --- a/target/board/generic_arm64/device.mk +++ b/target/board/generic_arm64/device.mk @@ -30,6 +30,16 @@ PRODUCT_COPY_FILES := \ frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:system/etc/media_codecs_google_video.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/embedded.mk b/target/product/embedded.mk index b60c948..9f52336 100644 --- a/target/product/embedded.mk +++ b/target/product/embedded.mk @@ -23,7 +23,6 @@ PRODUCT_PACKAGES += \ atrace \ bootanimation \ debuggerd \ - debuggerd64 \ dumpstate \ dumpsys \ gralloc.default \ @@ -57,7 +56,6 @@ PRODUCT_PACKAGES += \ libui \ libutils \ linker \ - linker64 \ lmkd \ logcat \ logwrapper \ @@ -80,6 +78,10 @@ PRODUCT_PACKAGES += \ selinux_version \ service_contexts +# Ensure that this property is always defined so that bionic_systrace.cpp +# can rely on it being initially set by init. +PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ + debug.atrace.tags.enableflags=0 PRODUCT_COPY_FILES += \ system/core/rootdir/init.usb.rc:root/init.usb.rc \ diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk index c501f14..a0cf6c1 100644 --- a/target/product/sdk_phone_arm64.mk +++ b/target/product/sdk_phone_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_base.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) # Overrides PRODUCT_BRAND := generic_arm64 diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk index 33c5567..e819e0c 100644 --- a/tools/acp/Android.mk +++ b/tools/acp/Android.mk @@ -21,5 +21,6 @@ LOCAL_STATIC_LIBRARIES := libhost LOCAL_C_INCLUDES := build/libs/host/include LOCAL_MODULE := acp LOCAL_ACP_UNAVAILABLE := true +LOCAL_CXX_STL := none include $(BUILD_HOST_EXECUTABLE) diff --git a/tools/droiddoc/templates-sac/assets/images/sac_logo.png b/tools/droiddoc/templates-sac/assets/images/sac_logo.png Binary files differindex 6dc126a..4ad113c 100644 --- a/tools/droiddoc/templates-sac/assets/images/sac_logo.png +++ b/tools/droiddoc/templates-sac/assets/images/sac_logo.png diff --git a/tools/droiddoc/templates-sac/assets/images/sac_logo@2x.png b/tools/droiddoc/templates-sac/assets/images/sac_logo@2x.png Binary files differnew file mode 100644 index 0000000..4040f3f --- /dev/null +++ b/tools/droiddoc/templates-sac/assets/images/sac_logo@2x.png diff --git a/tools/droiddoc/templates-sac/components/masthead.cs b/tools/droiddoc/templates-sac/components/masthead.cs index fb9b71d..a8618c0 100644 --- a/tools/droiddoc/templates-sac/components/masthead.cs +++ b/tools/droiddoc/templates-sac/components/masthead.cs @@ -253,7 +253,9 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" /> <div class="wrap" id="header-wrap"> <div class="col-3 saclogo"> <a href="<?cs var:toroot ?>index.html"> - <img src="<?cs var:toroot ?>assets/images/sac_logo.png" width="114" height="16" alt="Android Developers" /> + <img src="<?cs var:toroot ?>assets/images/sac_logo.png" + srcset="<?cs var:toroot ?>assets/images/sac_logo@2x.png 2x" + width="123" height="25" alt="Android Developers" /> </a> </div> <ul class="nav-x col-9"> 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 7986798..4194f81 100644 --- a/tools/zipalign/Android.mk +++ b/tools/zipalign/Android.mk @@ -26,7 +26,7 @@ ifeq ($(HOST_OS),linux) LOCAL_LDLIBS += -lrt endif -ifneq ($(strip $(USE_MINGW)),) +ifdef USE_MINGW LOCAL_STATIC_LIBRARIES += libz else LOCAL_LDLIBS += -lz |