diff --git a/core/check_elf_file.mk b/core/check_elf_file.mk index 8f2eafb117..0faaadd3fe 100644 --- a/core/check_elf_file.mk +++ b/core/check_elf_file.mk @@ -13,14 +13,18 @@ # - intermediates # - my_installed_module_stem # - my_prebuilt_src_file +# - my_check_elf_file_shared_lib_files ifndef LOCAL_IS_HOST_MODULE ifneq ($(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS),) check_elf_files_stamp := $(intermediates)/check_elf_files.timestamp $(check_elf_files_stamp): PRIVATE_SONAME := $(if $(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES),$(my_installed_module_stem)) $(check_elf_files_stamp): PRIVATE_ALLOW_UNDEFINED_SYMBOLS := $(LOCAL_ALLOW_UNDEFINED_SYMBOLS) -$(check_elf_files_stamp): PRIVATE_SHARED_LIBRARY_FILES := # This variable will be set by `core/main.mk` -$(check_elf_files_stamp): $(my_prebuilt_src_file) $(CHECK_ELF_FILE) $(LLVM_READOBJ) +# PRIVATE_SHARED_LIBRARY_FILES are file paths to built shared libraries. +# In addition to $(my_check_elf_file_shared_lib_files), some file paths are +# added by `resolve-shared-libs-for-elf-file-check` from `core/main.mk`. +$(check_elf_files_stamp): PRIVATE_SHARED_LIBRARY_FILES := $(my_check_elf_file_shared_lib_files) +$(check_elf_files_stamp): $(my_prebuilt_src_file) $(my_check_elf_file_shared_lib_files) $(CHECK_ELF_FILE) $(LLVM_READOBJ) @echo Check prebuilt ELF binary: $< $(hide) mkdir -p $(dir $@) $(hide) rm -f $@ diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 49613e95c1..c5ea538309 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -108,6 +108,8 @@ $(error $(LOCAL_MODULE) : LOCAL_COMPRESSED_MODULE can only be defined for module endif # LOCAL_COMPRESSED_MODULE endif +my_check_elf_file_shared_lib_files := + ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module)),) ifdef LOCAL_IS_HOST_MODULE $(call pretty-error,Cannot strip/pack host module) @@ -123,6 +125,12 @@ ifneq ($(filter true keep_symbols no_debuglink mini-debug-info,$(my_strip_module include $(BUILD_SYSTEM)/dynamic_binary.mk built_module := $(linked_module) + ifneq ($(LOCAL_SDK_VERSION),) + # binary.mk filters out NDK_MIGRATED_LIBS from my_shared_libs, thus those NDK libs are not added + # to DEPENDENCIES_ON_SHARED_LIBRARIES. Assign $(my_ndk_shared_libraries_fullpath) to + # my_check_elf_file_shared_lib_files so that check_elf_file.py can see those NDK stub libs. + my_check_elf_file_shared_lib_files := $(my_ndk_shared_libraries_fullpath) + endif else # my_strip_module not true include $(BUILD_SYSTEM)/base_rules.mk built_module := $(LOCAL_BUILT_MODULE)