elf: Consolidate machine-agnostic DTV definitions in <dl-dtv.h>

Identical definitions of dtv_t and TLS_DTV_UNALLOCATED were
repeated for all architectures using DTVs.
This commit is contained in:
Florian Weimer 2016-06-20 14:31:40 +02:00
parent 92e1ab0eb5
commit aca1daef29
35 changed files with 106 additions and 242 deletions

View file

@ -1,3 +1,55 @@
2016-06-20 Florian Weimer <fweimer@redhat.com>
Consolidate machine-agnostic DTV definitions in <dl-dtv.h>.
* sysdeps/generic/dl-dtv.h: New file.
* sysdeps/aarch64/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/aarch64/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/alpha/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/alpha/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/arm/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/arm/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/hppa/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/hppa/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/i386/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/i386/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/ia64/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/ia64/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/m68k/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/m68k/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/mach/hurd/i386/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/microblaze/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/microblaze/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/mips/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/mips/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/nios2/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/nios2/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/powerpc/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/powerpc/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/s390/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/s390/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/sh/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/sh/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/sparc/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/sparc/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
* sysdeps/x86_64/dl-tls.h (TLS_DTV_UNALLOCATED): Remove.
* sysdeps/x86_64/nptl/tls.h: Include <dl-dtv.h>.
(dtv_t): Remove.
2016-06-20 Florian Weimer <fweimer@redhat.com>
Revert symbol poisoning of __malloc_initialize_hook.

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
/* Get system call information. */
# include <sysdep.h>

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

36
sysdeps/generic/dl-dtv.h Normal file
View file

@ -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
<http://www.gnu.org/licenses/>. */
#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 */

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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)

View file

@ -28,19 +28,7 @@
# include <sysdep.h>
# include <libc-internal.h>
# include <kernel-features.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
typedef struct
{

View file

@ -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)

View file

@ -26,19 +26,7 @@
# include <stdint.h>
# include <stdlib.h>
# include <list.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
typedef struct
{

View file

@ -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)

View file

@ -26,17 +26,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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 <dl-dtv.h>
/* Type of the TCB. */
typedef struct

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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)

View file

@ -25,20 +25,11 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
# include <dl-dtv.h>
/* Get system call information. */
# include <sysdep.h>
/* 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 ())

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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 */

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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)

View file

@ -27,19 +27,7 @@
# include <stdlib.h>
# include <list.h>
# include <kernel-features.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
typedef struct
{

View file

@ -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)

View file

@ -28,17 +28,7 @@
# include <stdlib.h>
# include <list.h>
# include <sysdep.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
typedef struct
{

View file

@ -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)

View file

@ -27,17 +27,7 @@
# include <stdlib.h>
# include <list.h>
# include <kernel-features.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
typedef struct
{

View file

@ -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)

View file

@ -25,17 +25,7 @@
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
# include <dl-dtv.h>
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>

View file

@ -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)

View file

@ -28,6 +28,7 @@
# include <sysdep.h>
# include <libc-internal.h>
# include <kernel-features.h>
# include <dl-dtv.h>
/* 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