From 9593e47f4723da93a5cf8d09df1c3e77e7b7d2b5 Mon Sep 17 00:00:00 2001 From: Sid Nayyar Date: Wed, 30 Apr 2025 13:06:56 +0000 Subject: [PATCH] ANDROID: compile / link / clean permitted-imports.o This commit adds the generation of permitted imports to Kbuild. Bug: 393366754 Change-Id: I522ec4a92c5c791fb1c2931a1e05251c3f7d530c Signed-off-by: Sid Nayyar --- Makefile | 2 +- scripts/Makefile.vmlinux | 5 +++++ scripts/link-vmlinux.sh | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c54dd9282b52..7e7f5ecf9f95 100644 --- a/Makefile +++ b/Makefile @@ -1549,7 +1549,7 @@ CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin.ranges vmlinux.o.map \ compile_commands.json rust/test \ rust-project.json .vmlinux.objs .vmlinux.export.c \ - .vmlinux.protected-exports.c + .vmlinux.protected-exports.c .vmlinux.permitted-imports.c # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \ diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index faaa9ba1f61a..cae5f3634030 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -26,6 +26,11 @@ targets += .vmlinux.protected-exports.o vmlinux: .vmlinux.protected-exports.o endif +ifdef CONFIG_TRIM_UNUSED_KSYMS +targets += .vmlinux.permitted-imports.o +vmlinux: .vmlinux.permitted-imports.o +endif + endif ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index bfac545879a1..829683250fea 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -73,6 +73,9 @@ vmlinux_link() if is_enabled CONFIG_MODULE_SIG_PROTECT; then objs="${objs} .vmlinux.protected-exports.o" fi + if is_enabled CONFIG_TRIM_UNUSED_KSYMS; then + objs="${objs} .vmlinux.permitted-imports.o" + fi fi objs="${objs} init/version-timestamp.o"