This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Removing non-TLS support


libc has recently removed support for various obsolete configure 
conditional, instead requiring the relevant configure tests to pass so 
that no conditionals on their results are needed in C code.

In particular, the USE___THREAD and HAVE___THREAD cases are now always 
true, and those macros are no longer defined, meaning that ports code 
testing those macros must change to treat the relevant conditionals as 
always-true.

I have applied this patch to make those changes for ARM.  It also removes 
USE_TLS; although not strictly required to avoid breakage (since the macro 
was defined and used within individual ports), this macro was removed from 
libc in 2006.

I will make the corresponding MIPS changes (only concerning USE_TLS) as 
well.  Target maintainers should note that other ports such as Alpha, M68K 
and PA also need similar changes.  (Alpha has the only reference to 
HAVE___THREAD in ports.)

diff --git a/ChangeLog.arm b/ChangeLog.arm
index 569b98f..93eee30 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,11 @@
+2011-09-11  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/arm/dl-machine.h, sysdeps/arm/dl-tlsdesc.S,
+	sysdeps/arm/libc-tls.c, sysdeps/arm/nptl/tls.h,
+	sysdeps/arm/tlsdesc.c, sysdeps/arm/tlsdesc.sym,
+	sysdeps/unix/arm/sysdep.S: Remove !USE_THREAD and !USE_TLS cases.
+	Don't define USE_TLS.
+
 2011-08-18  Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>
 
 	* sysdeps/unix/sysv/linux/arm/eabi/Makefile: Add libc-do-syscall
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index b5d477b..1ba7700 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  ARM version.
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,
-	2006, 2009, 2010 Free Software Foundation, Inc.
+	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
@@ -242,18 +242,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 USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
   ((((type) == R_ARM_JUMP_SLOT || (type) == R_ARM_TLS_DTPMOD32		\
      || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32	\
      || (type) == R_ARM_TLS_DESC)					\
     * ELF_RTYPE_CLASS_PLT)						\
    | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-#define elf_machine_type_class(type) \
-  ((((type) == R_ARM_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_ARM_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_ARM_JUMP_SLOT
@@ -494,7 +488,6 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  }
 	  break;
 #if !defined RTLD_BOOTSTRAP
-#if defined USE_TLS
 	case R_ARM_TLS_DTPMOD32:
 	  /* Get the information from the link map returned by the
 	     resolv function.  */
@@ -514,7 +507,6 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	      *reloc_addr += sym->st_value + sym_map->l_tls_offset;
 	    }
 	  break;
-#endif
 	case R_ARM_IRELATIVE:
 	  value = map->l_addr + *reloc_addr;
 	  value = ((Elf32_Addr (*) (void)) value) ();
@@ -608,7 +600,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  }
 	  break;
 #if !defined RTLD_BOOTSTRAP
-#if defined USE_TLS
 	case R_ARM_TLS_DTPMOD32:
 	  /* Get the information from the link map returned by the
 	     resolv function.  */
@@ -628,7 +619,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 			     + reloc->r_addend);
 	    }
 	  break;
-#endif
 	case R_ARM_IRELATIVE:
 	  value = map->l_addr + *reloc_addr;
 	  value = ((Elf32_Addr (*) (void)) value) ();
@@ -678,7 +668,6 @@ elf_machine_lazy_rel (struct link_map *map,
       else
 	*reloc_addr = map->l_mach.plt;
     }
-#ifdef USE_TLS
   else if (__builtin_expect (r_type == R_ARM_TLS_DESC, 1))
     {
       struct tlsdesc volatile *td =
@@ -691,7 +680,6 @@ elf_machine_lazy_rel (struct link_map *map,
       td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
 			  + map->l_addr);
     }
-#endif
   else
     _dl_reloc_bad_type (map, r_type, 1);
 }
diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S
index 19e4ed3..c192fc9 100644
--- a/sysdeps/arm/dl-tlsdesc.S
+++ b/sysdeps/arm/dl-tlsdesc.S
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  ARM version.
-   Copyright (C) 2006, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2006, 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
@@ -31,7 +31,6 @@
 	@ emit debug information with cfi
 	@ use arm-specific pseudos for unwinding itself
 	.cfi_sections .debug_frame
-#ifdef USE_TLS
 	.hidden _dl_tlsdesc_return
 	.global	_dl_tlsdesc_return
 	.type	_dl_tlsdesc_return,#function
@@ -218,5 +217,3 @@ _dl_tlsdesc_resolve_hold:
 	.fnend
 	cfi_endproc
 	.size	_dl_tlsdesc_resolve_hold, .-_dl_tlsdesc_resolve_hold
-
-#endif /* USE_TLS */
diff --git a/sysdeps/arm/libc-tls.c b/sysdeps/arm/libc-tls.c
index affb189..a6271bb 100644
--- a/sysdeps/arm/libc-tls.c
+++ b/sysdeps/arm/libc-tls.c
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  ARM version.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -20,8 +20,6 @@
 #include <csu/libc-tls.c>
 #include <dl-tls.h>
 
