]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/ldso/include/ldsodefs.h
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / ldso / include / ldsodefs.h
1 #ifndef _LDSODEFS_H
2 #define _LDSODEFS_H     1
3
4 #include <bits/kernel-features.h>
5 #include <link.h>
6 #include <features.h>
7 #include <tls.h>
8
9 #ifdef __mips__
10 /* The MIPS ABI specifies that the dynamic section has to be read-only.  */
11
12 #define DL_RO_DYN_SECTION 1
13
14 /* TODO: Import in 64-bit relocations from glibc. */
15 #endif
16
17 #ifndef SHARED
18 # define EXTERN extern
19 #else
20 # ifdef IS_IN_rtld
21 #  define EXTERN
22 # else
23 #  define EXTERN extern
24 # endif
25 #endif
26
27 /* Non-shared code has no support for multiple namespaces.  */
28 #ifdef SHARED
29 # define DL_NNS 16
30 #else
31 # define DL_NNS 1
32 #endif
33
34 #define GL(x) _##x
35 #define GLRO(x) _##x
36
37 /* Variable pointing to the end of the stack (or close to it).  This value
38    must be constant over the runtime of the application.  Some programs
39    might use the variable which results in copy relocations on some
40    platforms.  But this does not matter, ld.so can always use the local
41    copy.  */
42 extern void *__libc_stack_end;
43
44 /* Determine next available module ID.  */
45 extern size_t _dl_next_tls_modid (void) internal_function attribute_hidden;
46
47 /* Calculate offset of the TLS blocks in the static TLS block.  */
48 extern void _dl_determine_tlsoffset (void) internal_function attribute_hidden;
49
50 /* Set up the data structures for TLS, when they were not set up at startup.
51    Returns nonzero on malloc failure.
52    This is called from _dl_map_object_from_fd or by libpthread.  */
53 extern int _dl_tls_setup (void) internal_function;
54 rtld_hidden_proto (_dl_tls_setup)
55
56 /* Allocate memory for static TLS block (unless MEM is nonzero) and dtv.  */
57 extern void *_dl_allocate_tls (void *mem) internal_function;
58
59 /* Get size and alignment requirements of the static TLS block.  */
60 extern void _dl_get_tls_static_info (size_t *sizep, size_t *alignp)
61      internal_function;
62
63 extern void _dl_allocate_static_tls (struct link_map *map)
64      internal_function attribute_hidden;
65
66 /* Taken from glibc/elf/dl-reloc.c */
67 #define CHECK_STATIC_TLS(sym_map)                                                                                       \
68         do {                                                                                                                                    \
69                 if (unlikely((sym_map)->l_tls_offset == NO_TLS_OFFSET)) \
70                         _dl_allocate_static_tls (sym_map);                                                              \
71         } while (0)
72
73 /* These are internal entry points to the two halves of _dl_allocate_tls,
74    only used within rtld.c itself at startup time.  */
75 extern void *_dl_allocate_tls_storage (void)
76      internal_function attribute_hidden;
77 extern void *_dl_allocate_tls_init (void *) internal_function;
78
79 /* Deallocate memory allocated with _dl_allocate_tls.  */
80 extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
81
82 extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
83
84 /* Highest dtv index currently needed.  */
85 EXTERN size_t _dl_tls_max_dtv_idx;
86 /* Flag signalling whether there are gaps in the module ID allocation.  */
87 EXTERN bool _dl_tls_dtv_gaps;
88 /* Information about the dtv slots.  */
89 EXTERN struct dtv_slotinfo_list
90 {
91   size_t len;
92   struct dtv_slotinfo_list *next;
93   struct dtv_slotinfo
94   {
95     size_t gen;
96     bool is_static;
97     struct link_map *map;
98   } slotinfo[0];
99 } *_dl_tls_dtv_slotinfo_list;
100 /* Number of modules in the static TLS block.  */
101 EXTERN size_t _dl_tls_static_nelem;
102 /* Size of the static TLS block.  */
103 EXTERN size_t _dl_tls_static_size;
104 /* Size actually allocated in the static TLS block.  */
105 EXTERN size_t _dl_tls_static_used;
106 /* Alignment requirement of the static TLS block.  */
107 EXTERN size_t _dl_tls_static_align;
108 /* Function pointer for catching TLS errors.  */
109 EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
110
111 /* Number of additional entries in the slotinfo array of each slotinfo
112    list element.  A large number makes it almost certain take we never
113    have to iterate beyond the first element in the slotinfo list.  */
114 # define TLS_SLOTINFO_SURPLUS (62)
115
116 /* Number of additional slots in the dtv allocated.  */
117 # define DTV_SURPLUS    (14)
118
119 /* Initial dtv of the main thread, not allocated with normal malloc.  */
120 EXTERN void *_dl_initial_dtv;
121 /* Generation counter for the dtv.  */
122 EXTERN size_t _dl_tls_generation;
123
124 EXTERN void (*_dl_init_static_tls) (struct link_map *);
125
126 /* We have the auxiliary vector.  */
127 #define HAVE_AUX_VECTOR
128
129 /* We can assume that the kernel always provides the AT_UID, AT_EUID,
130    AT_GID, and AT_EGID values in the auxiliary vector from 2.4.0 or so on.  */
131 #if __ASSUME_AT_XID
132 # define HAVE_AUX_XID
133 #endif
134
135 /* We can assume that the kernel always provides the AT_SECURE value
136    in the auxiliary vector from 2.5.74 or so on.  */
137 #if __ASSUME_AT_SECURE
138 # define HAVE_AUX_SECURE
139 #endif
140
141 /* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
142    up the page size information.  */
143 #if __ASSUME_AT_PAGESIZE
144 # define HAVE_AUX_PAGESIZE
145 #endif
146
147 #endif