diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index ffbdc142..4a4350af 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2895,7 +2895,8 @@ # define NO_SA_SIGACTION #endif -#if defined(NO_SA_SIGACTION) && defined(MPROTECT_VDB) && !defined(DARWIN) \ +#if (defined(NO_SA_SIGACTION) || defined(GC_NO_SIGSETJMP)) \ + && defined(MPROTECT_VDB) && !defined(DARWIN) \ && !defined(MSWIN32) && !defined(MSWINCE) # undef MPROTECT_VDB #endif diff --git a/os_dep.c b/os_dep.c index d3429d04..c9b51528 100644 --- a/os_dep.c +++ b/os_dep.c @@ -424,20 +424,38 @@ GC_INNER char * GC_get_maps(void) { ptr_t data_end = DATAEND; -# if (defined(LINUX) || defined(HURD)) && !defined(IGNORE_PROG_DATA_START) +# if defined(PLATFORM_ANDROID) && (defined(LINUX) || defined(HURD)) && !defined(IGNORE_PROG_DATA_START) + /* Workaround for "gold" (default) linker (as of Android NDK r10e). */ /* Try the easy approaches first: */ -# ifdef PLATFORM_ANDROID - /* Workaround for "gold" (default) linker (as of Android NDK r10e). */ - if ((word)__data_start < (word)_etext - && (word)_etext < (word)__dso_handle) { - GC_data_start = (ptr_t)(__dso_handle); -# ifdef DEBUG_ADD_DEL_ROOTS - GC_log_printf( - "__data_start is wrong; using __dso_handle as data start\n"); -# endif - } else + if ((word)__data_start < (word)_etext + && (word)_etext < (word)__dso_handle) { + GC_data_start = (ptr_t)(__dso_handle); +# ifdef DEBUG_ADD_DEL_ROOTS + GC_log_printf( + "__data_start is wrong; using __dso_handle as data start\n"); +# endif + } else if (COVERT_DATAFLOW(__data_start) != 0) { + GC_data_start = (ptr_t)(__data_start); + } else { + GC_data_start = (ptr_t)(data_start); + } + if (COVERT_DATAFLOW(GC_data_start) != 0) { + if ((word)GC_data_start > (word)data_end) + ABORT_ARG2("Wrong __data_start/_end pair", + ": %p .. %p", (void *)GC_data_start, (void *)data_end); + return; + } +# ifdef DEBUG_ADD_DEL_ROOTS + GC_log_printf("__data_start not provided\n"); # endif - /* else */ if (COVERT_DATAFLOW(__data_start) != 0) { +# elif !defined(PLATFORM_ANDROID) && (defined(LINUX) || defined(HURD)) && defined(USE_PROG_DATA_START) + /* Try the easy approaches first: */ + /* However, this may lead to wrong data start value if libgc */ + /* code is put into a shared library (directly or indirectly) */ + /* which is linked with -Bsymbolic-functions option. Thus, */ + /* the following is not used by default. */ + + if (COVERT_DATAFLOW(__data_start) != 0) { GC_data_start = (ptr_t)(__data_start); } else { GC_data_start = (ptr_t)(data_start); @@ -967,6 +985,7 @@ GC_INNER size_t GC_page_size = 0; /* the smallest location q s.t. [q,p) is addressable (!up). */ /* We assume that p (up) or p-1 (!up) is addressable. */ /* Requires allocation lock. */ + GC_ATTR_NO_SANITIZE_ADDR STATIC ptr_t GC_find_limit_with_bound(ptr_t p, GC_bool up, ptr_t bound) { static volatile ptr_t result;