Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5037993pxb; Wed, 26 Jan 2022 03:32:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXhWPXpauJyW5Apz+gUmC8hsh4cuhnxd8KjeRC2Yr11aKHY1+lI7/9lptq9ddHW1LHhCDD X-Received: by 2002:a17:902:d703:b0:149:db85:9b30 with SMTP id w3-20020a170902d70300b00149db859b30mr22981078ply.23.1643196756906; Wed, 26 Jan 2022 03:32:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643196756; cv=none; d=google.com; s=arc-20160816; b=TEqmp5fJh9DP1BDBv2z1Pv5uhPxrv1p1qiLuxjTeabSqVeAwuWMIGOziXDNO62QpqK i9CaCQP6/V2CHkkB8mRg7qmr4ihEkgDKsQdOJnvZ9/xtssrUhu+BZkh92LSgNcuClHdl 3VN3mzk89Gmb2Pa7dVsE3GBR0rF70mXcB4dDMrutyIxLj7DltKqFVbbIVING90pDEjnz WuO0lU3w1Lf8/hPa4OkeB+d98hIvZBI4135GdWiIbNpoHRxkWxd0lEUvnuFQbzIhFTev rp6ensVpDMfx4SpyhHRqdCNst5IkbsXJtas1lY+ogXAANPT9FsGJMzfmZxRI21KZcLh4 mzmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5SQvrmFrBa5gmofbeH/N5bh5cY8yP4kSrgSn8lRafJ4=; b=ItbFwiE0jdVjQLAIS0gCmlj13vFCGSpN8uPlBg9gOzcGyexmU/W8mBwpJh936OrFch QVo54wd9YTKrmjRLXUpdAxES4PabuP43Gsu8zjqCeIiN7LiKnad1vDayknGyrGAO72uR /R5HzUeIa9HQDdipu4FZd/cgwpvwHQDs6nhn1YvPZ3EoFi3DkcWJF9D558v34/AAtgKZ Y5S2MeZbs1x7EW2IkL+PydU90YGTOeL51Xcg2EBsauf9uPqwjdw9fSTXuTVYAQhu8/My 0T0AECeb0VbVTxBznGMQ0siJP7N8TsYNMDk0OR+1Sdp6Lwx3ULR4+Hx8Z9pvPmyVz4Ql 53KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R1bwuR0A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si18867972pll.352.2022.01.26.03.32.23; Wed, 26 Jan 2022 03:32:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R1bwuR0A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233715AbiAYWT5 (ORCPT + 99 others); Tue, 25 Jan 2022 17:19:57 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47346 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233735AbiAYWTw (ORCPT ); Tue, 25 Jan 2022 17:19:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C86ACB81B76; Tue, 25 Jan 2022 22:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD26FC340E7; Tue, 25 Jan 2022 22:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643149189; bh=3ZivQ+FV86iNurkooJ7KOtL0OLNq/84ROVUSZKlyUQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1bwuR0A6QqrCq/SDFCiXZKLqitK5ygFouhvtwcGnCqmRrB+sA4+WwQX8sTzzvQUN i302fTiAqLA6FD6R8XIGsfnzRLUkfhtF5tWAFnW/PnJLX5JLWRCRaImDxJMOcnEd1f ncOdBckbw2V4fsZ4DTDsciUNrEGo3frRNuwM6skqlVfqLBG3LIWRnXw+nSil75TWl8 Aqy95geVO1I9rDUz18e3ql8vQ44KSCSWChZmkAoFKicY3++slU4WnY8NXCkA1Ew542 0dmeQb2TbPY5TJIAuS20mMBShWABctXvFngYF2KNe5i4Y+Jz2fU+8ViuXDRapHz8ck 4dhQzjVt1Yhfw== From: Nathan Chancellor To: Huacai Chen , Jiaxun Yang , Thomas Bogendoerfer Cc: Nick Desaulniers , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH v2 2/2] MIPS: Loongson{2ef,64}: Wrap -mno-branch-likely with cc-option Date: Tue, 25 Jan 2022 15:19:25 -0700 Message-Id: <20220125221925.3547683-2-nathan@kernel.org> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220125221925.3547683-1-nathan@kernel.org> References: <20220125221925.3547683-1-nathan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This flag is not supported by clang, which results in a warning: clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument] This breaks cc-option, which adds -Werror to make this warning fatal and catch flags that are not supported. Wrap this flag in cc-option so that it does not cause cc-option to fail, which can cause randconfigs to be really noisy, due to warnings not getting disabled that should be. Additionally, move the cc-option check to Kconfig so that the check is done at configuration time, rather than build time, as builds with no configuration change will be quicker because the cc-option call will not need to happen in those instances. Suggested-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- v1 -> v2: https://lore.kernel.org/r/20220120214001.1879469-2-nathan@kernel.org/ * Move cc-option call to Kconfig (Nick). * Also apply to loongson2ef, even though this will not currently build with clang. arch/mips/Kconfig | 4 ++++ arch/mips/loongson2ef/Platform | 3 ++- arch/mips/loongson64/Platform | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 058446f01487..da6b3e0501a7 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3202,6 +3202,10 @@ config MIPS32_N32 If unsure, say N. +config CC_HAS_MNO_BRANCH_LIKELY + def_bool y + depends on $(cc-option,-mno-branch-likely) + menu "Power management options" config ARCH_HIBERNATION_POSSIBLE diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform index 50e659aca543..eebabf9df6ac 100644 --- a/arch/mips/loongson2ef/Platform +++ b/arch/mips/loongson2ef/Platform @@ -41,6 +41,7 @@ cflags-y += $(call cc-option,-mno-loongson-mmi) # Loongson Machines' Support # -cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef -mno-branch-likely +cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef +cflags-$(CONFIG_CC_HAS_MNO_BRANCH_LIKELY) += -mno-branch-likely load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform index f2a08a185ee2..473404cae1c4 100644 --- a/arch/mips/loongson64/Platform +++ b/arch/mips/loongson64/Platform @@ -18,5 +18,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi) # Loongson Machines' Support # -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 +cflags-$(CONFIG_CC_HAS_MNO_BRANCH_LIKELY) += -mno-branch-likely load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000 -- 2.35.0