Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 1 | From 36d5e26f606e070553eb0fff1f738e61970be5d7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 9 Mar 2022 20:22:20 -0800 |
| 4 | Subject: [PATCH] sigsegv: Fix build on ppc/musl |
| 5 | |
| 6 | mcontext is not a standard layout so glibc and musl differ sadly. |
| 7 | |
| 8 | Fixes |
| 9 | ../../m4-1.4.19/lib/sigsegv.c: In function 'sigsegv_handler': ../../m4-1.4.19/lib/sigsegv.c:223:75: error: 'mcontext_t' has no member named 'uc_regs'; did you mean 'gregs'? 223 | # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1] | ^~~~~~~ |
| 10 | |
| 11 | Upstream-Status: Submitted [https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html] |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | lib/sigsegv.c | 6 +++--- |
| 15 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 16 | |
| 17 | diff --git a/lib/sigsegv.c b/lib/sigsegv.c |
| 18 | index 696a152..fa0c465 100644 |
| 19 | --- a/lib/sigsegv.c |
| 20 | +++ b/lib/sigsegv.c |
| 21 | @@ -217,10 +217,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION; |
| 22 | # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1] |
| 23 | # else /* 32-bit */ |
| 24 | /* both should be equivalent */ |
| 25 | -# if 0 |
| 26 | -# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1] |
| 27 | +# if ! defined __GLIBC__ |
| 28 | +# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_regs->gregs[1] |
| 29 | # else |
| 30 | -# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1] |
| 31 | +# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1] |
| 32 | # endif |
| 33 | # endif |
| 34 | |
| 35 | -- |
| 36 | 2.35.1 |
| 37 | |