]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv: Fix compilation error on Android 4.3.
authorBruno Haible <bruno@clisp.org>
Mon, 2 Jan 2023 15:57:31 +0000 (16:57 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Jan 2023 20:22:05 +0000 (21:22 +0100)
* lib/sigsegv.in.h: For Android, don't include <ucontext.h> and don't
reference ucontext_t.
* lib/sigsegv.c (SIGSEGV_FAULT_): For Android, use a plain POSIX fault
handler (cf. libsigsegv/src/fault-posix.h).

ChangeLog
lib/sigsegv.c
lib/sigsegv.in.h

index d9acffc787efacf50649d8acc295462a43b1bbc7..7084d485e28b64150d6399302949a34f78e744b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-01-02  Bruno Haible  <bruno@clisp.org>
+
+       sigsegv: Fix compilation error on Android 4.3.
+       * lib/sigsegv.in.h: For Android, don't include <ucontext.h> and don't
+       reference ucontext_t.
+       * lib/sigsegv.c (SIGSEGV_FAULT_): For Android, use a plain POSIX fault
+       handler (cf. libsigsegv/src/fault-posix.h).
+
 2023-01-01  Paul Eggert  <eggert@cs.ucla.edu>
 
        dfa: work around Clang 15 bug
index 14f3a4650bd4be85266e6df4d4dc55e0cff63cc3..29c452dbe0c0d044b43648076011a3ca0b282546 100644 (file)
@@ -61,7 +61,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
           occurred.
  */
 
-#if defined __linux__ || defined __ANDROID__ /* Linux */
+#if defined __linux__ && !defined __ANDROID__ /* Linux */
 
 # define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, siginfo_t *sip, void *ucp
 # define SIGSEGV_FAULT_ADDRESS  sip->si_addr
@@ -348,6 +348,17 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 #endif
 
+#if defined __ANDROID__ /* Android */
+/* A platform that supports the POSIX:2008 (XPG 7) way, without
+   'struct sigcontext' nor 'ucontext_t'.  */
+
+# define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, siginfo_t *sip, void *context
+# define SIGSEGV_FAULT_ADDRESS  sip->si_addr
+# define SIGSEGV_FAULT_CONTEXT  context
+# define SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO
+
+#endif
+
 #if defined __GNU__ /* Hurd */
 
 # define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, int code, struct sigcontext *scp
index 097041f1ba80df15f06bca0cb6db6cff5bef5f90..40b453e67b67bbbfbba9f753cd8a2acf7d653a01 100644 (file)
@@ -23,7 +23,7 @@
 #include <stddef.h>
 
 /* Define the fault context structure.  */
-#if defined __linux__ || defined __ANDROID__ \
+#if (defined __linux__ && !defined __ANDROID__) \
     || (defined __FreeBSD__ && (defined __arm__ || defined __armhf__ || defined __arm64__)) \
     || defined __NetBSD__ \
     || defined _AIX || defined __sun \
@@ -180,7 +180,7 @@ extern int sigsegv_leave_handler (void (*continuation) (void*, void*, void*), vo
  * on some platforms it is a 'struct sigcontext *', on others merely an
  * opaque 'void *'.
  */
-# if defined __linux__ || defined __ANDROID__ \
+# if (defined __linux__ && !defined __ANDROID__) \
      || (defined __FreeBSD__ && (defined __arm__ || defined __armhf__ || defined __arm64__)) \
      || defined __NetBSD__ \
      || (defined __APPLE__ && defined __MACH__) \