summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--bits/libc-tsd.h23
-rw-r--r--csu/errno-loc.c10
-rw-r--r--csu/errno.c21
-rw-r--r--elf/dl-libc.c25
-rw-r--r--elf/dl-tsd.c8
-rw-r--r--include/errno.h14
-rw-r--r--include/netdb.h22
-rw-r--r--include/resolv.h12
-rw-r--r--include/tls.h18
-rw-r--r--inet/herrno-loc.c6
-rw-r--r--inet/herrno.c20
-rw-r--r--malloc/arena.c41
-rw-r--r--malloc/hooks.c2
-rw-r--r--malloc/malloc.c14
-rw-r--r--nptl/ChangeLog15
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S20
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S28
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h37
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_post.S17
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S27
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S27
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S20
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S8
-rw-r--r--resolv/res-state.c19
-rw-r--r--resolv/res_libc.c2
-rw-r--r--sysdeps/i386/dl-machine.h40
-rw-r--r--sysdeps/ia64/dl-machine.h23
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.h13
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h90
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h7
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h5
-rw-r--r--sysdeps/sh/dl-machine.h28
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h13
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h28
-rw-r--r--sysdeps/unix/i386/sysdep.S43
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h50
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.S36
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S76
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h37
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S61
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h25
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h60
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h31
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h31
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h30
-rw-r--r--sysdeps/unix/x86_64/sysdep.S38
-rw-r--r--sysdeps/x86_64/dl-machine.h15
-rw-r--r--tls.make.c4
54 files changed, 339 insertions, 997 deletions
diff --git a/ChangeLog b/ChangeLog
index 4654e17985..17c9dcdb19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
 2011-09-10  Ulrich Drepper  <drepper@gmail.com>
 
+	* include/tls.h: Removed.  USE___THREAD must always be defined.
+	* bits/libc-tsd.h: Don't handle !USE___THREAD.
+	* elf/dl-libc.c: Likewise.
+	* elf/dl-tsd.c: Likewise.
+	* include/errno.h: Likewise.
+	* include/netdb.h: Likewise.
+	* include/resolv.h: Likewise.
+	* inet/herrno-loc.c: Likewise.
+	* inet/herrno.c: Likewise.
+	* malloc/arena.c: Likewise.
+	* malloc/hooks.c: Likewise.
+	* malloc/malloc.c: Likewise.
+	* resolv/res-state.c: Likewise.
+	* resolv/res_libc.c: Likewise.
+	* sysdeps/i386/dl-machine.h: Likewise.
+	* sysdeps/ia64/dl-machine.h: Likewise.
+	* sysdeps/powerpc/powerpc32/dl-machine.h: Likewise.
+	* sysdeps/powerpc/powerpc64/dl-machine.h: Likewise.
+	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
+	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
+	* sysdeps/sh/dl-machine.h: Likewise.
+	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
+	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
+	* sysdeps/unix/i386/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
+	* sysdeps/unix/x86_64/sysdep.S: Likewise.
+	* sysdeps/x86_64/dl-machine.h: Likewise.
+	* tls.make.c: Likewise.
+
 	* configure.in: Remove --with-__thread option.  Make tests for
 	--no-whole-archive, __builtin_expect, symbol redirection, __thread,
 	tls_model attribute fail if no support is available.  Remove
diff --git a/bits/libc-tsd.h b/bits/libc-tsd.h
index 1a24b701b9..d1118a5bae 100644
--- a/bits/libc-tsd.h
+++ b/bits/libc-tsd.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  Stub or TLS version.
-   Copyright (C) 1998,2001,2002,2008 Free Software Foundation, Inc.
+   Copyright (C) 1998,2001,2002,2008,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,12 +24,12 @@
    set of thread-specific `void *' data used only internally by libc.
 
    __libc_tsd_define(CLASS, TYPE, KEY)	-- Define or declare a datum with TYPE
-   					   for KEY.  CLASS can be `static' for
+					   for KEY.  CLASS can be `static' for
 					   keys used in only one source file,
 					   empty for global definitions, or
 					   `extern' for global declarations.
    __libc_tsd_address(TYPE, KEY)	-- Return the `TYPE *' pointing to
-   					   the current thread's datum for KEY.
+					   the current thread's datum for KEY.
    __libc_tsd_get(TYPE, KEY)		-- Return the `TYPE' datum for KEY.
    __libc_tsd_set(TYPE, KEY, VALUE)	-- Set the datum for KEY to VALUE.
 
@@ -51,20 +51,11 @@
    We don't define an enum for the possible key values, because the KEYs
    translate directly into variables by macro magic.  */
 
-#if USE___THREAD
-# define __libc_tsd_define(CLASS, TYPE, KEY)	\
+#define __libc_tsd_define(CLASS, TYPE, KEY)	\
   CLASS __thread TYPE __libc_tsd_##KEY attribute_tls_model_ie;
 
-# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY)
-# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY)
-# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
-#else
-# define __libc_tsd_define(CLASS, TYPE, KEY)	\
-  CLASS TYPE __libc_tsd_##KEY##_data;
-
-# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY##_data)
-# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY##_data)
-# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
-#endif
+#define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY)
+#define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY)
+#define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
 
 #endif	/* bits/libc-tsd.h */
diff --git a/csu/errno-loc.c b/csu/errno-loc.c
index 633590f4f9..f7de2b7b08 100644
--- a/csu/errno-loc.c
+++ b/csu/errno-loc.c
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, non-threaded
    version.
-   Copyright (C) 1996, 1998, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2004, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,15 +21,7 @@
 #include <errno.h>
 #include <tls.h>
 
-#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
-#undef errno
-extern int errno;
-#endif
-
 int *
-#if ! USE___THREAD
-weak_const_function
-#endif
 __errno_location (void)
 {
   return &errno;
diff --git a/csu/errno.c b/csu/errno.c
index 03d661b717..d5d2c98fb7 100644
--- a/csu/errno.c
+++ b/csu/errno.c
@@ -1,5 +1,5 @@
 /* Definition of `errno' variable.  Canonical version.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,27 +27,10 @@
 /* Code compiled for rtld refers only to this name.  */
 int rtld_errno attribute_hidden;
 
-#elif USE___THREAD
+#else
 
 __thread int errno;
 extern __thread int __libc_errno __attribute__ ((alias ("errno")))
   attribute_hidden;
 
-#else
-
-/* This differs from plain `int errno;' in that it doesn't create
-   a common definition, but a plain symbol that resides in .bss,
-   which can have an alias.  */
-int errno __attribute__ ((nocommon));
-strong_alias (errno, _errno)
-
-/* We declare these with compat_symbol so that they are not visible at
-   link time.  Programs must use the accessor functions.  RTLD is special,
-   since it's not exported from there at any time.  */
-# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
-#  include <shlib-compat.h>
-compat_symbol (libc, errno, errno, GLIBC_2_0);
-compat_symbol (libc, _errno, _errno, GLIBC_2_0);
-# endif
-
 #endif
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index 828588a8b1..f44fa10e0e 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -307,22 +307,19 @@ libc_freeres_fn (free_mem)
 	}
     }
 
-  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.  */
+  /* 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
-      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
+  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
-	/* 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);
-    }
+    /* 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);
 
   void *scope_free_list = GL(dl_scope_free_list);
   GL(dl_scope_free_list) = NULL;
diff --git a/elf/dl-tsd.c b/elf/dl-tsd.c
index f01f8d652e..ea0fccd989 100644
--- a/elf/dl-tsd.c
+++ b/elf/dl-tsd.c
@@ -1,5 +1,5 @@
 /* Thread-local data used by error handling for runtime dynamic linker.
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,17 +30,13 @@
 void ** __attribute__ ((const))
 _dl_initial_error_catch_tsd (void)
 {
-#  if USE___THREAD
   static __thread void *data;
-#  else
-  static void *data;
-#  endif
   return &data;
 }
 void **(*_dl_error_catch_tsd) (void) __attribute__ ((const))
      = &_dl_initial_error_catch_tsd;
 
-# elif USE___THREAD
+# else
 
 /* libpthread sets _dl_error_catch_tsd to point to this function.
    We define it here instead of in libpthread so that it doesn't
diff --git a/include/errno.h b/include/errno.h
index 80c7b6ec13..98c6080528 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -21,15 +21,13 @@ extern int rtld_errno attribute_hidden;
 
 #  include <tls.h>
 
-#  if USE___THREAD
-#   undef  errno
-#   ifndef NOT_IN_libc
-#    define errno __libc_errno
-#   else
-#    define errno errno		/* For #ifndef errno tests.  */
-#   endif
-extern __thread int errno attribute_tls_model_ie;
+#  undef  errno
+#  ifndef NOT_IN_libc
+#   define errno __libc_errno
+#  else
+#   define errno errno		/* For #ifndef errno tests.  */
 #  endif
+extern __thread int errno attribute_tls_model_ie;
 
 # endif	/* RTLD_PRIVATE_ERRNO */
 
diff --git a/include/netdb.h b/include/netdb.h
index 9bbe31b438..d5154c51d9 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -2,29 +2,19 @@
 #include <resolv/netdb.h>
 
 /* Macros for accessing h_errno from inside libc.  */
+# undef  h_errno
 # ifdef _LIBC_REENTRANT
 #  include <tls.h>
-#  if USE___THREAD
-#   undef  h_errno
-#   ifndef NOT_IN_libc
-#    define h_errno __libc_h_errno
-#   else
-#    define h_errno h_errno	/* For #ifndef h_errno tests.  */
-#   endif
-extern __thread int h_errno attribute_tls_model_ie;
-#   define __set_h_errno(x)	(h_errno = (x))
+#  ifndef NOT_IN_libc
+#   define h_errno __libc_h_errno
 #  else
-static inline int
-__set_h_errno (int __err)
-{
-  return *__h_errno_location () = __err;
-}
+#   define h_errno h_errno	/* For #ifndef h_errno tests.  */
 #  endif
+extern __thread int h_errno attribute_tls_model_ie;
 # else
-#  undef  h_errno
-#  define __set_h_errno(x) (h_errno = (x))
 extern int h_errno;
 # endif	/* _LIBC_REENTRANT */
+# define __set_h_errno(x) (h_errno = (x))
 
 libc_hidden_proto (hstrerror)
 libc_hidden_proto (innetgr)
diff --git a/include/resolv.h b/include/resolv.h
index 7ab7f8779d..30ea8776b5 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -15,14 +15,12 @@
 
 # ifdef _LIBC_REENTRANT
 #  include <tls.h>
-#  if USE___THREAD
-#   undef _res
-#   ifndef NOT_IN_libc
-#    define __resp __libc_resp
-#   endif
-#   define _res (*__resp)
-extern __thread struct __res_state *__resp attribute_tls_model_ie;
+#  undef _res
+#  ifndef NOT_IN_libc
+#   define __resp __libc_resp
 #  endif
