From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from magnesium.8pit.net (magnesium.8pit.net [45.76.88.171]) by sourceware.org (Postfix) with ESMTP id BAE013858D1E for ; Mon, 11 Apr 2022 17:26:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAE013858D1E Received: from localhost (p200300f5ff0bf400e4565cc83b663cdb.dip0.t-ipconnect.de [2003:f5:ff0b:f400:e456:5cc8:3b66:3cdb]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 3b0fe1ec (TLSv1.3:AEAD-AES256-GCM-SHA384:256:YES); Mon, 11 Apr 2022 19:26:02 +0200 (CEST) Date: Mon, 11 Apr 2022 19:25:57 +0200 To: Ian Lance Taylor Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Re: [PATCH v4] libgo: Don't use pt_regs member in mcontext_t From: =?UTF-8?Q?S=C3=B6ren?= Tempel References: <20220311073406.26722-1-soeren@soeren-tempel.net> <22SFHJJH9SLH2.2A2YD69UFEBGS@8pit.net> <28CKR3HNP3V6M.3J4T5E3ITVM1J@8pit.net> <34ERK5RNBY2J7.2RDLOQ9YR6OH1@8pit.net> In-Reply-To: <34ERK5RNBY2J7.2RDLOQ9YR6OH1@8pit.net> Message-Id: <3FIHQWF921IKP.2NRORMSVRPMYW@8pit.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2022 17:26:05 -0000 Hi, Any updates no this? Sorry I keep bothering you with this but we are quite literally only a few lines away from having the go-signal.c code compile on PPC64 musl :) Let me know if you need more information to get this fixed. Greetings, S=C3=B6ren S=C3=B6ren Tempel wrote: > Ian Lance Taylor wrote: > > Sorry, I guess I misread your patch. >=20 > No problem, I think this stuff is hard to get right and understand in > general since it is so poorly documented. >=20 > > What is the right standalone code for the PPC64 musl case? Thanks. >=20 > In order to have the current code (i.e. current gofrontend HEAD with > your patch) compile and work with PPC64 musl it would be sufficient to > just include asm/ptrace.h, as proposed in the v1 of my patch [1]: >=20 > // On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > // type. This type must be completed by including asm/ptrace.h. > #ifdef __PPC__ > #include > #endif >=20 > Technically, this should also be needed for using .regs on glibc since > it also declares pt_regs as in incomplete type [5]. As such, adding the > include may be the easiest way to resolve this issue. >=20 > However, based on your feedback [2] and feedback by Rich Felker [3]. I > rewrote the go-signal.c PowerPC register handling code to not use .regs > ("Having pt_regs appear at all in code not using ptrace is a serious > code smell"). See the v4 of my patch for details [4]. If you don't want > to use .regs on PPC64 musl the right standalone code should be: >=20 > ((ucontext_t*)(context))->uc_mcontext.gp_regs; >=20 > Unfortunately, this code only works on PPC64 musl and PPC64 glibc not on > PPC32 glibc and PPC32 musl, thus I added a case distinction in the v4 of > my patch [4]. For my personal needs it would be very much sufficient to > just add an include of asm/ptrace.h to go-signal.c to make the current > code (i.e. your patch) also work with PPC64 musl. >=20 > Greetings, > S=C3=B6ren >=20 > [1]: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html > [2]: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590668.html > [3]: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591257.html > [4]: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591593.html > [5]: https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob;f=3Dsysdeps/unix/= sysv/linux/powerpc/sys/ucontext.h;hb=3D6ff3c7714900529b8f5ca64b58d5da9cd5d5= b345#l33