mirror of
https://github.com/dynup/kpatch
synced 2025-01-03 11:12:01 +00:00
b2f40b03ce
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>
30 lines
778 B
Makefile
30 lines
778 B
Makefile
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD)
|
|
LDFLAGS += $(KPATCH_LDFLAGS)
|
|
|
|
# ppc64le kernel modules are expected to compile with the
|
|
# -mcmodel=large flag. This enables 64-bit relocations
|
|
# instead of a 32-bit offset from the TOC pointer.
|
|
PROCESSOR = $(shell uname -m)
|
|
ifeq ($(PROCESSOR), ppc64le)
|
|
KBUILD_CFLAGS_MODULE += -mcmodel=large
|
|
endif
|
|
|
|
obj-m += $(KPATCH_NAME).o
|
|
ldflags-y += -T $(src)/kpatch.lds
|
|
extra-y := kpatch.lds
|
|
|
|
$(KPATCH_NAME)-objs += patch-hook.o output.o
|
|
|
|
all: $(KPATCH_NAME).ko
|
|
|
|
$(KPATCH_NAME).ko:
|
|
$(KPATCH_MAKE)
|
|
|
|
patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c
|
|
$(KPATCH_MAKE) patch-hook.o
|
|
|
|
clean:
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \
|
|
Module.symvers
|