xref: /openbsd-src/lib/libc/hidden/tib.h (revision 46035553bfdd96e63c94e32da0210227ec2e3cf1)
1 /*	$OpenBSD: tib.h,v 1.3 2019/06/02 01:03:01 guenther Exp $	*/
2 /*
3  * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef	_LIBC_TIB_H_
19 #define	_LIBC_TIB_H_
20 
21 #include_next <tib.h>
22 
23 __BEGIN_HIDDEN_DECLS
24 
25 #ifndef PIC
26 /*
27  * Handling for static TLS allocation in staticly linked programs
28  */
29 /* Given the base of a TIB allocation, initialize the static TLS for a thread */
30 struct tib *_static_tls_init(char *_base, void *_thread);
31 
32 /* size of static TLS allocation */
33 extern size_t	_static_tls_size;
34 
35 /* alignment of static TLS allocation */
36 extern int	_static_tls_align;
37 
38 /* base-offset alignment of static TLS allocation */
39 extern int	_static_tls_align_offset;
40 #endif
41 
42 /* saved handle to callbacks from ld.so */
43 extern const dl_cb *_dl_cb;
44 
45 #if ! TCB_HAVE_MD_GET
46 /*
47  * For archs without a fast TCB_GET(): the pointer to the TCB in
48  * single-threaded programs, whether linked staticly or dynamically.
49  */
50 extern void	*_libc_single_tcb;
51 #endif
52 
53 __END_HIDDEN_DECLS
54 
55 
56 PROTO_NORMAL(__get_tcb);
57 PROTO_NORMAL(__set_tcb);
58 
59 #endif /* _LIBC_TIB_H_ */
60