kmod/patch: more linking fixes

While adding proper linker script option my previous patch left the
linker script in the list of source files (on pre-4.20 kernels) for
ld somehow breaking kpatch callback sections. For this to work
properly kpatch.lds needs to be added to 'extra-y' instead of objs. And
for kbuild to process this option properly we need to call make without
the .ko target, i.e. let kbuild decide what to build.

Fixes: 17a97b4 ("kmod/patch: fix patch linking with 4.20")
Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2018-12-07 16:46:08 +01:00
parent 1696f5db7b
commit b2f40b03ce
1 changed files with 3 additions and 2 deletions

View File

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