]> granicus.if.org Git - gc/commitdiff
Fix GC_INIT_CONF_ROOTS in gc.h for Android (define __data_start as weak)
authorIvan Maidanski <ivmai@mail.ru>
Sat, 1 Jun 2013 10:21:09 +0000 (14:21 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 1 Jun 2013 10:21:09 +0000 (14:21 +0400)
* include/gc.h (GC_INIT_CONF_ROOTS): Define __data_start as weak
symbol for Android (including x86 and MIPS targets); do not call
GC_add_roots if __data_start symbol is unresolved.

include/gc.h

index fe04fbc26428090bba699f5fc2388d20e5d78bbe..5db4040b540df5dad99a621ae7d8a8646d0fb91d 100644 (file)
@@ -1606,10 +1606,12 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void);
 # define GC_DATAEND ((void *)((ulong)_end))
 # define GC_INIT_CONF_ROOTS GC_add_roots(GC_DATASTART, GC_DATAEND)
 #elif (defined(PLATFORM_ANDROID) || defined(__ANDROID__)) \
-      && defined(__arm__) && !defined(GC_NOT_DLL)
+      && !defined(GC_NOT_DLL)
   /* Required if GC is built as shared lib with -D IGNORE_DYNAMIC_LOADING. */
+# pragma weak __data_start
   extern int __data_start[], _end[];
-# define GC_INIT_CONF_ROOTS GC_add_roots(__data_start, _end)
+# define GC_INIT_CONF_ROOTS (void)((GC_word)(__data_start) != 0 ? \
+                                (GC_add_roots(__data_start, _end), 0) : 0)
 #else
 # define GC_INIT_CONF_ROOTS /* empty */
 #endif