about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-14 16:08:16 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-14 16:08:16 +0000
commitf802accba41c85a2c122f7461282f8a1b5328379 (patch)
tree99c5bf2c35fd5819f6f681473b42790cd71c66a9 /elf/dl-close.c
parent76fbcfdd66556dfe8e813cda50ac28071d0da573 (diff)
downloadglibc-f802accba41c85a2c122f7461282f8a1b5328379.tar.gz
glibc-f802accba41c85a2c122f7461282f8a1b5328379.tar.xz
glibc-f802accba41c85a2c122f7461282f8a1b5328379.zip
Update.
1998-03-14 11:47  H.J. Lu  <hjl@gnu.org>

	* elf/dl-close.c (_dl_close): Stop unmapping the segments after
	unmapping the last loaded segment.

1998-03-14 15:54  Ulrich Drepper  <drepper@cygnus.com>

	* configure.in: Set base_os for Irix6.
	Correct test for .weakext.

1998-03-14  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* elf/dl-deps.c (_dl_map_object_deps): Add first parameter
	(new_line) to _dl_debug_message call.

	* locale/programs/linereader.c (lr_token): Return EOF token at EOF.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 285457323d..253b073367 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -80,6 +80,7 @@ _dl_close (struct link_map *map)
 	  /* That was the last reference, and this was a dlopen-loaded
 	     object.  We can unmap it.  */
 	  const ElfW(Phdr) *ph;
+	  const ElfW(Phdr) *eph;
 
 	  if (imap->l_info[DT_FINI])
 	    /* Call its termination function.  */
@@ -99,9 +100,14 @@ _dl_close (struct link_map *map)
 	      _dl_global_scope_end[1] = NULL;
 	    }
 
+	  /* Find the first entry specifying a load command.  We have
+	     to determine this now since the table itself is also loaded.  */
+	  for (eph = imap->l_phdr; eph < imap->l_phdr + imap->l_phnum; ++eph)
+	    if (eph->p_type == PT_LOAD)
+	      break;
+
 	  /* Unmap the segments.  */
-	  for (ph = imap->l_phdr + (imap->l_phnum - 1);
-	       ph >= imap->l_phdr; --ph)
+	  for (ph = imap->l_phdr + (imap->l_phnum - 1); ph >= eph; --ph)
 	    if (ph->p_type == PT_LOAD)
 	      {
 		ElfW(Addr) mapstart = ph->p_vaddr & ~(ph->p_align - 1);