summaryrefslogtreecommitdiff
path: root/lib/libc/hidden
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-12-01 23:30:06 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-12-01 23:30:06 +0000
commit510705aa85a5914ad9570dc6e7c5145a4b6c399f (patch)
treedd2fc4c50d9e4c478db4ce70e93a86e81e3c2293 /lib/libc/hidden
parente9b4c199f94473f7595bfea33e4bd18a60939874 (diff)
Redo the calculation of the alignment and placement of static TLS data to
correctly take into account the segment p_align. Previously, anything with a size belong the natural alignment or with alignment larger than the natural one would either not be intialized correctly, be misaligned, or result in the TIB being misaligned. Problems reported by Charles Collicutt (charles (at) collicutt.co.uk) ok kettenis@
Diffstat (limited to 'lib/libc/hidden')
-rw-r--r--lib/libc/hidden/tib.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/hidden/tib.h b/lib/libc/hidden/tib.h
index 49a562dbad9..9c4be95fb96 100644
--- a/lib/libc/hidden/tib.h
+++ b/lib/libc/hidden/tib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tib.h,v 1.1 2016/05/07 19:05:22 guenther Exp $ */
+/* $OpenBSD: tib.h,v 1.2 2017/12/01 23:30:05 guenther Exp $ */
/*
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
*
@@ -23,10 +23,20 @@
__BEGIN_HIDDEN_DECLS
#ifndef PIC
-void _static_tls_init(char *_base);
+/*
+ * Handling for static TLS allocation in staticly linked programs
+ */
+/* Given the base of a TIB allocation, initialize the static TLS for a thread */
+struct tib *_static_tls_init(char *_base, void *_thread);
-/* size of static TLS allocation in staticly linked programs */
+/* size of static TLS allocation */
extern size_t _static_tls_size;
+
+/* alignment of static TLS allocation */
+extern int _static_tls_align;
+
+/* base-offset alignment of static TLS allocation */
+extern int _static_tls_align_offset;
#endif
#if ! TCB_HAVE_MD_GET