diff options
author | Roland McGrath <roland@gnu.org> | 2005-04-06 01:42:52 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2005-04-06 01:42:52 +0000 |
commit | 8c5710a6011d86605d856130a6b95419baed3000 (patch) | |
tree | b7ef94594351452940702694483373b896c08c71 /elf | |
parent | 75a5dd2f481c488b80b599457d0fc2c44f85d0ed (diff) | |
download | glibc-8c5710a6011d86605d856130a6b95419baed3000.tar glibc-8c5710a6011d86605d856130a6b95419baed3000.tar.gz glibc-8c5710a6011d86605d856130a6b95419baed3000.tar.bz2 glibc-8c5710a6011d86605d856130a6b95419baed3000.zip |
2005-03-03 Ulrich Drepper <drepper@redhat.com>
[BZ #821]
* elf/dl-close.c (_dl_close): Don't try to set up new searchpath if the
loader is closed. Fixes unload3.
* elf/tst-global1.c: New file.
* elf/Makefile (tests): Add tst-global1.
* elf/testobj2.c (p): New function.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-close.c | 30 | ||||
-rw-r--r-- | elf/testobj2.c | 6 | ||||
-rw-r--r-- | elf/tst-global1.c | 36 |
3 files changed, 42 insertions, 30 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index c823b17642..f40d5b0d89 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -327,36 +327,6 @@ _dl_close (void *_map) } assert (found); } - else if (new_opencount[i] != 0 && imap->l_type == lt_loaded - && imap->l_searchlist.r_list == NULL - && imap->l_initfini != NULL) - { - /* The object is still used. But the object we are - unloading right now is responsible for loading it. If - the current object does not have it's own scope yet we - have to create one. This has to be done before running - the finalizers. - - To do this count the number of dependencies. */ - unsigned int cnt; - for (cnt = 1; imap->l_initfini[cnt] != NULL; ++cnt) - if (imap->l_initfini[cnt]->l_idx >= i - && imap->l_initfini[cnt]->l_idx < nopencount) - ++new_opencount[imap->l_initfini[cnt]->l_idx]; - else - ++imap->l_initfini[cnt]->l_opencount; - - /* We simply reuse the l_initfini list. */ - imap->l_searchlist.r_list = &imap->l_initfini[cnt + 1]; - imap->l_searchlist.r_nlist = cnt; - - for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt) - if (imap->l_scope[cnt] == &map->l_searchlist) - { - imap->l_scope[cnt] = &imap->l_searchlist; - break; - } - } /* Store the new l_opencount value. */ imap->l_opencount = new_opencount[i]; diff --git a/elf/testobj2.c b/elf/testobj2.c index 6514c56393..f00ba9f3e6 100644 --- a/elf/testobj2.c +++ b/elf/testobj2.c @@ -23,3 +23,9 @@ preload (int a) return fp (a) + 10; return 10; } + +void +p (void) +{ + puts ("hello world"); +} diff --git a/elf/tst-global1.c b/elf/tst-global1.c new file mode 100644 index 0000000000..1611b51b67 --- /dev/null +++ b/elf/tst-global1.c @@ -0,0 +1,36 @@ +#include <dlfcn.h> +#include <stdio.h> + +int +main (void) +{ + void *h1 = dlopen ("$ORIGIN/testobj6.so", RTLD_GLOBAL|RTLD_LAZY); + if (h1 == NULL) + { + puts ("cannot open testobj6"); + return 1; + } + + void *h2 = dlopen ("$ORIGIN/testobj2.so", + RTLD_GLOBAL|RTLD_DEEPBIND|RTLD_LAZY); + if (h2 == NULL) + { + puts ("cannot open testobj2"); + return 1; + } + + dlclose (h1); + + void (*f) (void) = dlsym (h2, "p"); + if (f == NULL) + { + puts ("cannot find p"); + return 1; + } + + f (); + + dlclose (h2); + + return 0; +} |