about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c5
-rw-r--r--elf/dl-libc.c2
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/rtld.c20
4 files changed, 15 insertions, 14 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 62c257ce4f..500b9d57d3 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -597,14 +597,15 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
 libc_freeres_fn (free_mem)
 {
   if (__builtin_expect (GL(dl_global_scope_alloc), 0) != 0
-      && GL(dl_main_searchlist)->r_nlist == GL(dl_initial_searchlist).r_nlist)
+      && (GL(dl_main_searchlist)->r_nlist
+	  == GLRO(dl_initial_searchlist).r_nlist))
     {
       /* All object dynamically loaded by the program are unloaded.  Free
 	 the memory allocated for the global scope variable.  */
       struct link_map **old = GL(dl_main_searchlist)->r_list;
 
       /* Put the old map in.  */
-      GL(dl_main_searchlist)->r_list = GL(dl_initial_searchlist).r_list;
+      GL(dl_main_searchlist)->r_list = GLRO(dl_initial_searchlist).r_list;
       /* Signal that the original map is used.  */
       GL(dl_global_scope_alloc) = 0;
 
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index a6c833a9e2..a8b851c090 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -209,7 +209,7 @@ libc_freeres_fn (free_mem)
 
   /* Remove all search directories.  */
   d = GL(dl_all_dirs);
-  while (d != GL(dl_init_all_dirs))
+  while (d != GLRO(dl_init_all_dirs))
     {
       struct r_search_path_elem *old = d;
       d = d->next;
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1ff12836ec..1a3c9c5ed9 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -757,7 +757,7 @@ _dl_init_paths (const char *llp)
     env_path_list.dirs = (void *) -1;
 
   /* Remember the last search directory added at startup.  */
-  GL(dl_init_all_dirs) = GL(dl_all_dirs);
+  GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
 }
 
 
diff --git a/elf/rtld.c b/elf/rtld.c
index 87d3958679..c9b9c1be80 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -93,8 +93,6 @@ INTVARDEF(_dl_starting_up)
    (except those which cannot be added for some reason).  */
 struct rtld_global _rtld_global =
   {
-    /* Get architecture specific initializer.  */
-#include <dl-procinfo.c>
     /* Default presumption without further information is executable stack.  */
     ._dl_stack_flags = PF_R|PF_W|PF_X,
 #ifdef _LIBC_REENTRANT
@@ -113,6 +111,8 @@ extern struct rtld_global _rtld_local
    read-only after relocation.  */
 struct rtld_global_ro _rtld_global_ro attribute_relro =
   {
+    /* Get architecture specific initializer.  */
+#include <dl-procinfo.c>
 #ifdef NEED_DL_SYSINFO
     ._dl_sysinfo = DL_SYSINFO_DEFAULT,
 #endif
@@ -1720,6 +1720,14 @@ cannot allocate TLS data structures for initial thread");
 #endif
   }
 
+  /* Now set up the variable which helps the assembler startup code.  */
+  GL(dl_main_searchlist) = &GL(dl_loaded)->l_searchlist;
+  GL(dl_global_scope)[0] = &GL(dl_loaded)->l_searchlist;
+
+  /* Save the information about the original global scope list since
+     we need it in the memory handling later.  */
+  GLRO(dl_initial_searchlist) = *GL(dl_main_searchlist);
+
   if (prelinked)
     {
       struct link_map *l;
@@ -1833,14 +1841,6 @@ cannot allocate TLS data structures for initial thread");
 	}
     }
 
-  /* Now set up the variable which helps the assembler startup code.  */
-  GL(dl_main_searchlist) = &GL(dl_loaded)->l_searchlist;
-  GL(dl_global_scope)[0] = &GL(dl_loaded)->l_searchlist;
-
-  /* Save the information about the original global scope list since
-     we need it in the memory handling later.  */
-  GL(dl_initial_searchlist) = *GL(dl_main_searchlist);
-
 #ifndef NONTLS_INIT_TP
 # define NONTLS_INIT_TP do { } while (0)
 #endif