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