From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 3F2A63858D38 for ; Mon, 3 Oct 2022 16:15:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F2A63858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 293GDiTw017125; Mon, 3 Oct 2022 11:13:45 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 293GDi2X017124; Mon, 3 Oct 2022 11:13:44 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 3 Oct 2022 11:13:44 -0500 From: Segher Boessenkool To: Olivier Hainque Cc: gcc-patches@gcc.gnu.org Subject: Re: =?iso-8859-1?Q?=5Bpatch=5D=A0Fi?= =?iso-8859-1?Q?x?= thinko in powerpc default specs for -mabi Message-ID: <20221003161344.GP25951@gate.crashing.org> References: <20220923154924.GA66899@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923154924.GA66899@adacore.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Fri, Sep 23, 2022 at 11:49:24AM -0400, Olivier Hainque wrote: > For a powerpc compiler configured with --with-abi=elfv2, an explicit > -mabi option other than elfv1 fails to override the default. > > For example, after > > [...]/configure --enable-languages=c --target=powerpc-elf --with-abi=elfv2 > make all-gcc > > This command: > > ./gcc/xgcc -B./gcc/ t.c -mabi=ieeelongdouble -v > > issues: > > ./gcc/cc1 [...] t.c -mabi=ieeelongdouble -mabi=elfv2 > > elfv2 overrides the user request here, which I think > is not as intended. -mabi= does two separate things, unfortunately. First, you can use it to set the base ABI: elfv1, elfv2. But you can also use it to set ABI variants, ABI options: -mabi={no-,}altivec, -mabi={ieee,ibm}longdouble, -mabi=vec-{extabi,default}. Things in that latter category are completely orthogonal to anything else (except that some only make sense together with some base ABIs). Base ABI is not selectable for most, it is implied by your target triple. -mabi=elfv[12] only makes sense for targets that have either of the two by default. > This is controlled by OPTION_DEFAULT_SPECS, where we have > > {"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, > > >From https://gcc.gnu.org/pipermail/gcc-patches/2013-November/375042.html > I don't see an explicit reason to trigger only on elfv* . It just looks > like an oversight with a focus on elfv1 vs elfv2 at the time. > > The attached patch is a proposal to correct this, simply removing the > "elfv" prefix from the spec and adding the corresponding description > to the block comment just above. > > We have been using this for about a year now in gcc-11 based toolchains. > This helps our dejagnu testsuite runs for VxWorks on powerpc and > hasn't produced any ill side effect to date. So what exactly is this meant to do? > 2022-09-14 Olivier Hainque > > * config/rs6000/option-defaults.h (OPTION_DEFAULT_SPECS): > Have any -mabi, not only -mabi=elfv*, override the --with-abi > configuration default. > /* Support for a compile-time default CPU, et cetera. The rules are: > + --with-abi is ignored if -mabi is specified. > --with-cpu is ignored if -mcpu is specified; likewise --with-cpu-32 > and --with-cpu-64. > --with-tune is ignored if -mtune or -mcpu is specified; likewise > @@ -54,7 +55,7 @@ > --with-float is ignored if -mhard-float or -msoft-float are > specified. */ > #define OPTION_DEFAULT_SPECS \ > - {"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, \ > + {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ > {"tune", "%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}" }, \ > {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \ > {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \ So this patch will make a difference to people who use --with-abi= for one of the ABI variant things. But it does not seem correct. -mabi=optionA should not override the -mabi=optionB set in --with-abi=, where A and B are independent, nor should it override the base ABI. Please open a PR for the problem you want to solve here, so we do not lose track of it? Thanks, Segher