kmod/patch: add kpatch.lds as a dependency for $(KPATCH_NAME).o

Starting with v5.10 kbuild no longer builds built-in targets for
external modules (including extra-y). Further it wasn't guaranteed that
extra-y targets were going to be built before linking.
Do a proper thing and add kpatch.lds as a dependency for $(KPATCH_NAME).o.

Upstream discussion for reference: https://lore.kernel.org/linux-kbuild/20201103054425.59251-1-chao.wang@ucloud.cn/

Fixes: #1148

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2020-12-04 12:29:55 +01:00
parent 158efe3191
commit 04021bbfd5

View File

@ -12,7 +12,7 @@ endif
obj-m += $(KPATCH_NAME).o
ldflags-y += -T $(src)/kpatch.lds
extra-y := kpatch.lds
targets += kpatch.lds
$(KPATCH_NAME)-objs += patch-hook.o output.o
@ -21,6 +21,8 @@ all: $(KPATCH_NAME).ko
$(KPATCH_NAME).ko:
$(KPATCH_MAKE)
$(obj)/$(KPATCH_NAME).o: $(src)/kpatch.lds
patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c
$(KPATCH_MAKE) patch-hook.o