History log of /openbsd-current/include/tib.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.10 08-Dec-2023 miod

Make sure TIB_INIT correctly initializes tib_thread_flags; regression
introduced in 1.3, causing sporadic pthread_main_np() erroneous results
(and possibly more subtle problems).

With and ok kurt@


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.9 27-Dec-2022 jmc

spelling fixes; from paul tagliamonte


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.8 14-Jul-2020 kettenis

Fix TIB/TCB on powerpc64. Some bright sould decided that the TCB should
be 8 bytes in the 64-bit ABI just like in the 32-bit ABI. But that means
there is no "spare" word in the TCB that we can use to store a pointer
to our struct pthread. So we have to treat powerpc64 special.

Also recognize that the thread pointer points 0x7000 bytes after the TCB.
Since the TCB is 8 bytes this means that TCB_OFFSET should be 0x7008.

Pointed out by guenther@; ok deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.7 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.6 28-Nov-2017 kettenis

Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@


Revision tags: OPENBSD_6_2_BASE
# 1.5 10-Aug-2017 guenther

fix typo in comment


# 1.4 20-Apr-2017 visa

Get TCB address using the RDHWR instruction instead of __get_tcb().
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.

The kernel counterpart of this change must be in place before
using this diff!

With guenther@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.3 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.2 20-Mar-2016 guenther

Prepare for future ld.so/libc bump: update <tib.h> with the definitions
that will be needed and make libpthread work when ld.so/libc.a provide an
initial TIB.


Revision tags: OPENBSD_5_9_BASE
# 1.1 14-Sep-2015 guenther

Prefer the standardized <poll.h> over <sys/poll.h>


# 1.9 27-Dec-2022 jmc

spelling fixes; from paul tagliamonte


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.8 14-Jul-2020 kettenis

Fix TIB/TCB on powerpc64. Some bright sould decided that the TCB should
be 8 bytes in the 64-bit ABI just like in the 32-bit ABI. But that means
there is no "spare" word in the TCB that we can use to store a pointer
to our struct pthread. So we have to treat powerpc64 special.

Also recognize that the thread pointer points 0x7000 bytes after the TCB.
Since the TCB is 8 bytes this means that TCB_OFFSET should be 0x7008.

Pointed out by guenther@; ok deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.7 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.6 28-Nov-2017 kettenis

Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@


Revision tags: OPENBSD_6_2_BASE
# 1.5 10-Aug-2017 guenther

fix typo in comment


# 1.4 20-Apr-2017 visa

Get TCB address using the RDHWR instruction instead of __get_tcb().
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.

The kernel counterpart of this change must be in place before
using this diff!

With guenther@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.3 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.2 20-Mar-2016 guenther

Prepare for future ld.so/libc bump: update <tib.h> with the definitions
that will be needed and make libpthread work when ld.so/libc.a provide an
initial TIB.


Revision tags: OPENBSD_5_9_BASE
# 1.1 14-Sep-2015 guenther

Prefer the standardized <poll.h> over <sys/poll.h>


# 1.8 14-Jul-2020 kettenis

Fix TIB/TCB on powerpc64. Some bright sould decided that the TCB should
be 8 bytes in the 64-bit ABI just like in the 32-bit ABI. But that means
there is no "spare" word in the TCB that we can use to store a pointer
to our struct pthread. So we have to treat powerpc64 special.

Also recognize that the thread pointer points 0x7000 bytes after the TCB.
Since the TCB is 8 bytes this means that TCB_OFFSET should be 0x7008.

Pointed out by guenther@; ok deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.7 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.6 28-Nov-2017 kettenis

Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@


Revision tags: OPENBSD_6_2_BASE
# 1.5 10-Aug-2017 guenther

fix typo in comment


# 1.4 20-Apr-2017 visa

Get TCB address using the RDHWR instruction instead of __get_tcb().
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.

The kernel counterpart of this change must be in place before
using this diff!

With guenther@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.3 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.2 20-Mar-2016 guenther

Prepare for future ld.so/libc bump: update <tib.h> with the definitions
that will be needed and make libpthread work when ld.so/libc.a provide an
initial TIB.


Revision tags: OPENBSD_5_9_BASE
# 1.1 14-Sep-2015 guenther

Prefer the standardized <poll.h> over <sys/poll.h>


# 1.7 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.6 28-Nov-2017 kettenis

Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@


Revision tags: OPENBSD_6_2_BASE
# 1.5 10-Aug-2017 guenther

fix typo in comment


# 1.4 20-Apr-2017 visa

Get TCB address using the RDHWR instruction instead of __get_tcb().
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.

The kernel counterpart of this change must be in place before
using this diff!

With guenther@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.3 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.2 20-Mar-2016 guenther

Prepare for future ld.so/libc bump: update <tib.h> with the definitions
that will be needed and make libpthread work when ld.so/libc.a provide an
initial TIB.


Revision tags: OPENBSD_5_9_BASE
# 1.1 14-Sep-2015 guenther

Prefer the standardized <poll.h> over <sys/poll.h>