From a02668a0f7ea3f82bf9220ce4bd264624fbd0f89 Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Mon, 9 Aug 2021 16:55:19 -0400 Subject: [PATCH] kmod: remove redundant -mcmodel=large on ppc64le In PR #1205, Kamalesh reports: ... I see that the -mcmodel=large flag is being passed twice with KBUILD_CFLAGS_MODULE set: gcc -Wp,-MMD,/root/.kpatch/tmp/patch/.livepatch-meminfo.mod.o.d ............ -mcmodel=medium .... -I/root/kpatch/kmod/patch -mcmodel=large -fplugin=/root/kpatch/kpatch-build/gcc-plugins/ppc64le-plugin.so ... -DMODULE -mno-save-toc-indirect -mcmodel=large -mcmodel=large -DKBUILD_BASENAME='"livepatch_meminfo.mod"' -DKBUILD_MODNAME='"livepatch_meminfo"' -D__KBUILD_MODNAME=kmod_livepatch_meminfo -c -o /root/.kpatch/tmp/patch/livepatch-meminfo.mod.o /root/.kpatch/tmp/patch/livepatch-meminfo.mod.c. I loaded the module built without the KBUILD_CFLAGS_MODULE += -mcmodel=large flag and seems to okay. I guess, we can remove the arch specific flag from the Makefile. Suggested-by: Kamalesh Babulal Signed-off-by: Joe Lawrence --- kmod/patch/Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kmod/patch/Makefile b/kmod/patch/Makefile index 85f0850..2e53ab1 100644 --- a/kmod/patch/Makefile +++ b/kmod/patch/Makefile @@ -2,14 +2,6 @@ KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD) CFLAGS_MODULE='$(CFLAGS_MODULE)' 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) -CFLAGS_MODULE += -mcmodel=large -endif - obj-m += $(KPATCH_NAME).o ldflags-y += -T $(src)/kpatch.lds targets += kpatch.lds