about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index fdd9fe6719..47316ec7f7 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -41,7 +41,6 @@ typedef void (*fini_t) (void);
 #define IDX_STILL_USED -1
 
 
-#ifdef USE_TLS
 /* Returns true we an non-empty was found.  */
 static bool
 remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
@@ -103,7 +102,6 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
   /* No non-entry in this list element.  */
   return false;
 }
-#endif
 
 
 void
@@ -136,9 +134,7 @@ _dl_close_worker (struct link_map *map)
  retry:
   dl_close_state = pending;
 
-#ifdef USE_TLS
   bool any_tls = false;
-#endif
   const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
   char used[nloaded];
   char done[nloaded];
@@ -460,11 +456,9 @@ _dl_close_worker (struct link_map *map)
   r->r_state = RT_DELETE;
   _dl_debug_state ();
 
-#ifdef USE_TLS
   size_t tls_free_start;
   size_t tls_free_end;
   tls_free_start = tls_free_end = NO_TLS_OFFSET;
-#endif
 
   /* Check each element of the search list to see if all references to
      it are gone.  */
@@ -495,7 +489,6 @@ _dl_close_worker (struct link_map *map)
 	      --GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
 	    }
 
-#ifdef USE_TLS
 	  /* Remove the object from the dtv slotinfo array if it uses TLS.  */
 	  if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
 	    {
@@ -514,7 +507,7 @@ _dl_close_worker (struct link_map *map)
 		     this search list, going in either direction.  When the
 		     whole chunk is at the end of the used area then we can
 		     reclaim it.  */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
 		  if (tls_free_start == NO_TLS_OFFSET
 		      || (size_t) imap->l_tls_offset == tls_free_start)
 		    {
@@ -554,7 +547,7 @@ _dl_close_worker (struct link_map *map)
 			    = tls_free_end - imap->l_tls_blocksize;
 			}
 		    }
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
 		  if ((size_t) imap->l_tls_offset == tls_free_end)
 		    /* Extend the contiguous chunk being reclaimed.  */
 		    tls_free_end -= imap->l_tls_blocksize;
@@ -571,12 +564,11 @@ _dl_close_worker (struct link_map *map)
 		      tls_free_start = imap->l_tls_offset;
 		      tls_free_end = tls_free_start + imap->l_tls_blocksize;
 		    }
-# else
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
 		}
 	    }
-#endif
 
 	  /* We can unmap all the maps at once.  We determined the
 	     start address and length when we loaded the object and
@@ -642,7 +634,6 @@ _dl_close_worker (struct link_map *map)
 	}
     }
 
-#ifdef USE_TLS
   /* If we removed any object which uses TLS bump the generation counter.  */
   if (any_tls)
     {
@@ -652,7 +643,6 @@ _dl_close_worker (struct link_map *map)
       if (tls_free_end == GL(dl_tls_static_used))
 	GL(dl_tls_static_used) = tls_free_start;
     }
-#endif
 
 #ifdef SHARED
   /* Auditing checkpoint: we have deleted all objects.  */
@@ -712,7 +702,6 @@ _dl_close (void *_map)
 }
 
 
-#ifdef USE_TLS
 static bool __libc_freeres_fn_section
 free_slotinfo (struct dtv_slotinfo_list **elemp)
 {
@@ -739,7 +728,6 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
 
   return true;
 }
-#endif
 
 
 libc_freeres_fn (free_mem)
@@ -765,22 +753,20 @@ libc_freeres_fn (free_mem)
 	free (old);
       }
 
-#ifdef USE_TLS
   if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
     {
       /* Free the memory allocated for the dtv slotinfo array.  We can do
 	 this only if all modules which used this memory are unloaded.  */
-# ifdef SHARED
+#ifdef SHARED
       if (GL(dl_initial_dtv) == NULL)
 	/* There was no initial TLS setup, it was set up later when
 	   it used the normal malloc.  */
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
       else
-# endif
+#endif
 	/* The first element of the list does not have to be deallocated.
 	   It was allocated in the dynamic linker (i.e., with a different
 	   malloc), and in the static library it's in .bss space.  */
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
     }
-#endif
 }