kmod/patch: fix patch linking with 4.20

4.20 includes commit 69ea912fda74 "kbuild: remove unneeded link_multi_deps"
which changes kbuild so that only '.o' files are given to ld as targets
for linking, leaving out our linker script. Even before this commit we
were still doing this wrong and were succeeding just because ld is smart
enough to detect the script, it even throws a warning:

ld: warning: kpatch.lds contains output sections; did you forget -T?

The right thing to do is to add the script to ldflags either through
kbuilds 'ldflags-y' or by adding it to LDFLAGS/KPATCH_LDFLAGS directly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2018-11-14 15:09:34 +01:00
parent da3eed612d
commit 17a97b48bc

View File

@ -11,6 +11,7 @@ KBUILD_CFLAGS_MODULE += -mcmodel=large
endif
obj-m += $(KPATCH_NAME).o
ldflags-y += -T $(src)/kpatch.lds
$(KPATCH_NAME)-objs += patch-hook.o kpatch.lds output.o