From a50efac19a1eb0a9dc6f5917ae299c0fbbf3c46b Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 14 Jun 2020 12:56:54 +0000 Subject: 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 . (dummy_list): Remove variable. (__pthread_get_cleanup_stack): Return the address of __pthread_cleanup_stack instead of that of dummy_list. --- htl/libc_pthread_init.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'htl/libc_pthread_init.c') diff --git a/htl/libc_pthread_init.c b/htl/libc_pthread_init.c index cee92f76ee..f617c4e0be 100644 --- a/htl/libc_pthread_init.c +++ b/htl/libc_pthread_init.c @@ -19,6 +19,8 @@ #include #include +__thread struct __pthread_cancelation_handler *__pthread_cleanup_stack; + void __libc_pthread_init (const struct pthread_functions *functions) { -- cgit v1.2.3