about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorDavid Kilroy <David.Kilroy@arm.com>2020-02-12 14:30:31 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-02-12 14:30:31 -0300
commit71bcfa62451dfaa015326d3524f2a0e2d09d80ed (patch)
tree905c924b8b50a8e8ecabd6aee1e0b8f726381623 /elf
parenteb447b7b4bd6177f876ba9420ad9e048c27bae91 (diff)
downloadglibc-71bcfa62451dfaa015326d3524f2a0e2d09d80ed.tar.gz
glibc-71bcfa62451dfaa015326d3524f2a0e2d09d80ed.tar.xz
glibc-71bcfa62451dfaa015326d3524f2a0e2d09d80ed.zip
elf: avoid redundant sort in dlopen
l_initfini is already sorted by dependency in _dl_map_object_deps(),
so avoid sorting again in dl_open_worker().

Tested by running the testsuite on x86_64.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-open.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index ecb2ba9cc1..314adc2f7e 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -617,9 +617,10 @@ dl_open_worker (void *a)
   if (GLRO(dl_lazy))
     reloc_mode |= mode & RTLD_LAZY;
 
-  /* Sort the objects by dependency for the relocation process.  This
-     allows IFUNC relocations to work and it also means copy
-     relocation of dependencies are if necessary overwritten.  */
+  /* Objects must be sorted by dependency for the relocation process.
+     This allows IFUNC relocations to work and it also means copy
+     relocation of dependencies are if necessary overwritten.
+     __dl_map_object_deps has already sorted l_initfini for us.  */
   unsigned int nmaps = 0;
   unsigned int j = 0;
   struct link_map *l = new->l_initfini[0];
@@ -642,7 +643,6 @@ dl_open_worker (void *a)
       l = new->l_initfini[++j];
     }
   while (l != NULL);
-  _dl_sort_maps (maps, nmaps, NULL, false);
 
   int relocation_in_progress = 0;