+#  define _res (*__resp)
+extern __thread struct __res_state *__resp attribute_tls_model_ie;
 # else
 #  ifndef __BIND_NOSTATIC
 #   undef _res
diff --git a/include/tls.h b/include/tls.h
deleted file mode 100644
index 8ee2b947be..0000000000
--- a/include/tls.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* This file defines USE___THREAD to 1 or 0 to cut down on the #if mess.  */
-
-#ifndef _include_tls_h
-#define _include_tls_h 1
-
-#include_next <tls.h>
-
-#if !defined NOT_IN_libc || defined IS_IN_libpthread
-
-# define USE___THREAD 1
-
-#else
-
-# define USE___THREAD 0
-
-#endif
-
-#endif
diff --git a/inet/herrno-loc.c b/inet/herrno-loc.c
index fd6deeb330..1c2002bee4 100644
--- a/inet/herrno-loc.c
+++ b/inet/herrno-loc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 97, 98, 2002, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,10 +19,6 @@
 #include <netdb.h>
 #include <tls.h>
 
-#if ! USE___THREAD
-# undef h_errno
-extern int h_errno;
-#endif
 
 /* When threaded, h_errno may be a per-thread variable.  */
 int *
diff --git a/inet/herrno.c b/inet/herrno.c
index 9ff30a191b..59706cdc05 100644
--- a/inet/herrno.c
+++ b/inet/herrno.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,97,98,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996,97,98,2002,2003,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,23 +25,7 @@
 /* We need to have the error status variable of the resolver
    accessible in the libc.  */
 
-#if USE___THREAD
 __thread int h_errno;
 extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno")))
   attribute_hidden;
-# define h_errno __libc_h_errno
-#else
-/* This differs from plain `int h_errno;' in that it doesn't create
-   a common definition, but a plain symbol that resides in .bss,
-   which can have an alias.  */
-int h_errno __attribute__((section (".bss")));
-weak_alias (h_errno, _h_errno)
-
-/* We declare these with compat_symbol so that they are not
-   visible at link time.  Programs must use the accessor functions.  */
-# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
-#  include <shlib-compat.h>
-compat_symbol (libc, h_errno, h_errno, GLIBC_2_0);
-compat_symbol (libc, _h_errno, _h_errno, GLIBC_2_0);
-# endif
-#endif
+#define h_errno __libc_h_errno
diff --git a/malloc/arena.c b/malloc/arena.c
index 29d8b2da47..aab55352f7 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -173,10 +173,6 @@ int __malloc_initialized = -1;
 
 static __malloc_ptr_t (*save_malloc_hook) (size_t __size,
 					   __const __malloc_ptr_t);
-# if !defined _LIBC || (defined SHARED && !USE___THREAD)
-static __malloc_ptr_t (*save_memalign_hook) (size_t __align, size_t __size,
-					     __const __malloc_ptr_t);
-# endif
 static void           (*save_free_hook) (__malloc_ptr_t __ptr,
 					 __const __malloc_ptr_t);
 static Void_t*        save_arena;
@@ -432,34 +428,6 @@ __failing_morecore (ptrdiff_t d)
 extern struct dl_open_hook *_dl_open_hook;
 libc_hidden_proto (_dl_open_hook);
 # endif
-
-# if defined SHARED && !USE___THREAD
-/* This is called by __pthread_initialize_minimal when it needs to use
-   malloc to set up the TLS state.  We cannot do the full work of
-   ptmalloc_init (below) until __pthread_initialize_minimal has finished,
-   so it has to switch to using the special startup-time hooks while doing
-   those allocations.  */
-void
-__libc_malloc_pthread_startup (bool first_time)
-{
-  if (first_time)
-    {
-      ptmalloc_init_minimal ();
-      save_malloc_hook = __malloc_hook;
-      save_memalign_hook = __memalign_hook;
-      save_free_hook = __free_hook;
-      __malloc_hook = malloc_starter;
-      __memalign_hook = memalign_starter;
-      __free_hook = free_starter;
-    }
-  else
-    {
-      __malloc_hook = save_malloc_hook;
-      __memalign_hook = save_memalign_hook;
-      __free_hook = save_free_hook;
-    }
-}
-# endif
 #endif
 
 static void
@@ -475,14 +443,7 @@ ptmalloc_init (void)
   if(__malloc_initialized >= 0) return;
   __malloc_initialized = 0;
 
-#ifdef _LIBC
-# if defined SHARED && !USE___THREAD
-  /* ptmalloc_init_minimal may already have been called via
-     __libc_malloc_pthread_startup, above.  */
-  if (mp_.pagesize == 0)
-# endif
-#endif
-    ptmalloc_init_minimal();
+  ptmalloc_init_minimal();
 
   mutex_init(&main_arena.mutex);
   main_arena.next = &main_arena;
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 4b1a996eb7..403024c416 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -417,7 +417,7 @@ memalign_check(alignment, bytes, caller)
 #ifndef NO_THREADS
 
 # ifdef _LIBC
-#  if USE___THREAD || !defined SHARED
+#  ifndef SHARED
     /* These routines are never needed in this configuration.  */
 #   define NO_STARTER
 #  endif
diff --git a/malloc/malloc.c b/malloc/malloc.c
index dccb6cc4fd..d7af63dae5 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1649,19 +1649,7 @@ static Void_t*   realloc_check(Void_t* oldmem, size_t bytes,
 static Void_t*   memalign_check(size_t alignment, size_t bytes,
 				const Void_t *caller);
 #ifndef NO_THREADS
-# ifdef _LIBC
-#  if USE___THREAD || !defined SHARED
-    /* These routines are never needed in this configuration.  */
-#   define NO_STARTER
-#  endif
-# endif
-# ifdef NO_STARTER
-#  undef NO_STARTER
-# else
-static Void_t*   malloc_starter(size_t sz, const Void_t *caller);
-static Void_t*   memalign_starter(size_t aln, size_t sz, const Void_t *caller);
-static void      free_starter(Void_t* mem, const Void_t *caller);
-# endif
+/* These routines are never needed in this configuration.  */
 static Void_t*   malloc_atfork(size_t sz, const Void_t *caller);
 static void      free_atfork(Void_t* mem, const Void_t *caller);
 #endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 3b94006eef..56f4d1dccc 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,20 @@
 2011-09-10  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Don't handle
+	!USE___THREAD.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sem_post.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sem_trywait.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sem_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise.
+
 	* tst-tls1.c: Support for __thread is now mandatory.
 	* tst-tls2.c: Likewise.
 	* tst-tls3.c: Likewise.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
index 86992c877e..9f3e63520f 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2005,2007,2008,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -81,18 +81,13 @@ __new_sem_post:
 4:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ebx), %edx
 	addl	%gs:0, %edx
 	movl	$EINVAL, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ebx), %edx
 	movl	$EINVAL, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	$EINVAL, (%eax)
 #endif
 
 	orl	$-1, %eax
@@ -107,18 +102,13 @@ __new_sem_post:
 5:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ebx), %edx
 	addl	%gs:0, %edx
 	movl	$EOVERFLOW, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ebx), %edx
 	movl	$EOVERFLOW, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	$EOVERFLOW, (%eax)
 #endif
 
 	orl	$-1, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
