summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorivmai <ivmai>2010-12-26 15:20:38 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:55 +0200
commit7b66e36f08dd096bc6df1ebc362d2689264f7825 (patch)
treece2884e5f794a843f6849592dd437c4e34eb427c /dyn_load.c
parentda518ec93509c607211f69d1ab0565fe0b663397 (diff)
2010-12-26 Ivan Maidanski <ivmai@mail.ru> (mostly really Geoff Norton
and Jonathan Pryor) * configure.ac: Use AC_CHECK_LIB() to check for pthread instead of just blindly linking to -lpthread, as Android includes pthread support within libc and does not provide a separate libpthread. * dyn_load.c (GC_register_dynamic_libraries): Skip current link map entry if l_addr is NULL (Android/bionic only). * pthread_stop_world.c (android_thread_kill): New internal function (Android only). * pthread_stop_world.c (GC_suspend_all, GC_start_world): Call android_thread_kill (based on tkill) instead of pthread_kill on Android (since pthread_kill cannot be used safely on the platform). * pthread_support.c (GC_new_thread): Store thread Id (obtained from gettid) for use by android_thread_kill (Android only). * include/private/pthread_support.h (GC_Thread_Rep): Add kernel_id structure member (Android only). * include/private/gcconfig.h: Recognize __x86_64 macro as a synonym of __x86_64__ (Darwin); define __environ macro (Android on M68K). * configure: Regenerate.
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dyn_load.c b/dyn_load.c
index 9927a21..37dd75a 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -199,6 +199,10 @@ GC_INNER void GC_register_dynamic_libraries(void)
int i;
e = (ElfW(Ehdr) *) lm->l_addr;
+# ifdef PLATFORM_ANDROID
+ if (e == NULL)
+ continue;
+# endif
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
@@ -652,6 +656,10 @@ GC_INNER void GC_register_dynamic_libraries(void)
int i;
e = (ElfW(Ehdr) *) lm->l_addr;
+# ifdef PLATFORM_ANDROID
+ if (e == NULL)
+ continue;
+# endif
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {