Merge "zipalign: remove support for adding members from gzip sources."
diff --git a/CleanSpec.mk b/CleanSpec.mk
index b9f6e13..9d3fc23 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -398,6 +398,8 @@
$(call add-clean-step, rm -rf $(HOST_OUT_TESTCASES))
$(call add-clean-step, rm -rf $(TARGET_OUT_TESTCASES))
+$(call add-clean-step, rm -rf $(TARGET_OUT_ETC)/init)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 1f55eae..8cceaad 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -163,24 +163,24 @@
endif
my_module_path := $(patsubst %/,%,$(my_module_path))
my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
+ifdef LOCAL_IS_HOST_MODULE
+ partition_tag :=
+else
+ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
+ partition_tag := _VENDOR
+else ifeq (true,$(LOCAL_OEM_MODULE))
+ partition_tag := _OEM
+else ifeq (true,$(LOCAL_ODM_MODULE))
+ partition_tag := _ODM
+else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
+ partition_tag := _DATA
+else
+ # The definition of should-install-to-system will be different depending
+ # on which goal (e.g., sdk or just droid) is being built.
+ partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
+endif
+endif
ifeq ($(my_module_path),)
- ifdef LOCAL_IS_HOST_MODULE
- partition_tag :=
- else
- ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
- partition_tag := _VENDOR
- else ifeq (true,$(LOCAL_OEM_MODULE))
- partition_tag := _OEM
- else ifeq (true,$(LOCAL_ODM_MODULE))
- partition_tag := _ODM
- else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
- partition_tag := _DATA
- else
- # The definition of should-install-to-system will be different depending
- # on which goal (e.g., sdk or just droid) is being built.
- partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
- endif
- endif
install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
install_path_var := $(install_path_var)_PRIVILEGED
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index bae38c5..614a7ca 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -164,6 +164,7 @@
LOCAL_PICKUP_FILES:=
LOCAL_POST_INSTALL_CMD:=
LOCAL_POST_LINK_CMD:=
+LOCAL_PREBUILT_COVERAGE_ARCHIVE:=
LOCAL_PREBUILT_EXECUTABLES:=
LOCAL_PREBUILT_JAVA_LIBRARIES:=
LOCAL_PREBUILT_JNI_LIBS:=
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 57a7993..729ef48 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -159,8 +159,8 @@
# LLVM is not set up to do this on a function basis, so force Thumb on the
# entire module.
LOCAL_ARM_MODE := thumb
- my_cflags += -flto -fsanitize-cfi-cross-dso -fvisibility=default
- my_ldflags += -flto -fsanitize-cfi-cross-dso -fsanitize=cfi -Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check
+ my_cflags += $(CFI_EXTRA_CFLAGS)
+ my_ldflags += $(CFI_EXTRA_LDFLAGS)
my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so
# Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
# Clang is updated past r290384.
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 10512ff..997f971 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -174,6 +174,19 @@
endif # my_strip_module not true
ifeq ($(NATIVE_COVERAGE),true)
+ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE)))
+ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).gcnodir))
+ ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
+ ifdef LOCAL_IS_HOST_MODULE
+ my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
+ else
+ my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+ endif
+ my_coverage_path := $(my_coverage_path)/$(basename $(my_installed_module_stem)).gcnodir
+ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path)))
+ $(LOCAL_BUILT_MODULE): $(my_coverage_path)
+ endif
+else
# Coverage information is needed when static lib is a dependency of another
# coverage-enabled module.
ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS))
@@ -186,6 +199,7 @@
$(transform-o-to-static-lib)
endif
endif
+endif
ifeq ($(LOCAL_MODULE_CLASS),APPS)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 6b914c9..1ea4cb8 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -96,6 +96,7 @@
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
$(transform-o-to-static-lib)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index ad2f204..c038a32 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -43,6 +43,9 @@
echo ' "ClangTidy": $(if $(filter 1 true,$(WITH_TIDY)),true,false),'; \
echo ' "TidyChecks": "$(WITH_TIDY_CHECKS)",'; \
echo ''; \
+ echo ' "NativeCoverage": $(if $(filter true,$(NATIVE_COVERAGE)),true,false),'; \
+ echo ' "CoveragePaths": [$(if $(COVERAGE_PATHS),"$(subst $(space),"$(comma)",$(subst $(comma),$(space),$(COVERAGE_PATHS)))")],'; \
+ echo ''; \
echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
echo ' "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index 6133ea2..6b4d22f 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -39,6 +39,7 @@
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries)
$(transform-o-to-static-lib)
endif
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 2449ea9..86d77bb 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -38,6 +38,44 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
+# Returns all words in $1 up to and including $2
+define find_and_earlier
+ $(strip $(if $(1),
+ $(firstword $(1))
+ $(if $(filter $(firstword $(1)),$(2)),,
+ $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
+endef
+
+#$(warning $(call find_and_earlier,A B C,A))
+#$(warning $(call find_and_earlier,A B C,B))
+#$(warning $(call find_and_earlier,A B C,C))
+#$(warning $(call find_and_earlier,A B C,D))
+
+define version-list
+$(1) $(1)DR1 $(1)DR2 $(1)MR1 $(1)MR2
+endef
+
+ALL_VERSIONS := O P
+ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
+
+ifeq (,$(TARGET_PLATFORM_VERSION))
+ # Default targeted platform version
+ # TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
+ # on this
+ TARGET_PLATFORM_VERSION := O
+endif
+
+ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION)))
+$(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
+$(warning $(ALL_VERSIONS))
+$(error Stopping...)
+endif
+
+ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
+
+$(foreach v,$(ENABLED_VERSIONS), \
+ $(eval IS_AT_LEAST_$(v) := true))
+
ifeq "" "$(PLATFORM_VERSION)"
# This is the canonical definition of the platform version,
# which is the version that we reveal to the end user.