summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2013-06-01 12:33:33 +0200
committerIvan Maidanski <ivmai@mail.ru>2013-06-01 12:33:33 +0200
commitd9b749e985d8720e6d102cb297215672becee3a8 (patch)
tree19b8af9dc82f8623fe4f66614ff221fd0271b136
parentb4c520670773821d764348f6f3d0247ae27a8afc (diff)
Register dynamic libraries via dl_iterate_phdr on Android if possible
* dyn_load.c (HAVE_DL_ITERATE_PHDR): Define also for Android. * dyn_load.c (dl_iterate_phdr): Declare explicitly for Android (since no prototype in NDK link.h for ARM).
-rw-r--r--dyn_load.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/dyn_load.c b/dyn_load.c
index a6f4a86..246195d 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -392,16 +392,21 @@ GC_INNER GC_bool GC_register_main_static_data(void)
#else /* !USE_PROC_FOR_LIBRARIES */
/* The following is the preferred way to walk dynamic libraries */
-/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
+/* for glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-#if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)) \
+ || defined(PLATFORM_ANDROID) /* Are others OK here, too? */
/* We have the header files for a glibc that includes dl_iterate_phdr. */
/* It may still not be available in the library on the target system. */
/* Thus we also treat it as a weak symbol. */
# define HAVE_DL_ITERATE_PHDR
+# ifdef PLATFORM_ANDROID
+ /* Android headers might have no such definition for some targets. */
+ int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *),
+ void *data);
+# endif
# pragma weak dl_iterate_phdr
#endif