Record binary modules' whole static library dependencies in make.

Bug: 324465531
Test: CIs
Change-Id: Icf2a664b11d29be18bbf3ab16286b7fc746b9ba6
diff --git a/core/binary.mk b/core/binary.mk
index f86b5a4..77ae6ef 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1352,6 +1352,8 @@
 my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk
 endif
 
+ALL_MODULES.$(my_register_name).WHOLE_STATIC_LIBS := $(my_whole_static_libraries)
+
 my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
 ifneq ($(filter-out STATIC_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
 my_link_deps += $(addprefix SHARED_LIBRARIES:,$(my_shared_libraries))