From patchwork Fri Apr 14 08:06:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13211089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEE42C77B71 for ; Fri, 14 Apr 2023 08:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbjDNIHj (ORCPT ); Fri, 14 Apr 2023 04:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjDNIHj (ORCPT ); Fri, 14 Apr 2023 04:07:39 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0A26E91 for ; Fri, 14 Apr 2023 01:07:34 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CA8255C00E8; Fri, 14 Apr 2023 04:07:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 14 Apr 2023 04:07:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1681459653; x= 1681546053; bh=319qtseuj6dXrXziMf2n5r9XqioLOhb85xW0q9IWu6c=; b=Q GDKSP1QW1DnvFoT+CClJqCOG0D4Hc92n/pTVeYpOF/5Ez7ctcmp8iEmQAvsUPv2B CJA1Dc4s63Ndq3g71yoDXyevx5QvyIQ6B9KNBDjG13Vcr2iFmx8llKN1tqPB6QVX Zkel71+emHrbO2N2zHlnf4t4ZLyxTyW4HYxGJIkzgIcDaQceFclIszsDAxf4XbsS 3q/klnFqxvmKciyH3w0HziGl9sbUnqLZOJeOs7dEMrE8WcfIRLpAEGeUmCNs90pm uS166Ic/74ZR0wQXHDj8UyDpVRzLjHuTYQ1mHEDIuYTJjhdufRClcr6TGX/1YFVH HDgT77Vi9HMT0kOickrVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1681459653; x= 1681546053; bh=319qtseuj6dXrXziMf2n5r9XqioLOhb85xW0q9IWu6c=; b=Y sBATC9nHm2ybLd9oVhWelVnlS+aPi0rljO4G7UaOE/2iIKxd5tuzXCbALHvUd1sU PVYRJ0KHhpJ+cgaB5zTrmMLYddswKD2O2B0HbekJw+8apuBS6mlVt4gFiHoJFvLb ZMWSVAhtvt6hqh39YHwOwyDShZVQ89270Qb40fuOtqPo7HWP8Twr/+CMapxasy+b nFu/UKCEWkrz0h97lS1TWjUaLp1Fv95Cp7qoZC4pR7Hei986Dr3Eb+5NM7EcLEHV TNlXcE3wx0lRuS67iWOY5HEXyoKjB7tyjTNW1w63xA+Df2Znn2hEk2tXfxv4Dr6D ufa4fvd9WFd+GnNVbzO3A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdekledgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigr nhhgsehflhihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpeeifefhvedthfejve evgfekueduieelfeetffdtveetffefgeelieetgfffueejkeenucffohhmrghinhepghhi thhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Apr 2023 04:07:32 -0400 (EDT) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: llvm@lists.linux.dev, tsbogend@alpha.franken.de, ndesaulniers@google.com, nathan@kernel.org, Jiaxun Yang 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 Message-Id: <20230414080701.15503-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20230414080701.15503-1-jiaxun.yang@flygoat.com> References: <20230414080701.15503-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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 Signed-off-by: Jiaxun Yang --- 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)