All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: linux-mips@vger.kernel.org
Cc: llvm@lists.linux.dev, tsbogend@alpha.franken.de,
	ndesaulniers@google.com, nathan@kernel.org,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH v2 4/7] MIPS: Detect toolchain support of o32 ABI with 64 bit CPU
Date: Fri, 14 Apr 2023 09:06:58 +0100	[thread overview]
Message-ID: <20230414080701.15503-5-jiaxun.yang@flygoat.com> (raw)
In-Reply-To: <20230414080701.15503-1-jiaxun.yang@flygoat.com>

LLVM is not happy with using o32 ABI on 64 bit CPU, thus build 32 bit
kernel is unsupported.

Detect this in Kconfig to prevent user select 32 bit kernel with
unsupported toolchain.

Link: https://github.com/ClangBuiltLinux/linux/issues/884
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/Kconfig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0cd9cd01b7ab..2374f859e001 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2016,6 +2016,7 @@ choice
 config 32BIT
 	bool "32-bit kernel"
 	depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL
+	depends on CC_HAS_O32_ABI
 	select TRAD_SIGNALS
 	help
 	  Select this option if you want to build a 32-bit kernel.
@@ -3137,7 +3138,7 @@ config COMPAT
 
 config MIPS32_O32
 	bool "Kernel support for o32 binaries"
-	depends on 64BIT
+	depends on 64BIT && CC_HAS_O32_ABI
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT
 	select MIPS32_COMPAT
@@ -3185,6 +3186,10 @@ config CC_HAS_DADDI_WORKAROUNDS
 config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH
 	def_bool y if CC_IS_CLANG
 
+config CC_HAS_O32_ABI
+	def_bool y
+	depends on !CPU_SUPPORTS_64BIT_KERNEL || $(cc-option,-march=mips3 -mabi=32)
+
 config AS_HAS_MSA
 	def_bool $(cc-option,-Wa$(comma)-mmsa)
 
-- 
2.39.2 (Apple Git-143)


  parent reply	other threads:[~2023-04-14  8:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14  8:06 [PATCH v2 0/7] MIPS: LLVM toolchain support for more CPUs Jiaxun Yang
2023-04-14  8:06 ` [PATCH v2 1/7] MIPS: Move various toolchain ASE check to Kconfig Jiaxun Yang
2023-04-14  8:06 ` [PATCH v2 2/7] MIPS: Add toolchain feature dependency for microMIPS smartMIPS Jiaxun Yang
2023-04-18 13:08   ` Thomas Bogendoerfer
2023-04-19 23:01     ` Nick Desaulniers
2023-04-20 19:41       ` Jiaxun Yang
2023-04-24 17:03         ` Nathan Chancellor
2023-04-14  8:06 ` [PATCH v2 3/7] MIPS: Detect toolchain support of workarounds in Kconfig Jiaxun Yang
2023-04-18 13:09   ` Thomas Bogendoerfer
2023-04-18 17:14     ` Jiaxun Yang
2023-04-14  8:06 ` Jiaxun Yang [this message]
2023-04-14  8:06 ` [PATCH v2 5/7] MIPS: Remove cc-option checks for -march=octeon Jiaxun Yang
2023-04-14  8:07 ` [PATCH v2 6/7] MIPS: Fallback CPU -march CFLAG to ISA level if unsupported Jiaxun Yang
2023-04-18 20:07   ` Nick Desaulniers
2023-04-19 16:50     ` Jiaxun Yang
2023-04-19 21:35       ` Nick Desaulniers
2023-04-19 22:15         ` Thomas Bogendoerfer
2023-04-19 23:36           ` Jiaxun Yang
2023-04-20  8:06             ` Thomas Bogendoerfer
2023-04-20 16:32           ` Nick Desaulniers
2023-04-20 18:42             ` Xi Ruoyao
2023-04-20 18:50               ` Xi Ruoyao
2023-04-20 19:16             ` Jiaxun Yang
2023-04-14  8:07 ` [PATCH v2 7/7] MIPS: Limit MIPS_MT_SMP support by ISA reversion Jiaxun Yang

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=20230414080701.15503-5-jiaxun.yang@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.