Merge "Check ELF prebuilts in PRODUCT_COPY_FILES" am: 2cbcf3bda2 am: 85e68e75f1

Change-Id: Ifb30cc6423b03d9468ec949ba862c61d70085f4f
This commit is contained in:
Yo Chiang 2020-04-17 01:41:49 +00:00 committed by Automerger Merge Worker
commit b301fd5434
3 changed files with 31 additions and 1 deletions

View file

@ -39,6 +39,16 @@ $(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
use ODM_MANIFEST_FILES / vintf_fragments instead!)) \ use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
) )
endef endef
# TODO(b/140560012): Flip BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES to default
# false after all problematic devices are tagged.
check_elf_prebuilt_product_copy_files :=
ifneq (,$(filter false,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES)))
check_elf_prebuilt_product_copy_files := true
endif
check_elf_prebuilt_product_copy_files_hint := \
found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.
# filter out the duplicate <source file>:<dest file> pairs. # filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs := unique_product_copy_files_pairs :=
$(foreach cf,$(PRODUCT_COPY_FILES), \ $(foreach cf,$(PRODUCT_COPY_FILES), \
@ -59,7 +69,10 @@ $(foreach cf,$(unique_product_copy_files_pairs), \
$(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \ $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
$(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\ $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
$(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\ $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
$(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \ $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \
$(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \
$(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \
$(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \
$(eval unique_product_copy_files_destinations += $(_dest)))) $(eval unique_product_copy_files_destinations += $(_dest))))
# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries) # Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)

View file

@ -87,6 +87,7 @@ _board_strip_readonly_list += $(_dynamic_partitions_var_list)
_build_broken_var_list := \ _build_broken_var_list := \
BUILD_BROKEN_DUP_RULES \ BUILD_BROKEN_DUP_RULES \
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
BUILD_BROKEN_PREBUILT_ELF_FILES \ BUILD_BROKEN_PREBUILT_ELF_FILES \
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \

View file

@ -2552,6 +2552,22 @@ $(foreach f, $(1), $(strip \
$(_cmf_dest))) $(_cmf_dest)))
endef endef
# Copy the file only if it's not an ELF file. For use via $(eval).
# $(1): source file
# $(2): destination file
# $(3): message to print on error
define copy-non-elf-file-checked
$(2): $(1) $(LLVM_READOBJ)
@echo "Copy non-ELF: $$@"
$(hide) \
if $(LLVM_READOBJ) -h $$< >/dev/null 2>&1; then \
$(call echo-error,$$@,$(3)); \
$(call echo-error,$$@,found ELF file: $$<); \
false; \
fi
$$(copy-file-to-target)
endef
# The -t option to acp and the -p option to cp is # The -t option to acp and the -p option to cp is
# required for OSX. OSX has a ridiculous restriction # required for OSX. OSX has a ridiculous restriction
# where it's an error for a .a file's modification time # where it's an error for a .a file's modification time