|
@@ -1,58 +0,0 @@
|
|
|
-From 6f2f006185cdeeda997d19d651379bfc6887e394 Mon Sep 17 00:00:00 2001
|
|
|
-From: Joel Stanley <joel@jms.id.au>
|
|
|
-Date: Mon, 6 Jun 2022 17:14:12 +0930
|
|
|
-Subject: [PATCH] sigsegv: Add support for Linux/PowerPC (32-bit) with musl
|
|
|
- libc. Reported by Khem Raj <raj.khem@gmail.com> in
|
|
|
- <https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html>.
|
|
|
-
|
|
|
-* src/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): In the Linux/PowerPC
|
|
|
-32-bit case, handle musl libc differently.
|
|
|
-* modules/sigsegv (Files): Add m4/musl.m4.
|
|
|
-(configure.ac): Invoke gl_MUSL_LIBC.
|
|
|
-
|
|
|
-Backported from http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d830e4a792fcd9f614ed08a7f18584b8b21d23b
|
|
|
-Signed-off-by: Joel Stanley <joel@jms.id.au>
|
|
|
----
|
|
|
- lib/sigsegv.c | 25 +++++++++++++++++++++----
|
|
|
- 1 file changed, 21 insertions(+), 4 deletions(-)
|
|
|
-
|
|
|
-diff --git a/lib/sigsegv.c b/lib/sigsegv.c
|
|
|
-index da70ffa5fda1..da64d7d0b617 100644
|
|
|
---- a/lib/sigsegv.c
|
|
|
-+++ b/lib/sigsegv.c
|
|
|
-@@ -227,11 +227,28 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
|
|
|
- # if defined __powerpc64__ || defined __powerpc64_elfv2__ /* 64-bit */
|
|
|
- # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1]
|
|
|
- # else /* 32-bit */
|
|
|
--/* both should be equivalent */
|
|
|
--# if 0
|
|
|
--# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
|
|
|
-+# if MUSL_LIBC
|
|
|
-+/* musl libc has a different structure of ucontext_t in
|
|
|
-+ musl/arch/powerpc/bits/signal.h. */
|
|
|
-+/* The glibc comments say:
|
|
|
-+ "Different versions of the kernel have stored the registers on signal
|
|
|
-+ delivery at different offsets from the ucontext struct. Programs should
|
|
|
-+ thus use the uc_mcontext.uc_regs pointer to find where the registers are
|
|
|
-+ actually stored." */
|
|
|
-+# if 0
|
|
|
-+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[1]
|
|
|
-+# else
|
|
|
-+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_regs->gregs[1]
|
|
|
-+# endif
|
|
|
- # else
|
|
|
--# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
|
|
|
-+/* Assume the structure of ucontext_t in
|
|
|
-+ glibc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h. */
|
|
|
-+/* Because of the union, both definitions should be equivalent. */
|
|
|
-+# if 0
|
|
|
-+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
|
|
|
-+# else
|
|
|
-+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
|
|
|
-+# endif
|
|
|
- # endif
|
|
|
- # endif
|
|
|
-
|
|
|
---
|
|
|
-2.35.1
|
|
|
-
|