summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1fffe72108..48e7cba235 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -941,30 +941,18 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 
 #ifdef USE_TLS
 	case PT_TLS:
-	  l->l_tls_blocksize = ph->p_memsz;
-	  l->l_tls_align = ph->p_align;
-	  l->l_tls_initimage_size = ph->p_filesz;
-	  /* Since we don't know the load address yet only store the
-	     offset.  We will adjust it later.  */
-	  l->l_tls_initimage = (void *) ph->p_offset;
-
-	/* This is the first element of the initialization image list.
-	   It is created as a circular list so that we can easily
-	   append to it.  */
-	  if (GL(dl_initimage_list) == NULL)
-	    GL(dl_initimage_list) = l->l_tls_nextimage = l->l_tls_previmage
-	      = l;
-	  else
+	  if (ph->p_memsz > 0)
 	    {
-	      l->l_tls_nextimage = GL(dl_initimage_list)->l_tls_nextimage;
-	      l->l_tls_nextimage->l_tls_previmage = l;
-	      l->l_tls_previmage = GL(dl_initimage_list);
-	      l->l_tls_previmage->l_tls_nextimage = l;
-	      GL(dl_initimage_list) = l;
+	      l->l_tls_blocksize = ph->p_memsz;
+	      l->l_tls_align = ph->p_align;
+	      l->l_tls_initimage_size = ph->p_filesz;
+	      /* Since we don't know the load address yet only store the
+		 offset.  We will adjust it later.  */
+	      l->l_tls_initimage = (void *) ph->p_offset;
+
+	      /* Assign the next available module ID.  */
+	      l->l_tls_modid = _dl_next_tls_modid ();
 	    }
-
-	  /* Assign the next available module ID.  */
-	  l->l_tls_modid = _dl_next_tls_modid ();
 	  break;
 #endif
 	}