diff options
author | Hans Boehm <Hans_Boehm@hp.com> | 2003-03-04 22:18:08 +0000 |
---|---|---|
committer | Hans Boehm <hboehm@gcc.gnu.org> | 2003-03-04 22:18:08 +0000 |
commit | c62b90642287de048ac1735adeb210e3b78ff874 (patch) | |
tree | 1d91feb234953cb7730e29e49af3ec28ecb7a656 /boehm-gc/dyn_load.c | |
parent | 65ebbf81604b9234703aaa0bbe332e8d5301945c (diff) | |
download | gcc-c62b90642287de048ac1735adeb210e3b78ff874.tar.gz |
gcconfig.h (GC_data_start): declare when needed.
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.
From-SVN: r63809
Diffstat (limited to 'boehm-gc/dyn_load.c')
-rw-r--r-- | boehm-gc/dyn_load.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c index f7b88f00dab..71ad5fb1d78 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; |