summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-01-07 19:11:25 +0100
committerBruno Haible <bruno@clisp.org>2022-01-07 19:11:25 +0100
commitcfaebd1eaf093e481dddbc5c57d3fc76135d136b (patch)
tree08498bffb03084433a63ca8eb96fecb550b25860 /lib
parent035ce56a3353b00d34dbbb338580ff25fb7ef767 (diff)
downloadgnulib-cfaebd1eaf093e481dddbc5c57d3fc76135d136b.tar.gz
sigsegv: Improve support for Linux/LoongArch64.
* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Add special case for Linux/LoongArch.
Diffstat (limited to 'lib')
-rw-r--r--lib/sigsegv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index ef00f61393..da70ffa5fd 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -168,6 +168,15 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
because $bsp and $bspstore never differ by more than ca. 1 KB. */
# define SIGSEGV_FAULT_BSP_POINTER ((ucontext_t *) ucp)->uc_mcontext.sc_ar_bsp
+# elif defined __loongarch__
+
+/* See <sys/ucontext.h>.
+ Note that the 'mcontext_t' defined in <sys/ucontext.h>
+ and the 'struct sigcontext' defined in <bits/sigcontext.h>
+ (see also <asm/sigcontext.h>) are effectively the same. */
+
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.__gregs[3]
+
# elif defined __m68k__
/* See glibc/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h