index 18013a8df4..ee46ab9363 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2005, 2007, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -154,18 +154,13 @@ sem_timedwait:
 4:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ebx), %edx
 	addl	%gs:0, %edx
 	movl	%esi, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ebx), %edx
 	movl	%esi, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	%esi, (%eax)
 #endif
 
 	movl	28(%esp), %ebx	/* Load semaphore address.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
index 2d49934f02..18adb9a092 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -49,18 +49,13 @@ __new_sem_trywait:
 3:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ecx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ecx), %edx
 	addl	%gs:0, %edx
 	movl	$EAGAIN, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ecx), %edx
 	movl	$EAGAIN, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	$EAGAIN, (%eax)
 #endif
 	orl	$-1, %eax
 	ret
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
index 93c0a64a9e..fb8a398430 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -114,18 +114,13 @@ __new_sem_wait:
 8:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ebx), %edx
 	addl	%gs:0, %edx
 	movl	%esi, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ebx), %edx
 	movl	%esi, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	%esi, (%eax)
 #endif
 	orl	$-1, %eax
 
@@ -228,13 +223,13 @@ sem_wait_cleanup:
 	.byte	14				# DW_CFA_def_cfa_offset
 	.uleb128 8
 	.byte   0x83				# DW_CFA_offset %ebx
-        .uleb128 2
+	.uleb128 2
 	.byte	4				# DW_CFA_advance_loc4
 	.long	.Lpush_esi-.Lpush_ebx
 	.byte	14				# DW_CFA_def_cfa_offset
 	.uleb128 12
 	.byte   0x86				# DW_CFA_offset %esi
-        .uleb128 3
+	.uleb128 3
 	.byte	4				# DW_CFA_advance_loc4
 	.long	.Lsub_esp-.Lpush_esi
 	.byte	14				# DW_CFA_def_cfa_offset
@@ -250,9 +245,9 @@ sem_wait_cleanup:
 	.byte	14				# DW_CFA_def_cfa_offset
 	.uleb128 16
 	.byte   0x83				# DW_CFA_offset %ebx
-        .uleb128 2
+	.uleb128 2
 	.byte   0x86				# DW_CFA_offset %esi
-        .uleb128 3
+	.uleb128 3
 	.align	4
 .LENDFDE:
 
@@ -333,18 +328,13 @@ __old_sem_wait:
 4:
 #endif
 	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
-#if USE___THREAD
-# ifdef NO_TLS_DIRECT_SEG_REFS
+#ifdef NO_TLS_DIRECT_SEG_REFS
 	movl	errno@gotntpoff(%ebx), %edx
 	addl	%gs:0, %edx
 	movl	%esi, (%edx)
-# else
+#else
 	movl	errno@gotntpoff(%ebx), %edx
 	movl	%esi, %gs:(%edx)
-# endif
-#else
-	call	__errno_location@plt
-	movl	%esi, (%eax)
 #endif
 	orl	$-1, %eax
 	jmp	5b
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
index c4d52860dd..8687ba46ab 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -27,13 +27,12 @@
 
 # undef PSEUDO
 
-# if USE___THREAD
-#  ifndef NOT_IN_libc
-#   define SYSDEP_CANCEL_ERRNO __libc_errno
-#  else
-#   define SYSDEP_CANCEL_ERRNO errno
-#  endif
-#  define SYSDEP_CANCEL_ERROR(args)					      \
+# ifndef NOT_IN_libc
+#  define SYSDEP_CANCEL_ERRNO __libc_errno
+# else
+#  define SYSDEP_CANCEL_ERRNO errno
+# endif
+# define SYSDEP_CANCEL_ERROR(args)					      \
 .section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
      .align 32;								      \
      .proc __syscall_error_##args;					      \
@@ -53,28 +52,6 @@ __syscall_error_##args:							      \
      add loc4 = loc4, r13;;						      \
      st4 [loc4] = loc3;							      \
      mov ar.pfs = loc0
-# else
-#  define SYSDEP_CANCEL_ERROR(args)					      \
-.section .gnu.linkonce.t.__syscall_error_##args, "ax";			      \
-     .align 32;								      \
-     .proc __syscall_error_##args;					      \
-     .global __syscall_error_##args;					      \
-     .hidden __syscall_error_##args;					      \
-     .size __syscall_error_##args, 64;					      \
-__syscall_error_##args:							      \
-     .prologue;								      \
-     .regstk args, 5, args, 0;						      \
-     .save ar.pfs, loc0;						      \
-     .save rp, loc1;							      \
-     .body;								      \
-     mov loc4 = r1;;							      \
-     br.call.sptk.many b0 = __errno_location;;				      \
-     st4 [r8] = loc3;							      \
-     mov r1 = loc4;							      \
-     mov rp = loc1;							      \
-     mov r8 = -1;							      \
-     mov ar.pfs = loc0
-# endif
 
 # ifndef USE_DL_SYSINFO
 
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
index 4a154fc649..c3dd6825f0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -65,7 +65,7 @@ __new_sem_post:
 
 3:
 	mov	#EOVERFLOW, r2
-4:	
+4:
 	mov.l	r12, @-r15
 	mov.l	r8, @-r15
 	sts.l	pr, @-r15
@@ -73,7 +73,6 @@ __new_sem_post:
 	mov.l	.Lgot3, r12
 	add	r0, r12
 
-#if USE___THREAD
 	mov.l	.Lerrno3, r0
 	stc	gbr, r1
 	mov.l	@(r0, r12), r0
@@ -84,14 +83,6 @@ __new_sem_post:
 	.long	errno@GOTTPOFF
 .Lexit:
 	mov.l	r2, @r0
-#else
-	mov	r2, r8
-	mov.l	.Lerrloc3, r1
-	bsrf	r1
-	 nop
-.Lerrloc3b:
-	mov	r8, @r0
-#endif
 	lds.l	@r15+, pr
 	mov.l	@r15+, r8
 	mov.l	@r15+, r12
@@ -103,9 +94,5 @@ __new_sem_post:
 	.long	SEM_VALUE_MAX
 .Lgot3:
 	.long	_GLOBAL_OFFSET_TABLE_
-#if !USE___THREAD
-.Lerrloc3:
-	.long	__errno_location@PLT-(.Lerrloc3b-.)
-#endif
 	.size	__new_sem_post,.-__new_sem_post
 	versioned_symbol(libpthread, __new_sem_post, sem_post, GLIBC_2_1)
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
index 7924e87594..d57986150c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -131,7 +131,7 @@ sem_timedwait:
 	mov	r10, r4
 	bsrf	r1
 	 mov	r0, r10
-.Ldisable0b:	
+.Ldisable0b:
 	mov	r10, r0
 .LcleanupEND:
 
@@ -173,7 +173,6 @@ sem_timedwait:
 	mov.l	.Lgot2, r12
 	add	r0, r12
 
-#if USE___THREAD
 	mov.l	.Lerrno2, r0
 	stc	gbr, r1
 	mov.l	@(r0, r12), r0
@@ -181,14 +180,8 @@ sem_timedwait:
 	 add	r1, r0
 	.align	2
 .Lerrno2:
- 	.long	errno@GOTTPOFF
+	.long	errno@GOTTPOFF
 .Lexit:
-#else
-	mov.l	.Lerrloc2, r1
-	bsrf	r1
-	 nop
-.Lerrloc2b:
-#endif
 	mov.l	r10, @r0
 	DEC (@(NWAITERS,r8), r2)
 	bra	10b
@@ -201,10 +194,6 @@ sem_timedwait:
 	.long	1000000000
 .Lgot2:
 	.long	_GLOBAL_OFFSET_TABLE_
-#if !USE___THREAD
-.Lerrloc2:
-	.long	__errno_location@PLT-(.Lerrloc2b-.)
-#endif
 .Lenable0:
 	.long	__pthread_enable_asynccancel-.Lenable0b
 .Ldisable0:
@@ -213,7 +202,7 @@ sem_timedwait:
 
 	.type	sem_wait_cleanup,@function
 sem_wait_cleanup:
- 	DEC (@(NWAITERS,r8), r2)
+	DEC (@(NWAITERS,r8), r2)
 .LcallUR:
 	mov.l	.Lresume, r1
 #ifdef PIC
@@ -314,25 +303,25 @@ sem_wait_cleanup:
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 4
 	.byte   0x88				! DW_CFA_offset r8
-        .uleb128 1
+	.uleb128 1
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_r9-.Lpush_r8
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 8
 	.byte   0x89				! DW_CFA_offset r9
-        .uleb128 2
+	.uleb128 2
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_r10-.Lpush_r9
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 12
 	.byte   0x8a				! DW_CFA_offset r10
-        .uleb128 3
+	.uleb128 3
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_r12-.Lpush_r10
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 16
 	.byte   0x8c				! DW_CFA_offset r12
-        .uleb128 4
+	.uleb128 4
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_pr-.Lpush_r12
 	.byte	14				! DW_CFA_def_cfa_offset
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
index 835e37db9f..183aac6bc3 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,6 @@ __new_sem_trywait:
 	mov.l	.Lgot1, r12
 	add	r0, r12
 
-#if USE___THREAD
 	mov.l	.Lerrno1, r0
 	stc	gbr, r1
 	mov.l	@(r0, r12), r0
@@ -67,12 +66,6 @@ __new_sem_trywait:
 .Lerrno1:
 	.long	errno@GOTTPOFF
 .Lexit:
-#else
-	mov.l	.Lerrloc1, r1
-	bsrf	r1
-	 nop
-.Lerrloc1b:
-#endif
 	mov.l	r8, @r0
 	lds.l	@r15+, pr
 	mov.l	@r15+, r8
@@ -83,9 +76,5 @@ __new_sem_trywait:
 	.align	2
 .Lgot1:
 	.long	_GLOBAL_OFFSET_TABLE_
-#if !USE___THREAD
-.Lerrloc1:
-	.long	__errno_location@PLT-(.Lerrloc1b-.)
-#endif
 	.size	__new_sem_trywait,.-__new_sem_trywait
 	versioned_symbol(libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1)
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
index 6ef7fcf0cb..aed8609fd0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -68,7 +68,7 @@ __new_sem_wait:
 .Lafter_ret:
 1:
 	INC (@(NWAITERS,r8),r2)
-	
+
 .LcleanupSTART:
 6:
 	mov.l	.Lenable0, r1
@@ -96,7 +96,7 @@ __new_sem_wait:
 	mov	r10, r4
 	bsrf	r1
 	 mov	r0, r10
-.Ldisable0b:	
+.Ldisable0b:
 	mov	r10, r0
 .LcleanupEND:
 
@@ -131,7 +131,6 @@ __new_sem_wait:
 	mov.l	.Lgot0, r12
 	add	r0, r12
 
-#if USE___THREAD
 	mov.l	.Lerrno0, r0
 	stc	gbr, r1
 	mov.l	@(r0, r12), r0
@@ -141,12 +140,6 @@ __new_sem_wait:
 .Lerrno0:
 	.long	errno@GOTTPOFF
 .Lexit:
-#else
-	mov.l	.Lerrloc0, r1
-	bsrf	r1
-	 nop
-.Lerrloc0b:
-#endif
 	mov.l	r8, @r0
 	bra	9b
 	 mov	#-1, r0
@@ -154,10 +147,6 @@ __new_sem_wait:
 	.align	2
 .Lgot0:
 	.long	_GLOBAL_OFFSET_TABLE_
-#if !USE___THREAD
-.Lerrloc0:
-	.long	__errno_location@PLT-(.Lerrloc0b-.)
-#endif
 .Lenable0:
 	.long	__pthread_enable_asynccancel-.Lenable0b
 .Ldisable0:
@@ -168,7 +157,7 @@ __new_sem_wait:
 
 	.type	sem_wait_cleanup,@function
 sem_wait_cleanup:
- 	DEC (@(NWAITERS,r8), r2)
+	DEC (@(NWAITERS,r8), r2)
 .LcallUR:
 	mov.l	.Lresume, r1
 #ifdef PIC
@@ -269,25 +258,25 @@ sem_wait_cleanup:
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 4
 	.byte   0x88				! DW_CFA_offset r8
-        .uleb128 1
+	.uleb128 1
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_r10-.Lpush_r8
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 8
 	.byte   0x8a				! DW_CFA_offset r10
-        .uleb128 2
+	.uleb128 2
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_r12-.Lpush_r10
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 12
 	.byte   0x8c				! DW_CFA_offset r12
-        .uleb128 3
+	.uleb128 3
 	.byte	4				! DW_CFA_advance_loc4
 	.ualong	.Lpush_pr-.Lpush_r12
 	.byte	14				! DW_CFA_def_cfa_offset
 	.uleb128 16
 	.byte   0x91				! DW_CFA_offset pr
-        .uleb128 4
+	.uleb128 4
 	.align	4
 .LENDFDE:
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
index 979b1bf1d6..4691e4d683 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2005,2007,2008,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -62,29 +62,15 @@ sem_post:
 	retq
 
 1:
-#if USE___THREAD
 	movl	$EINVAL, %eax
-#else
-	callq	__errno_location@plt
-	movl	$EINVAL, %edx
-#endif
 	jmp	4f
 
 3:
-#if USE___THREAD
 	movl	$EOVERFLOW, %eax
-#else
-	callq	__errno_location@plt
-	movl	$EOVERFLOW, %edx
-#endif
 
 4:
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	%eax, %fs:(%rdx)
-#else
-	movl	%edx, (%rax)
-#endif
 	orl	$-1, %eax
 	retq
 	.size	sem_post,.-sem_post
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
index 2926b36e7b..576a494966 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -143,39 +143,24 @@ sem_timedwait:
 
 	cfi_adjust_cfa_offset(8)
 3:	negq	%r9
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	%r9d, %fs:(%rdx)
-#else
-	callq	__errno_location@plt
-	movl	%r9d, (%rax)
-#endif
 
 	orl	$-1, %eax
 	jmp	15b
 
 	cfi_adjust_cfa_offset(-8)
 6:
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	$EINVAL, %fs:(%rdx)
-#else
-	callq	__errno_location@plt
-	movl	$EINVAL, (%rax)
-#endif
 
 	orl	$-1, %eax
 
 	retq
 
 16:
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	$ETIMEDOUT, %fs:(%rdx)
-#else
-	callq	__errno_location@plt
-	movl	$ETIMEDOUT, (%rax)
-#endif
 
 	orl	$-1, %eax
 
@@ -303,13 +288,8 @@ sem_timedwait:
 	cfi_rel_offset(%r14, STACKFRAME)
 33:	negq	%r14
 36:
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	%r14d, %fs:(%rdx)
-#else
-	callq	__errno_location@plt
-	movl	%r14d, (%rax)
-#endif
 
 	orl	$-1, %eax
 	jmp	45b
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
index a5719cadda..64652c46f8 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -41,13 +41,8 @@ sem_trywait:
 	retq
 
 1:
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	$EAGAIN, %fs:(%rdx)
-#else
-	callq	__errno_location@plt
-	movl	$EAGAIN, (%rax)
-#endif
 	orl	$-1, %eax
 	retq
 	.size	sem_trywait,.-sem_trywait
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
index 2cf6ec10a4..3ea714a754 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -125,14 +125,8 @@ sem_wait:
 
 	cfi_adjust_cfa_offset(8)
 4:	negq	%rcx
-#if USE___THREAD
 	movq	errno@gottpoff(%rip), %rdx
 	movl	%ecx, %fs:(%rdx)
-#else
-# error "not supported.  %rcx and %rdi must be preserved"
-	callq	__errno_location@plt
-	movl	%ecx, (%rax)
-#endif
 	orl	$-1, %eax
 
 	jmp 9b
diff --git a/resolv/res-state.c b/resolv/res-state.c
index e327e34f59..b0aa22cfc2 100644
--- a/resolv/res-state.c
+++ b/resolv/res-state.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 97, 98, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 97, 98, 2002, 2003, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,27 +19,10 @@
 #include <resolv.h>
 #include <tls.h>
 
-#if ! USE___THREAD
-
-# undef _res
-extern struct __res_state _res;
-
-/* When threaded, _res may be a per-thread variable.  */
-struct __res_state *
-weak_const_function
-__res_state (void)
-{
-  return &_res;
-}
-
-#else
 
 struct __res_state *
 __res_state (void)
 {
   return __resp;
 }
