• Baoquan He's avatar
    loongarch, kexec: change dependency of object files · 655fc6cd
    Baoquan He authored
    Patch series "kexec: fix the incorrect ifdeffery and dependency of
    CONFIG_KEXEC".
    
    The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
    dropped, then compiling errors will be triggered if below config items are
    set:
    
    ===
    CONFIG_CRASH_CORE=y
    CONFIG_KEXEC_CORE=y
    CONFIG_CRASH_DUMP=y
    ===
    
    E.g on mips, below link error are seen:
    --------------------------------------------------------------------
    mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
    kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
    mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
    kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
    mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
    mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
    kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
    mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
    --------------------------------------------------------------------
    
    Here, change the incorrect dependency of building kexec_core related
    object files, and the ifdeffery on architectures from CONFIG_KEXEC to
    CONFIG_KEXEC_CORE.
    
    Testing:
    ========
    Passed on mips and loognarch with the LKP reproducer.
    
    
    This patch (of 5):
    
    Currently, in arch/loongarch/kernel/Makefile, building machine_kexec.o
    relocate_kernel.o depends on CONFIG_KEXEC.
    
    Whereas, since we will drop the select of KEXEC for CRASH_DUMP in
    kernel/Kconfig.kexec, compiling error will be triggered if below config
    items are set:
    
    ===
    CONFIG_CRASH_CORE=y
    CONFIG_KEXEC_CORE=y
    CONFIG_CRASH_DUMP=y
    ===
    
    ---------------------------------------------------------------
    loongarch64-linux-ld: kernel/kexec_core.o: in function `.L209':
    >> kexec_core.c:(.text+0x1660): undefined reference to `machine_kexec_cleanup'
       loongarch64-linux-ld: kernel/kexec_core.o: in function `.L287':
    >> kexec_core.c:(.text+0x1c5c): undefined reference to `machine_crash_shutdown'
    >> loongarch64-linux-ld: kexec_core.c:(.text+0x1c64): undefined reference to `machine_kexec'
       loongarch64-linux-ld: kernel/kexec_core.o: in function `.L2^B5':
    >> kexec_core.c:(.text+0x2090): undefined reference to `machine_shutdown'
       loongarch64-linux-ld: kexec_core.c:(.text+0x20a0): undefined reference to `machine_kexec'
    ---------------------------------------------------------------
    
    Here, change the dependency of machine_kexec.o relocate_kernel.o to
    CONFIG_KEXEC_CORE can fix above building error.
    
    Link: https://lkml.kernel.org/r/20231208073036.7884-1-bhe@redhat.com
    Link: https://lkml.kernel.org/r/20231208073036.7884-2-bhe@redhat.comSigned-off-by: default avatarBaoquan He <bhe@redhat.com>
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202311300946.kHE9Iu71-lkp@intel.com/
    Cc: Eric DeVolder <eric_devolder@yahoo.com>
    Cc: Ignat Korchagin <ignat@cloudflare.com>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    655fc6cd
Makefile 2.13 KB