Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	llvm@lists.linux.dev, patches@lists.linux.dev
Subject: Re: [PATCH] MIPS: generic: Do not select CPUs that are unsupported in clang
Date: Thu, 6 Apr 2023 14:09:53 -0700	[thread overview]
Message-ID: <20230406210953.GA53516@dev-arch.thelio-3990X> (raw)
In-Reply-To: <AAAAB6A1-81EE-42A8-84F7-CF8D0DA16456@flygoat.com>

On Thu, Apr 06, 2023 at 09:59:45PM +0100, Jiaxun Yang wrote:
> 
> 
> > 2023年4月6日 21:09,Nathan Chancellor <nathan@kernel.org> 写道:
> > 
> > When building allnoconfig with clang after commit de34007751aa ("MIPS:
> > generic: Enable all CPUs supported by virt board in Kconfig"), the
> > following error occurs:
> > 
> >  error: unknown target CPU 'r4600'
> >  note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5, mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600
> > 
> > Working around that, there are similar errors for 'loongson2e' and
> > 'loongson2f'.
> > 
> > These CPUs are not supported in clang/LLVM, so do not select support for
> > them in MIPS_GENERIC_KERNEL when building with clang.
> > 
> > Fixes: de34007751aa ("MIPS: generic: Enable all CPUs supported by virt board in Kconfig")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> Thanks for the patch.
> 
> Actually there is no need for any special support for those CPUs.
> We should be able to build those kernels with -march=mips3.
> 
> I think something like:
> 
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -150,7 +150,7 @@ cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
>  #
>  cflags-$(CONFIG_CPU_R3000)     += -march=r3000
>  cflags-$(CONFIG_CPU_R4300)     += -march=r4300 -Wa,--trap
> -cflags-$(CONFIG_CPU_R4X00)     += -march=r4600 -Wa,--trap
> +cflags-$(CONFIG_CPU_R4X00)     += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
>  cflags-$(CONFIG_CPU_TX49XX)    += -march=r4600 -Wa,--trap
>  cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
>  cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
> @@ -181,8 +181,8 @@ endif
>  cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
>  cflags-$(CONFIG_CPU_BMIPS)     += -march=mips32 -Wa,-mips32 -Wa,--trap
>  
> -cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e -Wa,--trap
> -cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap
> +cflags-$(CONFIG_CPU_LOONGSON2E) += $(call cc-option,-march=loongson2e,-march=mips3) -Wa,--trap
> +cflags-$(CONFIG_CPU_LOONGSON2F) += $(call cc-option,-march=loongson2f,-march=mips3) -Wa,--trap
>  # Some -march= flags enable MMI instructions, and GCC complains about that
>  # support being enabled alongside -msoft-float. Thus explicitly disable MMI.
>  cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-mno-loongson-mmi)
> 
> Will make them build.

Thank you for taking a look and the suggestion! I applied it and tried
to build allnoconfig but I get

  error: ABI 'o32' is not supported on CPU 'mips3'

immediately, which could certainly be a bug in clang...

Cheers,
Nathan

  reply	other threads:[~2023-04-06 21:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 20:09 [PATCH] MIPS: generic: Do not select CPUs that are unsupported in clang Nathan Chancellor
2023-04-06 20:59 ` Jiaxun Yang
2023-04-06 21:09   ` Nathan Chancellor [this message]
2023-04-06 21:19     ` Jiaxun Yang
2023-04-06 21:30       ` Jiaxun Yang
2023-04-06 21:39         ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406210953.GA53516@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=patches@lists.linux.dev \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox