]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use __libc_ptf_call in _longjmp_unwind
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Sep 2015 19:22:36 +0000 (12:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Sep 2015 19:22:47 +0000 (12:22 -0700)
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

* sysdeps/nptl/jmp-unwind.c: Include <libc-lock.h> instead of
<nptl/pthreadP.h>.
(_longjmp_unwind): Use __libc_ptf_call.
* sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise.

ChangeLog
sysdeps/nptl/jmp-unwind.c
sysdeps/unix/sysv/linux/s390/jmp-unwind.c

index 764af43e1e1c7d1027fb0da5ae19aa929600482e..03e23409edac2f1dfb259824a1b075a70ee38888 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * sysdeps/nptl/jmp-unwind.c: Include <libc-lock.h> instead of
+       <nptl/pthreadP.h>.
+       (_longjmp_unwind): Use __libc_ptf_call.
+       * sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise.
+
 2015-09-18  David Lamparter  <equinox-gentoo@diac24.net>
 
        * sysdeps/arm/setjmp.S: Change PIC to SHARED.
index 8e019867a7fb8f9605aafb807bb73739c8434951..291598956d3dc9496362d7ee561e27c9a92d9a57 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <setjmp.h>
 #include <stddef.h>
-#include <nptl/pthreadP.h>
+#include <libc-lock.h>
 
 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);
 }
index 52fe1019f2e16b3e7741f87f79a9a1863b2d39a3..4b8ad286307a51af5cd980aeb0eb93078172e2a9 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <setjmp.h>
 #include <stddef.h>
-#include <nptl/pthreadP.h>
+#include <libc-lock.h>
 
 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);
 }