Package: m4
Version: 1.4.19
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: loongarch64
Dear m4 maintainers,
According to your suggestion, we have added patch for m4 package.
You can also refer to the released Gnulib project([1]).
If you have any questions, you can contact me at any time.
[1]:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git&a=search&h=HEAD&st=commit&s=loongarch
thanks,
Dandan Zhang
diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index 696a152..c640c26 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -166,6 +166,18 @@ 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__ || defined __loongarch64
+
+/* See glibc/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
+ and the definition of GET_STACK in
+ glibc/sysdeps/unix/sysv/linux/loongarch/sigcontextinfo.h.
+ Note that the 'mcontext_t' defined in
+ glibc/sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
+ and the 'struct sigcontext' defined in <asm/sigcontext.h>
+ are effectively the same. */
+
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.__gregs[LARCH_REG_SP]
+
# elif defined __m68k__
/* See glibc/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 64e28b1..13bf36b 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -382,6 +382,9 @@ EOF
#ifndef __ia64__
#undef __ia64__
#endif
+#ifndef __loongarch64__
+#undef __loongarch64__
+#endif
#ifndef __m68k__
#undef __m68k__
#endif
diff --git a/m4/stack-direction.m4 b/m4/stack-direction.m4
index c7a20a2..fe2c1ba 100644
--- a/m4/stack-direction.m4
+++ b/m4/stack-direction.m4
@@ -31,6 +31,7 @@ AC_DEFUN([SV_STACK_DIRECTION],
i?86 | x86_64 | \
i860 | \
ia64 | \
+ loongarch* | \
m32r | \
m68* | \
m88k | \