-#if USE_TLS
-
 /* On ARM, linker optimizations are not required, so __tls_get_addr
    can be called even in statically linked binaries.  In this case module
    must be always 1 and PT_TLS segment exist in the binary, otherwise it
@@ -33,5 +31,3 @@ __tls_get_addr (tls_index *ti)
   dtv_t *dtv = THREAD_DTV ();
   return (char *) dtv[1].pointer.val + ti->ti_offset;
 }
-
-#endif
diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h
index f257b93..82a6881 100644
--- a/sysdeps/arm/nptl/tls.h
+++ b/sysdeps/arm/nptl/tls.h
@@ -1,5 +1,5 @@
 /* Definition for thread-local data handling.  NPTL/ARM version.
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 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
@@ -48,9 +48,6 @@ typedef union dtv
 # error "TLS support is required."
 #endif
 
-/* Signal that TLS support is available.  */
-# define USE_TLS	1
-
 #ifndef __ASSEMBLER__
 
 /* Get system call information.  */
diff --git a/sysdeps/arm/tlsdesc.c b/sysdeps/arm/tlsdesc.c
index e0b970f..811d66b 100644
--- a/sysdeps/arm/tlsdesc.c
+++ b/sysdeps/arm/tlsdesc.c
@@ -1,5 +1,5 @@
 /* Manage TLS descriptors.  ARM version.
-   Copyright (C) 2005, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2005, 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
@@ -24,8 +24,6 @@
 #include <dl-tlsdesc.h>
 #include <tlsdeschtab.h>
 
-#ifdef USE_TLS
-
 /* This function is used to lazily resolve TLS_DESC REL relocations
    Besides the TLS descriptor itself, we get the module's got address
    as the second parameter. */
@@ -161,4 +159,3 @@ _dl_unmap (struct link_map *map)
     htab_delete (map->l_mach.tlsdesc_table);
 #endif
 }
-#endif
diff --git a/sysdeps/arm/tlsdesc.sym b/sysdeps/arm/tlsdesc.sym
index a1deb21..3f3a13e 100644
--- a/sysdeps/arm/tlsdesc.sym
+++ b/sysdeps/arm/tlsdesc.sym
@@ -7,13 +7,9 @@
 --
 
 -- Abuse tls.h macros to derive offsets relative to the thread register.
-#if defined USE_TLS
-
 
 TLSDESC_ARG			offsetof(struct tlsdesc, argument.pointer)
 
 TLSDESC_GEN_COUNT		offsetof(struct tlsdesc_dynamic_arg, gen_count)
 TLSDESC_MODID			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module)
 TLSDESC_MODOFF			offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset)
-
-#endif
diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S
index d3ad81b..dcd3ce2 100644
--- a/sysdeps/unix/arm/sysdep.S
+++ b/sysdeps/unix/arm/sysdep.S
@@ -1,5 +1,5 @@
 /* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2002, 2003,
-   2004, 2005, 2009
+   2004, 2005, 2009, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -42,7 +42,6 @@ syscall_error:
 	moveq r0, $EAGAIN	/* Yes; translate it to EAGAIN.  */
 #endif
 
-#if USE___THREAD
 	mov ip, lr
 	cfi_register (lr, ip)
 	mov r1, r0
@@ -58,46 +57,6 @@ syscall_error:
 	RETINSTR (, ip)
 
 1:	.word errno(gottpoff) + (. - 2b - 8)
-#elif RTLD_PRIVATE_ERRNO
-	ldr r1, 1f
-0:	str r0, [pc, r1]
-	mvn r0, $0
-	DO_RET(r14)
-
-1:	.word C_SYMBOL_NAME(rtld_errno) - 0b - 8
-#elif defined(_LIBC_REENTRANT)
-	str lr, [sp, #-4]!
-	cfi_adjust_cfa_offset (4)
-	cfi_rel_offset (lr, 0)
-	str r0, [sp, #-4]!
-	cfi_adjust_cfa_offset (4)
-	bl PLTJMP(C_SYMBOL_NAME(__errno_location))
-	ldr r1, [sp], #4
-	cfi_adjust_cfa_offset (-4)
-	str r1, [r0]
-	mvn r0, $0
-	ldr pc, [sp], #4	
-#else
-#ifndef	PIC
-	ldr r1, 1f
-	str r0, [r1]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.long C_SYMBOL_NAME(errno)
-#else
-	@ we have to establish our PIC register
-	ldr r2, 1f
-	ldr r1, 2f
-0:	add r2, pc, r2
-	str r0, [r1, r2]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.word _GLOBAL_OFFSET_TABLE_ - 0b - 8
-2:	.word C_SYMBOL_NAME(errno)(GOTOFF)
-#endif
-#endif
 
 #undef	__syscall_error
 END (__syscall_error)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]