aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2017-11-07 15:24:19 +0100
committerAndreas Schwab <schwab@suse.de>2017-11-27 11:37:19 +0100
commitc2c299fd24e87b83c63191ff979d41a86b37d714 (patch)
tree47b1dcdd9bd9348b5a15f93b376a8e7d275a324b /elf/dl-close.c
parentde61465c04d36dadce2f4e7f78ebbe50bae6a21e (diff)
downloadglibc-c2c299fd24e87b83c63191ff979d41a86b37d714.zip
glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.tar.gz
glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.tar.bz2
Consolidate link map sorting
Combine the four places where link maps are sorted into a single function. This also moves the logic to skip the first map (representing the main binary) to the callers.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 2b46b7c..3dd75c8 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -241,8 +241,10 @@ _dl_close_worker (struct link_map *map, bool force)
}
}
- /* Sort the entries. */
- _dl_sort_fini (maps, nloaded, used, nsid);
+ /* Sort the entries. We can skip looking for the binary itself which is
+ at the front of the search list for the main namespace. */
+ _dl_sort_maps (maps + (nsid == LM_ID_BASE), nloaded - (nsid == LM_ID_BASE),
+ used + (nsid == LM_ID_BASE), true);
/* Call all termination functions at once. */
#ifdef SHARED