From: Ivan Maidanski Date: Wed, 9 Sep 2015 21:15:22 +0000 (+0300) Subject: Support build for Android 64-bit (arm64, mips64, x86_64) X-Git-Tag: gc7_6_0~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af2edc0bc059244c7b4bcbd183297520d71aff26;p=gc Support build for Android 64-bit (arm64, mips64, x86_64) * include/private/gcconfig.h (_end): Replace type from char[] to int[] to avoid redefinition error (as it is also declared in gc.h) for Linux/x86_64. * include/private/gcconfig.h (NO_GETCONTEXT): Define for all Android targets. * include/private/gcconfig.h (USE_TKILL_ON_ANDROID): New macro (defined only for 32-bit Android targets). * pthread_stop_world.c (tkill, android_thread_kill, GC_suspend_all, GC_start_world): Use USE_TKILL_ON_ANDROID instead of PLATFORM_ANDROID. --- diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 1b511acb..a986b16d 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2055,7 +2055,7 @@ # define DYNAMIC_LOADING extern int __data_start[]; # define DATASTART ((ptr_t)__data_start) - extern char _end[]; + extern int _end[]; # define DATAEND ((ptr_t)(&_end)) # endif # ifdef DARWIN @@ -2597,6 +2597,12 @@ # define GETPAGESIZE() getpagesize() #endif +#if defined(PLATFORM_ANDROID) && ((defined(MIPS) && (CPP_WORDSZ == 32)) \ + || defined(ARM32) || defined(I386) /* but not x32 */) + /* tkill() exists only on arm32/mips(32)/x86. */ +# define USE_TKILL_ON_ANDROID +#endif + #if defined(SOLARIS) || defined(DRSNX) || defined(UTS4) /* OS has SVR4 generic features. */ /* Probably others also qualify. */ @@ -2742,7 +2748,7 @@ || defined(MIPS) || defined(AVR32) \ || defined(OR1K))) \ || (defined(LINUX) && (defined(SPARC) || defined(M68K))) \ - || ((defined(RTEMS) || defined(PLATFORM_ANDROID)) && defined(I386))) \ + || (defined(RTEMS) && defined(I386)) || defined(PLATFORM_ANDROID)) \ && !defined(NO_GETCONTEXT) # define NO_GETCONTEXT #endif diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 84b787c1..4905b5cf 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -447,7 +447,7 @@ GC_INNER void GC_push_all_stacks(void) int GC_stopping_pid = 0; #endif -#ifdef PLATFORM_ANDROID +#ifdef USE_TKILL_ON_ANDROID extern int tkill(pid_t tid, int sig); /* from sys/linux-unistd.h */ static int android_thread_kill(pid_t tid, int sig) @@ -463,7 +463,7 @@ GC_INNER void GC_push_all_stacks(void) return ret; } -#endif /* PLATFORM_ANDROID */ +#endif /* USE_TKILL_ON_ANDROID */ /* We hold the allocation lock. Suspend all threads that might */ /* still be running. Return the number of suspend signals that */ @@ -473,7 +473,7 @@ STATIC int GC_suspend_all(void) int n_live_threads = 0; int i; # ifndef NACL -# ifndef PLATFORM_ANDROID +# ifndef USE_TKILL_ON_ANDROID pthread_t thread_id; # else pid_t thread_id; @@ -514,7 +514,7 @@ STATIC int GC_suspend_all(void) (void *)p->id); } # else -# ifndef PLATFORM_ANDROID +# ifndef USE_TKILL_ON_ANDROID thread_id = p -> id; result = pthread_kill(thread_id, GC_sig_suspend); # else @@ -818,7 +818,7 @@ GC_INNER void GC_start_world(void) register int n_live_threads = 0; register int result; # endif -# ifndef PLATFORM_ANDROID +# ifndef USE_TKILL_ON_ANDROID pthread_t thread_id; # else pid_t thread_id; @@ -852,7 +852,7 @@ GC_INNER void GC_start_world(void) if (GC_on_thread_event) GC_on_thread_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)p->id); # else -# ifndef PLATFORM_ANDROID +# ifndef USE_TKILL_ON_ANDROID thread_id = p -> id; result = pthread_kill(thread_id, GC_sig_thr_restart); # else