diff options
author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-24 13:40:21 +0000 |
---|---|---|
committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-04-24 13:40:21 +0000 |
commit | 2770736a425f430981ababc76e39565b28599ec4 (patch) | |
tree | a8074b9a8a67aadac33d1495f247696c5b362985 /boehm-gc/dyn_load.c | |
parent | e4a492cd76b0de5b3399658122bfbb7cb777406a (diff) | |
download | linaro-gcc-2770736a425f430981ababc76e39565b28599ec4.tar.gz linaro-gcc-2770736a425f430981ababc76e39565b28599ec4.tar.bz2 linaro-gcc-2770736a425f430981ababc76e39565b28599ec4.zip |
2006-03-07 Andrew Haley <aph@redhat.com>
* dyn_load.c (GC_has_static_roots): Declare.
(GC_register_dynlib_callback): Call GC_has_static_roots.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/dyn_load.c')
-rw-r--r-- | boehm-gc/dyn_load.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c index 749bf824681..94e66092e31 100644 --- a/boehm-gc/dyn_load.c +++ b/boehm-gc/dyn_load.c @@ -119,6 +119,17 @@ # endif # endif +/* An user-supplied routine that is called to dtermine if a DSO must + be scanned by the gc. */ +static int (*GC_has_static_roots)(const char *, void *, size_t); +/* Register the routine. */ +void +GC_register_has_static_roots_callback + (int (*callback)(const char *, void *, size_t)) +{ + GC_has_static_roots = callback; +} + #if defined(SUNOS5DL) && !defined(USE_PROC_FOR_LIBRARIES) #ifdef LINT @@ -371,7 +382,7 @@ GC_bool GC_register_main_static_data() { return FALSE; } - + # define HAVE_REGISTER_MAIN_STATIC_DATA #endif /* USE_PROC_FOR_LIBRARIES */ @@ -411,6 +422,11 @@ static int GC_register_dynlib_callback(info, size, ptr) { if( !(p->p_flags & PF_W) ) break; start = ((char *)(p->p_vaddr)) + info->dlpi_addr; + + if (GC_has_static_roots + && !GC_has_static_roots(info->dlpi_name, start, p->p_memsz)) + break; + GC_add_roots_inner(start, start + p->p_memsz, TRUE); } break; |