]> granicus.if.org Git - gc/commitdiff
Allow not to rely on __data_start value (Linux)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 13 Feb 2013 20:47:30 +0000 (00:47 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 13 Feb 2013 20:47:30 +0000 (00:47 +0400)
* os_dep.c (GC_init_linux_data_start): Skip use of [__]data_start if
IGNORE_PROG_DATA_START (useful if give wrong value).
* os_dep.c (GC_init_linux_data_start): Add assertion checks for
[__]data_start to be not greater than _end.

os_dep.c

index 563cd6ce4c38d66f452d0cab648b03bdad66f1cc..cb3ef43b45053d69058d29b05df49fd4a7d839b5 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -455,14 +455,16 @@ GC_INNER char * GC_get_maps(void)
 
   GC_INNER void GC_init_linux_data_start(void)
   {
-#   if defined(LINUX) || defined(HURD)
+#   if (defined(LINUX) || defined(HURD)) && !defined(IGNORE_PROG_DATA_START)
       /* Try the easy approaches first: */
       if ((ptr_t)__data_start != 0) {
           GC_data_start = (ptr_t)(__data_start);
+          GC_ASSERT((word)GC_data_start <= (word)_end);
           return;
       }
       if ((ptr_t)data_start != 0) {
           GC_data_start = (ptr_t)(data_start);
+          GC_ASSERT((word)GC_data_start <= (word)_end);
           return;
       }
 #   endif /* LINUX */