From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26543 invoked from network); 8 Mar 2022 22:00:12 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 8 Mar 2022 22:00:12 -0000 Received: (qmail 15563 invoked by uid 550); 8 Mar 2022 22:00:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15539 invoked from network); 8 Mar 2022 22:00:09 -0000 Date: Tue, 8 Mar 2022 16:59:56 -0500 From: Rich Felker To: Florian Weimer Cc: musl@lists.openwall.com Message-ID: <20220308215956.GQ7074@brightrain.aerifal.cx> References: <875ysips53.fsf@oldenburg.str.redhat.com> <20211123201438.GA7074@brightrain.aerifal.cx> <87y25eoc5b.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87y25eoc5b.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] __WORDSIZE on x32 OK, following up on this rather late... On Tue, Nov 23, 2021 at 09:22:24PM +0100, Florian Weimer wrote: > * Rich Felker: > > > On Tue, Nov 23, 2021 at 08:51:36PM +0100, Florian Weimer wrote: > >> This looks a bid suspicious: > > > > Come on, you missed a chance to say "sus". :-) > > Sorry? I typo'ed “bit”, but that's not it? In the past year or two, "sus" has entered the vernacular for gaming-related reasons. ;-) > >> arch/x32/bits/reg.h:#undef __WORDSIZE > >> arch/x32/bits/reg.h:#define __WORDSIZE 32 > >> arch/x32/bits/user.h:#undef __WORDSIZE > >> arch/x32/bits/user.h:#define __WORDSIZE 64 > >> > >> I don't know if it causes any actual problems. I discovered it while > >> checking whether musl defines/uses __WORDSIZE. > > > > Thanks for the find. Now... which is it supposed to be? > > > > commit 664cd341921007cea52c8891f27ce35927dca378 introduced x32 as a > > patch against a copy of x86_64 and changed one instance from 64 to 32, > > so presumably the intent was to change both. Is this in agreement with > > what it means on glibc or elsewhere? > > glibc uses __WORDSIZE == 64 to differentiate x86-64 from x86-64-32, so > it should be 32 for x32. Fixing this now. > However, arch/x32/bits/user.h looks written as if define __WORDSIZE to > 64 changes the width of long to 64. I think struct user_regs_struct > needs to have unsigned long long members on x32. (It's what glibc uses > for both x86-64 and x86-64-32.) Likewise a most of the members of > struct user. For user_regs_struct, it's pretty clear they need to be 64-bit. I'm not sure about the long fields in struct user -- these may be 32-bit on ELF32? Let's keep this part open until someone looks into it more. Rich