diff options
author | Andreas Schwab <schwab@suse.de> | 2017-11-07 15:24:19 +0100 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2017-11-27 11:37:19 +0100 |
commit | c2c299fd24e87b83c63191ff979d41a86b37d714 (patch) | |
tree | 47b1dcdd9bd9348b5a15f93b376a8e7d275a324b /elf/dl-close.c | |
parent | de61465c04d36dadce2f4e7f78ebbe50bae6a21e (diff) | |
download | glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.tar glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.tar.gz glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.tar.bz2 glibc-c2c299fd24e87b83c63191ff979d41a86b37d714.zip |
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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index 2b46b7cf8b..3dd75c8725 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 |