Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3553832imw; Mon, 11 Jul 2022 10:47:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8LO/xHNo8c++ViuaJMRZdq06zhXGbHZomCFyIJoQSptFgczxFcLCVcppLjmT0D3s+F3XC X-Received: by 2002:a17:902:f60b:b0:16a:2dcf:989d with SMTP id n11-20020a170902f60b00b0016a2dcf989dmr20057110plg.90.1657561631156; Mon, 11 Jul 2022 10:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657561631; cv=none; d=google.com; s=arc-20160816; b=jSEDQvAu3EnfQ99Y8DBLpg13lagZwmW46YnJzPrezO9kDMFmYeAFvA0Ict2mmOonXK IkmXJkWuOBjW1kGyBSQuEoUt+NdgXmHodJ/DAKZ3ez+xg2EDCO82qWSIbl+ohcOG6jou BqwQo6N+S2vr8rX4+TFYyxlzsSweoN9Dnpd1PnP0/Gh/kZp42sNOowFLjQhwH9PtTrEK TUC5p1yQqabI9pTd7ftK3/qlSPYf9JyNlZlpltZkdKyDWb7+o48+6wbGjWnE1Z/3NMAo Yhp7H9J1bqpYqvnilZE/DVM+FYbU3wcbQ40VFTKgUhnKJw05bGaLv8ubaf0dxt2BNQoE 1Jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=K6burjohuntZRiB6Y4gDEiCAgw7L2d37tynoa6g/aHY=; b=WDnh5OPq9ugfzskEa80oZIn5S17oOf9q56ioNmTeYUkgzapCKHC1L20/qrY9uh7f/A Yw+RufgKigLUOHYLbvS21UX/62QhI0vGeRHUovbI3zR4QNGiLJEXjp6TObzzgOZ/YOpa DNrOc9N05uSJHjCFC/ItZGmHSBMUzUkyqDZKkBPxyrlbm9kRfirBPbxbGbndRgJHF4xn vK6UbtDlmyNJ8OxkoNoiL6yuze13392GIcd9RSEDrWS9i+rMXrsPswwpBWte6kvyWhdP VSKnMTbjLOogFFjlGcUavdbvIlm/r54SwTlnhOAaV5y+c9qJWOp9G2pybUBAX4HicTMW kzKw== 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 b38-20020a631b26000000b00408d37d1fa1si11768233pgb.785.2022.07.11.10.46.58; Mon, 11 Jul 2022 10:47:11 -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 S229846AbiGKQzQ (ORCPT + 99 others); Mon, 11 Jul 2022 12:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbiGKQzN (ORCPT ); Mon, 11 Jul 2022 12:55:13 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78D8D3E762 for ; Mon, 11 Jul 2022 09:55:10 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 26BGorGZ007522; Mon, 11 Jul 2022 11:50:54 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 26BGort6007521; Mon, 11 Jul 2022 11:50:53 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 11 Jul 2022 11:50:53 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Michael Ellerman , Nicholas Piggin , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Pali =?iso-8859-1?Q?Roh=E1r?= , Arnd Bergmann Subject: Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler Message-ID: <20220711165053.GF25951@gate.crashing.org> References: <8abab4888da69ff78b73a56f64d9678a7bf684e9.1657549153.git.christophe.leroy@csgroup.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,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 On Mon, Jul 11, 2022 at 04:19:30PM +0200, Christophe Leroy wrote: > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic > machine type for 32-bit compile"), when building a 32 bits kernel > with a bi-arch version of GCC, or when building a book3s/32 kernel, > the option -mcpu=powerpc is passed to GCC at all time, relying on it > being eventually overriden by a subsequent -mcpu=xxxx. > > But when building the same kernel with a 32 bits only version of GCC, > that is not done, relying on gcc being built with the expected default > CPU. > > This logic has two problems. First, it is a bit fragile to rely on > whether the GCC version is bi-arch or not, because today we can have > bi-arch versions of GCC configured with a 32 bits default. Second, > there are some versions of GCC which don't support -mcpu=powerpc, > for instance for e500 SPE-only versions. More fundamentally, the *only* thing you should check biarch for is for determining if you can use both -m32 and -m64 with the same compiler. Everything behaves identically in a biarch and a non-biarch compiler, other than the latter screams bloody murder if you try to change the architecture from 32 to 64 bit or vice versa. > So, stop relying on this approximative logic and allow the user to > decide whether he/she wants to use the toolchain's default CPU or if > he/she wants to set one, and allow only possible CPUs based on the > selected target. > > Reported-by: Pali Roh?r > Tested-by: Pali Roh?r > Reviewed-by: Arnd Bergmann > Cc: Segher Boessenkool > Signed-off-by: Christophe Leroy Reviewed-by: Segher Boessenkool Looks good to me. This untangles/demystifies quite some code :-) Segher