about summary refs log tree commit diff
path: root/elf/dl-sym.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-sym.c')
-rw-r--r--elf/dl-sym.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index d2b4db7ec0..05de6c1c06 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -91,20 +91,10 @@ do_sym (void *handle, const char *name, void *who,
   lookup_t result;
   ElfW(Addr) caller = (ElfW(Addr)) who;
 
+  struct link_map *l = _dl_find_dso_for_object (caller);
   /* If the address is not recognized the call comes from the main
      program (we hope).  */
-  struct link_map *match = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
-
-  /* Find the highest-addressed object that CALLER is not below.  */
-  for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
-    for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL;
-	 l = l->l_next)
-      if (caller >= l->l_map_start && caller < l->l_map_end
-	  && (l->l_contiguous || _dl_addr_inside_object (l, caller)))
-	{
-	  match = l;
-	  break;
-	}
+  struct link_map *match = l ? l : GL(dl_ns)[LM_ID_BASE]._ns_loaded;
 
   if (handle == RTLD_DEFAULT)
     {