about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-08-30 15:37:54 +0200
committerAndreas Schwab <schwab@redhat.com>2011-08-30 15:37:54 +0200
commit2bc174332ba6ddbd1b855dced33889bef56e8ba3 (patch)
treea7d03a2e866ea779a3d4b8b8b217d31ce0dc4431 /elf
parentfbeb5f4db12dccb985ee10eb87fe00b46562b796 (diff)
downloadglibc-2bc174332ba6ddbd1b855dced33889bef56e8ba3.tar.gz
glibc-2bc174332ba6ddbd1b855dced33889bef56e8ba3.tar.xz
glibc-2bc174332ba6ddbd1b855dced33889bef56e8ba3.zip
Relocate objects in dependency order
Diffstat (limited to 'elf')
-rw-r--r--elf/rtld.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 87bb5f0b46..4f6bbfdaed 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2255,13 +2255,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
       /* If we are profiling we also must do lazy reloaction.  */
       GLRO(dl_lazy) |= consider_profiling;
 
-      struct link_map *l = main_map;
-      while (l->l_next)
-	l = l->l_next;
-
       HP_TIMING_NOW (start);
-      do
+      unsigned i = main_map->l_searchlist.r_nlist;
+      while (i-- > 0)
 	{
+	  struct link_map *l = main_map->l_initfini[i];
+
 	  /* While we are at it, help the memory handling a bit.  We have to
 	     mark some data structures as allocated with the fake malloc()
 	     implementation in ld.so.  */
@@ -2280,10 +2279,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	  /* Add object to slot information data if necessasy.  */
 	  if (l->l_tls_blocksize != 0 && tls_init_tp_called)
 	    _dl_add_to_slotinfo (l);
-
-	  l = l->l_prev;
 	}
-      while (l);
       HP_TIMING_NOW (stop);
 
       HP_TIMING_DIFF (relocate_time, start, stop);