-
-#endif
-
 libc_hidden_def (__res_state)
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index 810fbc804d..1f6b3a19ef 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -126,12 +126,10 @@ struct __res_state _res __attribute__((section (".bss")));
 
 #include <tls.h>
 
-#if USE___THREAD
 #undef __resp
 __thread struct __res_state *__resp = &_res;
 extern __thread struct __res_state *__libc_resp
   __attribute__ ((alias ("__resp"))) attribute_hidden;
-#endif
 
 /* We declare this with compat_symbol so that it's not
    visible at link time.  Programs must use the accessor functions.  */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index a093d2b151..d1a83ee0f2 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  i386 version.
-   Copyright (C) 1995-2005, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -243,18 +243,12 @@ _dl_start_user:\n\
    define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
 # define elf_machine_type_class(type) \
   ((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32		      \
      || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32	      \
      || (type) == R_386_TLS_TPOFF || (type) == R_386_TLS_DESC)		      \
     * ELF_RTYPE_CLASS_PLT)						      \
    | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
-  ((((type) == R_386_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)			      \
-   | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_386_JMP_SLOT
@@ -357,44 +351,43 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  *reloc_addr = value;
 	  break;
 
-# if !defined RTLD_BOOTSTRAP || USE___THREAD
 	case R_386_TLS_DTPMOD32:
-#  ifdef RTLD_BOOTSTRAP
+# ifdef RTLD_BOOTSTRAP
 	  /* During startup the dynamic linker is always the module
 	     with index 1.
 	     XXX If this relocation is necessary move before RESOLVE
 	     call.  */
 	  *reloc_addr = 1;
-#  else
+# else
 	  /* Get the information from the link map returned by the
 	     resolv function.  */
 	  if (sym_map != NULL)
 	    *reloc_addr = sym_map->l_tls_modid;
-#  endif
+# endif
 	  break;
 	case R_386_TLS_DTPOFF32:
-#  ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
 	  /* During relocation all TLS symbols are defined and used.
 	     Therefore the offset is already correct.  */
 	  if (sym != NULL)
 	    *reloc_addr = sym->st_value;
-#  endif
+# endif
 	  break;
 	case R_386_TLS_DESC:
 	  {
 	    struct tlsdesc volatile *td =
 	      (struct tlsdesc volatile *)reloc_addr;
 
-#  ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
 	    if (! sym)
 	      td->entry = _dl_tlsdesc_undefweak;
 	    else
-#  endif
+# endif
 	      {
-#  ifndef RTLD_BOOTSTRAP
-#   ifndef SHARED
+# ifndef RTLD_BOOTSTRAP
+#  ifndef SHARED
 		CHECK_STATIC_TLS (map, sym_map);
-#   else
+#  else
 		if (!TRY_STATIC_TLS (map, sym_map))
 		  {
 		    td->arg = _dl_make_tlsdesc_dynamic
@@ -402,8 +395,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 		    td->entry = _dl_tlsdesc_dynamic;
 		  }
 		else
-#   endif
 #  endif
+# endif
 		  {
 		    td->arg = (void*)(sym->st_value - sym_map->l_tls_offset
 				      + (ElfW(Word))td->arg);
@@ -426,13 +419,13 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	      CHECK_STATIC_TLS (map, sym_map);
 	      *reloc_addr += sym_map->l_tls_offset - sym->st_value;
 	    }
-#  endif
+# endif
 	  break;
 	case R_386_TLS_TPOFF:
 	  /* The offset is negative, forward from the thread pointer.  */
-#  ifdef RTLD_BOOTSTRAP
+# ifdef RTLD_BOOTSTRAP
 	  *reloc_addr += sym->st_value - map->l_tls_offset;
-#  else
+# else
 	  /* We know the offset of object the symbol is contained in.
 	     It is a negative value which will be added to the
 	     thread pointer.  */
@@ -441,9 +434,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	      CHECK_STATIC_TLS (map, sym_map);
 	      *reloc_addr += sym->st_value - sym_map->l_tls_offset;
 	    }
-#  endif
+# endif
 	  break;
-# endif	/* use TLS */
 
 # ifndef RTLD_BOOTSTRAP
 	case R_386_32:
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index 61b4ea99a7..6f88005482 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  IA-64 version.
-   Copyright (C) 1995-1997, 2000-2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 2000-2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -311,15 +311,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
    of the main executable's symbols, as for a COPY reloc, which we don't
    use.  */
 /* ??? Ignore *MSB for now.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
 #define elf_machine_type_class(type) \
   (((type) == R_IA64_IPLTLSB || (type) == R_IA64_DTPMOD64LSB		      \
     || (type) == R_IA64_DTPREL64LSB || (type) == R_IA64_TPREL64LSB)	      \
    * ELF_RTYPE_CLASS_PLT)
-#else
-#define elf_machine_type_class(type) \
-  (((type) == R_IA64_IPLTLSB) * ELF_RTYPE_CLASS_PLT)
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	 R_IA64_IPLTLSB
@@ -405,7 +400,7 @@ elf_machine_rela (struct link_map *map,
       /* Already done in dynamic linker.  */
       if (map != &GL(dl_rtld_map))
 # endif
-        value += map->l_addr;
+	value += map->l_addr;
     }
   else
 #endif
@@ -417,7 +412,7 @@ elf_machine_rela (struct link_map *map,
 
       /* RESOLVE_MAP() will return NULL if it fail to locate the symbol.  */
       if ((sym_map = RESOLVE_MAP (&sym, version, r_type)))
-        {
+	{
 	  value = sym_map->l_addr + sym->st_value + reloc->r_addend;
 
 	  if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DIR64LSB))
@@ -432,26 +427,24 @@ elf_machine_rela (struct link_map *map,
 	    value = _dl_make_fptr (sym_map, sym, value);
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB))
 	    value -= (Elf64_Addr) reloc_addr & -16;
-#if !defined RTLD_BOOTSTRAP || defined USE___THREAD
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPMOD64LSB))
-# ifdef RTLD_BOOTSTRAP
+#ifdef RTLD_BOOTSTRAP
 	    /* During startup the dynamic linker is always index 1.  */
 	    value = 1;
-# else
+#else
 	    /* Get the information from the link map returned by the
 	       resolv function.  */
 	    value = sym_map->l_tls_modid;
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPREL64LSB))
 	    value -= sym_map->l_addr;
-# endif
+#endif
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_TPREL64LSB))
 	    {
-# ifndef RTLD_BOOTSTRAP
+#ifndef RTLD_BOOTSTRAP
 	      CHECK_STATIC_TLS (map, sym_map);
-# endif
+#endif
 	      value += sym_map->l_tls_offset - sym_map->l_addr;
 	    }
-#endif
 	  else
 	    _dl_reloc_bad_type (map, r_type, 0);
 	}
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index 5351d9691d..e7052b69d5 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  PowerPC version.
-   Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2005, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -135,7 +135,6 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
 /* We never want to use a PLT entry as the destination of a
    reloc, when what is being relocated is a branch. This is
    partly for efficiency, but mostly so we avoid loops.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
 #define elf_machine_type_class(type)			\
   ((((type) == R_PPC_JMP_SLOT				\
     || (type) == R_PPC_REL24				\
@@ -143,13 +142,6 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
 	&& (type) <= R_PPC_DTPREL32)			\
     || (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT)	\
    | (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-#define elf_machine_type_class(type) \
-  ((((type) == R_PPC_JMP_SLOT				\
-    || (type) == R_PPC_REL24				\
-    || (type) == R_PPC_ADDR24) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_PPC_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_PPC_JMP_SLOT
@@ -331,8 +323,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       *reloc_addr = value;
       break;
 
-#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
-    && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
 # ifdef RTLD_BOOTSTRAP
 #  define NOT_BOOTSTRAP 0
 # else
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index 901a44e4b3..2defc44b19 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.
    PowerPC64 version.
-   Copyright 1995-2005, 2006, 2008, 2010 Free Software Foundation, Inc.
+   Copyright 1995-2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -376,9 +376,9 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 		 branch using two instructions;  Past that point,
 		 glink uses three instructions.  */
 	      if (i < 0x8000)
-          	glink_offset += 2;
+		glink_offset += 2;
 	      else
