about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index da9f2a207c..1fffe72108 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1036,12 +1036,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
     l->l_map_start = c->mapstart + l->l_addr;
     l->l_map_end = l->l_map_start + maplength;
 
-#ifdef USE_TLS
-    /* Adjust the address of the TLS initialization image.  */
-    if (l->l_tls_initimage != NULL)
-      l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
-#endif
-
     while (c < &loadcmds[nloadcmds])
       {
 	if (c->mapend > c->mapstart
@@ -1135,6 +1129,12 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
       (ElfW(Addr)) l->l_phdr += l->l_addr;
   }
 
+#ifdef USE_TLS
+    /* Adjust the address of the TLS initialization image.  */
+    if (l->l_tls_initimage != NULL)
+      l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_map_start;
+#endif
+
   /* We are done mapping in the file.  We no longer need the descriptor.  */
   __close (fd);
   /* Signal that we closed the file.  */