Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6963291rwp; Tue, 18 Jul 2023 08:09:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlFuNQ2LLtaoOJ10MLJMTCoYsDWZLenAxCEQ22eCzAUCTq1AJLxZw1z2d7isa4r/FknHx582 X-Received: by 2002:a2e:97c8:0:b0:2b6:cf0f:1fbf with SMTP id m8-20020a2e97c8000000b002b6cf0f1fbfmr11361531ljj.42.1689692974513; Tue, 18 Jul 2023 08:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689692974; cv=none; d=google.com; s=arc-20160816; b=MtHYtIuXwCB9V7fON6vuhQCaxF/4eEV/BOhfCIYdxJ+7UGNyasAdNup5Mf9hQUYoGl UoCO3ukyFbpADvAnlX+y8hJM1aRHWGcdg6lPwskSCRK+IW90X1SQ3hAQoHboLkI8VAe9 QvNsO5x4hONsEo66/iMy+2mH6EMHjX9Wx2XVA4k+jmED7mINlp9ppMUZAmqEqrQ0javU ZeWyPi2RTMP7jUpFnwutGVdzQknlGeEIdf/akZpbbPUDdHXTcPutB6+Y+iHZy6yF3Qam hGJLt59VbrM+rls6G6ma2oBM/7zD03QdeZs6fycGJB6NX7fZCHoeF56z8cnHhKPO9+DJ dFnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=UJNKQqYwbq7he40MNmxhJnzLVyT3zz0pdQp3n1cTIZE=; fh=P85sgKSvNQe6MVBZ08U/jxZ3RFAsvXQU0IKq4FeHi9Q=; b=wg5HOfkS1ke8qbthGAdXAPJ+KqFixxNY0h5un/cYZy11kjb5MZr+nSDJ/Kjoj2rvr0 DHu56xZVfeb+YmiouE/KorSl8P1yXoZtoN52mpVPeeO+jfqvfd6fBI0M6J3wCXpBv60b Zc2GPfh55D+EMXzKxv549qymxlOhDCfV7zIpCPuhyEfQi8x5U93eZhef4JITOcwf/aCW d//pzNoBrn/wG4nOEI7uoyBHgP0Br1arJo2lY9vpF4bwqV0QHYBhT/+kO/8XxEDirA19 +DKBfJdTqzd7yA7dOzh7DUjrLXGu4qIXDOHC9fgCVxOGNStg3e6I6W+d2QdTn6E5sxf3 OTGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a1709063e4700b0098291c57810si1233534eji.704.2023.07.18.08.09.09; Tue, 18 Jul 2023 08:09:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232942AbjGROh2 (ORCPT + 99 others); Tue, 18 Jul 2023 10:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232804AbjGROhY (ORCPT ); Tue, 18 Jul 2023 10:37:24 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D284A1719; Tue, 18 Jul 2023 07:37:23 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 3E23092009D; Tue, 18 Jul 2023 16:37:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 39C7C92009C; Tue, 18 Jul 2023 15:37:23 +0100 (BST) Date: Tue, 18 Jul 2023 15:37:23 +0100 (BST) From: "Maciej W. Rozycki" To: Thomas Bogendoerfer cc: Jan-Benedict Glaw , Guillaume Tucker , Huacai Chen , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] MIPS: Only fiddle with CHECKFLAGS if `need-compiler' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have originally guarded fiddling with CHECKFLAGS in our arch Makefile by checking for the CONFIG_MIPS variable, not set for targets such as `distclean', etc. that neither include `.config' nor use the compiler. Starting from commit 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed") we have had a generic `need-compiler' variable explicitly telling us if the compiler will be used and thus its capabilities need to be checked and expressed in the form of compilation flags. If this variable is not set, then `make' functions such as `cc-option' are undefined, causing all kinds of weirdness to happen if we expect specific results to be returned, most recently: cc1: error: '-mloongson-mmi' must be used with '-mhard-float' messages with configurations such as `fuloong2e_defconfig' and the `modules_install' target, which does include `.config' and yet does not use the compiler. Replace the check for CONFIG_MIPS with one for `need-compiler' instead, so as to prevent the compiler from being ever called for CHECKFLAGS when not needed. Reported-by: Guillaume Tucker Closes: https://lore.kernel.org/r/85031c0c-d981-031e-8a50-bc4fad2ddcd8@collabora.com/ Signed-off-by: Maciej W. Rozycki Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed") Cc: stable@vger.kernel.org # v5.13+ --- arch/mips/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) linux-mips-checkflags-need-compiler.diff Index: linux-macro/arch/mips/Makefile =================================================================== --- linux-macro.orig/arch/mips/Makefile +++ linux-macro/arch/mips/Makefile @@ -341,7 +341,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin KBUILD_LDFLAGS += -m $(ld-emul) -ifdef CONFIG_MIPS +ifdef need-compiler CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')