aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-sym.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-18 18:00:17 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-18 18:00:17 +0530
commitbe179c8a36fc171acff0634ac50ad31269ad4742 (patch)
tree39519d73882acb6fc3f3de4227e884e8a472abd9 /elf/dl-sym.c
parent8313cb997d2da2465c8560d3164358a68ea1e9ad (diff)
downloadglibc-be179c8a36fc171acff0634ac50ad31269ad4742.tar
glibc-be179c8a36fc171acff0634ac50ad31269ad4742.tar.gz
glibc-be179c8a36fc171acff0634ac50ad31269ad4742.tar.bz2
glibc-be179c8a36fc171acff0634ac50ad31269ad4742.zip
New function _dl_find_dso_for_object
Consolidate code to search for an address within a DSO.
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)
{