Re: [PATCH V4 14/14] LoongArch: Adjust build infrastructure for 32BIT/64BIT

Huacai Chen
2026-04-24T04:14:47Z

Hi, Nathan,

On Fri, Apr 24, 2026 at 6:06 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Hi Huacai,
>
> Now that this is in -next as commit 3d9aba6618d1 ("LoongArch: Adjust
> build infrastructure for 32BIT/64BIT"), I am seeing two issues:
>
> On Thu, Nov 27, 2025 at 11:48:32PM +0800, Huacai Chen wrote:
> > Adjust build infrastructure (Kconfig, Makefile and ld scripts) to let
> > us enable both 32BIT/64BIT kernel build.
> ...
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index 730f34214519..4bacde9f46d1 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > +menu "Kernel type and options"
> > +
> > +choice
> > + prompt "Kernel type"
> >
> > config 32BIT
> > - bool
> > + bool "32-bit kernel"
> > + help
> > + Select this option if you want to build a 32-bit kernel.
> >
> > config 64BIT
> > - def_bool y
> > + bool "64-bit kernel"
> > + help
> > + Select this option if you want to build a 64-bit kernel.
> > +
> > +endchoice
>
> The way this is written results in a 32-bit kernel when building
> ARCH=loongarch allmodconfig or having a previously 64-bit configuration
> and running olddefconfig on it, which seems surprising to me. I think it
> would be good to either adjust the ordering such that 64BIT is first or
> include an explicit default statement like so:
>
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 3b042dbb2c41..3addd06b3f5a 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -220,6 +220,7 @@ menu "Kernel type and options"
>
> choice
> prompt "Kernel type"
> + default 64BIT
>
> config 32BIT
> bool "32-bit kernel"
> --
Thank you for pointing out, since the code has been tagged, I will fix
it after 7.1-rc1 as soon as possible.

Huacai

>
> > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > index 8d45b860fe56..47516aeea9d2 100644
> > --- a/arch/loongarch/Makefile
> > +++ b/arch/loongarch/Makefile
> ...
> > @@ -62,9 +66,19 @@ ifneq ($(SUBARCH),$(ARCH))
> > endif
> > endif
> >
> > +ifdef CONFIG_32BIT
> > +ifdef CONFIG_32BIT_STANDARD
> > +ld-emul = $(32bit-emul)
> > +cflags-y += -march=la32v1.0 -mabi=ilp32s -mcmodel=normal
> > +else # CONFIG_32BIT_REDUCED
> > +ld-emul = $(32bit-emul)
> > +cflags-y += -march=la32rv1.0 -mabi=ilp32s -mcmodel=normal
> > +endif
> > +endif
>
> As a result of the above problem, I see
>
> clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored]
> clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored]
> clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored]
>
> when building configurations that I expected to be 64-bit but had been
> turned into 32-bit ones with LLVM. This was also reported by the test
> robot with allnoconfig.
>
> https://lore.kernel.org/202604232041.ESJDwVG4-lkp@intel.com/
>
> Maybe some change is needed on the LLVM side?
>
> Cheers,
> Nathan