diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-08-31 17:23:45 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-08-31 17:23:45 +0000 |
commit | 7afab53d438e9fdc3060c20cf855235aa5ef6f49 (patch) | |
tree | 2e6dcf9891303ea88e048c86faab6c4a1377a9e8 /elf | |
parent | bfce746a87e205a682b85e144e056029a8a30d07 (diff) | |
download | glibc-7afab53d438e9fdc3060c20cf855235aa5ef6f49.zip glibc-7afab53d438e9fdc3060c20cf855235aa5ef6f49.tar.gz glibc-7afab53d438e9fdc3060c20cf855235aa5ef6f49.tar.bz2 |
Update.
1998-08-31 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-close.c (_dl_close): Update _dl_loaded if the first
object on the list is removed. Don't use this code for PIC.
Reported by HJ Lu [PR libc/770].
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-close.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index 0d4b176..bbbeed8 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -17,6 +17,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <assert.h> #include <dlfcn.h> #include <stdlib.h> #include <string.h> @@ -139,8 +140,16 @@ _dl_close (struct link_map *map) __munmap ((caddr_t) (imap->l_addr + mapstart), mapend - mapstart); /* Finally, unlink the data structure and free it. */ - if (imap->l_prev) +#ifdef PIC + /* We will unlink the first object only if this is a statically + linked program. */ + assert (imap->l_prev != NULL); +#else + if (imap->l_prev != NULL) imap->l_prev->l_next = imap->l_next; + else + _dl_loaded = imap->l_next; +#endif if (imap->l_next) imap->l_next->l_prev = imap->l_prev; if (imap->l_searchlist && imap->l_searchlist != list) |