summaryrefslogtreecommitdiff
path: root/boehm-gc/dyn_load.c
diff options
context:
space:
mode:
authorhboehm <hboehm@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-03 19:34:11 +0000
committerhboehm <hboehm@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-03 19:34:11 +0000
commit0c67eea30c500aad72b41360a5268d3190085d08 (patch)
tree0e084fa019f219c6affbd96447044ea359920119 /boehm-gc/dyn_load.c
parent0801242f635e1ab529ed092f5a44e63fe933d9f1 (diff)
downloadgcc-0c67eea30c500aad72b41360a5268d3190085d08.tar.gz
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 dynamic libraries only if !REGISTER_LIBRARIES_EARLY. * alloc.c (GC_stopped_mark): Conditionally call GC_cond_register_dynamic_libraries(). (GC_collect_a_little_inner, GC_try_to_collect_inner): Check GC_dont_gc. * dyn_load.c (GC_register_main_static_data): define. (GC_register_dyn_libraries (Linux /proc, Linux ELF versions)): no longer skip main data. * misc.c (GC_REGISTER_MAIN_STATIC_DATA): define. (GC_init_inner): Make main data registration conditional. * include/private/gc_priv.h (GC_register_main_static_data): declare. * include/private/gcconfig.h (REGISTER_LIBRARIES_EARLY): define for LINUX. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/dyn_load.c')
-rw-r--r--boehm-gc/dyn_load.c54
1 files changed, 41 insertions, 13 deletions
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index d3ef572be68..f7b88f00dab 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -355,10 +355,6 @@ void GC_register_dynamic_libraries()
/* Stack mapping; discard */
continue;
}
- if (start <= datastart && end > datastart && maj_dev != 0) {
- /* Main data segment; discard */
- continue;
- }
# ifdef THREADS
if (GC_segment_is_thread_stack(start, end)) continue;
# endif
@@ -384,6 +380,13 @@ void GC_register_dynamic_libraries()
}
}
+/* We now take care of the main data segment ourselves: */
+GC_bool GC_register_main_static_data()
+{
+ return FALSE;
+}
+
+# define HAVE_REGISTER_MAIN_STATIC_DATA
//
// parse_map_entry parses an entry from /proc/self/maps so we can
// locate all writable data segments that belong to shared libraries.
@@ -469,13 +472,6 @@ static int GC_register_dynlib_callback(info, size, ptr)
+ sizeof (info->dlpi_phnum))
return -1;
- /* Skip the first object - it is the main program. */
- if (*(int *)ptr == 0)
- {
- *(int *)ptr = 1;
- return 0;
- }
-
p = info->dlpi_phdr;
for( i = 0; i < (int)(info->dlpi_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
@@ -510,6 +506,14 @@ GC_bool GC_register_dynamic_libraries_dl_iterate_phdr()
}
}
+/* Do we need to separately register the main static data segment? */
+GC_bool GC_register_main_static_data()
+{
+ return (dl_iterate_phdr == 0);
+}
+
+#define HAVE_REGISTER_MAIN_STATIC_DATA
+
# else /* !LINUX || version(glibc) < 2.2.4 */
/* Dynamic loading code for Linux running ELF. Somewhat tested on
@@ -775,10 +779,23 @@ void GC_register_dynamic_libraries()
}
# endif
-# ifndef MSWINCE
+# ifdef MSWINCE
+ /* Do we need to separately register the main static data segment? */
+ GC_bool GC_register_main_static_data()
+ {
+ return FALSE;
+ }
+# else /* win32 */
extern GC_bool GC_no_win32_dlls;
-# endif
+
+ GC_bool GC_register_main_static_data()
+ {
+ return GC_no_win32_dlls;
+ }
+# endif /* win32 */
+# define HAVE_REGISTER_MAIN_STATIC_DATA
+
void GC_register_dynamic_libraries()
{
MEMORY_BASIC_INFORMATION buf;
@@ -1079,4 +1096,15 @@ void GC_register_dynamic_libraries(){}
int GC_no_dynamic_loading;
#endif /* !PCR */
+
#endif /* !DYNAMIC_LOADING */
+
+#ifndef HAVE_REGISTER_MAIN_STATIC_DATA
+
+/* Do we need to separately register the main static data segment? */
+GC_bool GC_register_main_static_data()
+{
+ return TRUE;
+}
+#endif /* HAVE_REGISTER_MAIN_STATIC_DATA */
+