1 /* Thread-local storage handling in the ELF dynamic linker.  Xtensa version.
2    Copyright (C) 2013 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If
17    not, see <http://www.gnu.org/licenses/>.  */
18 
19 #ifndef _XTENSA_DL_TLS_H
20 #define _XTENSA_DL_TLS_H 1
21 
22 /* Type used for the representation of TLS information in the GOT.  */
23 typedef struct
24 {
25   unsigned long int ti_module;
26   unsigned long int ti_offset;
27 } tls_index;
28 
29 extern void *__tls_get_addr (tls_index *ti);
30 
31 /* Type used as the argument in a TLS descriptor for a symbol that
32    needs dynamic TLS offsets.  */
33 struct tlsdesc_dynamic_arg
34 {
35   tls_index tlsinfo;
36   size_t gen_count;
37 };
38 
39 #ifdef __FDPIC__
40 /* Type used to represent a TLS descriptor.  */
41 struct tlsdesc
42 {
43   ptrdiff_t (*entry)(struct tlsdesc *);
44   void *argument;
45 };
46 
47 extern ptrdiff_t attribute_hidden
48   _dl_tlsdesc_return(struct tlsdesc *);
49 
50 extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset);
51 extern ptrdiff_t attribute_hidden
52   _dl_tlsdesc_dynamic(struct tlsdesc *);
53 #else
54 /* Type used to represent a TLS descriptor.  */
55 struct tlsdesc
56 {
57   union
58     {
59       void *pointer;
60       long value;
61     } argument;
62   ptrdiff_t (*entry)(struct tlsdesc *);
63 };
64 
65 extern ptrdiff_t attribute_hidden
66   _dl_tlsdesc_return(struct tlsdesc_dynamic_arg *);
67 
68 extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset);
69 extern ptrdiff_t attribute_hidden
70   _dl_tlsdesc_dynamic(struct tlsdesc_dynamic_arg *);
71 #endif
72 #endif
73 
74 /* Value used for dtv entries for which the allocation is delayed.  */
75 #define TLS_DTV_UNALLOCATED    ((void *) -1l)
76