From c909fab8b3429a27eeba7ab8c2199f0295059afa Mon Sep 17 00:00:00 2001 From: Sid Nayyar Date: Thu, 30 Jan 2025 09:58:52 -0800 Subject: [PATCH] ANDROID: compile / link / clean protected-exports.o This commit adds the generation of protected exports to Kbuild. Bug: 393366754 Change-Id: Ib684e2424638614d38ed6b1390f451781935f37a Signed-off-by: Sid Nayyar --- Makefile | 3 ++- scripts/Makefile.vmlinux | 6 ++++++ scripts/link-vmlinux.sh | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 88cc9ee8c2c3..c54dd9282b52 100644 --- a/Makefile +++ b/Makefile @@ -1548,7 +1548,8 @@ CLEAN_FILES += vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ modules.builtin.ranges vmlinux.o.map \ compile_commands.json rust/test \ - rust-project.json .vmlinux.objs .vmlinux.export.c + rust-project.json .vmlinux.objs .vmlinux.export.c \ + .vmlinux.protected-exports.c # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \ diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 1284f05555b9..faaa9ba1f61a 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -20,6 +20,12 @@ quiet_cmd_cc_o_c = CC $@ ifdef CONFIG_MODULES targets += .vmlinux.export.o vmlinux: .vmlinux.export.o + +ifdef CONFIG_MODULE_SIG_PROTECT +targets += .vmlinux.protected-exports.o +vmlinux: .vmlinux.protected-exports.o +endif + endif ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index a9b3f34a78d2..bfac545879a1 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -70,6 +70,9 @@ vmlinux_link() if is_enabled CONFIG_MODULES; then objs="${objs} .vmlinux.export.o" + if is_enabled CONFIG_MODULE_SIG_PROTECT; then + objs="${objs} .vmlinux.protected-exports.o" + fi fi objs="${objs} init/version-timestamp.o"