+2009-12-08 Ivan Maidanski <ivmai@mail.ru> (with input from Marcos Dione)
+
+ * doc/README.macros (IGNORE_DYNAMIC_LOADING, PLATFORM_ANDROID):
+ Document.
+ * dyn_load.c: Don't include <elf.h> if PLATFORM_ANDROID.
+ * dyn_load.c: Include bionic <linker.h> (instead of <link.h>) if
+ PLATFORM_ANDROID.
+ * include/private/gcconfig.h (LINUX): Define also if
+ PLATFORM_ANDROID (for the windows-based toolkit).
+ * include/private/gcconfig.h (SEARCH_FOR_DATA_START): Explicitly
+ define for Android/x86 platform.
+ * include/private/gcconfig.h (IGNORE_DYNAMIC_LOADING): Recognize
+ new macro (undefine DYNAMIC_LOADING in this case).
+ * include/private/gcconfig.h (CANCEL_SAFE): Don't define if
+ PLATFORM_ANDROID.
+ * include/private/gcconfig.h (IF_CANCEL): Fix definition for the
+ explicitly defined CANCEL_SAFE.
+
2009-12-08 Ivan Maidanski <ivmai@mail.ru>
* allchblk.c (GC_allochblk_nth): Don't call GC_remove_protection()
informing the collector. But it typically performs poorly, especially
since it will scan inactive but cached NPTL thread stacks completely.
+IGNORE_DYNAMIC_LOADING Don't define DYNAMIC_LOADING even if supported by the
+ platform (that is, build the collector with disabled tracing of dynamic
+ library data roots).
+
NO_PROC_STAT Causes the collector to avoid relying on Linux
"/proc/self/stat".
UNICODE (Win32 only) Use the Unicode variant ('W') of the Win32 API instead
of ANSI/ASCII one ('A'). Useful for WinCE.
+
+PLATFORM_ANDROID Compile for Android NDK platform.
|| (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD)))
# include <stddef.h>
-# if !defined(OPENBSD)
+# if !defined(OPENBSD) && !defined(PLATFORM_ANDROID)
/* FIXME: Why we exclude it for OpenBSD? */
+ /* Exclude Android because linker.h below includes its own version. */
# include <elf.h>
# endif
-# include <link.h>
+# ifdef PLATFORM_ANDROID
+ /* The header file is in bionics/linker. */
+ /* If you don't need the "dynamic loading" feature, you may build */
+ /* the collector with -D IGNORE_DYNAMIC_LOADING. */
+# include <linker.h>
+# else
+# include <link.h>
+# endif
#endif
/* Newer versions of GNU/Linux define this macro. We
# ifndef PF_W
# define PF_W 2
# endif
-#else
+#elif !defined(PLATFORM_ANDROID)
# include <elf.h>
#endif
-#include <link.h>
+
+#ifndef PLATFORM_ANDROID
+# include <link.h>
+#endif
# endif
/* Machine specific parts contributed by various people. See README file. */
/* First a unified test for Linux: */
-# if defined(linux) || defined(__linux__)
-# ifndef LINUX
-# define LINUX
-# endif
+# if (defined(linux) || defined(__linux__) || defined(PLATFORM_ANDROID)) \
+ && !defined(LINUX)
+# define LINUX
# endif
/* And one for NetBSD: */
# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
# endif
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if defined(__GLIBC__) && __GLIBC__ >= 2 \
+ || defined(PLATFORM_ANDROID)
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
# error --> undefined STACKBOTTOM
# endif
+# ifdef IGNORE_DYNAMIC_LOADING
+# undef DYNAMIC_LOADING
+# endif
+
# if defined(SMALL_CONFIG) && !defined(GC_DISABLE_INCREMENTAL)
/* Presumably not worth the space it takes. */
# define GC_DISABLE_INCREMENTAL
# define THREADS
# endif
-# if defined(UNIX_LIKE) && defined(THREADS) && !defined(NO_CANCEL_SAFE)
+# if defined(UNIX_LIKE) && defined(THREADS) && !defined(NO_CANCEL_SAFE) \
+ && !defined(PLATFORM_ANDROID)
/* Make the code cancellation-safe. This basically means that we */
/* ensure that cancellation requests are ignored while we are in */
/* the collector. This applies only to Posix deferred cancellation;*/
/* Also note that little other code appears to be cancellation-safe.*/
/* Hence it may make sense to turn this off for performance. */
# define CANCEL_SAFE
+# endif
+
+# ifdef CANCEL_SAFE
# define IF_CANCEL(x) x
# else
# define IF_CANCEL(x)