]> granicus.if.org Git - gc/commitdiff
Workaround 'sa_sigaction member missing' compiler error (Android/x32)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 9 Sep 2015 22:36:30 +0000 (01:36 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 9 Sep 2015 22:36:30 +0000 (01:36 +0300)
Client should define NO_SA_SIGACTION to enable the workaround.

* include/private/gcconfig.h (NO_SA_SIGACTION): New macro (explicitly
define if SA_SIGINFO undefined).
* include/private/gcconfig.h (MPROTECT_VDB): Undefine if
NO_SA_SIGACTION unless DARWIN, MSWIN32 or MSWINCE.
* pthread_stop_world.c (GC_suspend_handler, GC_stop_init): Check
NO_SA_SIGACTION instead of SA_SIGINFO.

include/private/gcconfig.h
pthread_stop_world.c

index a986b16d78d95d260587ff756a5645f4ebdce87f..5a1705e65739a86d0e50a90f85109580a2f59114 100644 (file)
 # undef MPROTECT_VDB
 #endif
 
+#ifndef SA_SIGINFO
+# define NO_SA_SIGACTION
+#endif
+
+#if defined(NO_SA_SIGACTION) && defined(MPROTECT_VDB) && !defined(DARWIN) \
+    && !defined(MSWIN32) && !defined(MSWINCE)
+# undef MPROTECT_VDB
+#endif
+
 #if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \
     && !defined(GWW_VDB) && !defined(MANUAL_VDB) \
     && !defined(GC_DISABLE_INCREMENTAL)
index 4905b5cf88e567e0f00a14f562e8cc32e5e95965..a9f3416558f96f9bcf32dee96345cfe461eeab58 100644 (file)
@@ -202,7 +202,7 @@ STATIC sem_t GC_suspend_ack_sem;
 
 STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
 
-#ifdef SA_SIGINFO
+#ifndef NO_SA_SIGACTION
   STATIC void GC_suspend_handler(int sig, siginfo_t * info GC_ATTR_UNUSED,
                                  void * context GC_ATTR_UNUSED)
 #else
@@ -216,7 +216,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
 # else
     /* We believe that in all other cases the full context is already   */
     /* in the signal handler frame.                                     */
-#   ifndef SA_SIGINFO
+#   ifdef NO_SA_SIGACTION
       void *context = 0;
 #   endif
     GC_suspend_handler_inner((ptr_t)(word)sig, context);
@@ -925,7 +925,7 @@ GC_INNER void GC_stop_init(void)
 #   else
       act.sa_flags = 0
 #   endif
-#   ifdef SA_SIGINFO
+#   ifndef NO_SA_SIGACTION
                      | SA_SIGINFO
 #   endif
         ;
@@ -940,7 +940,7 @@ GC_INNER void GC_stop_init(void)
     GC_remove_allowed_signals(&act.sa_mask);
     /* GC_sig_thr_restart is set in the resulting mask. */
     /* It is unmasked by the handler when necessary.    */
-#   ifdef SA_SIGINFO
+#   ifndef NO_SA_SIGACTION
       act.sa_sigaction = GC_suspend_handler;
 #   else
       act.sa_handler = GC_suspend_handler;
@@ -950,7 +950,7 @@ GC_INNER void GC_stop_init(void)
         ABORT("Cannot set SIG_SUSPEND handler");
     }
 
-#   ifdef SA_SIGINFO
+#   ifndef NO_SA_SIGACTION
       act.sa_flags &= ~SA_SIGINFO;
 #   endif
     act.sa_handler = GC_restart_handler;