# 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
# 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. */
|| 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
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)
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 */
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;
(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
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;
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