diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-08-03 19:45:21 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-08-03 19:45:21 -0400 |
commit | 730bee725a770b543181424b52203dd1634ab5d1 (patch) | |
tree | ef0eac3484242a94ce6854423c6b1cb3ecfcc76a | |
parent | fc0ecd35d8e0041c81bbe08c10c7fcb946da85e0 (diff) | |
download | musl-730bee725a770b543181424b52203dd1634ab5d1.tar.gz musl-730bee725a770b543181424b52203dd1634ab5d1.tar.xz musl-730bee725a770b543181424b52203dd1634ab5d1.zip |
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.
-rw-r--r-- | src/thread/cancellation.c | 12 | ||||
-rw-r--r-- | src/thread/cancellation3.c | 0 | ||||
-rw-r--r-- | src/thread/i386/cancellation2.s | 8 | ||||
-rw-r--r-- | src/thread/i386/cancellation3.s | 8 | ||||
-rw-r--r-- | src/thread/pthread_create.c | 7 |
5 files changed, 21 insertions, 14 deletions
diff --git a/src/thread/cancellation.c b/src/thread/cancellation.c index 4976fedc..6dfee539 100644 --- a/src/thread/cancellation.c +++ b/src/thread/cancellation.c @@ -3,10 +3,22 @@ #ifdef __pthread_register_cancel #undef __pthread_register_cancel #undef __pthread_unregister_cancel +#undef __pthread_unwind_next #define __pthread_register_cancel __pthread_register_cancel_3 #define __pthread_unregister_cancel __pthread_unregister_cancel_3 +#define __pthread_unwind_next __pthread_unwind_next_3 #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) { struct pthread *self = pthread_self(); diff --git a/src/thread/cancellation3.c b/src/thread/cancellation3.c deleted file mode 100644 index e69de29b..00000000 --- a/src/thread/cancellation3.c +++ /dev/null diff --git a/src/thread/i386/cancellation2.s b/src/thread/i386/cancellation2.s index 4e4438b5..beeffb91 100644 --- a/src/thread/i386/cancellation2.s +++ b/src/thread/i386/cancellation2.s @@ -14,3 +14,11 @@ __pthread_unregister_cancel: call __pthread_unregister_cancel_3 popl %eax ret + +.global __pthread_unwind_next +.type __pthread_unwind_next,@function +__pthread_unwind_next: + pushl %eax + call __pthread_unwind_next_3 + popl %eax + ret diff --git a/src/thread/i386/cancellation3.s b/src/thread/i386/cancellation3.s deleted file mode 100644 index 88340224..00000000 --- a/src/thread/i386/cancellation3.s +++ /dev/null @@ -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 diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index adef510c..a6afd1e5 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -8,12 +8,7 @@ weak_alias(dummy_0, __synccall_lock); weak_alias(dummy_0, __synccall_unlock); weak_alias(dummy_0, __pthread_tsd_run_dtors); -#ifdef __pthread_unwind_next -#undef __pthread_unwind_next -#define __pthread_unwind_next __pthread_unwind_next_3 -#endif - -void __pthread_unwind_next(struct __ptcb *cb) +void __pthread_do_unwind(struct __ptcb *cb) { pthread_t self = pthread_self(); int n; |