about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1e0db77c55..7c2f2e3985 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -459,7 +459,12 @@ _dl_map_object (struct link_map *loader, const char *name, int type)
 
   /* Look for this name among those already loaded.  */
   for (l = _dl_loaded; l; l = l->l_next)
-    if (! strcmp (name, l->l_libname))
+    if (! strcmp (name, l->l_libname) || /* NAME was requested before.  */
+	/* If the requested name matches the soname of a loaded object,
+	   use that object.  */
+	(l->l_info[DT_SONAME] &&
+	 ! strcmp (name, (const char *) (l->addr +
+					 l->l_info[DT_SONAME]->d_un.d_ptr))))
       {
 	/* The object is already loaded.
 	   Just bump its reference count and return it.  */