htl: Move cleanup stack to variable shared between libc and pthread
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 14 Jun 2020 12:56:54 +0000 (12:56 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 14 Jun 2020 15:53:04 +0000 (15:53 +0000)
commita50efac19a1eb0a9dc6f5917ae299c0fbbf3c46b
tree975cff922cf658c87dfc70e3b4fb490fdca8519b
parente2b9d562d1e024fda6d10f0f272521bf20fa664f
htl: Move cleanup stack to variable shared between libc and pthread

If libpthread gets loaded dynamically, the stack needs to already contain the
cleanup handlers of the main thread.

* htl/libc_pthread_init.c (__pthread_cleanup_stack): New per-thread variable.
* htl/Versions (libc): Add __pthread_cleanup_stack as private symbol.
* htl/pt-internal.h (struct __pthread): Remove cancelation_handlers
field.
(__pthread_cleanup_stack): Add variable declaration.
* htl/pt-alloc.c (initialize_pthread): Remove initialization of
cancelation_handlers field.
* htl/pt-cleanup.c (__pthread_get_cleanup_stack): Return the address of
__pthread_cleanup_stack instead of that of the cancelation_handlers
field.
* htl/forward.c: Include <pt-internal.h>.
(dummy_list): Remove variable.
(__pthread_get_cleanup_stack): Return the address of __pthread_cleanup_stack
instead of that of dummy_list.
htl/Versions
htl/forward.c
htl/libc_pthread_init.c
htl/pt-alloc.c
htl/pt-cleanup.c
htl/pt-internal.h