xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-devtools/m4/m4/0001-sigsegv-Fix-build-on-ppc-musl.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 36d5e26f606e070553eb0fff1f738e61970be5d7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Mar 2022 20:22:20 -0800
4Subject: [PATCH] sigsegv: Fix build on ppc/musl
5
6mcontext is not a standard layout so glibc and musl differ sadly.
7
8Fixes
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
11Upstream-Status: Submitted [https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 lib/sigsegv.c | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/lib/sigsegv.c b/lib/sigsegv.c
18index 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--
362.35.1
37
38