public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-8210] runtime: use correct field name for PPC32 GLIBC registers
Date: Thu, 21 Apr 2022 00:49:55 +0000 (GMT)	[thread overview]
Message-ID: <20220421004955.DA7853858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:6a4e9934545c112eef5eb7248636baa96cbfd2c0

commit r12-8210-g6a4e9934545c112eef5eb7248636baa96cbfd2c0
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 20 14:22:41 2022 -0700

    runtime: use correct field name for PPC32 GLIBC registers
    
    One of these days we will get this right.
    
    Fixes PR go/105315
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401374

Diff:
---
 gcc/go/gofrontend/MERGE   |  2 +-
 libgo/runtime/go-signal.c | 35 +++++++++++++++++++++++------------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 63238715bd0..ef20a0aafd6 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-99ca6be406a5781be078ff23f45a72b4c84b16e3
+70ca85f08edf63f46c87d540fa99c45e2903edc2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index 2caddd068d6..528d9b6d9fe 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -233,7 +233,11 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
 #elif defined(__PPC64__) && defined(__linux__)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
 #elif defined(__PPC__) && defined(__linux__)
+# if defined(__GLIBC__)
+	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.uc_regs->gregs[32];
+# else
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
+# endif
 #elif defined(__PPC__) && defined(_AIX)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
 #elif defined(__aarch64__) && defined(__linux__)
@@ -344,12 +348,13 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
 		runtime_printf("sp  %X\n", m->sc_regs[30]);
 		runtime_printf("pc  %X\n", m->sc_pc);
 	  }
-#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__)
+#elif defined(__PPC__) && defined(__linux__)
 	  {
-		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
 		int i;
 
-#if defined(__PPC64__)
+# if defined(__PPC64__)
+		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
+
 		for (i = 0; i < 32; i++)
 			runtime_printf("r%d %X\n", i, m->gp_regs[i]);
 		runtime_printf("pc  %X\n", m->gp_regs[32]);
@@ -358,16 +363,22 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
 		runtime_printf("lr  %X\n", m->gp_regs[36]);
 		runtime_printf("ctr %X\n", m->gp_regs[35]);
 		runtime_printf("xer %X\n", m->gp_regs[37]);
-#else
+# else
+#  if defined(__GLIBC__)
+		mcontext_t *m = ((ucontext_t*)(context))->uc_mcontext.uc_regs;
+#  else
+		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
+#  endif
+
 		for (i = 0; i < 32; i++)
-			runtime_printf("r%d %X\n", i, m->gregs[i]);
-		runtime_printf("pc  %X\n", m->gregs[32]);
-		runtime_printf("msr %X\n", m->gregs[33]);
-		runtime_printf("cr  %X\n", m->gregs[38]);
-		runtime_printf("lr  %X\n", m->gregs[36]);
-		runtime_printf("ctr %X\n", m->gregs[35]);
-		runtime_printf("xer %X\n", m->gregs[37]);
-#endif
+			runtime_printf("r%d %x\n", i, m->gregs[i]);
+		runtime_printf("pc  %x\n", m->gregs[32]);
+		runtime_printf("msr %x\n", m->gregs[33]);
+		runtime_printf("cr  %x\n", m->gregs[38]);
+		runtime_printf("lr  %x\n", m->gregs[36]);
+		runtime_printf("ctr %x\n", m->gregs[35]);
+		runtime_printf("xer %x\n", m->gregs[37]);
+# endif
 	  }
 #elif defined(__PPC__) && defined(_AIX)
 	  {


                 reply	other threads:[~2022-04-21  0:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220421004955.DA7853858D1E@sourceware.org \
    --to=ian@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).