[PATCH] elf: Make _dl_sort_maps prefer default DFS algorithm

litenglong <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
The default dynamic_sort tunable is 2, which maps to
dso_sort_algorithm_dfs.  Update the likely branch to match the
default, without changing behavior for valid tunable values.

Reviewed-by: gaoxiang<[email protected]>
---
 elf/dl-sort-maps.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/elf/dl-sort-maps.c b/elf/dl-sort-maps.c
index 28ba850a6b..75e6fc1015 100644
--- a/elf/dl-sort-maps.c
+++ b/elf/dl-sort-maps.c
@@ -303,8 +303,8 @@ _dl_sort_maps (struct link_map **maps, unsigned int nmaps,
      PTR_MANGLE/DEMANGLE, further impairing performance of small, common
      input cases. A simple if-case with direct function calls appears to
      be the fastest.  */
-  if (__glibc_likely (GLRO(dl_dso_sort_algo) == dso_sort_algorithm_original))
-    _dl_sort_maps_original (maps, nmaps, force_first, for_fini);
-  else
+  if (__glibc_likely (GLRO(dl_dso_sort_algo) == dso_sort_algorithm_dfs))
     _dl_sort_maps_dfs (maps, nmaps, force_first, for_fini);
+  else
+    _dl_sort_maps_original (maps, nmaps, force_first, for_fini);
 }
-- 
2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.