summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-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
22 files changed, 190 insertions, 590 deletions
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
     }
 }