From ddb277b9c7dc9e8df766d7b8816a143722a13efe Mon Sep 17 00:00:00 2001 From: HONG Yifan Date: Tue, 1 Apr 2025 12:02:16 -0700 Subject: [PATCH] ANDROID: Set ALL_KMI_SYMBOLS to CONFIG_UNUSED_KSYMS_WHITELIST. Kleaf already generates CONFIG_UNUSED_KSYMS_WHITELIST according to the list of provided KMI symbol lists (kernel_build.kmi_symbol_list plus kernel_build.additional_kmi_symbol_lists). CONFIG_UNUSED_KSYMS_WHITELIST is the source of truth, not the wildcard here, especially if --user_kmi_symbol_list is set, or kernel_build.kmi_symbol_list or additional_kmi_symbol_lists contains files in different directories. Use CONFIG_UNUSED_KSYMS_WHITELIST directly. For mainline, CONFIG_UNUSED_KSYMS_WHITELIST is not set, so use an empty file as a placeholder. Bug: 406094444 Change-Id: Ia62c7a2e40ca607ac6f0d7e91c732044ec559282 Signed-off-by: HONG Yifan (cherry picked from commit b100dc1133ad4fbb9fd14c1dd91c00363cab44ec) --- kernel/module/Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/module/Makefile b/kernel/module/Makefile index 3c0db7f101f6..8ec0bc4e49ab 100644 --- a/kernel/module/Makefile +++ b/kernel/module/Makefile @@ -32,7 +32,13 @@ obj-$(CONFIG_MODULE_STATS) += stats.o $(obj)/gki_module.o: include/generated/gki_module_protected_exports.h \ include/generated/gki_module_unprotected.h +ifneq ($(CONFIG_UNUSED_KSYMS_WHITELIST),) +ALL_KMI_SYMBOLS := $(CONFIG_UNUSED_KSYMS_WHITELIST) +else ALL_KMI_SYMBOLS := include/config/abi_gki_kmi_symbols +$(ALL_KMI_SYMBOLS): + : > $@ +endif include/generated/gki_module_unprotected.h: $(ALL_KMI_SYMBOLS) \ $(srctree)/scripts/gen_gki_modules_headers.sh @@ -40,13 +46,6 @@ include/generated/gki_module_unprotected.h: $(ALL_KMI_SYMBOLS) \ "$(srctree)" \ $(ALL_KMI_SYMBOLS) -# AARCH is the same as ARCH, except that arm64 becomes aarch64 -AARCH := $(if $(filter arm64,$(ARCH)),aarch64,$(ARCH)) - -# Generate symbol list with union of all symbol list for ARCH -$(ALL_KMI_SYMBOLS): $(wildcard $(srctree)/gki/$(AARCH)/symbols/*) - $(if $(strip $^),cat $^ > $(ALL_KMI_SYMBOLS), echo "" > $(ALL_KMI_SYMBOLS)) - # ABI protected exports list file specific to ARCH if exists else empty ABI_PROTECTED_EXPORTS_FILE := $(wildcard $(srctree)/gki/$(AARCH)/protected_exports)