summaryrefslogtreecommitdiffstats
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-03-31 13:05:37 -0700
committerIan Lance Taylor <iant@golang.org>2022-03-31 13:26:13 -0700
commit0abc1cbad1687a887d754917927b6023e4dba3ce (patch)
treecca493c0b5be2d593d79df869ed7d405d6e7305d /libgo
parentoptions: Clarifications around option definition records' help texts (diff)
downloadgcc-0abc1cbad1687a887d754917927b6023e4dba3ce.tar.gz
gcc-0abc1cbad1687a887d754917927b6023e4dba3ce.tar.bz2
gcc-0abc1cbad1687a887d754917927b6023e4dba3ce.tar.xz
runtime: support PPC32 MUSL register access
Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-signal.c18
1 files changed, 18 insertions, 0 deletions
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)))
231#elif defined(__alpha__) && defined(__linux__) 231#elif defined(__alpha__) && defined(__linux__)
232 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc; 232 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
233#elif defined(__PPC__) && defined(__linux__) 233#elif defined(__PPC__) && defined(__linux__)
234 // For some reason different libc implementations use
235 // different names.
236#if defined(__PPC64__) || defined(__GLIBC__)
234 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; 237 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
238#else
239 // Assumed to be ppc32 musl.
240 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
241#endif
235#elif defined(__PPC__) && defined(_AIX) 242#elif defined(__PPC__) && defined(_AIX)
236 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar; 243 ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
237#elif defined(__aarch64__) && defined(__linux__) 244#elif defined(__aarch64__) && defined(__linux__)
@@ -347,6 +354,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
347 mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; 354 mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
348 int i; 355 int i;
349 356
357#if defined(__PPC64__) || defined(__GLIBC__)
350 for (i = 0; i < 32; i++) 358 for (i = 0; i < 32; i++)
351 runtime_printf("r%d %X\n", i, m->regs->gpr[i]); 359 runtime_printf("r%d %X\n", i, m->regs->gpr[i]);
352 runtime_printf("pc %X\n", m->regs->nip); 360 runtime_printf("pc %X\n", m->regs->nip);
@@ -355,6 +363,16 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
355 runtime_printf("lr %X\n", m->regs->link); 363 runtime_printf("lr %X\n", m->regs->link);
356 runtime_printf("ctr %X\n", m->regs->ctr); 364 runtime_printf("ctr %X\n", m->regs->ctr);
357 runtime_printf("xer %X\n", m->regs->xer); 365 runtime_printf("xer %X\n", m->regs->xer);
366#else
367 for (i = 0; i < 32; i++)
368 runtime_printf("r%d %X\n", i, m->gregs[i]);
369 runtime_printf("pc %X\n", m->gregs[32]);
370 runtime_printf("msr %X\n", m->gregs[33]);
371 runtime_printf("cr %X\n", m->gregs[38]);
372 runtime_printf("lr %X\n", m->gregs[36]);
373 runtime_printf("ctr %X\n", m->gregs[35]);
374 runtime_printf("xer %X\n", m->gregs[37]);
375#endif
358 } 376 }
359#elif defined(__PPC__) && defined(_AIX) 377#elif defined(__PPC__) && defined(_AIX)
360 { 378 {