From patchwork Fri Sep 18 11:29:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 8767 Received: (qmail 67342 invoked by alias); 18 Sep 2015 11:29:36 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 67327 invoked by uid 89); 18 Sep 2015 11:29:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga14.intel.com X-ExtLoop1: 1 Date: Fri, 18 Sep 2015 04:29:33 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] Use __libc_ptf_call in _longjmp_unwind Message-ID: <20150918112933.GA31869@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Use __libc_ptf_call in _longjmp_unwind to avoid duplicated logic. On x86-64, I got jmp-unwind.os: _longjmp_unwind: movl __libc_pthread_functions_init(%rip), %eax testl %eax, %eax jne .L4 rep ret .L4: movq 304+__libc_pthread_functions(%rip), %rax movq %rsp, %rsi ror $2*8+1, %rax xor %fs:48, %rax jmp *%rax jmp-unwind.o: _longjmp_unwind: movl $__pthread_cleanup_upto, %eax testq %rax, %rax je .L1 movq %rsp, %rsi jmp __pthread_cleanup_upto .L1: rep ret OK for master? H.J. --- * sysdeps/nptl/jmp-unwind.c: Include instead of . (_longjmp_unwind): Use __libc_ptf_call. * sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise. --- sysdeps/nptl/jmp-unwind.c | 12 +++--------- sysdeps/unix/sysv/linux/s390/jmp-unwind.c | 10 ++-------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sysdeps/nptl/jmp-unwind.c b/sysdeps/nptl/jmp-unwind.c index 8e01986..2915989 100644 --- a/sysdeps/nptl/jmp-unwind.c +++ b/sysdeps/nptl/jmp-unwind.c @@ -18,7 +18,7 @@ #include #include -#include +#include extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); #pragma weak __pthread_cleanup_upto @@ -27,12 +27,6 @@ extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); void _longjmp_unwind (jmp_buf env, int val) { -#ifdef SHARED - if (__libc_pthread_functions_init) - PTHFCT_CALL (ptr___pthread_cleanup_upto, (env->__jmpbuf, - CURRENT_STACK_FRAME)); -#else - if (__pthread_cleanup_upto != NULL) - __pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME); -#endif + __libc_ptf_call (__pthread_cleanup_upto, (env->__jmpbuf, + CURRENT_STACK_FRAME), 0); } diff --git a/sysdeps/unix/sysv/linux/s390/jmp-unwind.c b/sysdeps/unix/sysv/linux/s390/jmp-unwind.c index 52fe101..4b8ad28 100644 --- a/sysdeps/unix/sysv/linux/s390/jmp-unwind.c +++ b/sysdeps/unix/sysv/linux/s390/jmp-unwind.c @@ -18,7 +18,7 @@ #include #include -#include +#include extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); #pragma weak __pthread_cleanup_upto @@ -29,11 +29,5 @@ _longjmp_unwind (jmp_buf env, int val) { char local_var; -#ifdef SHARED - if (__libc_pthread_functions_init) - PTHFCT_CALL (ptr___pthread_cleanup_upto, (env->__jmpbuf, &local_var)); -#else - if (__pthread_cleanup_upto != NULL) - __pthread_cleanup_upto (env->__jmpbuf, &local_var); -#endif + __libc_ptf_call (__pthread_cleanup_upto, (env->__jmpbuf, &local_var), 0); }