[PATCH] RISC-V: Fix a linkage error related to CONFIG_KEXEC{,_FILE}

GONG, Ruiqi gongruiqi1 at huawei.com
Fri Jun 10 04:46:59 PDT 2022


Following files (currently compiled with CONFIG_KEXEC=y) are needed to
be linked with kernel/kexec_core.o (compiled with CONFIG_KEXEC_CORE=y):

  arch/riscv/kernel/kexec_relocate.o,
  arch/riscv/kernel/crash_save_regs.o,
  arch/riscv/kernel/machine_kexec.o

But CONFIG_KEXEC_CORE can also be selected by CONFIG_KEXEC_FILE
regardless of CONFIG_KEXEC, which causes the problem as the Link
specifies.

Fix this problem by changing the controling config of the above
arch/riscv/kernel/*.o to be CONFIG_KEXEC_CORE, as how some other
architectures do.

Link: https://lore.kernel.org/all/202206100324.B0KDSd1C-lkp@intel.com/
Reported-by: kernel test robot <lkp at intel.com>
Fixes: 6261586e0c91 ("RISC-V: Add kexec_file support")
Signed-off-by: GONG, Ruiqi <gongruiqi1 at huawei.com>
---
 arch/riscv/kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile
index c71d6591d539..33bb60a354cd 100644
--- a/arch/riscv/kernel/Makefile
+++ b/arch/riscv/kernel/Makefile
@@ -78,7 +78,7 @@ obj-$(CONFIG_SMP) += cpu_ops_sbi.o
 endif
 obj-$(CONFIG_HOTPLUG_CPU)	+= cpu-hotplug.o
 obj-$(CONFIG_KGDB)		+= kgdb.o
-obj-$(CONFIG_KEXEC)		+= kexec_relocate.o crash_save_regs.o machine_kexec.o
+obj-$(CONFIG_KEXEC_CORE)	+= kexec_relocate.o crash_save_regs.o machine_kexec.o
 obj-$(CONFIG_KEXEC_FILE)	+= elf_kexec.o machine_kexec_file.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 
-- 
2.25.1




More information about the linux-riscv mailing list