about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 55725c3cb3..978a81c30d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1413,7 +1413,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 	{
 	  const char *soname;
 
-	  if (l->l_info[DT_SONAME] == NULL)
+	  if (__builtin_expect (l->l_soname_added, 1)
+	      || l->l_info[DT_SONAME] == NULL)
 	    continue;
 
 	  soname = ((const char *) D_PTR (l, l_info[DT_STRTAB])
@@ -1423,6 +1424,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 
 	  /* We have a match on a new name -- cache it.  */
 	  add_name_to_object (l, soname);
+	  l->l_soname_added = 1;
 	}
 
       /* We have a match -- bump the reference count and return it.  */