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.
This commit is contained in:
David Kilroy 2020-02-12 14:30:31 -03:00 committed by Adhemerval Zanella
parent eb447b7b4b
commit 71bcfa6245

View File

@ -617,9 +617,10 @@ dl_open_worker (void *a)
if (GLRO(dl_lazy)) if (GLRO(dl_lazy))
reloc_mode |= mode & RTLD_LAZY; reloc_mode |= mode & RTLD_LAZY;
/* Sort the objects by dependency for the relocation process. This /* Objects must be sorted by dependency for the relocation process.
allows IFUNC relocations to work and it also means copy This allows IFUNC relocations to work and it also means copy
relocation of dependencies are if necessary overwritten. */ relocation of dependencies are if necessary overwritten.
__dl_map_object_deps has already sorted l_initfini for us. */
unsigned int nmaps = 0; unsigned int nmaps = 0;
unsigned int j = 0; unsigned int j = 0;
struct link_map *l = new->l_initfini[0]; struct link_map *l = new->l_initfini[0];
@ -642,7 +643,6 @@ dl_open_worker (void *a)
l = new->l_initfini[++j]; l = new->l_initfini[++j];
} }
while (l != NULL); while (l != NULL);
_dl_sort_maps (maps, nmaps, NULL, false);
int relocation_in_progress = 0; int relocation_in_progress = 0;