am 79b46720: am 02f98a26: Merge "Fix loophole in module expansion."
* commit '79b46720e606e3db5fff87f672b73613a9a19c69': Fix loophole in module expansion.
This commit is contained in:
commit
dceddd91d9
|
@ -209,7 +209,7 @@ installed_shared_library_module_names := $(sort $(installed_shared_library_modul
|
|||
ifdef LOCAL_INSTALLED_MODULE
|
||||
ifdef installed_shared_library_module_names
|
||||
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
|
||||
$(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
|
||||
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -2120,20 +2120,6 @@ define set-inherited-package-variables-internal
|
|||
,)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Expand a module name list with REQUIRED modules
|
||||
###########################################################
|
||||
# $(1): The variable name that holds the initial module name list.
|
||||
# the variable will be modified to hold the expanded results.
|
||||
# $(2): The initial module name list.
|
||||
# Returns empty string (maybe with some whitespaces).
|
||||
define expand-required-modules
|
||||
$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
|
||||
$(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
|
||||
$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
|
||||
$(call expand-required-modules,$(1),$(_erm_new_modules)))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## API Check
|
||||
###########################################################
|
||||
|
|
60
core/main.mk
60
core/main.mk
|
@ -630,37 +630,36 @@ h_m :=
|
|||
t_r :=
|
||||
h_r :=
|
||||
|
||||
# Resolve the dependencies on shared libraries.
|
||||
$(foreach m,$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
|
||||
$(eval p := $(subst :,$(space),$(m))) \
|
||||
$(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
|
||||
$(subst $(comma),$(space),$(lastword $(p)))))) \
|
||||
$(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
|
||||
$(foreach m,$(HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \
|
||||
$(eval p := $(subst :,$(space),$(m))) \
|
||||
$(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
|
||||
$(subst $(comma),$(space),$(lastword $(p)))))) \
|
||||
$(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
|
||||
# Establish the dependecies on the shared libraries.
|
||||
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
|
||||
# so they can be expanded to product_MODULES later.
|
||||
# $(1): TARGET_ or HOST_.
|
||||
# $(2): non-empty for 2nd arch.
|
||||
define resolve-shared-libs-depes
|
||||
$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
|
||||
$(eval p := $(subst :,$(space),$(m)))\
|
||||
$(eval mod := $(firstword $(p)))\
|
||||
$(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
|
||||
$(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
|
||||
$(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\
|
||||
$(deps))))\
|
||||
$(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\
|
||||
$(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
|
||||
endef
|
||||
|
||||
$(call resolve-shared-libs-depes,TARGET_)
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
|
||||
$(eval p := $(subst :,$(space),$(m))) \
|
||||
$(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
|
||||
$(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX), \
|
||||
$(subst $(comma),$(space),$(lastword $(p))))))) \
|
||||
$(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
|
||||
$(call resolve-shared-libs-depes,TARGET_,true)
|
||||
endif
|
||||
$(call resolve-shared-libs-depes,HOST_)
|
||||
ifdef HOST_2ND_ARCH
|
||||
$(foreach m,$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \
|
||||
$(eval p := $(subst :,$(space),$(m))) \
|
||||
$(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
|
||||
$(addsuffix $(HOST_2ND_ARCH_MODULE_SUFFIX), \
|
||||
$(subst $(comma),$(space),$(lastword $(p))))))) \
|
||||
$(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
|
||||
$(call resolve-shared-libs-depes,HOST_,true)
|
||||
endif
|
||||
|
||||
m :=
|
||||
r :=
|
||||
p :=
|
||||
deps :=
|
||||
add-required-deps :=
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
@ -669,6 +668,20 @@ add-required-deps :=
|
|||
# Of the modules defined by the component makefiles,
|
||||
# determine what we actually want to build.
|
||||
|
||||
###########################################################
|
||||
## Expand a module name list with REQUIRED modules
|
||||
###########################################################
|
||||
# $(1): The variable name that holds the initial module name list.
|
||||
# the variable will be modified to hold the expanded results.
|
||||
# $(2): The initial module name list.
|
||||
# Returns empty string (maybe with some whitespaces).
|
||||
define expand-required-modules
|
||||
$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
|
||||
$(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
|
||||
$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
|
||||
$(call expand-required-modules,$(1),$(_erm_new_modules)))
|
||||
endef
|
||||
|
||||
ifdef FULL_BUILD
|
||||
# The base list of modules to build for this product is specified
|
||||
# by the appropriate product definition file, which was included
|
||||
|
@ -693,6 +706,7 @@ ifdef FULL_BUILD
|
|||
endif
|
||||
|
||||
$(call expand-required-modules,product_MODULES,$(product_MODULES))
|
||||
|
||||
product_FILES := $(call module-installed-files, $(product_MODULES))
|
||||
ifeq (0,1)
|
||||
$(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
|
||||
|
|
|
@ -92,7 +92,7 @@ endif # prebuilt_module_is_a_library
|
|||
ifdef LOCAL_INSTALLED_MODULE
|
||||
ifdef LOCAL_SHARED_LIBRARIES
|
||||
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
|
||||
$(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
|
||||
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
|
||||
|
||||
# We also need the LOCAL_BUILT_MODULE dependency,
|
||||
# since we use -rpath-link which points to the built module's path.
|
||||
|
|
|
@ -39,20 +39,7 @@ _vendor_owner_whitelist := \
|
|||
|
||||
ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))
|
||||
|
||||
_vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
|
||||
$(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules))
|
||||
|
||||
# Expand the target modules installed via LOCAL_SHARED_LIBRARIES
|
||||
# $(1): the list of modules to expand.
|
||||
define expand-required-shared-libraries
|
||||
$(eval _ersl_new_modules := $(filter $(addsuffix :%,$(1)),$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES)))\
|
||||
$(eval _ersl_new_modules := $(foreach p,$(_ersl_new_modules),$(word 3,$(subst :,$(space),$(p)))))\
|
||||
$(eval _ersl_new_modules := $(sort $(subst $(comma),$(space),$(_ersl_new_modules))))\
|
||||
$(eval _ersl_new_modules := $(filter-out $(_vendor_check_modules),$(_ersl_new_modules)))\
|
||||
$(if $(_ersl_new_modules),$(eval _vendor_check_modules += $(_ersl_new_modules))\
|
||||
$(call expand-required-shared-libraries,$(_ersl_new_modules)))
|
||||
endef
|
||||
$(call expand-required-shared-libraries,$(_vendor_check_modules))
|
||||
_vendor_check_modules := $(product_MODULES)
|
||||
|
||||
_vendor_module_owner_info :=
|
||||
# Restrict owners
|
||||
|
|
Loading…
Reference in New Issue