fix static linking dependency bloat with cancellation

previously, pthread_cleanup_push/pop were pulling in all of
pthread_create due to dependency on the __pthread_unwind_next
function. this was not needed, as cancellation cleanup handlers can
never be called unless pthread_exit or pthread_cancel is reachable.
This commit is contained in:
Rich Felker 2011-08-03 19:45:21 -04:00
commit 730bee725a
5 changed files with 21 additions and 14 deletions

View file

@ -3,10 +3,22 @@
#ifdef __pthread_register_cancel #ifdef __pthread_register_cancel
#undef __pthread_register_cancel #undef __pthread_register_cancel
#undef __pthread_unregister_cancel #undef __pthread_unregister_cancel
#undef __pthread_unwind_next
#define __pthread_register_cancel __pthread_register_cancel_3 #define __pthread_register_cancel __pthread_register_cancel_3
#define __pthread_unregister_cancel __pthread_unregister_cancel_3 #define __pthread_unregister_cancel __pthread_unregister_cancel_3
#define __pthread_unwind_next __pthread_unwind_next_3
#endif #endif
static void dummy(struct __ptcb *cb)
{
}
weak_alias(dummy, __pthread_do_unwind);
void __pthread_unwind_next(struct __ptcb *cb)
{
__pthread_do_unwind(cb);
}
void __pthread_register_cancel(struct __ptcb *cb) void __pthread_register_cancel(struct __ptcb *cb)
{ {
struct pthread *self = pthread_self(); struct pthread *self = pthread_self();

View file

@ -14,3 +14,11 @@ __pthread_unregister_cancel:
call __pthread_unregister_cancel_3 call __pthread_unregister_cancel_3
popl %eax popl %eax
ret ret
.global __pthread_unwind_next
.type __pthread_unwind_next,@function
__pthread_unwind_next:
pushl %eax
call __pthread_unwind_next_3
popl %eax
ret

View file

@ -1,8 +0,0 @@
.text
.global __pthread_unwind_next
.type __pthread_unwind_next,@function
__pthread_unwind_next:
pushl %eax
call __pthread_unwind_next_3
popl %eax
ret

View file

@ -8,12 +8,7 @@ weak_alias(dummy_0, __synccall_lock);
weak_alias(dummy_0, __synccall_unlock); weak_alias(dummy_0, __synccall_unlock);
weak_alias(dummy_0, __pthread_tsd_run_dtors); weak_alias(dummy_0, __pthread_tsd_run_dtors);
#ifdef __pthread_unwind_next void __pthread_do_unwind(struct __ptcb *cb)
#undef __pthread_unwind_next
#define __pthread_unwind_next __pthread_unwind_next_3
#endif
void __pthread_unwind_next(struct __ptcb *cb)
{ {
pthread_t self = pthread_self(); pthread_t self = pthread_self();
int n; int n;