From 7afab53d438e9fdc3060c20cf855235aa5ef6f49 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 31 Aug 1998 17:23:45 +0000 Subject: Update. 1998-08-31 Ulrich Drepper * 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]. --- elf/dl-close.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'elf') diff --git a/elf/dl-close.c b/elf/dl-close.c index 0d4b176b1e..bbbeed8e58 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 #include #include #include @@ -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) -- cgit 1.4.1