From aca1daef298b43bd7b1987b31f5aabcf6c2f6021 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 20 Jun 2016 14:31:40 +0200 Subject: elf: Consolidate machine-agnostic DTV definitions in Identical definitions of dtv_t and TLS_DTV_UNALLOCATED were repeated for all architectures using DTVs. --- sysdeps/aarch64/dl-tls.h | 3 --- sysdeps/aarch64/nptl/tls.h | 12 +----------- sysdeps/alpha/dl-tls.h | 3 --- sysdeps/alpha/nptl/tls.h | 12 +----------- sysdeps/arm/dl-tls.h | 3 --- sysdeps/arm/nptl/tls.h | 12 +----------- sysdeps/generic/dl-dtv.h | 36 ++++++++++++++++++++++++++++++++++++ sysdeps/hppa/dl-tls.h | 3 --- sysdeps/hppa/nptl/tls.h | 12 +----------- sysdeps/i386/dl-tls.h | 3 --- sysdeps/i386/nptl/tls.h | 14 +------------- sysdeps/ia64/dl-tls.h | 3 --- sysdeps/ia64/nptl/tls.h | 14 +------------- sysdeps/m68k/dl-tls.h | 3 --- sysdeps/m68k/nptl/tls.h | 12 +----------- sysdeps/mach/hurd/i386/tls.h | 12 +----------- sysdeps/microblaze/dl-tls.h | 3 --- sysdeps/microblaze/nptl/tls.h | 12 +----------- sysdeps/mips/dl-tls.h | 3 --- sysdeps/mips/nptl/tls.h | 13 ++----------- sysdeps/nios2/dl-tls.h | 3 --- sysdeps/nios2/nptl/tls.h | 12 +----------- sysdeps/powerpc/dl-tls.h | 3 --- sysdeps/powerpc/nptl/tls.h | 12 +----------- sysdeps/s390/dl-tls.h | 3 --- sysdeps/s390/nptl/tls.h | 14 +------------- sysdeps/sh/dl-tls.h | 3 --- sysdeps/sh/nptl/tls.h | 12 +----------- sysdeps/sparc/dl-tls.h | 3 --- sysdeps/sparc/nptl/tls.h | 12 +----------- sysdeps/tile/dl-tls.h | 3 --- sysdeps/tile/nptl/tls.h | 12 +----------- sysdeps/x86_64/dl-tls.h | 3 --- sysdeps/x86_64/nptl/tls.h | 13 +------------ 34 files changed, 54 insertions(+), 242 deletions(-) create mode 100644 sysdeps/generic/dl-dtv.h (limited to 'sysdeps') diff --git a/sysdeps/aarch64/dl-tls.h b/sysdeps/aarch64/dl-tls.h index 71265c5341..7eff42789e 100644 --- a/sysdeps/aarch64/dl-tls.h +++ b/sysdeps/aarch64/dl-tls.h @@ -25,6 +25,3 @@ typedef struct extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h index 95ea3f9a1a..c5f20efc8c 100644 --- a/sysdeps/aarch64/nptl/tls.h +++ b/sysdeps/aarch64/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/alpha/dl-tls.h b/sysdeps/alpha/dl-tls.h index 5f4e4cf4a6..b723a6e019 100644 --- a/sysdeps/alpha/dl-tls.h +++ b/sysdeps/alpha/dl-tls.h @@ -25,6 +25,3 @@ typedef struct } tls_index; extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h index 90d98e124d..0d63770fc0 100644 --- a/sysdeps/alpha/nptl/tls.h +++ b/sysdeps/alpha/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include /* Get system call information. */ # include diff --git a/sysdeps/arm/dl-tls.h b/sysdeps/arm/dl-tls.h index ed2efe8c18..be2fe620f4 100644 --- a/sysdeps/arm/dl-tls.h +++ b/sysdeps/arm/dl-tls.h @@ -26,6 +26,3 @@ typedef struct dl_tls_index extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h index 1ef57d2a87..9b9a5213af 100644 --- a/sysdeps/arm/nptl/tls.h +++ b/sysdeps/arm/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/generic/dl-dtv.h b/sysdeps/generic/dl-dtv.h new file mode 100644 index 0000000000..36c5c58cdd --- /dev/null +++ b/sysdeps/generic/dl-dtv.h @@ -0,0 +1,36 @@ +/* Generic declarations for DTV-based TLS handling in the dynamic linker. + Copyright (C) 2002-2016 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_DTV_H +#define _DL_DTV_H + +/* Type for the dtv. */ +typedef union dtv +{ + size_t counter; + struct + { + void *val; + bool is_static; + } pointer; +} dtv_t; + +/* Value used for dtv entries for which the allocation is delayed. */ +#define TLS_DTV_UNALLOCATED ((void *) -1l) + +#endif /* _DLT_DTV_H */ diff --git a/sysdeps/hppa/dl-tls.h b/sysdeps/hppa/dl-tls.h index 58b9280848..2cae6e42ec 100644 --- a/sysdeps/hppa/dl-tls.h +++ b/sysdeps/hppa/dl-tls.h @@ -26,6 +26,3 @@ typedef struct extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h index 2e0c861e09..14a0083d30 100644 --- a/sysdeps/hppa/nptl/tls.h +++ b/sysdeps/hppa/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h index 1a8c358bfc..d798b9a695 100644 --- a/sysdeps/i386/dl-tls.h +++ b/sysdeps/i386/dl-tls.h @@ -59,6 +59,3 @@ rtld_hidden_def (___tls_get_addr) # endif #endif - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h index a6dfa9b377..74a11dd0d3 100644 --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -28,19 +28,7 @@ # include # include # include - - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - +# include typedef struct { diff --git a/sysdeps/ia64/dl-tls.h b/sysdeps/ia64/dl-tls.h index bc008882bf..756b84d0ee 100644 --- a/sysdeps/ia64/dl-tls.h +++ b/sysdeps/ia64/dl-tls.h @@ -28,6 +28,3 @@ #define DONT_USE_TLS_INDEX 1 extern void *__tls_get_addr (size_t m, size_t offset); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/ia64/nptl/tls.h b/sysdeps/ia64/nptl/tls.h index 54fddf5952..1e03e2c0a8 100644 --- a/sysdeps/ia64/nptl/tls.h +++ b/sysdeps/ia64/nptl/tls.h @@ -26,19 +26,7 @@ # include # include # include - - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - +# include typedef struct { diff --git a/sysdeps/m68k/dl-tls.h b/sysdeps/m68k/dl-tls.h index f853b99874..d24ad90dbc 100644 --- a/sysdeps/m68k/dl-tls.h +++ b/sysdeps/m68k/dl-tls.h @@ -45,6 +45,3 @@ extern void *__tls_get_addr (tls_index *ti); #define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) #define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h index f93228212b..4825c4c81a 100644 --- a/sysdeps/m68k/nptl/tls.h +++ b/sysdeps/m68k/nptl/tls.h @@ -26,17 +26,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 3ec5bb032b..81e6926680 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -25,17 +25,7 @@ #ifndef __ASSEMBLER__ -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - +# include /* Type of the TCB. */ typedef struct diff --git a/sysdeps/microblaze/dl-tls.h b/sysdeps/microblaze/dl-tls.h index f0f8205181..5613e21e2e 100644 --- a/sysdeps/microblaze/dl-tls.h +++ b/sysdeps/microblaze/dl-tls.h @@ -24,6 +24,3 @@ typedef struct } tls_index; extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/microblaze/nptl/tls.h b/sysdeps/microblaze/nptl/tls.h index 8376f5005e..5e9560abf3 100644 --- a/sysdeps/microblaze/nptl/tls.h +++ b/sysdeps/microblaze/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/mips/dl-tls.h b/sysdeps/mips/dl-tls.h index 4d084d6191..1c5a83f8a4 100644 --- a/sysdeps/mips/dl-tls.h +++ b/sysdeps/mips/dl-tls.h @@ -43,6 +43,3 @@ extern void *__tls_get_addr (tls_index *ti); # define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) # define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h index 10ca878292..f5f4891bd8 100644 --- a/sysdeps/mips/nptl/tls.h +++ b/sysdeps/mips/nptl/tls.h @@ -25,20 +25,11 @@ # include # include # include +# include + /* Get system call information. */ # include -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - #ifdef __mips16 /* MIPS16 uses GCC builtin to access the TP. */ # define READ_THREAD_POINTER() (__builtin_thread_pointer ()) diff --git a/sysdeps/nios2/dl-tls.h b/sysdeps/nios2/dl-tls.h index cd794610b6..45c0db2b9c 100644 --- a/sysdeps/nios2/dl-tls.h +++ b/sysdeps/nios2/dl-tls.h @@ -43,6 +43,3 @@ extern void *__tls_get_addr (tls_index *ti); # define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) # define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/nios2/nptl/tls.h b/sysdeps/nios2/nptl/tls.h index ad29ac5ac2..55e115419b 100644 --- a/sysdeps/nios2/nptl/tls.h +++ b/sysdeps/nios2/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/powerpc/dl-tls.h b/sysdeps/powerpc/dl-tls.h index eced36b65d..f8b6fcf195 100644 --- a/sysdeps/powerpc/dl-tls.h +++ b/sysdeps/powerpc/dl-tls.h @@ -49,7 +49,4 @@ extern void *__tls_get_addr (tls_index *ti); # define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) #endif -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) - #endif /* dl-tls.h */ diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index 0e889bc122..fa476a5b3f 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/s390/dl-tls.h b/sysdeps/s390/dl-tls.h index 503048a622..ce2d020aba 100644 --- a/sysdeps/s390/dl-tls.h +++ b/sysdeps/s390/dl-tls.h @@ -102,6 +102,3 @@ extern void *__tls_get_addr_internal (tls_index *ti); + (unsigned long) __builtin_thread_pointer (); }) #endif - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/s390/nptl/tls.h b/sysdeps/s390/nptl/tls.h index e4c3ec7830..0fec5863ca 100644 --- a/sysdeps/s390/nptl/tls.h +++ b/sysdeps/s390/nptl/tls.h @@ -27,19 +27,7 @@ # include # include # include - - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - +# include typedef struct { diff --git a/sysdeps/sh/dl-tls.h b/sysdeps/sh/dl-tls.h index 276ec54760..52e2a10caf 100644 --- a/sysdeps/sh/dl-tls.h +++ b/sysdeps/sh/dl-tls.h @@ -26,6 +26,3 @@ typedef struct extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/sh/nptl/tls.h b/sysdeps/sh/nptl/tls.h index 6f128c9e95..a81e8055f1 100644 --- a/sysdeps/sh/nptl/tls.h +++ b/sysdeps/sh/nptl/tls.h @@ -28,17 +28,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include typedef struct { diff --git a/sysdeps/sparc/dl-tls.h b/sysdeps/sparc/dl-tls.h index 2bfd366747..b74861ab47 100644 --- a/sysdeps/sparc/dl-tls.h +++ b/sysdeps/sparc/dl-tls.h @@ -26,6 +26,3 @@ typedef struct extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/sparc/nptl/tls.h b/sysdeps/sparc/nptl/tls.h index 08c055220a..85f2a2c31c 100644 --- a/sysdeps/sparc/nptl/tls.h +++ b/sysdeps/sparc/nptl/tls.h @@ -27,17 +27,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include typedef struct { diff --git a/sysdeps/tile/dl-tls.h b/sysdeps/tile/dl-tls.h index d26c6befc5..20096f4234 100644 --- a/sysdeps/tile/dl-tls.h +++ b/sysdeps/tile/dl-tls.h @@ -40,6 +40,3 @@ extern void *__tls_get_addr (tls_index *ti); /* Compute the value for a DTPREL reloc. */ #define TLS_DTPREL_VALUE(sym) \ ((sym)->st_value - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/tile/nptl/tls.h b/sysdeps/tile/nptl/tls.h index c908fb8e1f..16e8fafa8f 100644 --- a/sysdeps/tile/nptl/tls.h +++ b/sysdeps/tile/nptl/tls.h @@ -25,17 +25,7 @@ # include # include # include - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; +# include #else /* __ASSEMBLER__ */ # include diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h index 0f101e6ac6..cf6c107f54 100644 --- a/sysdeps/x86_64/dl-tls.h +++ b/sysdeps/x86_64/dl-tls.h @@ -27,6 +27,3 @@ typedef struct dl_tls_index extern void *__tls_get_addr (tls_index *ti); - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h index 2b061a07c6..1bf9586c3b 100644 --- a/sysdeps/x86_64/nptl/tls.h +++ b/sysdeps/x86_64/nptl/tls.h @@ -28,6 +28,7 @@ # include # include # include +# include /* Replacement type for __m128 since this file is included by ld.so, which is compiled with -mno-sse. It must not change the alignment @@ -38,18 +39,6 @@ typedef struct } __128bits; -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - - typedef struct { void *tcb; /* Pointer to the TCB. Not necessarily the -- cgit 1.4.1