From 6d9eec852611157df5eca913caa9d23b80473113 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 10 Sep 2015 01:36:30 +0300 Subject: [PATCH] Workaround 'sa_sigaction member missing' compiler error (Android/x32) 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 | 9 +++++++++ pthread_stop_world.c | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index a986b16d..5a1705e6 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2737,6 +2737,15 @@ # 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) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 4905b5cf..a9f34165 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -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; -- 2.40.0