aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-02-02 20:10:09 +0100
committerFlorian Weimer <fweimer@redhat.com>2025-02-02 20:10:09 +0100
commitfc058b46c78f090580c1ca5b785b54ae4092f0c1 (patch)
tree7e32890b91927a6ac000faa01963c7fbf8d2bb28 /elf
parentb05e78d47351181694d7eda3dfcccc495b538fa8 (diff)
downloadglibc-fc058b46c78f090580c1ca5b785b54ae4092f0c1.tar.xz
glibc-fc058b46c78f090580c1ca5b785b54ae4092f0c1.zip
elf: Use _dl_find_object instead of _dl_find_dso_for_object in dlopen
The _dl_find_object function uses a binary search and is faster if there are many objects.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-open.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index ee420983cd..60a1dce9de 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -866,8 +866,10 @@ no more namespaces available for dlmopen()"));
if (nsid == __LM_ID_CALLER || strchr (file, '$') != NULL
|| strchr (file, '/') == NULL)
{
- args.caller_map = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
- if (args.caller_map == NULL)
+ struct dl_find_object dlfo;
+ if (_dl_find_object ((void *) caller_dlopen, &dlfo) == 0)
+ args.caller_map = dlfo.dlfo_link_map;
+ else
/* By default we assume this is the main application. */
args.caller_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
if (args.nsid == __LM_ID_CALLER)