Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

Baoquan He
2023-12-20T13:27:43Z

On 12/20/23 at 06:00am, Al Viro wrote:
> On Wed, Dec 20, 2023 at 01:44:19PM +0800, Baoquan He wrote:
>
> > > arch/sh/kernel/relocate_kernel.S: Assembler messages:
> > > >> arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:41: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:126: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:129: Error: invalid operands for opcode
> >
> > I reproduced this error, haven't got why and a way to fix it, will come
> > back later if I have fix.
>
> At a guess - after that commit ARCH_SUPPORTS_CRASH_DUMP is enough to enable CRASH_DUMP,
> which selects KEXEC_CORE regardless of ARCH_SUPPORTS_KEXEC. And on sh you have
> the former selected on any UP build, while the latter - only on MMU ones (i.e.
> not SH2).

Yeah, you are right. I managed to set CONFIG_CPU_SH4=y and CONFIG_MMU=y,
the building passed.
---------------------
CONFIG_CPU_SH4=y
CONFIG_CPU_SH4A=y
CONFIG_CPU_SHX2=y
...
CONFIG_MMU=y
...
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
-----------------------------

Since the kexec_core code building depends on CONFIG_MMU=y, we may
need to add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP. I made below
change, do you think it's OK?

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 7500521b2b98..fe1500871648 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -548,6 +548,7 @@ config ARCH_SUPPORTS_KEXEC

config ARCH_SUPPORTS_CRASH_DUMP
def_bool BROKEN_ON_SMP
+ depends on MMU

config ARCH_SUPPORTS_KEXEC_JUMP
def_bool y