1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00
Commit Graph

10 Commits

Author SHA1 Message Date
miod
9b42e9bf97 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@
2023-12-08 19:14:36 +00:00
jmc
2811b70e6c spelling fixes; from paul tagliamonte 2022-12-27 07:44:56 +00:00
kettenis
874055c7f0 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@
2020-07-14 16:48:13 +00:00
guenther
c0197e40dd 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@
2019-05-10 13:29:21 +00:00
kettenis
53213268fe Add a member to be used by __cxa_thread_atexit(). Remove padding which would
now misalign things.

ok guenther@
2017-11-28 18:57:02 +00:00
guenther
18cf7fd763 fix typo in comment 2017-08-10 13:35:18 +00:00
visa
29879bdc83 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@
2017-04-20 16:07:52 +00:00
guenther
fe38b55cb0 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@
2016-05-07 19:05:21 +00:00
guenther
157c34b356 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.
2016-03-20 02:30:28 +00:00
guenther
f09ad35c18 Prefer the standardized <poll.h> over <sys/poll.h> 2015-09-14 08:16:14 +00:00