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 708053858C55 for ; Wed, 31 Aug 2022 21:50:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 708053858C55 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 27VLnjE7016614; Wed, 31 Aug 2022 16:49:45 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 27VLnjt3016613; Wed, 31 Aug 2022 16:49:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 31 Aug 2022 16:49:44 -0500 From: Segher Boessenkool To: Peter Bergner Cc: "Kewen.Lin" , GCC Patches , David Edelsohn Subject: Re: [PATCH] rs6000/test: Fix bswap64-4.c with has_arch_ppc64 [PR106680] Message-ID: <20220831214944.GW25951@gate.crashing.org> References: <69277846-f587-b79e-f741-a2942d326778@linux.ibm.com> <20220831152412.GP25951@gate.crashing.org> <20220831160529.GR25951@gate.crashing.org> <16dc8d80-44d5-b739-b4a8-d02a01943d49@linux.ibm.com> <20220831192839.GT25951@gate.crashing.org> <20220831210750.GV25951@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On Wed, Aug 31, 2022 at 04:38:02PM -0500, Peter Bergner wrote: > On 8/31/22 4:07 PM, Segher Boessenkool wrote: > > On Wed, Aug 31, 2022 at 02:53:07PM -0500, Peter Bergner wrote: > >> Changing OS_MISSING_POWERPC64 as I mentioned would not add OPTION_MASK_POWERPC64 > >> to our cpu masks when -m32 is used. > > > > So you say this is where the bug is? > > For linux64.h which is what I think the powerpc64-linux build will use, > we have: > > linux64.h:#define OS_MISSING_POWERPC64 !TARGET_64BIT > > Doing the macro expansion by hand into: > > set_masks = POWERPC_MASKS; > #ifdef OS_MISSING_POWERPC64 > if (OS_MISSING_POWERPC64) > set_masks &= ~OPTION_MASK_POWERPC64; > #endif > > > ...gives us: > > set_masks = POWERPC_MASKS; > if (!TARGET_64BIT) > set_masks &= ~OPTION_MASK_POWERPC64; > > So if we handled a -mpowerpc64 earlier on the command line and added > OPTION_MASK_POWERPC64 to our cpu mask, then a following -m32 use will > remove it here. > > So I mentioned doing: > > linux64.h: > - #define OS_MISSING_POWERPC64 !TARGET_64BIT > + #define OS_MISSING_POWERPC64 0 > > ...which disables the above code only for powerpc64-linux builds and doesn't > affect AIX, Darwin, BSD, etc. or a powerpc-linux build. But it is incorrect as well. Instead, we should look if -mpowerpc64 is enabled explicitly, and not change it if so. > > The kernel has. But there are user space things (glibc) that haven't > > been fixed, and those are default as well. > > Sure, but someone who is using -m32 -mpowerpc64 should know that and > relying on a 32-bit glibc to save/restore the full 64-bit registers > is a user error in my book. If you're using -m32 -mpower64, you > better know what you are doing and the limitations you have to live under. Of course. But -mpowerpc64 can never be any kind of default for 32-bit Linux. Not indirectly either. Segher