-          	glink_offset += 3;
+		glink_offset += 3;
 	    }
 
 	  /* Now, we've modified data.  We need to write the changes from
@@ -492,10 +492,10 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
 #define dont_expect(X) __builtin_expect ((X), 0)
 
 extern void _dl_reloc_overflow (struct link_map *map,
-                                const char *name,
-                                Elf64_Addr *const reloc_addr,
-                                const Elf64_Sym *refsym)
-                                attribute_hidden;
+				const char *name,
+				Elf64_Addr *const reloc_addr,
+				const Elf64_Sym *refsym)
+				attribute_hidden;
 
 auto inline void __attribute__ ((always_inline))
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
@@ -505,7 +505,6 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
   *reloc_addr = l_addr + reloc->r_addend;
 }
 
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
 /* This computes the value used by TPREL* relocs.  */
 auto inline Elf64_Addr __attribute__ ((always_inline, const))
 elf_machine_tprel (struct link_map *map,
@@ -513,18 +512,17 @@ elf_machine_tprel (struct link_map *map,
 		   const Elf64_Sym *sym,
 		   const Elf64_Rela *reloc)
 {
-# ifndef RTLD_BOOTSTRAP
+#ifndef RTLD_BOOTSTRAP
   if (sym_map)
     {
       CHECK_STATIC_TLS (map, sym_map);
-# endif
+#endif
       return TLS_TPREL_VALUE (sym_map, sym, reloc);
-# ifndef RTLD_BOOTSTRAP
+#ifndef RTLD_BOOTSTRAP
     }
-# endif
+#endif
   return 0;
 }
-#endif
 
 /* Call function at address VALUE (an OPD entry) to resolve ifunc relocs.  */
 auto inline Elf64_Addr __attribute__ ((always_inline))
@@ -611,26 +609,25 @@ elf_machine_rela (struct link_map *map,
 #endif
       return;
 
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
     case R_PPC64_DTPMOD64:
-# ifdef RTLD_BOOTSTRAP
+#ifdef RTLD_BOOTSTRAP
       /* During startup the dynamic linker is always index 1.  */
       *reloc_addr = 1;
-# else
+#else
       /* Get the information from the link map returned by the
 	 resolve function.  */
       if (sym_map != NULL)
-        *reloc_addr = sym_map->l_tls_modid;
-# endif
+	*reloc_addr = sym_map->l_tls_modid;
+#endif
       return;
 
     case R_PPC64_DTPREL64:
       /* During relocation all TLS symbols are defined and used.
-         Therefore the offset is already correct.  */
-# ifndef RTLD_BOOTSTRAP
+	 Therefore the offset is already correct.  */
+#ifndef RTLD_BOOTSTRAP
       if (sym_map != NULL)
 	*reloc_addr = TLS_DTPREL_VALUE (sym, reloc);
-# endif
+#endif
       return;
 
     case R_PPC64_TPREL64:
@@ -640,21 +637,21 @@ elf_machine_rela (struct link_map *map,
     case R_PPC64_TPREL16_LO_DS:
       value = elf_machine_tprel (map, sym_map, sym, reloc);
       if (dont_expect ((value & 3) != 0))
-        _dl_reloc_overflow (map, "R_PPC64_TPREL16_LO_DS", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_TPREL16_LO_DS", reloc_addr, refsym);
       BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
       break;
 
     case R_PPC64_TPREL16_DS:
       value = elf_machine_tprel (map, sym_map, sym, reloc);
       if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
-        _dl_reloc_overflow (map, "R_PPC64_TPREL16_DS", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_TPREL16_DS", reloc_addr, refsym);
       BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
       break;
 
     case R_PPC64_TPREL16:
       value = elf_machine_tprel (map, sym_map, sym, reloc);
       if (dont_expect ((value + 0x8000) >= 0x10000))
-        _dl_reloc_overflow (map, "R_PPC64_TPREL16", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_TPREL16", reloc_addr, refsym);
       *(Elf64_Half *) reloc_addr = PPC_LO (value);
       break;
 
@@ -692,12 +689,11 @@ elf_machine_rela (struct link_map *map,
       value = elf_machine_tprel (map, sym_map, sym, reloc);
       *(Elf64_Half *) reloc_addr = PPC_HIGHESTA (value);
       break;
-#endif
 
 #ifndef RTLD_BOOTSTRAP /* None of the following appear in ld.so */
     case R_PPC64_ADDR16_LO_DS:
       if (dont_expect ((value & 3) != 0))
-        _dl_reloc_overflow (map, "R_PPC64_ADDR16_LO_DS", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_ADDR16_LO_DS", reloc_addr, refsym);
       BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
       break;
 
@@ -715,29 +711,29 @@ elf_machine_rela (struct link_map *map,
 
     case R_PPC64_ADDR30:
       {
-        Elf64_Addr delta = value - (Elf64_Xword) reloc_addr;
-        if (dont_expect ((delta + 0x80000000) >= 0x10000000
+	Elf64_Addr delta = value - (Elf64_Xword) reloc_addr;
+	if (dont_expect ((delta + 0x80000000) >= 0x10000000
 			 || (delta & 3) != 0))
-          _dl_reloc_overflow (map, "R_PPC64_ADDR30", reloc_addr, refsym);
-        BIT_INSERT (*(Elf64_Word *) reloc_addr, delta, 0xfffffffc);
+	  _dl_reloc_overflow (map, "R_PPC64_ADDR30", reloc_addr, refsym);
+	BIT_INSERT (*(Elf64_Word *) reloc_addr, delta, 0xfffffffc);
       }
       break;
 
     case R_PPC64_COPY:
       if (dont_expect (sym == NULL))
 	/* This can happen in trace mode when an object could not be found. */
-        return;
+	return;
       if (dont_expect (sym->st_size > refsym->st_size
 		       || (GLRO(dl_verbose)
 			   && sym->st_size < refsym->st_size)))
 	{
-          const char *strtab;
+	  const char *strtab;
 
-          strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-          _dl_error_printf ("%s: Symbol `%s' has different size" \
-                            " in shared object," \
-                            " consider re-linking\n",
-                            _dl_argv[0] ?: "<program name unknown>",
+	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+	  _dl_error_printf ("%s: Symbol `%s' has different size" \
+			    " in shared object," \
+			    " consider re-linking\n",
+			    _dl_argv[0] ?: "<program name unknown>",
 			    strtab + refsym->st_name);
 	}
       memcpy (reloc_addr_arg, (char *) value,
@@ -766,25 +762,25 @@ elf_machine_rela (struct link_map *map,
 
     case R_PPC64_ADDR32:
       if (dont_expect ((value + 0x80000000) >= 0x10000000))
-        _dl_reloc_overflow (map, "R_PPC64_ADDR32", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_ADDR32", reloc_addr, refsym);
       *(Elf64_Word *) reloc_addr = value;
       return;
 
     case R_PPC64_ADDR24:
       if (dont_expect ((value + 0x2000000) >= 0x4000000 || (value & 3) != 0))
-        _dl_reloc_overflow (map, "R_PPC64_ADDR24", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_ADDR24", reloc_addr, refsym);
       BIT_INSERT (*(Elf64_Word *) reloc_addr, value, 0x3fffffc);
       break;
 
     case R_PPC64_ADDR16:
       if (dont_expect ((value + 0x8000) >= 0x10000))
-        _dl_reloc_overflow (map, "R_PPC64_ADDR16", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_ADDR16", reloc_addr, refsym);
       *(Elf64_Half *) reloc_addr = value;
       break;
 
     case R_PPC64_UADDR16:
       if (dont_expect ((value + 0x8000) >= 0x10000))
-        _dl_reloc_overflow (map, "R_PPC64_UADDR16", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_UADDR16", reloc_addr, refsym);
       /* We are big-endian.  */
       ((char *) reloc_addr_arg)[0] = (value >> 8) & 0xff;
       ((char *) reloc_addr_arg)[1] = (value >> 0) & 0xff;
@@ -792,7 +788,7 @@ elf_machine_rela (struct link_map *map,
 
     case R_PPC64_ADDR16_DS:
       if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
-        _dl_reloc_overflow (map, "R_PPC64_ADDR16_DS", reloc_addr, refsym);
+	_dl_reloc_overflow (map, "R_PPC64_ADDR16_DS", reloc_addr, refsym);
       BIT_INSERT (*(Elf64_Half *) reloc_addr, value, 0xfffc);
       break;
 
@@ -816,11 +812,11 @@ elf_machine_rela (struct link_map *map,
     case R_PPC64_ADDR14_BRTAKEN:
     case R_PPC64_ADDR14_BRNTAKEN:
       {
-        if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
+	if (dont_expect ((value + 0x8000) >= 0x10000 || (value & 3) != 0))
 	  _dl_reloc_overflow (map, "R_PPC64_ADDR14", reloc_addr, refsym);
-        Elf64_Word insn = *(Elf64_Word *) reloc_addr;
-        BIT_INSERT (insn, value, 0xfffc);
-        if (r_type != R_PPC64_ADDR14)
+	Elf64_Word insn = *(Elf64_Word *) reloc_addr;
+	BIT_INSERT (insn, value, 0xfffc);
+	if (r_type != R_PPC64_ADDR14)
 	  {
 	    insn &= ~(1 << 21);
 	    if (r_type == R_PPC64_ADDR14_BRTAKEN)
@@ -830,7 +826,7 @@ elf_machine_rela (struct link_map *map,
 	    else if ((insn & (0x14 << 21)) == (0x10 << 21))
 	      insn |= 0x08 << 21;
 	  }
-        *(Elf64_Word *) reloc_addr = insn;
+	*(Elf64_Word *) reloc_addr = insn;
       }
       break;
 
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 415b388012..b1f6f41640 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  S390 Version.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011
    Free Software Foundation, Inc.
    Contributed by Carl Pederson & Martin Schwidefsky.
    This file is part of the GNU C Library.
@@ -43,7 +43,7 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
     return 0;
 
   return (ehdr->e_machine == EM_S390 || ehdr->e_machine == EM_S390_OLD)
-         && ehdr->e_ident[EI_CLASS] == ELFCLASS32;
+	 && ehdr->e_ident[EI_CLASS] == ELFCLASS32;
 }
 
 
@@ -316,8 +316,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  *reloc_addr = value + reloc->r_addend;
 	  break;
 
-#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
-    && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
 	case R_390_TLS_DTPMOD:
 # ifdef RTLD_BOOTSTRAP
 	  /* During startup the dynamic linker is always the module
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index c4df274cdb..913ea0870b 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.
    64 bit S/390 Version.
-   Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001-2005, 2006, 2011 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -288,8 +288,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  *reloc_addr = value + reloc->r_addend;
 	  break;
 
-#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
-    && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
 	case R_390_TLS_DTPMOD:
 # ifdef RTLD_BOOTSTRAP
 	  /* During startup the dynamic linker is always the module
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 78f70e3880..4e09ea4eb5 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SH version.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -208,17 +208,11 @@ __fpscr_values:\n\
    define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
   ((((type) == R_SH_JMP_SLOT || (type) == R_SH_TLS_DTPMOD32		      \
      || (type) == R_SH_TLS_DTPOFF32 || (type) == R_SH_TLS_TPOFF32)	      \
     * ELF_RTYPE_CLASS_PLT)						      \
    | (((type) == R_SH_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-#define elf_machine_type_class(type) \
-  ((((type) == R_SH_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_SH_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_SH_JMP_SLOT
@@ -354,35 +348,34 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  /* These addresses are always aligned.  */
 	  *reloc_addr = value;
 	  break;
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
 	  /* XXX Remove TLS relocations which are not needed.  */
 	case R_SH_TLS_DTPMOD32:
-# ifdef RTLD_BOOTSTRAP
+#ifdef RTLD_BOOTSTRAP
 	  /* During startup the dynamic linker is always the module
 	     with index 1.
 	     XXX If this relocation is necessary move before RESOLVE
 	     call.  */
 	  *reloc_addr = 1;
-# else
+#else
 	  /* Get the information from the link map returned by the
 	     resolv function.  */
 	  if (sym_map != NULL)
 	    *reloc_addr = sym_map->l_tls_modid;
-# endif
+#endif
 	  break;
 	case R_SH_TLS_DTPOFF32:
-# ifndef RTLD_BOOTSTRAP
+#ifndef RTLD_BOOTSTRAP
 	  /* During relocation all TLS symbols are defined and used.
 	     Therefore the offset is already correct.  */
 	  if (sym != NULL)
 	    *reloc_addr = sym->st_value;
-# endif
+#endif
 	  break;
 	case R_SH_TLS_TPOFF32:
 	  /* The offset is positive, afterward from the thread pointer.  */
-# ifdef RTLD_BOOTSTRAP
+#ifdef RTLD_BOOTSTRAP
 	  *reloc_addr = map->l_tls_offset + sym->st_value + reloc->r_addend;
-# else
+#else
 	  /* We know the offset of object the symbol is contained in.
 	     It is a positive value which will be added to the thread
 	     pointer.  To get the variable position in the TLS block
@@ -393,9 +386,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	      *reloc_addr = sym_map->l_tls_offset + sym->st_value
 			    + reloc->r_addend;
 	    }
-# endif
+#endif
 	  break;
-#endif	/* use TLS */
 	case R_SH_DIR32:
 	  {
 #ifndef RTLD_BOOTSTRAP
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index f2bc94a07d..8f54f7e3ef 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -139,7 +139,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 		 nop
 		.word MAP
 
-         The PC value (pltpc) saved in %g2 by the jmpl points near the
+	 The PC value (pltpc) saved in %g2 by the jmpl points near the
 	 location where we store the link_map pointer for this object.  */
 
       plt[0] = 0x05000000 | ((rfunc >> 10) & 0x003fffff);
@@ -193,17 +193,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
    PLT entries should not be allowed to define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
   ((((type) == R_SPARC_JMP_SLOT						      \
      || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64))     \
     * ELF_RTYPE_CLASS_PLT)						      \
    | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
-  ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)			      \
-   | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_SPARC_JMP_SLOT
@@ -454,8 +448,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	sparc_fixup_plt (reloc, reloc_addr, value, 0, do_flush);
       }
       break;
-#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
-    && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
     case R_SPARC_TLS_DTPMOD32:
       /* Get the information from the link map returned by the
 	 resolv function.  */
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 3f71a66774..47579cd05f 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -1,6 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  Sparc64 version.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-	2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2009, 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -77,11 +76,11 @@ elf_machine_load_address (void)
   register Elf64_Addr *got __asm ("%l7");
 
   __asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"
-         "call 1f\n\t"
-         " add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"
-         "call _DYNAMIC\n\t"
-         "call _GLOBAL_OFFSET_TABLE_\n"
-         "1:\tadd %1, %0, %1\n\t" : "=r" (pc), "=r" (got));
+	 "call 1f\n\t"
+	 " add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"
+	 "call _DYNAMIC\n\t"
+	 "call _GLOBAL_OFFSET_TABLE_\n"
+	 "1:\tadd %1, %0, %1\n\t" : "=r" (pc), "=r" (got));
 
   /* got is now l_addr + _GLOBAL_OFFSET_TABLE_
      *got is _DYNAMIC
@@ -115,17 +114,11 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
    PLT entries should not be allowed to define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
   ((((type) == R_SPARC_JMP_SLOT						      \
      || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64))     \
     * ELF_RTYPE_CLASS_PLT)						      \
    | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
-  ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_SPARC_JMP_SLOT
@@ -168,7 +161,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 
       /* PLT0 looks like:
 
-         sethi	%uhi(_dl_runtime_{resolve,profile}_0), %g4
+	 sethi	%uhi(_dl_runtime_{resolve,profile}_0), %g4
 	 sethi	%hi(_dl_runtime_{resolve,profile}_0), %g5
 	 or	%g4, %ulo(_dl_runtime_{resolve,profile}_0), %g4
 	 or	%g5, %lo(_dl_runtime_{resolve,profile}_0), %g5
@@ -189,7 +182,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 
       /* PLT1 looks like:
 
-         sethi	%uhi(_dl_runtime_{resolve,profile}_1), %g4
+	 sethi	%uhi(_dl_runtime_{resolve,profile}_1), %g4
 	 sethi	%hi(_dl_runtime_{resolve,profile}_1), %g5
 	 or	%g4, %ulo(_dl_runtime_{resolve,profile}_1), %g4
 	 or	%g5, %lo(_dl_runtime_{resolve,profile}_1), %g5
@@ -479,8 +472,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
       sparc64_fixup_plt (map, reloc, reloc_addr, value, reloc->r_addend, 0);
 #endif
       break;
-#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
-    && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
     case R_SPARC_TLS_DTPMOD64:
       /* Get the information from the link map returned by the
 	 resolv function.  */
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index 3bc872add8..9f279e15b1 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2000,2002,2004,2005
+/* Copyright (C) 1991-1997,2000,2002,2004,2005,2011
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -46,57 +46,24 @@ syscall_error:
 notb:
 #endif
 #ifndef	PIC
-# if USE___THREAD
-#  ifndef NO_TLS_DIRECT_SEG_REFS
+# ifndef NO_TLS_DIRECT_SEG_REFS
 	movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
-#  else
+# else
 	movl %gs:0, %ecx
 	movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
-#  endif
-# elif !defined _LIBC_REENTRANT
-	movl %eax, C_SYMBOL_NAME(errno)
-# else
-	pushl %eax
-	PUSH_ERRNO_LOCATION_RETURN
-	call BP_SYM (__errno_location)
-	POP_ERRNO_LOCATION_RETURN
-	popl %ecx
-	movl %ecx, (%eax)
 # endif
 #else
 	/* The caller has pushed %ebx and then set it up to
 	   point to the GOT before calling us through the PLT.  */
-# if USE___THREAD
 	movl C_SYMBOL_NAME(errno@GOTNTPOFF)(%ebx), %ecx
 
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
-#  ifndef NO_TLS_DIRECT_SEG_REFS
+# ifndef NO_TLS_DIRECT_SEG_REFS
 	addl %gs:0, %ecx
 	movl %eax, (%ecx)
-#  else
-	movl %eax, %gs:0(%ecx)
-#  endif
-# elif RTLD_PRIVATE_ERRNO
-	movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
-
-	/* Pop %ebx value saved before jumping here.  */
-	popl %ebx
-# elif !defined _LIBC_REENTRANT
-	movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
-
-	/* Pop %ebx value saved before jumping here.  */
-	popl %ebx
-	movl %eax, (%ecx)
 # else
-	pushl %eax
-	PUSH_ERRNO_LOCATION_RETURN
-	call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
-	POP_ERRNO_LOCATION_RETURN
-	popl %ecx
-	/* Pop %ebx value saved before jumping here.  */
-	popl %ebx
-	movl %ecx, (%eax)
+	movl %eax, %gs:0(%ecx)
 # endif
 #endif
 	movl $-1, %eax
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 77e6bad105..64ef4008bc 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995-2000,2002-2006,2007
-   	Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995-2000,2002-2006,2007,2011
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
 
@@ -121,13 +121,12 @@
 
 # elif defined _LIBC_REENTRANT
 
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_HANDLER					      \
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_HANDLER					      \
 0:SETUP_PIC_REG (cx);							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ecx;					      \
   movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx;			      \
@@ -136,38 +135,13 @@
   SYSCALL_ERROR_HANDLER_TLS_STORE (%edx, %ecx);				      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
-#   ifndef NO_TLS_DIRECT_SEG_REFS
-#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+#  ifndef NO_TLS_DIRECT_SEG_REFS
+#   define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
   movl src, %gs:(destoff)
-#   else
-#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+#  else
+#   define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
   addl %gs:0, destoff;							      \
   movl src, (destoff)
-#   endif
-#  else
-#   define SYSCALL_ERROR_HANDLER					      \
-0:pushl %ebx;								      \
-  cfi_adjust_cfa_offset (4);						      \
-  cfi_rel_offset (ebx, 0);						      \
-  SETUP_PIC_REG (bx);							      \
-  addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
-  xorl %edx, %edx;							      \
-  subl %eax, %edx;							      \
-  pushl %edx;								      \
-  cfi_adjust_cfa_offset (4);						      \
-  PUSH_ERRNO_LOCATION_RETURN;						      \
-  call BP_SYM (__errno_location)@PLT;					      \
-  POP_ERRNO_LOCATION_RETURN;						      \
-  popl %ecx;								      \
-  cfi_adjust_cfa_offset (-4);						      \
-  popl %ebx;								      \
-  cfi_adjust_cfa_offset (-4);						      \
-  cfi_restore (ebx);							      \
-  movl %ecx, (%eax);							      \
-  orl $-1, %eax;							      \
-  jmp L(pseudo_end);
-/* A quick note: it is assumed that the call to `__errno_location' does
-   not modify the stack!  */
 #  endif
 # else
 /* Store (- %eax) into errno through the GOT.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.S b/sysdeps/unix/sysv/linux/ia64/sysdep.S
index 3633dd4b78..3271857d61 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.S
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2001, 2003, 2004, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
@@ -34,7 +34,7 @@ ENTRY(__syscall_error)
 	;;
 	st4	[r2]=r8
 	mov	r8=-1
-#elif USE___THREAD
+#else
 # ifndef NOT_IN_libc
 #  define SYSCALL_ERROR_ERRNO __libc_errno
 # else
@@ -46,37 +46,7 @@ ENTRY(__syscall_error)
 	mov	r8=-1
 	add	r2=r2,r13;;
 	st4	[r2]=r3
-#elif defined _LIBC_REENTRANT
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0)
-	alloc	r33=ar.pfs, 0, 4, 0, 0
-	mov	r32=rp
-	.body
-	mov	r35=r8
-	mov	r34=r1
-	;;
-	br.call.sptk.many b0 = __errno_location
-.Lret0:		/* force new bundle */
-	st4	[r8]=r35
-	mov	r1=r34
-	mov	rp=r32
-	mov	r8=-1
-	mov	ar.pfs=r33
-#else /* _LIBC_REENTRANT */
-	/*
-	 * Note that the gp has to be set properly for this to work.
-	 * As long as all syscalls are in the same load unit
-	 * (executable or shared library) as this routine, we should
-	 * be fine.  Otherwise, we would have to first load the global
-	 * pointer register from __gp.
-	 */
-	addl	r2=@ltoff(errno),gp
-	;;
-	ld8	r2=[r2]
-	mov	r3=r8
-	mov	r8=-1
-	;;
-	st4	[r2]=r3
-#endif /* _LIBC_REENTRANT */
+#endif
 	ret			// ret is #define'd in syscall.h!
 END(__syscall_error)
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
index 2a1dad0695..5a24fdc2e7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -32,12 +32,11 @@
 	.text
 ENTRY(__syscall_error)
 #ifndef PIC
-# if USE___THREAD
-#  ifndef NOT_IN_libc
-#   define SYSCALL_ERROR_ERRNO __libc_errno
-#  else
-#   define SYSCALL_ERROR_ERRNO errno
-#  endif
+# ifndef NOT_IN_libc
+#  define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+#  define SYSCALL_ERROR_ERRNO errno
+# endif
 	basr	%r1,0
 0:	l	%r1,1f-0b(%r1)
 	ear	%r3,%a0
@@ -46,34 +45,6 @@ ENTRY(__syscall_error)
 	lhi	%r2,-1
 	br	%r14
 1:	.long	SYSCALL_ERROR_ERRNO@ntpoff
-# elif !defined _LIBC_REENTRANT
-	basr	%r1,0
-0:	l	%r1,1f-0b(%r1)
-	lcr	%r2,%r2
-	st	%r2,0(%r1)
-	lhi	%r2,-1
-	br	%r14
-1:	.long  errno
-# else
-	stm	%r13,%r15,52(%r15)
-	cfi_offset (%r15, -36)
-	cfi_offset (%r14, -40)
-	cfi_offset (%r13, -44)
-	lr	%r0,%r15
-	ahi	%r15,-96
-	cfi_adjust_cfa_offset (96)
-	lcr	%r13,%r2
-	st	%r0,0(%r15)
-	basr	%r1,0
-0:	l	%r1,1f-0b(%r1)
-	basr	%r14,%r1
-	st	%r13,0(%r2)
-	lm	%r13,%r15,148(%r15)
-	cfi_adjust_cfa_offset (-96)
-	lhi	%r2,-1
-	br	%r14
-1:	.long  __errno_location
-#endif
 #else
 # if RTLD_PRIVATE_ERRNO
 	basr	%r1,0
@@ -83,7 +54,7 @@ ENTRY(__syscall_error)
 	lhi	%r2,-1
 	br	%r14
 1:	.long	rtld_errno - 0b
-# elif USE___THREAD
+# else
 #  ifndef NOT_IN_libc
 #   define SYSCALL_ERROR_ERRNO __libc_errno
 #  else
@@ -98,39 +69,6 @@ ENTRY(__syscall_error)
 	lhi	%r2,-1
 	br	%r14
 1:	.long	_GLOBAL_OFFSET_TABLE_-0b
-# elif !defined _LIBC_REENTRANT
-	basr	%r1,0
-0:	al	%r1,1f-0b(%r1)
-	l	%r1,errno@GOT(%r1)
-	lcr	%r2,%r2
-	st	%r2,0(0,%r1)
-	lhi	%r2,-1
-	br	%r14
-1:	.long	_GLOBAL_OFFSET_TABLE_-0b
-# else
-	stm	%r11,%r15,44(%r15)
-	cfi_offset (%r15, -36)
-	cfi_offset (%r14, -40)
-	cfi_offset (%r13, -44)
-	cfi_offset (%r12, -48)
-	cfi_offset (%r11, -52)
-	lr	%r0,%r15
-	ahi	%r15,-96
-	cfi_adjust_cfa_offset (96)
-	lcr	%r11,%r2
-	st	%r0,0(%r15)
-	basr	%r13,0
-0:	l	%r12,1f-0b(%r13)
-	l	%r1,2f-0b(%r13)
-	la	%r12,0(%r12,%r13)
-	bas	%r14,0(%r1,%r13)
-	st	%r11,0(%r2)
-	lm	%r11,%r15,140(%r15)
-	cfi_adjust_cfa_offset (-96)
-	lhi	%r2,-1
-	br	%r14
-1:	.long _GLOBAL_OFFSET_TABLE_-0b
-2:	.long __errno_location@PLT-0b
 # endif
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 13ce9ab748..435eaabb17 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008
+/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011
    Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
@@ -56,10 +56,10 @@
 #undef PSEUDO
 #define	PSEUDO(name, syscall_name, args)				      \
   .text;                                                                      \
-  ENTRY (name)							              \
+  ENTRY (name)								      \
     DO_CALL (syscall_name, args);                                             \
     lhi  %r4,-4095 ;                                                          \
-    clr  %r2,%r4 ;		                                              \
+    clr  %r2,%r4 ;							      \
     jnl  SYSCALL_ERROR_LABEL
 
 #undef PSEUDO_END
@@ -70,7 +70,7 @@
 #undef PSEUDO_NOERRNO
 #define	PSEUDO_NOERRNO(name, syscall_name, args)			      \
   .text;                                                                      \
-  ENTRY (name)							              \
+  ENTRY (name)								      \
     DO_CALL (syscall_name, args)
 
 #undef PSEUDO_END_NOERRNO
@@ -80,7 +80,7 @@
 #undef PSEUDO_ERRVAL
 #define	PSEUDO_ERRVAL(name, syscall_name, args)				      \
   .text;                                                                      \
-  ENTRY (name)							              \
+  ENTRY (name)								      \
     DO_CALL (syscall_name, args);					      \
     lcr %r2,%r2
 
@@ -107,14 +107,13 @@
     br    %r14;								      \
 2:  .long rtld_errno-1b
 # elif defined _LIBC_REENTRANT
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_LABEL 0f
-#   define SYSCALL_ERROR_HANDLER \
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_LABEL 0f
+#  define SYSCALL_ERROR_HANDLER \
 0:  lcr   %r0,%r2;							      \
     basr  %r1,0;							      \
 1:  al    %r1,2f-1b(%r1);						      \
@@ -124,14 +123,6 @@
     lhi   %r2,-1;							      \
     br    %r14;								      \
 2:  .long _GLOBAL_OFFSET_TABLE_-1b
-#  else
-#   define SYSCALL_ERROR_LABEL 0f
-#   define SYSCALL_ERROR_HANDLER \
-0:  basr  %r1,0;							      \
-1:  al    %r1,2f-1b(%r1);						      \
-    br    %r1;								      \
-2:  .long syscall_error@plt-1b
-#  endif
 # else
 #  define SYSCALL_ERROR_LABEL 0f
 #  define SYSCALL_ERROR_HANDLER \
@@ -317,8 +308,8 @@
     if (INTERNAL_SYSCALL_ERROR_P (_ret, ))				      \
       {									      \
       iserr:								      \
-        __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
-        _ret = -1L;							      \
+	__set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
+	_ret = -1L;							      \
       }									      \
   out:									      \
     (int) _ret;								      \
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
index bb61e894f1..41d8143896 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -33,12 +33,11 @@
 .text
 ENTRY(__syscall_error)
 #ifndef PIC
-# if USE___THREAD
-#  ifndef NOT_IN_libc
-#   define SYSCALL_ERROR_ERRNO __libc_errno
-#  else
-#   define SYSCALL_ERROR_ERRNO errno
-#  endif
+# ifndef NOT_IN_libc
+#  define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+#  define SYSCALL_ERROR_ERRNO errno
+# endif
 	basr	%r1,0
 0:	lg	%r1,1f-0b(%r1)
 	ear	%r3,%a0
@@ -49,29 +48,6 @@ ENTRY(__syscall_error)
 	lghi	%r2,-1
 	br	%r14
 1:	.quad	SYSCALL_ERROR_ERRNO@ntpoff
-# elif !defined _LIBC_REENTRANT
-	larl	%r1,errno
-	lcr	%r2,%r2
-	st	%r2,0(%r1)
-	lghi	%r2,-1
-	br	%r14
-# else
-	stmg	%r13,%r15,104(%r15)
-	cfi_offset (%r15,-40)
-	cfi_offset (%r14,-48)
-	cfi_offset (%r13,-56)
-	lgr	%r0,%r15
-	aghi	%r15,-160
-	cfi_adjust_cfa_offset (160)
-	lcr	%r13,%r2
-	stg	%r0,0(%r15)
-	brasl	%r14,__errno_location
-	st	%r13,0(%r2)
-	lmg	%r13,%r15,264(%r15)
-	cfi_adjust_cfa_offset (-160)
-	lghi	%r2,-1
-	br	%r14
-#endif
 #else
 # if RTLD_PRIVATE_ERRNO
 	larl	%r1,rtld_errno
@@ -79,7 +55,7 @@ ENTRY(__syscall_error)
 	st	%r2,0(%r1)
 	lghi	%r2,-1
 	br	%r14
-# elif USE___THREAD
+# else
 #  ifndef NOT_IN_libc
 #   define SYSCALL_ERROR_ERRNO __libc_errno
 #  else
@@ -94,29 +70,6 @@ ENTRY(__syscall_error)
 	st	%r2,0(%r1,%r3)
 	lghi	%r2,-1
 	br	%r14
-# elif !defined _LIBC_REENTRANT
-	larl	%r1,_GLOBAL_OFFSET_TABLE_
-	lg	%r1,errno@GOT(%r1)
-	lcr	%r2,%r2
-	st	%r2,0(%r1)
-	lghi	%r2,-1
-	br	%r14
-# else
-	stmg	%r13,%r15,104(%r15)
-	cfi_offset (%r15,-40)
-	cfi_offset (%r14,-48)
-	cfi_offset (%r13,-56)
-	lgr	%r0,%r15
-	aghi	%r15,-160
-	cfi_adjust_cfa_offset (160)
-	lcr	%r13,%r2
-	stg	%r0,0(%r15)
-	brasl	%r14,__errno_location@PLT
-	st	%r13,0(%r2)
-	lmg	%r13,%r15,264(%r15)
-	cfi_adjust_cfa_offset (-160)
-	lghi	%r2,-1
-	br	%r14
 # endif
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 4d45417639..598fb86529 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembler macros for 64 bit S/390.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011
    Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
@@ -115,14 +115,13 @@
     lghi  %r2,-1;							      \
     br    %r14
 # elif defined _LIBC_REENTRANT
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_LABEL 0f
-#   define SYSCALL_ERROR_HANDLER \
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_LABEL 0f
+#  define SYSCALL_ERROR_HANDLER \
 0:  lcr   %r0,%r2;							      \
     larl  %r1,SYSCALL_ERROR_ERRNO@indntpoff;				      \
     lg    %r1,0(%r1);							      \
@@ -132,10 +131,6 @@
     st    %r0,0(%r1,%r2);						      \
     lghi   %r2,-1;							      \
     br    %r14
-#  else
-#   define SYSCALL_ERROR_LABEL syscall_error@plt
-#   define SYSCALL_ERROR_HANDLER
-#  endif
 # else
 #  define SYSCALL_ERROR_LABEL 0f
 #  define SYSCALL_ERROR_HANDLER \
@@ -319,8 +314,8 @@
     if (INTERNAL_SYSCALL_ERROR_P (_ret, ))				      \
       {									      \
       iserr:								      \
-        __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
-        _ret = -1L;							      \
+	__set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
+	_ret = -1L;							      \
       }									      \
   out:									      \
     (int) _ret;								      \
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index 0fc2c4f1ee..4ba0def0ed 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
-   2005,2006,2009	Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995-2000,2002-2006,2009,2011
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
    Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -114,13 +114,12 @@
 
 # elif defined _LIBC_REENTRANT
 
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_HANDLER \
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_HANDLER \
 	neg r0,r1; \
 	mov r12,r2; \
 	mov.l 0f,r12; \
@@ -137,43 +136,6 @@
 	.align 2; \
      0: .long _GLOBAL_OFFSET_TABLE_; \
      1: .long SYSCALL_ERROR_ERRNO@GOTTPOFF
-#  else
-#   define SYSCALL_ERROR_HANDLER \
-	neg r0,r1; \
-	mov.l r14,@-r15; \
-	cfi_adjust_cfa_offset (4); \
-	cfi_rel_offset (r14, 0); \
-	mov.l r12,@-r15; \
-	cfi_adjust_cfa_offset (4); \
-	cfi_rel_offset (r12, 0); \
-	mov.l r1,@-r15; \
-	cfi_adjust_cfa_offset (4); \
-	cfi_rel_offset (r1, 0); \
-	mov.l 0f,r12; \
-	mova 0f,r0; \
-	add r0,r12; \
-	sts.l pr,@-r15; \
-	cfi_adjust_cfa_offset (4); \
-	cfi_rel_offset (pr, 0); \
-	mov r15,r14; \
-	cfi_def_cfa_register (r14); \
-	mov.l 1f,r1; \
-	bsrf r1; \
-         nop; \
-     2: mov r14,r15; \
-	lds.l @r15+,pr; \
-	mov.l @r15+,r1; \
-	mov.l r1,@r0; \
-	mov.l @r15+,r12; \
-	mov.l @r15+,r14; \
-	bra .Lpseudo_end; \
-	 mov _IMM1,r0; \
-	.align 2; \
-     0: .long _GLOBAL_OFFSET_TABLE_; \
-     1: .long PLTJMP(C_SYMBOL_NAME(__errno_location))-(2b-.)
-/* A quick note: it is assumed that the call to `__errno_location' does
-   not modify the stack!  */
-#  endif
 # else
 /* Store (-r0) into errno through the GOT.  */
 #  define SYSCALL_ERROR_HANDLER						      \
@@ -324,8 +286,8 @@
     unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);             \
     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))         \
       {                                                                       \
-        __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));                   \
-        resultvar = 0xffffffff;                                               \
+	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));                   \
+	resultvar = 0xffffffff;                                               \
       }                                                                       \
     (int) resultvar; })
 
@@ -347,7 +309,7 @@
 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
   ({									      \
     unsigned long int resultvar;					      \
-    register long int r3 asm ("%r3") = (name);			 	      \
+    register long int r3 asm ("%r3") = (name);				      \
     SUBSTITUTE_ARGS_##nr(args);						      \
 									      \
     asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD			      \
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 8af045dc2b..161f431078 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2002, 2003, 2004, 2006, 2008
+/* Copyright (C) 1997, 2002, 2003, 2004, 2006, 2008, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
@@ -99,32 +99,19 @@ ENTRY(name);					\
 	 mov	-1, %o0;
 # elif defined _LIBC_REENTRANT
 
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_HANDLER				\
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_HANDLER				\
 0:	SETUP_PIC_REG(o2,g1)					\
 	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;		\
 	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;	\
 	ld	[%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);	\
-	st	%o0, [%g7 + %g1]; 				\
-	jmp	%o7 + 8;    					\
+	st	%o0, [%g7 + %g1];				\
+	jmp	%o7 + 8;					\
 	 mov	-1, %o0;
-#  else
-#  define SYSCALL_ERROR_HANDLER		\
-0:	save	%sp, -96, %sp;		\
-	cfi_def_cfa_register(%fp);	\
-	cfi_window_save;		\
-	cfi_register (%o7, %i7);	\
-	call	__errno_location;	\
-	 nop;				\
-	st	%i0, [%o0];		\
-	jmp	%i7 + 8;		\
-	 restore %g0, -1, %o0;
-#  endif
 # else
 #  define SYSCALL_ERROR_HANDLER		\
 0:	SETUP_PIC_REG(o2,g1)		\
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index bdd1d45bd7..bc8a0b0e3a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -106,32 +106,19 @@ ENTRY(name);					\
 	 mov	-1, %o0;
 # elif defined _LIBC_REENTRANT
 
-#  if USE___THREAD
-#   ifndef NOT_IN_libc
-#    define SYSCALL_ERROR_ERRNO __libc_errno
-#   else
-#    define SYSCALL_ERROR_ERRNO errno
-#   endif
-#   define SYSCALL_ERROR_HANDLER				\
+#  ifndef NOT_IN_libc
+#   define SYSCALL_ERROR_ERRNO __libc_errno
+#  else
+#   define SYSCALL_ERROR_ERRNO errno
+#  endif
+#  define SYSCALL_ERROR_HANDLER				\
 0:	SETUP_PIC_REG(o2,g1)					\
 	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;		\
 	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;	\
 	ldx	[%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\
-	st	%o0, [%g7 + %g1]; 				\
-	jmp	%o7 + 8;    					\
+	st	%o0, [%g7 + %g1];				\
+	jmp	%o7 + 8;					\
 	 mov	-1, %o0;
-#  else
-#  define SYSCALL_ERROR_HANDLER		\
-0:	save	%sp, -176, %sp;		\
-	cfi_def_cfa_register(%fp);	\
-	cfi_window_save;		\
-	cfi_register (%o7, %i7);	\
-	call	__errno_location;	\
-	 nop;				\
-	st	%i0, [%o0];		\
-	jmp	%i7 + 8;		\
-	 restore %g0, -1, %o0;
-#  endif
 # else
 #  define SYSCALL_ERROR_HANDLER		\
 0:	SETUP_PIC_REG(o2,g1)		\
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index a9821dc0a8..64362300ae 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -124,7 +124,7 @@
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
   jmp L(pseudo_end);
-# elif USE___THREAD
+# else
 #  ifndef NOT_IN_libc
 #   define SYSCALL_ERROR_ERRNO __libc_errno
 #  else
@@ -138,34 +138,6 @@
   movl %edx, %fs:(%rcx);			\
   orq $-1, %rax;				\
   jmp L(pseudo_end);
-# elif defined _LIBC_REENTRANT
-/* Store (- %rax) into errno through the GOT.
-   Note that errno occupies only 4 bytes.  */
-#  define SYSCALL_ERROR_HANDLER			\
-0:						\
-  xorl %edx, %edx;				\
-  subq %rax, %rdx;				\
-  pushq %rdx;					\
-  cfi_adjust_cfa_offset(8);			\
-  PUSH_ERRNO_LOCATION_RETURN;			\
-  call BP_SYM (__errno_location)@PLT;		\
-  POP_ERRNO_LOCATION_RETURN;			\
-  popq %rdx;					\
-  cfi_adjust_cfa_offset(-8);			\
-  movl %edx, (%rax);				\
-  orq $-1, %rax;				\
-  jmp L(pseudo_end);
-
-/* A quick note: it is assumed that the call to `__errno_location' does
-   not modify the stack!  */
-# else /* Not _LIBC_REENTRANT.  */
-#  define SYSCALL_ERROR_HANDLER			\
-0:movq errno@GOTPCREL(%RIP), %rcx;		\
-  xorl %edx, %edx;				\
-  subq %rax, %rdx;				\
-  movl %edx, (%rcx);				\
-  orq $-1, %rax;				\
-  jmp L(pseudo_end);
 # endif	/* PIC */
 
 /* The Linux/x86-64 kernel expects the system call parameters in
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
index aca81fef2f..908da3c3d5 100644
--- a/sysdeps/unix/x86_64/sysdep.S
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2004, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,43 +45,11 @@ syscall_error:
 	movl $EAGAIN, %eax	/* Yes; translate it to EAGAIN.  */
 notb:
 #endif
-#if USE___THREAD
-# ifdef PIC
+#ifdef PIC
 	movq C_SYMBOL_NAME(errno@GOTTPOFF)(%rip), %rcx
 	movl %eax, %fs:0(%rcx)
-# else
-	movl %eax, %fs:C_SYMBOL_NAME(errno@TPOFF)
-# endif
-#elif !defined PIC
-# ifndef _LIBC_REENTRANT
-	movl %eax, C_SYMBOL_NAME(errno)
-# else
-	pushq %rax
-	cfi_adjust_cfa_offset(8)
-	PUSH_ERRNO_LOCATION_RETURN
-	call BP_SYM (__errno_location)
-	POP_ERRNO_LOCATION_RETURN
-	popq %rcx
-	cfi_adjust_cfa_offset(-8)
-	movl %ecx, (%rax)
-# endif
 #else
-# if RTLD_PRIVATE_ERRNO
-	leaq rtld_errno(%rip), %rcx
-	movl %eax, (%rcx)
-# elif !defined _LIBC_REENTRANT
-	movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
-	movl %eax, (%rcx)
-# else
-	pushq %rax
-	cfi_adjust_cfa_offset(8)
-	PUSH_ERRNO_LOCATION_RETURN
-	call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
-	POP_ERRNO_LOCATION_RETURN
-	popq %rcx
-	cfi_adjust_cfa_offset(-8)
-	movl %ecx, (%rax)
-# endif
+	movl %eax, %fs:C_SYMBOL_NAME(errno@TPOFF)
 #endif
 	movq $-1, %rax
 	ret
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index f615e9591f..4c31ac5da8 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  x86-64 version.
-   Copyright (C) 2001-2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2001-2006, 2008-2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -195,8 +195,7 @@ _dl_start_user:\n\
    define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#if !defined RTLD_BOOTSTRAP || USE___THREAD
-# define elf_machine_type_class(type)					      \
+#define elf_machine_type_class(type)					      \
   ((((type) == R_X86_64_JUMP_SLOT					      \
      || (type) == R_X86_64_DTPMOD64					      \
      || (type) == R_X86_64_DTPOFF64					      \
@@ -204,11 +203,6 @@ _dl_start_user:\n\
      || (type) == R_X86_64_TLSDESC)					      \
     * ELF_RTYPE_CLASS_PLT)						      \
    | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
-  ((((type) == R_X86_64_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
-   | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_X86_64_JUMP_SLOT
@@ -302,10 +296,6 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
 	value = ((Elf64_Addr (*) (void)) value) ();
 
-# if defined RTLD_BOOTSTRAP && !USE___THREAD
-      assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT);
-      *reloc_addr = value + reloc->r_addend;
-# else
       switch (r_type)
 	{
 	case R_X86_64_GLOB_DAT:
@@ -453,7 +443,6 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  break;
 # endif
 	}
-#endif
     }
 }
 
diff --git a/tls.make.c b/tls.make.c
index 6bcd2479c6..4627aa37e0 100644
--- a/tls.make.c
+++ b/tls.make.c
@@ -2,8 +2,4 @@
 
 #include <tls.h>
 
-#if USE___THREAD
 @@@ use-thread = yes @@@
-#else
-@@@ use-thread = no @@@
-#endif