about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-support.c4
-rw-r--r--elf/dynamic-link.h8
-rw-r--r--elf/rtld.c18
3 files changed, 17 insertions, 13 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 8b69ef07e7..c103d0e42e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -46,8 +46,6 @@ struct r_search_path *_dl_search_paths;
 const char *_dl_profile;
 struct link_map *_dl_profile_map;
 
-extern void __libc_init_secure (void);
-
 
 static void non_dynamic_init (void) __attribute__ ((unused));
 
@@ -58,8 +56,6 @@ non_dynamic_init (void)
 
   _dl_pagesize = __getpagesize ();
 
-  __libc_init_secure ();
-
   /* Initialize the data structures for the search paths for shared
      objects.  */
   _dl_init_paths ();
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 64b5f78bc7..aedee20700 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -56,7 +56,7 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
 	     + DT_VERSIONTAGNUM] = dyn;
       else
 	assert (! "bad dynamic tag");
-      dyn++;
+      ++dyn;
     }
 
   if (info[DT_RELA])
@@ -96,10 +96,10 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
 	    if (r_addr <= p_addr && r_addr+r_size > p_addr)		      \
 	      {								      \
 		ElfW(Addr) r2_addr, r2_size;				      \
-		r2_addr = p_addr+p_size;				      \
-		if (r2_addr < r_addr+r_size)				      \
+		r2_addr = p_addr + p_size;				      \
+		if (r2_addr < r_addr + r_size)				      \
 		  {							      \
-		    r2_size = r_addr+r_size - r2_addr;			      \
+		    r2_size = r_addr + r_size - r2_addr;		      \
 		    elf_dynamic_do_##reloc ((map), r2_addr, r2_size, 0);      \
 		  }							      \
 		r_size = p_addr - r_addr;				      \
diff --git a/elf/rtld.c b/elf/rtld.c
index b1538aa893..72c2520d6a 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -495,8 +495,10 @@ of this helper program; chances are you did not intend to run this program.\n",
       while ((p = strsep (&list, " ")) != NULL)
 	if (! __libc_enable_secure || strchr (p, '/') == NULL)
 	  {
-	    (void) _dl_map_object (NULL, p, lt_library, 0);
-	    ++npreloads;
+	    struct link_map *new_map = _dl_map_object (NULL, p, lt_library, 0);
+	    if (new_map->l_opencount == 1)
+	      /* It is no duplicate.  */
+	      ++npreloads;
 	  }
     }
 
@@ -550,15 +552,21 @@ of this helper program; chances are you did not intend to run this program.\n",
 	  runp = file;
 	  while ((p = strsep (&runp, ": \t\n")) != NULL)
 	    {
-	      (void) _dl_map_object (NULL, p, lt_library, 0);
-	      ++npreloads;
+	      struct link_map *new_map = _dl_map_object (NULL, p,
+							 lt_library, 0);
+	      if (new_map->l_opencount == 1)
+		/* It is no duplicate.  */
+		++npreloads;
 	    }
 	}
 
       if (problem != NULL)
 	{
 	  char *p = strndupa (problem, file_size - (problem - file));
-	  (void) _dl_map_object (NULL, p, lt_library, 0);
+	  struct link_map *new_map = _dl_map_object (NULL, p, lt_library, 0);
+	  if (new_map->l_opencount == 1)
+	    /* It is no duplicate.  */
+	    ++npreloads;
 	}
 
       /* We don't need the file anymore.  */