Fix check_elf_file with LOCAL_SDK_VERSION and NDK libs
This commit fixes prebuilt ELF checker for modules with
LOCAL_SDK_VERSIONS and depend on NDK shared libraries. This fix is
required because dynamic_binary.mk filters out NDK libraries thus those
libraries do not show up in DEPENDENCIES_ON_SHARED_LIBRARIES.
Bug: 119084334
Test: Create a prebuilt module with LOCAL_SDK_VERSION and check whether
the NDK libs in LOCAL_SHARED_LIBRARIES are passed to
check_elf_file.py.
Change-Id: I0f72ae1b0edc3e8d7e43eb70829e74d606564966
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 49613e9..c5ea538 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -108,6 +108,8 @@
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 @@
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)