This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Linuxthreads enable Altivec for setjmp/longjmp part 4 of5
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: Tom Gall <tgall at us dot ibm dot com>, dgm69 at us dot ibm dot com, Segher Boessenkoof <segher at kernel dot crashing dot org>
- Date: Fri, 30 Jan 2004 18:06:49 -0600
- Subject: [PATCH] Linuxthreads enable Altivec for setjmp/longjmp part 4 of5
- Organization: IBM LTC
- Reply-to: sjmunroe at vnet dot ibm dot com
Third try, part 4.
2004-01-29 Steven Munroe <sjmunroe@us.ibm.com>
* Makefile(libpthread-routines): Add ptcleanup
* ptlongjmp.c: Removed.
* ptcleanup.c: Copied __pthread_cleanup_upto to here. New file.
* sysdeps/pthread/pt-longjmp.c: Copied longjmp to here. New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions: New file.
Add longjmp, siglongjmp to GLIBC_2.3.4.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/pt-longjmp.c: New File.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions: New file.
Add longjmp, siglongjmp to GLIBC_2.3.4.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pt-longjmp.c: New File.
diff -urN libc23-cvstip-20040129/linuxthreads/Makefile libc23/linuxthreads/Makefile
--- libc23-cvstip-20040129/linuxthreads/Makefile 2004-01-01 12:43:01.000000000 -0600
+++ libc23/linuxthreads/Makefile 2004-01-29 13:13:37.000000000 -0600
@@ -49,7 +49,8 @@
ptw-lseek64 ptw-llseek ptw-msync ptw-nanosleep \
ptw-open ptw-open64 ptw-pause ptw-pread ptw-pread64 \
ptw-pwrite ptw-pwrite64 ptw-tcdrain ptw-wait \
- ptw-waitpid pt-system old_pthread_atfork pthread_atfork
+ ptw-waitpid pt-system old_pthread_atfork pthread_atfork \
+ ptcleanup
# Don't generate deps for calls with no sources. See sysdeps/unix/Makefile.
omit-deps = $(unix-syscalls:%=ptw-%)
diff -urN libc23-cvstip-20040129/linuxthreads/ptcleanup.c libc23/linuxthreads/ptcleanup.c
--- libc23-cvstip-20040129/linuxthreads/ptcleanup.c Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/ptcleanup.c Thu Jan 29 13:13:37 2004
@@ -0,0 +1,53 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix */
+/* threads for Linux. */
+/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Library General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU Library General Public License for more details. */
+
+/* Redefine siglongjmp and longjmp so that they interact correctly
+ with cleanup handlers */
+
+#include <setjmp.h>
+#include "pthread.h"
+#include "internals.h"
+
+void __pthread_cleanup_upto (__jmp_buf target, char *targetframe)
+{
+ pthread_descr self = thread_self();
+ struct _pthread_cleanup_buffer * c;
+
+ for (c = THREAD_GETMEM(self, p_cleanup);
+ c != NULL && _JMPBUF_UNWINDS(target, c);
+ c = c->__prev)
+ {
+#if _STACK_GROWS_DOWN
+ if ((char *) c <= targetframe)
+ {
+ c = NULL;
+ break;
+ }
+#elif _STACK_GROWS_UP
+ if ((char *) c >= targetframe)
+ {
+ c = NULL;
+ break;
+ }
+#else
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+#endif
+ c->__routine(c->__arg);
+ }
+ THREAD_SETMEM(self, p_cleanup, c);
+ if (THREAD_GETMEM(self, p_in_sighandler)
+ && _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler)))
+ THREAD_SETMEM(self, p_in_sighandler, NULL);
+}
+
diff -urN libc23-cvstip-20040129/linuxthreads/ptlongjmp.c libc23/linuxthreads/ptlongjmp.c
--- libc23-cvstip-20040129/linuxthreads/ptlongjmp.c Thu Jan 02 18:32:20 2003
+++ libc23/linuxthreads/ptlongjmp.c Wed Dec 31 17:00:00 1969
@@ -1,72 +0,0 @@
-/* Linuxthreads - a simple clone()-based implementation of Posix */
-/* threads for Linux. */
-/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
-/* */
-/* This program is free software; you can redistribute it and/or */
-/* modify it under the terms of the GNU Library General Public License */
-/* as published by the Free Software Foundation; either version 2 */
-/* of the License, or (at your option) any later version. */
-/* */
-/* This program is distributed in the hope that it will be useful, */
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
-/* GNU Library General Public License for more details. */
-
-/* Redefine siglongjmp and longjmp so that they interact correctly
- with cleanup handlers */
-
-#include <setjmp.h>
-#include "pthread.h"
-#include "internals.h"
-
-/* These functions are not declared anywhere since they shouldn't be
- used at another place but here. */
-extern void __libc_siglongjmp (sigjmp_buf env, int val)
- __attribute__ ((noreturn));
-extern void __libc_longjmp (sigjmp_buf env, int val)
- __attribute__ ((noreturn));
-
-
-void __pthread_cleanup_upto (__jmp_buf target, char *targetframe)
-{
- pthread_descr self = thread_self();
- struct _pthread_cleanup_buffer * c;
-
- for (c = THREAD_GETMEM(self, p_cleanup);
- c != NULL && _JMPBUF_UNWINDS(target, c);
- c = c->__prev)
- {
-#if _STACK_GROWS_DOWN
- if ((char *) c <= targetframe)
- {
- c = NULL;
- break;
- }
-#elif _STACK_GROWS_UP
- if ((char *) c >= targetframe)
- {
- c = NULL;
- break;
- }
-#else
-# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
-#endif
- c->__routine(c->__arg);
- }
- THREAD_SETMEM(self, p_cleanup, c);
- if (THREAD_GETMEM(self, p_in_sighandler)
- && _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler)))
- THREAD_SETMEM(self, p_in_sighandler, NULL);
-}
-
-#ifdef SHARED
-void siglongjmp (sigjmp_buf env, int val)
-{
- __libc_siglongjmp (env, val);
-}
-
-void longjmp (jmp_buf env, int val)
-{
- __libc_longjmp (env, val);
-}
-#endif
diff -urN libc23-cvstip-20040129/linuxthreads/sysdeps/pthread/ptlongjmp.c libc23/linuxthreads/sysdeps/pthread/ptlongjmp.c
--- libc23-cvstip-20040129/linuxthreads/sysdeps/pthread/ptlongjmp.c Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/sysdeps/pthread/ptlongjmp.c Thu Jan 29 13:13:37 2004
@@ -0,0 +1,39 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix */
+/* threads for Linux. */
+/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Library General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU Library General Public License for more details. */
+
+/* Redefine siglongjmp and longjmp so that they interact correctly
+ with cleanup handlers */
+
+#include <setjmp.h>
+#include "pthread.h"
+#include "internals.h"
+
+/* These functions are not declared anywhere since they shouldn't be
+ used at another place but here. */
+extern void __libc_siglongjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+extern void __libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+#ifdef SHARED
+void siglongjmp (sigjmp_buf env, int val)
+{
+ __libc_siglongjmp (env, val);
+}
+
+void longjmp (jmp_buf env, int val)
+{
+ __libc_longjmp (env, val);
+}
+#endif
diff -urN libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
--- libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions Thu Jan 29 13:13:37 2004
@@ -0,0 +1,5 @@
+libpthread {
+ GLIBC_2.3.4 {
+ longjmp; siglongjmp;
+ }
+}
diff -urN libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/ptlongjmp.c libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/ptlongjmp.c
--- libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/ptlongjmp.c Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/ptlongjmp.c Fri Jan 30 14:36:28 2004
@@ -0,0 +1,64 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix */
+/* threads for Linux. */
+/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Library General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU Library General Public License for more details. */
+
+/* Redefine siglongjmp and longjmp so that they interact correctly
+ with cleanup handlers */
+/* Derived from linuxthreads/ptlongjmp.c & added AltiVec/VMX versioning. */
+#include "pthread.h"
+#include <setjmp.h>
+#include <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3_4)
+
+/* These functions are not declared anywhere since they shouldn't be
+ used at another place but here. */
+extern void __novmx__libc_siglongjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+extern void __novmx__libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+
+void __novmx_siglongjmp (sigjmp_buf env, int val)
+{
+ __novmx__libc_siglongjmp (env, val);
+}
+
+void __novmx_longjmp (jmp_buf env, int val)
+{
+ __novmx__libc_longjmp (env, val);
+}
+
+symbol_version (__novmx_longjmp,longjmp,GLIBC_2.0);
+symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.0);
+#endif /* defined SHARED && SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3_4) ) */
+
+/* These functions are not declared anywhere since they shouldn't be
+ used at another place but here. */
+extern void __vmx__libc_siglongjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+extern void __vmx__libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+#ifdef SHARED
+void __vmx_siglongjmp (sigjmp_buf env, int val)
+{
+ __vmx__libc_siglongjmp (env, val);
+}
+
+void __vmxlongjmp (jmp_buf env, int val)
+{
+ __vmx__libc_longjmp (env, val);
+}
+#endif
+default_symbol_version (__vmx_longjmp,longjmp,GLIBC_2.3.4);
+default_symbol_version (__vmx_siglongjmp,siglongjmp,GLIBC_2.3.4);
diff -urN libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
--- libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions Thu Jan 29 13:13:37 2004
@@ -0,0 +1,5 @@
+libpthread {
+ GLIBC_2.3.4 {
+ longjmp; siglongjmp;
+ }
+}
diff -urN libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/ptlongjmp.c libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/ptlongjmp.c
--- libc23-cvstip-20040129/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/ptlongjmp.c Wed Dec 31 17:00:00 1969
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/ptlongjmp.c Fri Jan 30 14:36:56 2004
@@ -0,0 +1,65 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix */
+/* threads for Linux. */
+/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Library General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU Library General Public License for more details. */
+
+/* Redefine siglongjmp and longjmp so that they interact correctly
+ with cleanup handlers */
+/* Derived from linuxthreads/ptlongjmp.c & added AltiVec/VMX versioning. */
+#include "pthread.h"
+#include <setjmp.h>
+#include <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libpthread, GLIBC_2_3, GLIBC_2_3_4)
+
+/* These functions are not declared anywhere since they shouldn't be
+ used at another place but here. */
+extern void __novmx__libc_siglongjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+extern void __novmx__libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+
+void __novmxsiglongjmp (sigjmp_buf env, int val)
+{
+ __novmx__libc_siglongjmp (env, val);
+}
+
+void __novmxlongjmp (jmp_buf env, int val)
+{
+ __novmx__libc_longjmp (env, val);
+}
+
+symbol_version (__novmxlongjmp,longjmp,GLIBC_2.3);
+symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.3);
+#endif /* defined SHARED && SHLIB_COMPAT (libpthread, GLIBC_2_3, GLIBC_2_3_4) */
+
+/* These functions are not declared anywhere since they shouldn't be
+ used at another place but here. */
+extern void __vmx__libc_siglongjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+extern void __vmx__libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+
+#ifdef SHARED
+void __vmx_siglongjmp (sigjmp_buf env, int val)
+{
+ __vmx__libc_siglongjmp (env, val);
+}
+
+void __vmx_longjmp (jmp_buf env, int val)
+{
+ __vmx__libc_longjmp (env, val);
+}
+#endif
+default_symbol_version (__vmx_longjmp,longjmp,GLIBC_2.3.4);
+default_symbol_version (__vmx_siglongjmp,siglongjmp,GLIBC_2.3.4);