From: Ivan Maidanski Date: Sat, 1 Jun 2013 10:21:09 +0000 (+0400) Subject: Fix GC_INIT_CONF_ROOTS in gc.h for Android (define __data_start as weak) X-Git-Tag: gc7_4_0~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4c520670773821d764348f6f3d0247ae27a8afc;p=gc Fix GC_INIT_CONF_ROOTS in gc.h for Android (define __data_start as weak) * 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. --- diff --git a/include/gc.h b/include/gc.h index fe04fbc2..5db4040b 100644 --- a/include/gc.h +++ b/include/gc.h @@ -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