From nobody Mon Sep 8 09:00:15 2025 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 EC25FEB64DD for ; Tue, 18 Jul 2023 14:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbjGROh2 (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We have originally guarded fiddling with CHECKFLAGS in our arch Makefile=20 by checking for the CONFIG_MIPS variable, not set for targets such as=20 `distclean', etc. that neither include `.config' nor use the compiler. =20 Starting from commit 805b2e1d427a ("kbuild: include Makefile.compiler=20 only when compiler is needed") we have had a generic `need-compiler'=20 variable explicitly telling us if the compiler will be used and thus its=20 capabilities need to be checked and expressed in the form of compilation flags. If this variable is not set, then `make' functions such as=20 `cc-option' are undefined, causing all kinds of weirdness to happen if=20 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=20 `modules_install' target, which does include `.config' and yet does not=20 use the compiler. Replace the check for CONFIG_MIPS with one for `need-compiler' instead,=20 so as to prevent the compiler from being ever called for CHECKFLAGS when=20 not needed. Reported-by: Guillaume Tucker Closes: https://lore.kernel.org/r/85031c0c-d981-031e-8a50-bc4fad2ddcd8@coll= abora.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+ Reported-by: "kernelci.org bot" --- arch/mips/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) linux-mips-checkflags-need-compiler.diff Index: linux-macro/arch/mips/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/arch/mips/Makefile +++ linux-macro/arch/mips/Makefile @@ -341,7 +341,7 @@ KBUILD_CFLAGS +=3D -fno-asynchronous-unwin =20 KBUILD_LDFLAGS +=3D -m $(ld-emul) =20 -ifdef CONFIG_MIPS +ifdef need-compiler CHECKFLAGS +=3D $(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/ /'=3D'/" -e "s/$$/'/" -e 's/\$$/&&/g')