Avoid SIGSEGV during GC_INIT on some Android devices
authorJonathan Chambers <joncham@gmail.com>
Thu, 1 Feb 2018 08:53:34 +0000 (11:53 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 1 Feb 2018 08:53:34 +0000 (11:53 +0300)
(part of commit 9379c66 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/gc.h [(HOST_ANDROID || __ANDROID__) && !GC_NOT_DLL]
(GC_INIT_CONF_ROOTS): Define to empty unless IGNORE_DYNAMIC_LOADING;
add comment.

include/gc.h

index 3f7c9d5..f206cf8 100644 (file)
@@ -1833,7 +1833,11 @@ 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(HOST_ANDROID) || defined(__ANDROID__)) \
-      && !defined(GC_NOT_DLL)
+      && !defined(GC_NOT_DLL) && defined(IGNORE_DYNAMIC_LOADING)
+  /* It causes the entire binary section of memory be pushed as a root. */
+  /* This might be a bad idea though because on some Android devices    */
+  /* some of the binary data might become unmapped thus causing SIGSEGV */
+  /* with code SEGV_MAPERR.                                             */
 # pragma weak _etext
 # pragma weak __data_start
 # pragma weak __dso_handle