diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index a33943e8518e62655aaf17500eac242671aaee46..c6539791d2f9a1b02d4a473d2cee48d6c275af19 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,13 @@
+2003-03-04  Hans Boehm <Hans.Boehm@hp.com>
+	* include/private/gcconfig.h (GC_data_start): declare when needed.
+	* include/private/gc_priv.h: Include gcconfig.h after ptr_t
+	declaration.
+	* dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr,
+	GC_register_dynlib_callback): Register main data for static
+	executable if dl_iterate_phdr() didn't.
+	* misc.c (GC_init_inner): Call GC_init_linux_data_start() even
+	if we don't expect to register main static data.
+
 2003-03-03  Hans Boehm  <Hans.Boehm@hp.com>
 	* mark_rts.c (GC_cond_register_dynamic_libraries): add.
 	(GC_push_roots): explicitly mark free list headers, register
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index f7b88f00dabd7b3bbd77f8dbaf5bdd238d05d851..71ad5fb1d78d80aa483f2e97ccfafd553d90f767 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -487,6 +487,7 @@ static int GC_register_dynlib_callback(info, size, ptr)
     }
   }
 
+  * (int *)ptr = 1;	/* Signal that we were called */
   return 0;
 }     
 
@@ -496,10 +497,17 @@ static int GC_register_dynlib_callback(info, size, ptr)
 
 GC_bool GC_register_dynamic_libraries_dl_iterate_phdr()
 {
-  int tmp = 0;
-
   if (dl_iterate_phdr) {
-    dl_iterate_phdr(GC_register_dynlib_callback, &tmp);
+    int did_something = 0;
+    dl_iterate_phdr(GC_register_dynlib_callback, &did_something);
+    if (!did_something) {
+	/* dl_iterate_phdr may forget the static data segment in	*/
+	/* statically linked executables.				*/
+	GC_add_roots_inner(DATASTART, (char *)(DATAEND), TRUE);
+#       if defined(DATASTART2)
+          GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), TRUE);
+#       endif
+    }
     return TRUE;
   } else {
     return FALSE;
diff --git a/boehm-gc/include/private/gc_priv.h b/boehm-gc/include/private/gc_priv.h
index dac604f2a117f59d543646cee73875e46cd11bfd..b09c4840945607dcc0f44a39e7475cbfac982422 100644
--- a/boehm-gc/include/private/gc_priv.h
+++ b/boehm-gc/include/private/gc_priv.h
@@ -44,10 +44,6 @@
 #   include "../gc_mark.h"
 # endif
 
-# ifndef GCCONFIG_H
-#   include "gcconfig.h"
-# endif
-
 typedef GC_word word;
 typedef GC_signed_word signed_word;
 
@@ -60,6 +56,10 @@ typedef char * ptr_t;	/* A generic pointer to which we can add	*/
 			/* Preferably identical to caddr_t, if it 	*/
 			/* exists.					*/
 			
+# ifndef GCCONFIG_H
+#   include "gcconfig.h"
+# endif
+
 # ifndef HEADERS_H
 #   include "gc_hdrs.h"
 # endif
diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
index af0d2e4ec49077b8ca29accdae81d8f2c30cd376..51d9de0186ce64a918c7d3187f2b3f1d168c4567 100644
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -1810,6 +1810,10 @@
     /* platforms as well, though it should be avoided in win32.		*/
 # endif /* LINUX */
 
+# if defined(SEARCH_FOR_DATA_START) && defined(GC_PRIVATE_H)
+    extern ptr_t GC_data_start;
+# endif
+
 # ifndef CLEAR_DOUBLE
 #   define CLEAR_DOUBLE(x) \
 	((word*)x)[0] = 0; \
diff --git a/boehm-gc/misc.c b/boehm-gc/misc.c
index 891cdc722b750c3d09a1057e9c62de14fff7fc59..8f83ff3ab53c2a2425a9f22c99c86530788b92fa 100644
--- a/boehm-gc/misc.c
+++ b/boehm-gc/misc.c
@@ -580,7 +580,7 @@ void GC_init_inner()
  	GC_init_win32();
 #   endif
 #   if defined(SEARCH_FOR_DATA_START)
-	if (GC_REGISTER_MAIN_STATIC_DATA()) GC_init_linux_data_start();
+	GC_init_linux_data_start();
 #   endif
 #   if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__)
 	GC_init_netbsd_elf();