public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Sören Tempel" <soeren@soeren-tempel.net>
To: Ian Lance Taylor <iant@golang.org>
Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Re: [PATCH v4] libgo: Don't use pt_regs member in mcontext_t
Date: Sun, 03 Apr 2022 11:28:18 +0200	[thread overview]
Message-ID: <34ERK5RNBY2J7.2RDLOQ9YR6OH1@8pit.net> (raw)
In-Reply-To: <CAOyqgcW21SyGbZ5-jUTwLNg0m1oxWVJmJWebJLUuTRoGypgJ=A@mail.gmail.com>

Ian Lance Taylor <iant@golang.org> wrote:
> Sorry, I guess I misread your patch.

No problem, I think this stuff is hard to get right and understand in
general since it is so poorly documented.

> What is the right standalone code for the PPC64 musl case?  Thanks.

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]:

	// 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 <asm/ptrace.h>
	#endif

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.

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:

	((ucontext_t*)(context))->uc_mcontext.gp_regs;

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.

Greetings,
Sören

[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=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h;hb=6ff3c7714900529b8f5ca64b58d5da9cd5d5b345#l33

  reply	other threads:[~2022-04-03  9:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-02 16:37 [PATCH] libgo: include asm/ptrace.h for pt_regs definition on PowerPC soeren
2022-02-20 10:43 ` Sören Tempel
2022-02-21 17:25   ` [gofrontend-dev] " Ian Lance Taylor
2022-03-06 12:49     ` Sören Tempel
2022-03-06 15:22     ` Rich Felker
2022-03-06 16:59       ` Rich Felker
2022-02-20 11:01 ` Andreas Schwab
2022-03-06 18:59 ` [PATCH v2] libgo: Don't use pt_regs member in mcontext_t soeren
2022-03-06 21:21   ` Rich Felker
2022-03-07  7:09     ` [PATCH v3] " soeren
2022-03-07 22:59       ` Ian Lance Taylor
2022-03-08 13:23         ` Rich Felker
2022-03-09  7:26         ` Sören Tempel
2022-03-09 11:52           ` Rich Felker
2022-03-11  7:34             ` [PATCH v4] " soeren
2022-03-31 16:41               ` Sören Tempel
2022-03-31 20:26                 ` Ian Lance Taylor
2022-04-02  8:21                   ` Sören Tempel
2022-04-03  2:02                     ` Ian Lance Taylor
2022-04-03  9:28                       ` Sören Tempel [this message]
2022-04-11 17:25                         ` Sören Tempel
2022-04-11 17:35                           ` Ian Lance Taylor
2022-04-11 18:28                             ` Sören Tempel
2022-04-14 22:15                               ` Ian Lance Taylor
2022-04-21  0:50                                 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34ERK5RNBY2J7.2RDLOQ9YR6OH1@8pit.net \
    --to=soeren@soeren-tempel.net \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    --cc=iant@golang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).