1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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.
This commit is contained in:
Samuel Thibault
2020-06-14 12:56:54 +00:00
parent e2b9d562d1
commit a50efac19a
6 changed files with 9 additions and 6 deletions

View File

@@ -23,6 +23,7 @@
#include <pthread-functions.h>
#include <libc-lock.h>
#include <fork.h>
#include <pt-internal.h>
/* Pointers to the libc functions. */
struct pthread_functions __libc_pthread_functions attribute_hidden;
@@ -140,6 +141,5 @@ strong_alias (__pthread_setcancelstate, pthread_setcancelstate);
FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
struct __pthread_cancelation_handler *dummy_list;
FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
(void), (), return &dummy_list);
(void), (), return &__pthread_cleanup_stack);