public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7944] runtime: support PPC32 MUSL register access
@ 2022-03-31 20:26 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2022-03-31 20:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0abc1cbad1687a887d754917927b6023e4dba3ce

commit r12-7944-g0abc1cbad1687a887d754917927b6023e4dba3ce
Author: Ian Lance Taylor <iant@golang.org>
Date:   Thu Mar 31 13:05:37 2022 -0700

    runtime: support PPC32 MUSL register access
    
    Based on patch by Sören Tempel.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394

Diff:
---
 gcc/go/gofrontend/MERGE   |  2 +-
 libgo/runtime/go-signal.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index afaccb0e9e6..f93eaf48e28 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-7f33baa09a8172bb2c5f1ca0435d9efe3e194c9b
+45108f37070afb696b069768700e39a269f1fecb
 
 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 0cb90304730..9c919e1568a 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -231,7 +231,14 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
 #elif defined(__alpha__) && defined(__linux__)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
 #elif defined(__PPC__) && defined(__linux__)
+	// For some reason different libc implementations use
+	// different names.
+#if defined(__PPC64__) || defined(__GLIBC__)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
+#else
+	// Assumed to be ppc32 musl.
+	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__)
@@ -347,6 +354,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
 		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
 		int i;
 
+#if defined(__PPC64__) || defined(__GLIBC__)
 		for (i = 0; i < 32; i++)
 			runtime_printf("r%d %X\n", i, m->regs->gpr[i]);
 		runtime_printf("pc  %X\n", m->regs->nip);
@@ -355,6 +363,16 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
 		runtime_printf("lr  %X\n", m->regs->link);
 		runtime_printf("ctr %X\n", m->regs->ctr);
 		runtime_printf("xer %X\n", m->regs->xer);
+#else
+		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
 	  }
 #elif defined(__PPC__) && defined(_AIX)
 	  {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-31 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 20:26 [gcc r12-7944] runtime: support PPC32 MUSL register access Ian Lance Taylor

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).