about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-05-31 13:23:14 +0000
committerRoland McGrath <roland@gnu.org>1995-05-31 13:23:14 +0000
commita1a9d215963c548aef245cacd8efa944de69503b (patch)
treeff96263310f3c2e3c1f90d4ec8b332b7af028d84 /elf/dl-load.c
parent4174072112e4e2b43cc65a5093a433b4270aed49 (diff)
downloadglibc-a1a9d215963c548aef245cacd8efa944de69503b.tar.gz
glibc-a1a9d215963c548aef245cacd8efa944de69503b.tar.xz
glibc-a1a9d215963c548aef245cacd8efa944de69503b.zip
Tue May 30 15:52:32 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* mach/Makefile (server-interfaces): Removed notify and
 	device_reply.  For shlibs with eager binding, libmachuser.so must
 	not refer to any functions not defined in libc.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f8b37ba346..bb1ad972d4 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -158,11 +158,12 @@ _dl_map_object (struct link_map *loader, const char *name,
 
       size_t namelen = strlen (name) + 1;
 
-      void trypath (const char *dirpath)
+      inline void trypath (const char *dirpath)
 	{
 	  fd = open_path (name, namelen, dirpath, &realname);
 	}
 
+      fd = -1;
       if (loader && loader->l_info[DT_RPATH])
 	trypath ((const char *) (loader->l_addr +
 				 loader->l_info[DT_RPATH]->d_un.d_ptr));
@@ -317,14 +318,14 @@ _dl_map_object (struct link_map *loader, const char *name,
 	    if (ph->p_memsz > ph->p_filesz)
 	      {
 		/* Extra zero pages should appear at the end of this segment,
-		   after the data mapped from the file.  Adjust MAPEND to map
-		   only the data from the file.  We will later allocate zero
-		   pages following the data mapping.  */
-		caddr_t zero = mapat - mapstart + ph->p_filesz;
-		caddr_t zeroend = mapat - mapstart + ph->p_memsz;
-		caddr_t zeropage
-		  = (caddr_t) ((Elf32_Addr) (zero + pagesize - 1)
-			       & ~(pagesize - 1));
+		   after the data mapped from the file.   */
+		caddr_t zero, zeroend, zeropage;
+
+		mapat += ph->p_vaddr - mapstart;
+		zero = mapat + ph->p_filesz;
+		zeroend = mapat + ph->p_memsz;
+		zeropage = (caddr_t) ((Elf32_Addr) (zero + pagesize - 1)
+				      & ~(pagesize - 1));
 
 		if (zeroend < zeropage)
 		  /* All the extra data is in the last page of the segment.
@@ -342,7 +343,7 @@ _dl_map_object (struct link_map *loader, const char *name,
 				      prot|PROT_WRITE) < 0)
 			  lose (errno, "cannot change memory protections");
 		      }
-		    memset (zero, 0, zeroend - zero);
+		    memset (zero, 0, zeropage - zero);
 		    if ((prot & PROT_WRITE) == 0)
 		      mprotect ((caddr_t) ((Elf32_Addr) zero
 					   & ~(pagesize - 1)),