aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog81
-rw-r--r--linuxthreads/ChangeLog10
-rw-r--r--linuxthreads/Makefile3
-rw-r--r--linuxthreads/ptcleanup.c (renamed from linuxthreads/ptlongjmp.c)22
-rw-r--r--linuxthreads/sysdeps/pthread/ptlongjmp.c39
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/powerpc/Versions5
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c70
-rw-r--r--sysdeps/powerpc/Dist2
-rw-r--r--sysdeps/powerpc/Makefile6
-rw-r--r--sysdeps/powerpc/Versions11
-rw-r--r--sysdeps/powerpc/bits/setjmp.h28
-rw-r--r--sysdeps/powerpc/longjmp.c62
-rw-r--r--sysdeps/powerpc/novmx-longjmp.c68
-rw-r--r--sysdeps/powerpc/novmx-sigjmp.c50
-rw-r--r--sysdeps/powerpc/novmxsetjmp.h133
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp-common.S59
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp.S57
-rw-r--r--sysdeps/powerpc/powerpc32/bsd-_setjmp.S42
-rw-r--r--sysdeps/powerpc/powerpc32/bsd-setjmp.S46
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S150
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp.S76
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp-common.S168
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp.S78
-rw-r--r--sysdeps/powerpc/powerpc32/setjmp-common.S59
-rw-r--r--sysdeps/powerpc/powerpc32/setjmp.S59
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S153
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp.S79
-rw-r--r--sysdeps/powerpc/powerpc64/bsd-_setjmp.S46
-rw-r--r--sysdeps/powerpc/powerpc64/bsd-setjmp.S42
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp-common.S171
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp.S97
-rw-r--r--sysdeps/powerpc/sigjmp.c46
32 files changed, 1660 insertions, 358 deletions
diff --git a/ChangeLog b/ChangeLog
index aafa6d8a62..be57e291c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,84 @@
+2004-02-13 Steven Munroe <sjmunroe@us.ibm.com>
+
+ * sysdeps/powerpc/powerpc64/__longjmp-common.S: New file.
+ * sysdeps/powerpc/powerpc64/__longjmp.S [NOT_IN_libc](__longjmp):
+ Non-versioned __longjmp for rtld-__longjmp.
+ [!NOT_IN_libc](__vmx__longjmp): Add VMX reg support and define as
+ default version of __longjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)]
+ (__novmx__longjmp): Original version of __longjmp.
+ * sysdeps/powerpc/powerpc64/bsd-_setjmp.S [NOT_IN_libc](_setjmp):
+ Non-versioned _setjmp for rtld-_setjmp.
+ [!NOT_IN_libc](__vmx_setjmp): Branch to __vmx__sigsetjmp and define
+ as default version of _setjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)]
+ (__novmx_setjmp): Original version of _setjmp.
+ * sysdeps/powerpc/powerpc64/bsd-setjmp.S (__vmxsetjmp): Branch to
+ __vmx__sigsetjmp and define as default version of setjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)]
+ (__novmxsetjmp): Original version of setjmp.
+ * sysdeps/powerpc/powerpc64/setjmp-common.S: New file.
+ * sysdeps/powerpc/powerpc64/setjmp.S [NOT_IN_libc](__setjmp):
+ Non-versioned __sigsetjmp for rtld-setjmp.
+ [!NOT_IN_libc](__vmx__sigsetjmp): Add VMX reg support and define
+ as default version of __sigsetjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)]
+ (__novmx__sigsetjmp): Original version of __sigsetjmp.
+
+ * sysdeps/powerpc/powerpc32/__longjmp-common.S: New File
+ * sysdeps/powerpc/powerpc32/__longjmp.S [NOT_IN_libc](__longjmp):
+ Non-versioned __longjmp for rtld-__longjmp.
+ [!NOT_IN_libc](__vmx__longjmp): Add VMX reg support and define as
+ default version of __longjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmx__longjmp): Original version of __longjmp.
+ * sysdeps/powerpc/powerpc32/bsd-_setjmp.S [NOT_IN_libc](_setjmp):
+ Non-versioned _setjmp for rtld-_setjmp.
+ [!NOT_IN_libc](__vmx_setjmp): Branch to __vmx__sigsetjmp and define
+ as default version of _setjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmx_setjmp): Original version of _setjmp.
+ * sysdeps/powerpc/powerpc32/bsd-setjmp.S (__vmxsetjmp): Branch to
+ __vmx__sigsetjmp and define as default version of setjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmxsetjmp): Original version of setjmp.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/__longjmp.S [NOT_IN_libc](__longjmp):
+ Non-versioned __longjmp for rtld-__longjmp.
+ [!NOT_IN_libc](__vmx__longjmp): Add VMX reg support and define as
+ default version of __longjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmx__longjmp): Original version of __longjmp.
+ * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/setjmp.S [NOT_IN_libc](__setjmp):
+ Non-versioned __sigsetjmp for rtld-setjmp.
+ [!NOT_IN_libc](__vmx__sigsetjmp): Add VMX reg support and define
+ as default version of __sigsetjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmx__sigsetjmp): Original version of __sigsetjmp.
+ * sysdeps/powerpc/powerpc32/setjmp-common.S: New file.
+ * sysdeps/powerpc/powerpc32/setjmp.S [NOT_IN_libc](__setjmp):
+ Non-versioned __sigsetjmp for rtld-setjmp.
+ [!NOT_IN_libc](__vmx__sigsetjmp): Add VMX reg support and define
+ as default version of __sigsetjmp.
+ [SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)]
+ (__novmx__sigsetjmp): Original version of __sigsetjmp.
+
+ * sysdeps/powerpc/Dist: New File.
+ * sysdeps/powerpc/Makefile (sysdep_routines): Add novmx-longjmp.c
+ and novmx-sigjmp.c
+ * sysdeps/powerpc/Versions (libc): To GLIBC_2.3_4 add _longjmp,
+ __sigsetjmp, _setjmp, longjmp, and setjmp. To GLIBC_PRIVATE add
+ __novmx__libc_longjmp, __novmx__libc_siglongjmp, __vmx__libc_longjmp,
+ and __vmx__libc_siglongjmp.
+ * sysdeps/powerpc/bits/setjmp.h: Define JB_VRSAVE, JB_VRS, and adjust
+ JB_SIZE to add VMX regs to __jmp_buf.
+ * sysdeps/powerpc/longjmp.c: New file.
+ * sysdeps/powerpc/novmxsetjmp.h: New file.
+ * sysdeps/powerpc/novmx-longjmp.c: New file.
+ * sysdeps/powerpc/novmx-sigjmp.c: New file.
+ * sysdeps/powerpc/sigjmp.c: New file.
+
2004-02-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.c (__lrintf, lrintf):
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 827fdd9f97..b783ddc528 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,13 @@
+2004-02-10 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/ptlongjmp.c: Copied longjmp to here. New file.
+ * sysdeps/unix/sysv/linux/powerpc/Versions: New file.
+ Version longjmp, siglongjmp for GLIBC_2.3.4.
+ * sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c: New File.
+
2004-01-22 Andreas Jaeger <aj@suse.de>
* spinlock.c (__pthread_lock): Fix contraint to avoid warning.
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index 7b2e1048da..201440076f 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -49,7 +49,8 @@ libpthread-routines := attr cancel condvar join manager mutex ptfork \
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 --git a/linuxthreads/ptlongjmp.c b/linuxthreads/ptcleanup.c
index c89d28bccd..9fde2555b1 100644
--- a/linuxthreads/ptlongjmp.c
+++ b/linuxthreads/ptcleanup.c
@@ -1,6 +1,6 @@
/* Linuxthreads - a simple clone()-based implementation of Posix */
/* threads for Linux. */
-/* Copyright (C) 1998 Xavier Leroy (Xavier.Leroy@inria.fr) */
+/* Copyright (C) 1998, 2004 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 */
@@ -19,14 +19,6 @@
#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();
@@ -58,15 +50,3 @@ void __pthread_cleanup_upto (__jmp_buf target, char *targetframe)
&& _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 --git a/linuxthreads/sysdeps/pthread/ptlongjmp.c b/linuxthreads/sysdeps/pthread/ptlongjmp.c
new file mode 100644
index 0000000000..a2a56b8d9c
--- /dev/null
+++ b/linuxthreads/sysdeps/pthread/ptlongjmp.c
@@ -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 --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/Versions b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/Versions
new file mode 100644
index 0000000000..326307c30c
--- /dev/null
+++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -0,0 +1,5 @@
+libpthread {
+ GLIBC_2.3.4 {
+ longjmp; siglongjmp;
+ }
+}
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c
new file mode 100644
index 0000000000..d22be13145
--- /dev/null
+++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/ptlongjmp.c
@@ -0,0 +1,70 @@
+/* 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 <bits/wordsize.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);
+}
+
+# if __WORDSIZE == 64
+symbol_version (__novmx_longjmp,longjmp,GLIBC_2.3);
+symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.3);
+# else
+symbol_version (__novmx_longjmp,longjmp,GLIBC_2.0);
+symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.0);
+# endif
+#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 --git a/sysdeps/powerpc/Dist b/sysdeps/powerpc/Dist
new file mode 100644
index 0000000000..ba909df26f
--- /dev/null
+++ b/sysdeps/powerpc/Dist
@@ -0,0 +1,2 @@
+novmx-longjmp.c
+novmx-sigjmp.c
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index f0b37bbdf9..616458f136 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -18,6 +18,12 @@ sysdep_routines += dl-machine
sysdep-rtld-routines += dl-machine
endif
+ifeq ($(subdir),setjmp)
+ifeq (yes,$(build-shared))
+sysdep_routines += novmx-longjmp novmx-sigjmp
+endif
+endif
+
ifeq ($(subdir),csu)
# get offset to rtld_global._dl_hwcap
gen-as-const-headers += rtld-global-offsets.sym
diff --git a/sysdeps/powerpc/Versions b/sysdeps/powerpc/Versions
index b7d5bf904b..47c2c3e6e7 100644
--- a/sysdeps/powerpc/Versions
+++ b/sysdeps/powerpc/Versions
@@ -4,3 +4,14 @@ libm {
__fe_dfl_env; __fe_enabled_env; __fe_nonieee_env; __fe_nomask_env;
}
}
+
+libc {
+ GLIBC_2.3.4 {
+ _longjmp; __sigsetjmp; _setjmp;
+ longjmp; setjmp;
+ }
+ GLIBC_PRIVATE {
+ __novmx__libc_longjmp; __novmx__libc_siglongjmp;
+ __vmx__libc_longjmp; __vmx__libc_siglongjmp;
+ }
+}
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h
index f849fe23ff..3134916a51 100644
--- a/sysdeps/powerpc/bits/setjmp.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,22 +37,38 @@
# define JB_LR 2 /* The address we will return to */
# if __WORDSIZE == 64
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_CR 21 /* Condition code registers. */
+# define JB_CR 21 /* Condition code registers with the VRSAVE at */
+ /* offset 172 (low half of the double word. */
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_SIZE (40*8)
+# define JB_SIZE (64 * 8) /* As per PPC64-VMX ABI. */
+# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */
+ /* 168 (high half of the double word). */
+# define JB_VRS 40 /* VRs 20 through 31 are saved, 12*4 words total. */
# else
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */
# define JB_CR 21 /* Condition code registers. */
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
-# define JB_SIZE (58*4)
+# define JB_SIZE ((64 + (12 * 4)) * 4)
+# define JB_VRSAVE 62
+# define JB_VRS 64
# endif
#endif
+
+/* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI
+ the vrsave must be at byte 248 & v20 at byte 256. So we must pad this
+ correctly on 32 bit. It also insists that vecregs are only gauranteed
+ 4 byte alignment so we need to use vperm in the setjmp/longjmp routines.
+ We have to version the code because members like int __mask_was_saved
+ in the jmp_buf will move as jmp_buf is now larger than 248 bytes. We
+ cannot keep the altivec jmp_buf backward compatible with the jmp_buf. */
#ifndef _ASM
# if __WORDSIZE == 64
-typedef long int __jmp_buf[40];
+typedef long int __jmp_buf[64] __attribute__ ((__aligned__ (16)));
# else
-typedef long int __jmp_buf[58];
+/* The alignment is not essential, i.e.the buffer can be copied to a 4 byte
+ aligned buffer as per the ABI it is just added for performance reasons. */
+typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16)));
# endif
#endif
diff --git a/sysdeps/powerpc/longjmp.c b/sysdeps/powerpc/longjmp.c
new file mode 100644
index 0000000000..e2d7556fd2
--- /dev/null
+++ b/sysdeps/powerpc/longjmp.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Versioned copy of sysdeps/generic/longjmp.c modified for AltiVec support. */
+
+#include <shlib-compat.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+extern void __vmx__longjmp (__jmp_buf __env, int __val);
+ __attribute__ ((noreturn));
+extern void __vmx__libc_longjmp (sigjmp_buf env, int val);
+ __attribute__ ((noreturn));
+libc_hidden_proto (__vmx__libc_longjmp)
+
+/* Set the signal mask to the one specified in ENV, and jump
+ to the position specified in ENV, causing the setjmp
+ call there to return VAL, or 1 if VAL is 0. */
+void
+__vmx__libc_siglongjmp (sigjmp_buf env, int val)
+{
+ /* Perform any cleanups needed by the frames being unwound. */
+ _longjmp_unwind (env, val);
+
+ if (env[0].__mask_was_saved)
+ /* Restore the saved signal mask. */
+ (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+ (sigset_t *) NULL);
+
+ /* Call the machine-dependent function to restore machine state. */
+ __vmx__longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__vmx__libc_siglongjmp, __vmx__libc_longjmp)
+libc_hidden_def (__vmx__libc_longjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmx_longjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmxlongjmp)
+weak_alias (__vmx__libc_siglongjmp, __vmxsiglongjmp)
+
+
+default_symbol_version (__vmx__libc_longjmp, __libc_longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmx__libc_siglongjmp, __libc_siglongjmp, GLIBC_2.3.4);
+default_symbol_version (__vmx_longjmp, _longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmxlongjmp, longjmp, GLIBC_2.3.4);
+default_symbol_version (__vmxsiglongjmp, siglongjmp, GLIBC_2.3.4);
diff --git a/sysdeps/powerpc/novmx-longjmp.c b/sysdeps/powerpc/novmx-longjmp.c
new file mode 100644
index 0000000000..d823239ea6
--- /dev/null
+++ b/sysdeps/powerpc/novmx-longjmp.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copy of sysdeps/generic/longjmp.c modified for backward compatibility
+ with old non AltiVec/VMX longjmp. */
+
+#include <bits/wordsize.h>
+#include <shlib-compat.h>
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# include <stddef.h>
+# include <novmxsetjmp.h>
+# include <signal.h>
+
+
+/* Set the signal mask to the one specified in ENV, and jump
+ to the position specified in ENV, causing the setjmp
+ call there to return VAL, or 1 if VAL is 0. */
+void
+__novmx__libc_siglongjmp (__novmx__sigjmp_buf env, int val)
+{
+ /* Perform any cleanups needed by the frames being unwound. */
+ _longjmp_unwind (env, val);
+
+ if (env[0].__mask_was_saved)
+ /* Restore the saved signal mask. */
+ (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+ (sigset_t *) NULL);
+
+ /* Call the machine-dependent function to restore machine state. */
+ __novmx__longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__novmx__libc_siglongjmp, __novmx__libc_longjmp)
+libc_hidden_def (__novmx__libc_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmx_longjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxlongjmp)
+weak_alias (__novmx__libc_siglongjmp, __novmxsiglongjmp)
+
+# if __WORDSIZE == 64
+symbol_version (__novmx__libc_longjmp,__libc_longjmp,GLIBC_2.3);
+symbol_version (__novmx__libc_siglongjmp,__libc_siglongjmp,GLIBC_2.3);
+symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.3);
+symbol_version (__novmxlongjmp,longjmp,GLIBC_2.3);
+symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.3);
+# else
+symbol_version (__novmx__libc_longjmp,__libc_longjmp,GLIBC_2.0);
+symbol_version (__novmx__libc_siglongjmp,__libc_siglongjmp,GLIBC_2.0);
+symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.0);
+symbol_version (__novmxlongjmp,longjmp,GLIBC_2.0);
+symbol_version (__novmxsiglongjmp,siglongjmp,GLIBC_2.0);
+# endif
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */
diff --git a/sysdeps/powerpc/novmx-sigjmp.c b/sysdeps/powerpc/novmx-sigjmp.c
new file mode 100644
index 0000000000..7489ded4a9
--- /dev/null
+++ b/sysdeps/powerpc/novmx-sigjmp.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1992, 1994, 1997, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copy of sysdeps/generic/sigjmp.c modified for backward compatibility
+ with old non AltiVec/VMX setjmp. */
+
+#include <bits/wordsize.h>
+#include <shlib-compat.h>
+#if !defined NOT_IN_libc && defined SHARED
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# include <stddef.h>
+# include <novmxsetjmp.h>
+# include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+ before doing a `__setjmp' on ENV[0].__jmpbuf.
+ Always return zero. */
+
+int
+__novmx__sigjmp_save (__novmx__sigjmp_buf env, int savemask)
+{
+ env[0].__mask_was_saved = (savemask &&
+ __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+ &env[0].__saved_mask) == 0);
+
+ return 0;
+}
+
+# if __WORDSIZE == 64
+symbol_version (__novmx__sigjmp_save,__sigjmp_save,GLIBC_2.3);
+# else
+symbol_version (__novmx__sigjmp_save,__sigjmp_save,GLIBC_2.0);
+# endif /* __WORDSIZE == 64 */
+# endif /* SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */
+#endif /* !NOT_IN_libc && SHARED */
diff --git a/sysdeps/powerpc/novmxsetjmp.h b/sysdeps/powerpc/novmxsetjmp.h
new file mode 100644
index 0000000000..da2a338257
--- /dev/null
+++ b/sysdeps/powerpc/novmxsetjmp.h
@@ -0,0 +1,133 @@
+/* Copyright (C) 1991-1999, 2001, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Copied from setjmp/setjmp.h, powerpc/bits/setjmp.h and modified
+ appropriately to keep backward compatible with setjmp without
+ AltiVec/VMX support.
+
+ This file is not exported and the interfaces are private to libc. */
+
+#ifndef __NOVMX_SETJMP_H
+#define __NOVMX_SETJMP_H 1
+
+#include <bits/wordsize.h>
+
+/* The following definitions are needed by ASM implementations of the old
+ (novmx) __longjmp/__setjmp functions. */
+
+# define JB_GPR1 0 /* Also known as the stack pointer */
+# define JB_GPR2 1
+# define JB_LR 2 /* The address we will return to */
+# if __WORDSIZE == 64
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_CR 21 /* Condition code registers. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE (40 * 8)
+# else
+# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */
+# define JB_CR 21 /* Condition code registers. */
+# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */
+# define JB_SIZE (58 * 4)
+# endif
+
+#ifndef _ASM
+/* The following definitions are needed by the novmx* implementations of
+ setjmp/longjmp/sigsetjmp/etc that wrapper __setjmp/__longjmp. */
+
+# if __WORDSIZE == 64
+typedef long int __jmp_buf[40];
+# else
+typedef long int __jmp_buf[58];
+# endif
+
+# include <bits/sigset.h> /* Get `__sigset_t'. */
+
+/* Calling environment, plus possibly a saved signal mask. */
+typedef struct __novmx__jmp_buf_tag
+ {
+ /* NOTE: The machine-dependent definitions of `__sigsetjmp'
+ assume that a `jmp_buf' begins with a `__jmp_buf' and that
+ `__mask_was_saved' follows it. Do not move these members
+ or add others before it. */
+ __jmp_buf __jmpbuf; /* Calling environment. */
+ int __mask_was_saved; /* Saved the signal mask? */
+ __sigset_t __saved_mask; /* Saved signal mask. */
+ } __novmx__jmp_buf[1];
+
+
+/* Store the calling environment in ENV, also saving the signal mask.
+ Return 0. */
+extern int __novmxsetjmp (__novmx__jmp_buf __env);
+
+/* Store the calling environment in ENV, also saving the
+ signal mask if SAVEMASK is nonzero. Return 0.
+ This is the internal name for `sigsetjmp'. */
+extern int __novmx__sigsetjmp (struct __novmx__jmp_buf_tag __env[1],
+ int __savemask);
+
+/* Store the calling environment in ENV, not saving the signal mask.
+ Return 0. */
+extern int __novmx_setjmp (struct __novmx__jmp_buf_tag __env[1]);
+
+/* Jump to the environment saved in ENV, making the
+ `setjmp' call there return VAL, or 1 if VAL is 0. */
+extern void __novmxlongjmp (struct __novmx__jmp_buf_tag __env[1], int __val)
+ __attribute__ ((__noreturn__));
+
+/* Same. Usually `_longjmp' is used with `_setjmp', which does not save
+ the signal mask. But it is how ENV was saved that determines whether
+ `longjmp' restores the mask; `_longjmp' is just an alias. */
+extern void __novmx_longjmp (struct __novmx__jmp_buf_tag __env[1], int __val)
+ __attribute__ ((__noreturn__));
+
+/* Use the same type for `jmp_buf' and `sigjmp_buf'.
+ The `__mask_was_saved' flag determines whether
+ or not `longjmp' will restore the signal mask. */
+typedef struct __novmx__jmp_buf_tag __novmx__sigjmp_buf[1];
+
+/* Jump to the environment saved in ENV, making the
+ sigsetjmp call there return VAL, or 1 if VAL is 0.
+ Restore the signal mask if that sigsetjmp call saved it.
+ This is just an alias `longjmp'. */
+extern void __novmxsiglongjmp (__novmx__sigjmp_buf __env, int __val)
+ __attribute__ ((__noreturn__));
+
+/* Internal machine-dependent function to restore context sans signal mask. */
+extern void __novmx__longjmp (__novmx__jmp_buf __env, int __val)
+ __attribute__ ((__noreturn__));
+
+/* Internal function to possibly save the current mask of blocked signals
+ in ENV, and always set the flag saying whether or not it was saved.
+ This is used by the machine-dependent definition of `__sigsetjmp'.
+ Always returns zero, for convenience. */
+extern int __novmx__sigjmp_save (__novmx__jmp_buf __env, int __savemask);
+
+extern void _longjmp_unwind (__novmx__jmp_buf env, int val);
+
+extern void __novmx__libc_siglongjmp (__novmx__sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+extern void __novmx__libc_longjmp (__novmx__sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
+
+libc_hidden_proto (__novmx__libc_longjmp)
+libc_hidden_proto (__novmx_setjmp)
+libc_hidden_proto (__novmx__sigsetjmp)
+#endif /* !_ASM */
+
+#endif
diff --git a/sysdeps/powerpc/powerpc32/__longjmp-common.S b/sysdeps/powerpc/powerpc32/__longjmp-common.S
new file mode 100644
index 0000000000..82531ad6b3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -0,0 +1,59 @@
+/* longjmp for PowerPC.
+ Copyright (C) 1995-1997,1999-2001,2003,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+ENTRY (BP_SYM (__longjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+
+ lwz r1,(JB_GPR1*4)(r3)
+ lwz r0,(JB_LR*4)(r3)
+ lwz r14,((JB_GPRS+0)*4)(r3)
+ lwz r15,((JB_GPRS+1)*4)(r3)
+ lwz r16,((JB_GPRS+2)*4)(r3)
+ lwz r17,((JB_GPRS+3)*4)(r3)
+ lwz r18,((JB_GPRS+4)*4)(r3)
+ lwz r19,((JB_GPRS+5)*4)(r3)
+ lwz r20,((JB_GPRS+6)*4)(r3)
+ mtlr r0
+ lwz r21,((JB_GPRS+7)*4)(r3)
+ lwz r22,((JB_GPRS+8)*4)(r3)
+ lwz r0,(JB_CR*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+ lwz r24,((JB_GPRS+10)*4)(r3)
+ lwz r25,((JB_GPRS+11)*4)(r3)
+ mtcrf 0xFF,r0
+ lwz r26,((JB_GPRS+12)*4)(r3)
+ lwz r27,((JB_GPRS+13)*4)(r3)
+ lwz r28,((JB_GPRS+14)*4)(r3)
+ lwz r29,((JB_GPRS+15)*4)(r3)
+ lwz r30,((JB_GPRS+16)*4)(r3)
+ lwz r31,((JB_GPRS+17)*4)(r3)
+ mr r3,r4
+ blr
+END (BP_SYM (__longjmp))
diff --git a/sysdeps/powerpc/powerpc32/__longjmp.S b/sysdeps/powerpc/powerpc32/__longjmp.S
index 5a3d1d8180..4218619a8c 100644
--- a/sysdeps/powerpc/powerpc32/__longjmp.S
+++ b/sysdeps/powerpc/powerpc32/__longjmp.S
@@ -1,5 +1,5 @@
-/* longjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* AltiVec/VMX (new) version of __longjmp for PowerPC.
+ Copyright (C) 1995-1997,1999,2000,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,39 +17,24 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
+#include <libc-symbols.h>
+#include <shlib-compat.h>
-ENTRY (BP_SYM (__longjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "__longjmp-common.S"
- lwz r1,(JB_GPR1*4)(r3)
- lwz r0,(JB_LR*4)(r3)
- lwz r14,((JB_GPRS+0)*4)(r3)
- lwz r15,((JB_GPRS+1)*4)(r3)
- lwz r16,((JB_GPRS+2)*4)(r3)
- lwz r17,((JB_GPRS+3)*4)(r3)
- lwz r18,((JB_GPRS+4)*4)(r3)
- lwz r19,((JB_GPRS+5)*4)(r3)
- lwz r20,((JB_GPRS+6)*4)(r3)
- mtlr r0
- lwz r21,((JB_GPRS+7)*4)(r3)
- lwz r22,((JB_GPRS+8)*4)(r3)
- lwz r0,(JB_CR*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
- lwz r24,((JB_GPRS+10)*4)(r3)
- lwz r25,((JB_GPRS+11)*4)(r3)
- mtcrf 0xFF,r0
- lwz r26,((JB_GPRS+12)*4)(r3)
- lwz r27,((JB_GPRS+13)*4)(r3)
- lwz r28,((JB_GPRS+14)*4)(r3)
- lwz r29,((JB_GPRS+15)*4)(r3)
- lwz r30,((JB_GPRS+16)*4)(r3)
- lwz r31,((JB_GPRS+17)*4)(r3)
- mr r3,r4
- blr
-END (BP_SYM (__longjmp))
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__longjmp,__longjmp,GLIBC_2.3.4);
+# define __longjmp __vmx__longjmp
+# include "__longjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+symbol_version (__novmx__longjmp,__longjmp,GLIBC_2.0);
+# undef __longjmp
+# define __longjmp __novmx__longjmp
+# include "__longjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc32/bsd-_setjmp.S b/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
index ce05f4ac91..458f52c4cb 100644
--- a/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
+++ b/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
@@ -1,5 +1,6 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC version.
- Copyright (C) 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC32/64 version.
+ Copyright (C) 1994,1997,1999,2000,2002,2003,2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,16 +17,43 @@
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
- We cannot do it in C because it must be a tail-call, so frame-unwinding
- in setjmp doesn't clobber the state restored by longjmp. */
-
+#include <shlib-compat.h>
+#include <libc-symbols.h>
#include <sysdep.h>
#include <bp-sym.h>
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
ENTRY (BP_SYM (_setjmp))
li r4,0 /* Set second argument to 0. */
b JUMPTARGET(BP_SYM (__sigsetjmp))
END (BP_SYM (_setjmp))
libc_hidden_def (_setjmp)
+#else
+/* Build a versioned object for libc. */
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.0);
+
+ENTRY (BP_SYM (__novmx_setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmx_setjmp))
+libc_hidden_def (__novmx_setjmp)
+# endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */
+
+default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
+/* __GI__setjmp prototype is needed for ntpl i.e. _setjmp is defined
+ as a libc_hidden_proto & is used in sysdeps/generic/libc-start.c
+ if HAVE_CLEANUP_JMP_BUF is defined */
+ENTRY (BP_SYM (__GI__setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__GI__setjmp))
+
+ENTRY (BP_SYM (__vmx_setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmx_setjmp))
+libc_hidden_def (__vmx_setjmp)
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc32/bsd-setjmp.S b/sysdeps/powerpc/powerpc32/bsd-setjmp.S
index 3dba8babb0..af2fdc25bc 100644
--- a/sysdeps/powerpc/powerpc32/bsd-setjmp.S
+++ b/sysdeps/powerpc/powerpc32/bsd-setjmp.S
@@ -1,5 +1,5 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC version.
- Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC32/64 version.
+ Copyright (C) 1994,1997,1999,2000,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,17 +16,41 @@
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
- We cannot do it in C because it must be a tail-call, so frame-unwinding
- in setjmp doesn't clobber the state restored by longjmp. */
-
+#include <shlib-compat.h>
+#include <libc-symbols.h>
#include <sysdep.h>
#include <bp-sym.h>
-ENTRY (BP_SYM (__setjmp))
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+
+
+/* We need 2 copies of identicatal code for the setjmp's as gas complains
+ erronously about having multiple versions of setjmp this eliminates the
+ need for the strong alias of __setjmp to setjmp which
+ does not support versioning i.e. another gas unimplemented feature. */
+symbol_version (__novmx__setjmp,__setjmp,GLIBC_2.0)
+symbol_version (__novmxsetjmp,setjmp,GLIBC_2.0)
+
+ENTRY (BP_SYM (__novmxsetjmp))
li r4,1 /* Set second argument to 1. */
- b JUMPTARGET (BP_SYM (__sigsetjmp))
-END (BP_SYM (__setjmp))
+ b JUMPTARGET (BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmxsetjmp))
-strong_alias (__setjmp, setjmp)
+ENTRY (BP_SYM (__novmx__setjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmx__setjmp))
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) ) */
+
+default_symbol_version (__vmx__setjmp,__setjmp,GLIBC_2.3.4)
+default_symbol_version (__vmxsetjmp,setjmp,GLIBC_2.3.4)
+
+ENTRY (BP_SYM (__vmxsetjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmxsetjmp))
+
+ENTRY (BP_SYM (__vmx__setjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmx__setjmp))
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
new file mode 100644
index 0000000000..60f1df7d46
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -0,0 +1,150 @@
+/* longjmp for PowerPC.
+ Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+ENTRY (BP_SYM (__longjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#ifndef __NO_VMX__
+# ifdef PIC
+ mflr r6
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r5
+# ifdef SHARED
+ lwz r5,_rtld_global@got(r5)
+ mtlr r6
+ lwz r5,RTLD_GLOBAL_DL_HWCAP_OFFSET(r5)
+# else
+ lwz r5,_rtld_global@got(r5)
+ mtlr r6
+ lwz r5,0(r5)
+# endif
+# else
+ lis r5,_dl_hwcap@ha
+ lwz r5,_dl_hwcap@l(r5)
+# endif
+ andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq no_vmx
+ la r5,((JB_VRS)*4)(3)
+ andi. r6,r5,0xf
+ lwz r0,((JB_VRSAVE)*4)(3)
+ mtspr VRSAVE,r0
+ beq+ aligned_restore_vmx
+ addi r6,r5,16
+ lvsl v0,0,r5
+ lvx v1,0,r5
+ addi r5,r5,32
+ lvx v21,0,r6
+ vperm v20,v1,v21,v0
+# define load_misaligned_vmx_lo_loaded(loadvr,lovr,shiftvr,loadgpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ lvx lovr,0,loadgpr; \
+ vperm loadvr,loadvr,lovr,shiftvr;
+ load_misaligned_vmx_lo_loaded(v21,v22,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v22,v23,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v23,v24,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v24,v25,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v25,v26,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v26,v27,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v27,v28,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v28,v29,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v29,v30,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v30,v31,v0,r6,r5)
+ lvx v1,0,r5
+ vperm v31,v31,v1,v0
+ b no_vmx
+aligned_restore_vmx:
+ addi r6,r5,16
+ lvx v20,0,r5
+ addi r5,r5,32
+ lvx v21,0,r6
+ addi r6,r6,32
+ lvx v22,0,r5
+ addi r5,r5,32
+ lvx v23,0,r6
+ addi r6,r6,32
+ lvx v24,0,r5
+ addi r5,r5,32
+ lvx v25,0,r6
+ addi r6,r6,32
+ lvx v26,0,r5
+ addi r5,r5,32
+ lvx v27,0,r6
+ addi r6,r6,32
+ lvx v28,0,r5
+ addi r5,r5,32
+ lvx v29,0,r6
+ addi r6,r6,32
+ lvx v30,0,r5
+ lvx v31,0,r6
+no_vmx:
+#endif
+ lwz r1,(JB_GPR1*4)(r3)
+ lwz r0,(JB_LR*4)(r3)
+ lwz r14,((JB_GPRS+0)*4)(r3)
+ lfd fp14,((JB_FPRS+0*2)*4)(r3)
+ lwz r15,((JB_GPRS+1)*4)(r3)
+ lfd fp15,((JB_FPRS+1*2)*4)(r3)
+ lwz r16,((JB_GPRS+2)*4)(r3)
+ lfd fp16,((JB_FPRS+2*2)*4)(r3)
+ lwz r17,((JB_GPRS+3)*4)(r3)
+ lfd fp17,((JB_FPRS+3*2)*4)(r3)
+ lwz r18,((JB_GPRS+4)*4)(r3)
+ lfd fp18,((JB_FPRS+4*2)*4)(r3)
+ lwz r19,((JB_GPRS+5)*4)(r3)
+ lfd fp19,((JB_FPRS+5*2)*4)(r3)
+ lwz r20,((JB_GPRS+6)*4)(r3)
+ lfd fp20,((JB_FPRS+6*2)*4)(r3)
+ mtlr r0
+ lwz r21,((JB_GPRS+7)*4)(r3)
+ lfd fp21,((JB_FPRS+7*2)*4)(r3)
+ lwz r22,((JB_GPRS+8)*4)(r3)
+ lfd fp22,((JB_FPRS+8*2)*4)(r3)
+ lwz r0,(JB_CR*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+ lfd fp23,((JB_FPRS+9*2)*4)(r3)
+ lwz r24,((JB_GPRS+10)*4)(r3)
+ lfd fp24,((JB_FPRS+10*2)*4)(r3)
+ lwz r25,((JB_GPRS+11)*4)(r3)
+ lfd fp25,((JB_FPRS+11*2)*4)(r3)
+ mtcrf 0xFF,r0
+ lwz r26,((JB_GPRS+12)*4)(r3)
+ lfd fp26,((JB_FPRS+12*2)*4)(r3)
+ lwz r27,((JB_GPRS+13)*4)(r3)
+ lfd fp27,((JB_FPRS+13*2)*4)(r3)
+ lwz r28,((JB_GPRS+14)*4)(r3)
+ lfd fp28,((JB_FPRS+14*2)*4)(r3)
+ lwz r29,((JB_GPRS+15)*4)(r3)
+ lfd fp29,((JB_FPRS+15*2)*4)(r3)
+ lwz r30,((JB_GPRS+16)*4)(r3)
+ lfd fp30,((JB_FPRS+16*2)*4)(r3)
+ lwz r31,((JB_GPRS+17)*4)(r3)
+ lfd fp31,((JB_FPRS+17*2)*4)(r3)
+ mr r3,r4
+ blr
+END (BP_SYM (__longjmp))
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
index de100445fa..c43483561a 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp.S
@@ -1,5 +1,5 @@
-/* longjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* AltiVec/VMX (new) version of __longjmp for PowerPC.
+ Copyright (C) 1995,1996,1997,1999,2000,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,57 +17,25 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
+#include <libc-symbols.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
-ENTRY (BP_SYM (__longjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "__longjmp-common.S"
- lwz r1,(JB_GPR1*4)(r3)
- lwz r0,(JB_LR*4)(r3)
- lwz r14,((JB_GPRS+0)*4)(r3)
- lfd fp14,((JB_FPRS+0*2)*4)(r3)
- lwz r15,((JB_GPRS+1)*4)(r3)
- lfd fp15,((JB_FPRS+1*2)*4)(r3)
- lwz r16,((JB_GPRS+2)*4)(r3)
- lfd fp16,((JB_FPRS+2*2)*4)(r3)
- lwz r17,((JB_GPRS+3)*4)(r3)
- lfd fp17,((JB_FPRS+3*2)*4)(r3)
- lwz r18,((JB_GPRS+4)*4)(r3)
- lfd fp18,((JB_FPRS+4*2)*4)(r3)
- lwz r19,((JB_GPRS+5)*4)(r3)
- lfd fp19,((JB_FPRS+5*2)*4)(r3)
- lwz r20,((JB_GPRS+6)*4)(r3)
- lfd fp20,((JB_FPRS+6*2)*4)(r3)
- mtlr r0
- lwz r21,((JB_GPRS+7)*4)(r3)
- lfd fp21,((JB_FPRS+7*2)*4)(r3)
- lwz r22,((JB_GPRS+8)*4)(r3)
- lfd fp22,((JB_FPRS+8*2)*4)(r3)
- lwz r0,(JB_CR*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
- lfd fp23,((JB_FPRS+9*2)*4)(r3)
- lwz r24,((JB_GPRS+10)*4)(r3)
- lfd fp24,((JB_FPRS+10*2)*4)(r3)
- lwz r25,((JB_GPRS+11)*4)(r3)
- lfd fp25,((JB_FPRS+11*2)*4)(r3)
- mtcrf 0xFF,r0
- lwz r26,((JB_GPRS+12)*4)(r3)
- lfd fp26,((JB_FPRS+12*2)*4)(r3)
- lwz r27,((JB_GPRS+13)*4)(r3)
- lfd fp27,((JB_FPRS+13*2)*4)(r3)
- lwz r28,((JB_GPRS+14)*4)(r3)
- lfd fp28,((JB_FPRS+14*2)*4)(r3)
- lwz r29,((JB_GPRS+15)*4)(r3)
- lfd fp29,((JB_FPRS+15*2)*4)(r3)
- lwz r30,((JB_GPRS+16)*4)(r3)
- lfd fp30,((JB_FPRS+16*2)*4)(r3)
- lwz r31,((JB_GPRS+17)*4)(r3)
- lfd fp31,((JB_FPRS+17*2)*4)(r3)
- mr r3,r4
- blr
-END (BP_SYM (__longjmp))
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__longjmp,__longjmp,GLIBC_2.3.4);
+# define __longjmp __vmx__longjmp
+# include "__longjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+symbol_version (__novmx__longjmp,__longjmp,GLIBC_2.0);
+# undef __longjmp
+# define __longjmp __novmx__longjmp
+# include "__longjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
new file mode 100644
index 0000000000..b69ce33755
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -0,0 +1,168 @@
+/* setjmp for PowerPC.
+ Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+
+ENTRY (BP_SYM (__sigsetjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+
+ stw r1,(JB_GPR1*4)(3)
+ mflr r0
+ stw r14,((JB_GPRS+0)*4)(3)
+ stfd fp14,((JB_FPRS+0*2)*4)(3)
+ stw r0,(JB_LR*4)(3)
+ stw r15,((JB_GPRS+1)*4)(3)
+ stfd fp15,((JB_FPRS+1*2)*4)(3)
+ mfcr r0
+ stw r16,((JB_GPRS+2)*4)(3)
+ stfd fp16,((JB_FPRS+2*2)*4)(3)
+ stw r0,(JB_CR*4)(3)
+ stw r17,((JB_GPRS+3)*4)(3)
+ stfd fp17,((JB_FPRS+3*2)*4)(3)
+ stw r18,((JB_GPRS+4)*4)(3)
+ stfd fp18,((JB_FPRS+4*2)*4)(3)
+ stw r19,((JB_GPRS+5)*4)(3)
+ stfd fp19,((JB_FPRS+5*2)*4)(3)
+ stw r20,((JB_GPRS+6)*4)(3)
+ stfd fp20,((JB_FPRS+6*2)*4)(3)
+ stw r21,((JB_GPRS+7)*4)(3)
+ stfd fp21,((JB_FPRS+7*2)*4)(3)
+ stw r22,((JB_GPRS+8)*4)(3)
+ stfd fp22,((JB_FPRS+8*2)*4)(3)
+ stw r23,((JB_GPRS+9)*4)(3)
+ stfd fp23,((JB_FPRS+9*2)*4)(3)
+ stw r24,((JB_GPRS+10)*4)(3)
+ stfd fp24,((JB_FPRS+10*2)*4)(3)
+ stw r25,((JB_GPRS+11)*4)(3)
+ stfd fp25,((JB_FPRS+11*2)*4)(3)
+ stw r26,((JB_GPRS+12)*4)(3)
+ stfd fp26,((JB_FPRS+12*2)*4)(3)
+ stw r27,((JB_GPRS+13)*4)(3)
+ stfd fp27,((JB_FPRS+13*2)*4)(3)
+ stw r28,((JB_GPRS+14)*4)(3)
+ stfd fp28,((JB_FPRS+14*2)*4)(3)
+ stw r29,((JB_GPRS+15)*4)(3)
+ stfd fp29,((JB_FPRS+15*2)*4)(3)
+ stw r30,((JB_GPRS+16)*4)(3)
+ stfd fp30,((JB_FPRS+16*2)*4)(3)
+ stw r31,((JB_GPRS+17)*4)(3)
+ stfd fp31,((JB_FPRS+17*2)*4)(3)
+#ifndef __NO_VMX__
+#ifdef PIC
+ mflr r6
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r5
+#ifdef SHARED
+ lwz r5,_rtld_global@got(r5)
+ mtlr r6
+ lwz r5,RTLD_GLOBAL_DL_HWCAP_OFFSET(r5)
+#else
+ lwz r5,_rtld_global@got(r5)
+ mtlr r6
+ lwz r5,0(r5)
+#endif
+#else
+ lis r5,_dl_hwcap@ha
+ lwz r5,_dl_hwcap@l(r5)
+#endif
+ andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq no_vmx
+ la r5,((JB_VRS)*4)(3)
+ andi. r6,r5,0xf
+ mfspr r0,VRSAVE
+ stw r0,((JB_VRSAVE)*4)(3)
+ addi r6,r5,16
+ beq+ aligned_save_vmx
+ lvsr v0,0,r5
+ vspltisb v1,-1 /* set v1 to all 1's */
+ vspltisb v2,0 /* set v2 to all 0's */
+ vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes on left = misalignment */
+
+
+ /* Special case for v20 we need to preserve what is in save area below v20 before obliterating it */
+ lvx v5,0,r5
+ vperm v20,v20,v20,v0
+ vsel v5,v5,v20,v3
+ vsel v20,v20,v2,v3
+ stvx v5,0,r5
+
+#define save_2vmx_partial(savevr,prev_savevr,hivr,shiftvr,maskvr,savegpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ vperm savevr,savevr,savevr,shiftvr; \
+ vsel hivr,prev_savevr,savevr,maskvr; \
+ stvx hivr,0,savegpr;
+
+ save_2vmx_partial(v21,v20,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v22,v21,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v23,v22,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v24,v23,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v25,v24,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v26,v25,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v27,v26,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v28,v27,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v29,v28,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v30,v29,v5,v0,v3,r5,r6)
+
+ /* Special case for r31 we need to preserve what is in save area above v31 before obliterating it */
+ addi r5,r5,32
+ vperm v31,v31,v31,v0
+ lvx v4,0,r5
+ vsel v5,v30,v31,v3
+ stvx v5,0,r6
+ vsel v4,v31,v4,v3
+ stvx v4,0,r5
+ b no_vmx
+
+aligned_save_vmx:
+ stvx 20,0,r5
+ addi r5,r5,32
+ stvx 21,0,r6
+ addi r6,r6,32
+ stvx 22,0,r5
+ addi r5,r5,32
+ stvx 23,0,r6
+ addi r6,r6,32
+ stvx 24,0,r5
+ addi r5,r5,32
+ stvx 25,0,r6
+ addi r6,r6,32
+ stvx 26,0,r5
+ addi r5,r5,32
+ stvx 27,0,r6
+ addi r6,r6,32
+ stvx 28,0,r5
+ addi r5,r5,32
+ stvx 29,0,r6
+ addi r6,r6,32
+ stvx 30,0,r5
+ stvx 31,0,r6
+no_vmx:
+#endif
+ b JUMPTARGET (BP_SYM (__sigjmp_save))
+END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp.S b/sysdeps/powerpc/powerpc32/fpu/setjmp.S
index 871ae28625..6012bf2166 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp.S
@@ -1,5 +1,5 @@
-/* setjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* non alitivec (old) version of setjmp for PowerPC.
+ Copyright (C) 1995-1997,1999,2000,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,56 +17,28 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
+#include <libc-symbols.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
-ENTRY (BP_SYM (__sigsetjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "setjmp-common.S"
- stw r1,(JB_GPR1*4)(3)
- mflr r0
- stw r14,((JB_GPRS+0)*4)(3)
- stfd fp14,((JB_FPRS+0*2)*4)(3)
- stw r0,(JB_LR*4)(3)
- stw r15,((JB_GPRS+1)*4)(3)
- stfd fp15,((JB_FPRS+1*2)*4)(3)
- mfcr r0
- stw r16,((JB_GPRS+2)*4)(3)
- stfd fp16,((JB_FPRS+2*2)*4)(3)
- stw r0,(JB_CR*4)(3)
- stw r17,((JB_GPRS+3)*4)(3)
- stfd fp17,((JB_FPRS+3*2)*4)(3)
- stw r18,((JB_GPRS+4)*4)(3)
- stfd fp18,((JB_FPRS+4*2)*4)(3)
- stw r19,((JB_GPRS+5)*4)(3)
- stfd fp19,((JB_FPRS+5*2)*4)(3)
- stw r20,((JB_GPRS+6)*4)(3)
- stfd fp20,((JB_FPRS+6*2)*4)(3)
- stw r21,((JB_GPRS+7)*4)(3)
- stfd fp21,((JB_FPRS+7*2)*4)(3)
- stw r22,((JB_GPRS+8)*4)(3)
- stfd fp22,((JB_FPRS+8*2)*4)(3)
- stw r23,((JB_GPRS+9)*4)(3)
- stfd fp23,((JB_FPRS+9*2)*4)(3)
- stw r24,((JB_GPRS+10)*4)(3)
- stfd fp24,((JB_FPRS+10*2)*4)(3)
- stw r25,((JB_GPRS+11)*4)(3)
- stfd fp25,((JB_FPRS+11*2)*4)(3)
- stw r26,((JB_GPRS+12)*4)(3)
- stfd fp26,((JB_FPRS+12*2)*4)(3)
- stw r27,((JB_GPRS+13)*4)(3)
- stfd fp27,((JB_FPRS+13*2)*4)(3)
- stw r28,((JB_GPRS+14)*4)(3)
- stfd fp28,((JB_FPRS+14*2)*4)(3)
- stw r29,((JB_GPRS+15)*4)(3)
- stfd fp29,((JB_FPRS+15*2)*4)(3)
- stw r30,((JB_GPRS+16)*4)(3)
- stfd fp30,((JB_FPRS+16*2)*4)(3)
- stw r31,((JB_GPRS+17)*4)(3)
- stfd fp31,((JB_FPRS+17*2)*4)(3)
- b JUMPTARGET (BP_SYM (__sigjmp_save))
-END (BP_SYM (__sigsetjmp))
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+# define __sigsetjmp __vmx__sigsetjmp
+# define __sigjmp_save __vmx__sigjmp_save
+# include "setjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+# undef __sigsetjmp
+# undef __sigjmp_save
+symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
+# define __sigsetjmp __novmx__sigsetjmp
+# define __sigjmp_save __novmx__sigjmp_save
+# include "setjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc32/setjmp-common.S b/sysdeps/powerpc/powerpc32/setjmp-common.S
new file mode 100644
index 0000000000..40f626498c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/setjmp-common.S
@@ -0,0 +1,59 @@
+/* setjmp for PowerPC.
+ Copyright (C) 1995-1997,1999-2001,2003,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+
+ENTRY (BP_SYM (__sigsetjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+
+ stw r1,(JB_GPR1*4)(3)
+ mflr r0
+ stw r14,((JB_GPRS+0)*4)(3)
+ stw r0,(JB_LR*4)(3)
+ stw r15,((JB_GPRS+1)*4)(3)
+ mfcr r0
+ stw r16,((JB_GPRS+2)*4)(3)
+ stw r0,(JB_CR*4)(3)
+ stw r17,((JB_GPRS+3)*4)(3)
+ stw r18,((JB_GPRS+4)*4)(3)
+ stw r19,((JB_GPRS+5)*4)(3)
+ stw r20,((JB_GPRS+6)*4)(3)
+ stw r21,((JB_GPRS+7)*4)(3)
+ stw r22,((JB_GPRS+8)*4)(3)
+ stw r23,((JB_GPRS+9)*4)(3)
+ stw r24,((JB_GPRS+10)*4)(3)
+ stw r25,((JB_GPRS+11)*4)(3)
+ stw r26,((JB_GPRS+12)*4)(3)
+ stw r27,((JB_GPRS+13)*4)(3)
+ stw r28,((JB_GPRS+14)*4)(3)
+ stw r29,((JB_GPRS+15)*4)(3)
+ stw r30,((JB_GPRS+16)*4)(3)
+ stw r31,((JB_GPRS+17)*4)(3)
+ b JUMPTARGET (BP_SYM (__sigjmp_save))
+END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc32/setjmp.S b/sysdeps/powerpc/powerpc32/setjmp.S
index 9c9729a8dd..ecc1482981 100644
--- a/sysdeps/powerpc/powerpc32/setjmp.S
+++ b/sysdeps/powerpc/powerpc32/setjmp.S
@@ -1,5 +1,5 @@
-/* setjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* non alitivec (old) version of setjmp for PowerPC.
+ Copyright (C) 1995-1997,1999-2001,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,38 +17,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
+#include <shlib-compat.h>
+#include <libc-symbols.h>
-ENTRY (BP_SYM (__sigsetjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "setjmp-common.S"
- stw r1,(JB_GPR1*4)(3)
- mflr r0
- stw r14,((JB_GPRS+0)*4)(3)
- stw r0,(JB_LR*4)(3)
- stw r15,((JB_GPRS+1)*4)(3)
- mfcr r0
- stw r16,((JB_GPRS+2)*4)(3)
- stw r0,(JB_CR*4)(3)
- stw r17,((JB_GPRS+3)*4)(3)
- stw r18,((JB_GPRS+4)*4)(3)
- stw r19,((JB_GPRS+5)*4)(3)
- stw r20,((JB_GPRS+6)*4)(3)
- stw r21,((JB_GPRS+7)*4)(3)
- stw r22,((JB_GPRS+8)*4)(3)
- stw r23,((JB_GPRS+9)*4)(3)
- stw r24,((JB_GPRS+10)*4)(3)
- stw r25,((JB_GPRS+11)*4)(3)
- stw r26,((JB_GPRS+12)*4)(3)
- stw r27,((JB_GPRS+13)*4)(3)
- stw r28,((JB_GPRS+14)*4)(3)
- stw r29,((JB_GPRS+15)*4)(3)
- stw r30,((JB_GPRS+16)*4)(3)
- stw r31,((JB_GPRS+17)*4)(3)
- b JUMPTARGET (BP_SYM (__sigjmp_save))
-END (BP_SYM (__sigsetjmp))
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+# define __sigsetjmp __vmx__sigsetjmp
+# define __sigjmp_save __vmx__sigjmp_save
+# include "setjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+# undef __sigsetjmp
+# undef __sigjmp_save
+symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
+# define __sigsetjmp __novmx__sigsetjmp
+# define __sigjmp_save __novmx__sigjmp_save
+# include "setjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
new file mode 100644
index 0000000000..df316234d9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -0,0 +1,153 @@
+/* longjmp for PowerPC64.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+#ifndef __NO_VMX__
+ .section ".toc","aw"
+.LC__dl_hwcap:
+#ifdef SHARED
+ .tc _rtld_global[TC],_rtld_global
+#else
+ .tc _dl_hwcap[TC],_dl_hwcap
+#endif
+ .section ".text"
+#endif
+
+ENTRY (BP_SYM (__longjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#ifndef __NO_VMX__
+ ld r5,.LC__dl_hwcap@toc(r2)
+#ifdef SHARED
+ /* Load _rtld-global._dl_hwcap. */
+ ld r5,RTLD_GLOBAL_DL_HWCAP_OFFSET(r5)
+#else
+ ld r5,0(r5) /* Load extern _dl_hwcap. */
+#endif
+ andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq no_vmx
+ la r5,((JB_VRS)*8)(3)
+ andi. r6,r5,0xf
+ lwz r0,((JB_VRSAVE)*8)(3)
+ mtspr VRSAVE,r0
+ beq+ aligned_restore_vmx
+ addi r6,r5,16
+ lvsl v0,0,r5
+ lvx v1,0,r5
+ addi r5,r5,32
+ lvx v21,0,r6
+ vperm v20,v1,v21,v0
+#define load_misaligned_vmx_lo_loaded(loadvr,lovr,shiftvr,loadgpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ lvx lovr,0,loadgpr; \
+ vperm loadvr,loadvr,lovr,shiftvr;
+ load_misaligned_vmx_lo_loaded(v21,v22,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v22,v23,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v23,v24,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v24,v25,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v25,v26,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v26,v27,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v27,v28,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v28,v29,v0,r6,r5)
+ load_misaligned_vmx_lo_loaded(v29,v30,v0,r5,r6)
+ load_misaligned_vmx_lo_loaded(v30,v31,v0,r6,r5)
+ lvx v1,0,r5
+ vperm v31,v31,v1,v0
+ b no_vmx
+aligned_restore_vmx:
+ addi r6,r5,16
+ lvx v20,0,r5
+ addi r5,r5,32
+ lvx v21,0,r6
+ addi r6,r6,32
+ lvx v22,0,r5
+ addi r5,r5,32
+ lvx v23,0,r6
+ addi r6,r6,32
+ lvx v24,0,r5
+ addi r5,r5,32
+ lvx v25,0,r6
+ addi r6,r6,32
+ lvx v26,0,r5
+ addi r5,r5,32
+ lvx v27,0,r6
+ addi r6,r6,32
+ lvx v28,0,r5
+ addi r5,r5,32
+ lvx v29,0,r6
+ addi r6,r6,32
+ lvx v30,0,r5
+ lvx v31,0,r6
+no_vmx:
+#endif
+ ld r1,(JB_GPR1*8)(r3)
+ ld r2,(JB_GPR2*8)(r3)
+ ld r0,(JB_LR*8)(r3)
+ ld r14,((JB_GPRS+0)*8)(r3)
+ lfd fp14,((JB_FPRS+0)*8)(r3)
+ ld r15,((JB_GPRS+1)*8)(r3)
+ lfd fp15,((JB_FPRS+1)*8)(r3)
+ ld r16,((JB_GPRS+2)*8)(r3)
+ lfd fp16,((JB_FPRS+2)*8)(r3)
+ ld r17,((JB_GPRS+3)*8)(r3)
+ lfd fp17,((JB_FPRS+3)*8)(r3)
+ ld r18,((JB_GPRS+4)*8)(r3)
+ lfd fp18,((JB_FPRS+4)*8)(r3)
+ ld r19,((JB_GPRS+5)*8)(r3)
+ lfd fp19,((JB_FPRS+5)*8)(r3)
+ ld r20,((JB_GPRS+6)*8)(r3)
+ lfd fp20,((JB_FPRS+6)*8)(r3)
+ mtlr r0
+ ld r21,((JB_GPRS+7)*8)(r3)
+ lfd fp21,((JB_FPRS+7)*8)(r3)
+ ld r22,((JB_GPRS+8)*8)(r3)
+ lfd fp22,((JB_FPRS+8)*8)(r3)
+ ld r0,(JB_CR*8)(r3)
+ ld r23,((JB_GPRS+9)*8)(r3)
+ lfd fp23,((JB_FPRS+9)*8)(r3)
+ ld r24,((JB_GPRS+10)*8)(r3)
+ lfd fp24,((JB_FPRS+10)*8)(r3)
+ ld r25,((JB_GPRS+11)*8)(r3)
+ lfd fp25,((JB_FPRS+11)*8)(r3)
+ mtcrf 0xFF,r0
+ ld r26,((JB_GPRS+12)*8)(r3)
+ lfd fp26,((JB_FPRS+12)*8)(r3)
+ ld r27,((JB_GPRS+13)*8)(r3)
+ lfd fp27,((JB_FPRS+13)*8)(r3)
+ ld r28,((JB_GPRS+14)*8)(r3)
+ lfd fp28,((JB_FPRS+14)*8)(r3)
+ ld r29,((JB_GPRS+15)*8)(r3)
+ lfd fp29,((JB_FPRS+15)*8)(r3)
+ ld r30,((JB_GPRS+16)*8)(r3)
+ lfd fp30,((JB_FPRS+16)*8)(r3)
+ ld r31,((JB_GPRS+17)*8)(r3)
+ lfd fp31,((JB_FPRS+17)*8)(r3)
+ mr r3,r4
+ blr
+END (BP_SYM (__longjmp))
diff --git a/sysdeps/powerpc/powerpc64/__longjmp.S b/sysdeps/powerpc/powerpc64/__longjmp.S
index e4152126b1..88b6cfcd78 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp.S
@@ -1,6 +1,5 @@
-/* longjmp for PowerPC64.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+/* AltiVec/VMX (new) version of __longjmp for PowerPC64.
+ Copyright (C) 1995-1997, 1999-2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,57 +17,25 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
+#include <libc-symbols.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
-ENTRY (BP_SYM (__longjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
- ld r1,(JB_GPR1*8)(r3)
- ld r2,(JB_GPR2*8)(r3)
- ld r0,(JB_LR*8)(r3)
- ld r14,((JB_GPRS+0)*8)(r3)
- lfd fp14,((JB_FPRS+0)*8)(r3)
- ld r15,((JB_GPRS+1)*8)(r3)
- lfd fp15,((JB_FPRS+1)*8)(r3)
- ld r16,((JB_GPRS+2)*8)(r3)
- lfd fp16,((JB_FPRS+2)*8)(r3)
- ld r17,((JB_GPRS+3)*8)(r3)
- lfd fp17,((JB_FPRS+3)*8)(r3)
- ld r18,((JB_GPRS+4)*8)(r3)
- lfd fp18,((JB_FPRS+4)*8)(r3)
- ld r19,((JB_GPRS+5)*8)(r3)
- lfd fp19,((JB_FPRS+5)*8)(r3)
- ld r20,((JB_GPRS+6)*8)(r3)
- lfd fp20,((JB_FPRS+6)*8)(r3)
- mtlr r0
- ld r21,((JB_GPRS+7)*8)(r3)
- lfd fp21,((JB_FPRS+7)*8)(r3)
- ld r22,((JB_GPRS+8)*8)(r3)
- lfd fp22,((JB_FPRS+8)*8)(r3)
- ld r0,(JB_CR*8)(r3)
- ld r23,((JB_GPRS+9)*8)(r3)
- lfd fp23,((JB_FPRS+9)*8)(r3)
- ld r24,((JB_GPRS+10)*8)(r3)
- lfd fp24,((JB_FPRS+10)*8)(r3)
- ld r25,((JB_GPRS+11)*8)(r3)
- lfd fp25,((JB_FPRS+11)*8)(r3)
- mtcrf 0xFF,r0
- ld r26,((JB_GPRS+12)*8)(r3)
- lfd fp26,((JB_FPRS+12)*8)(r3)
- ld r27,((JB_GPRS+13)*8)(r3)
- lfd fp27,((JB_FPRS+13)*8)(r3)
- ld r28,((JB_GPRS+14)*8)(r3)
- lfd fp28,((JB_FPRS+14)*8)(r3)
- ld r29,((JB_GPRS+15)*8)(r3)
- lfd fp29,((JB_FPRS+15)*8)(r3)
- ld r30,((JB_GPRS+16)*8)(r3)
- lfd fp30,((JB_FPRS+16)*8)(r3)
- ld r31,((JB_GPRS+17)*8)(r3)
- lfd fp31,((JB_FPRS+17)*8)(r3)
- mr r3,r4
- blr
-END (BP_SYM (__longjmp))
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "__longjmp-common.S"
+
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__longjmp,__longjmp,GLIBC_2.3.4)
+# define __longjmp __vmx__longjmp
+# include "__longjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+# define __NO_VMX__
+# undef __longjmp
+symbol_version(__novmx__longjmp,__longjmp,GLIBC_2.3)
+# define __longjmp __novmx__longjmp
+# include "__longjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc64/bsd-_setjmp.S b/sysdeps/powerpc/powerpc64/bsd-_setjmp.S
index 994f82f851..1b15fedd64 100644
--- a/sysdeps/powerpc/powerpc64/bsd-_setjmp.S
+++ b/sysdeps/powerpc/powerpc64/bsd-_setjmp.S
@@ -1,5 +1,6 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC64 version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC32/64 version.
+ Copyright (C) 1994, 1997, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +17,43 @@
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <shlib-compat.h>
+#include <libc-symbols.h>
+#include <sysdep.h>
+#include <bp-sym.h>
-/* This code was moved into setjmp.S to solve a double stub call problem.
- @local would have worked but it is not supported in PowerPC64 asm. */
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+ENTRY (BP_SYM (_setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__sigsetjmp))
+END (BP_SYM (_setjmp))
+libc_hidden_def (_setjmp)
+
+#else
+/* Build a versioned object for libc. */
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.3);
+
+ENTRY (BP_SYM (__novmx_setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmx_setjmp))
+libc_hidden_def (__novmx_setjmp)
+# endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4) */
+
+default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
+/* __GI__setjmp prototype is needed for ntpl i.e. _setjmp is defined
+ as a libc_hidden_proto & is used in sysdeps/generic/libc-start.c
+ if HAVE_CLEANUP_JMP_BUF is defined */
+ENTRY (BP_SYM (__GI__setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__GI__setjmp))
+
+ENTRY (BP_SYM (__vmx_setjmp))
+ li r4,0 /* Set second argument to 0. */
+ b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmx_setjmp))
+libc_hidden_def (__vmx_setjmp)
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc64/bsd-setjmp.S b/sysdeps/powerpc/powerpc64/bsd-setjmp.S
index b6bb8f6e08..e83fe53a92 100644
--- a/sysdeps/powerpc/powerpc64/bsd-setjmp.S
+++ b/sysdeps/powerpc/powerpc64/bsd-setjmp.S
@@ -1,5 +1,5 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC32/64 version.
+ Copyright (C) 1994,1997,1999,2000,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,40 @@
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <shlib-compat.h>
+#include <libc-symbols.h>
+#include <sysdep.h>
+#include <bp-sym.h>
-/* This code was moved into setjmp.S to solve a double stub call problem.
- @local would have worked but it is not supported in PowerPC64 asm. */
+#if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+
+/* We need 2 copies of identicatal code for the setjmp's as gas complains
+ erronously about having multiple versions of setjmp this eliminates the
+ need for the strong alias of __setjmp to setjmp which
+ does not support versioning i.e. another gas unimplemented feature. */
+symbol_version (__novmx__setjmp,__setjmp,GLIBC_2.3)
+symbol_version (__novmxsetjmp,setjmp,GLIBC_2.3)
+
+ENTRY (BP_SYM (__novmxsetjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmxsetjmp))
+
+ENTRY (BP_SYM (__novmx__setjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__novmx__sigsetjmp))
+END (BP_SYM (__novmx__setjmp))
+#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4) */
+
+default_symbol_version (__vmx__setjmp,__setjmp,GLIBC_2.3.4)
+default_symbol_version (__vmxsetjmp,setjmp,GLIBC_2.3.4)
+
+ENTRY (BP_SYM (__vmxsetjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmxsetjmp))
+
+ENTRY (BP_SYM (__vmx__setjmp))
+ li r4,1 /* Set second argument to 1. */
+ b JUMPTARGET (BP_SYM (__vmx__sigsetjmp))
+END (BP_SYM (__vmx__setjmp))
diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S
new file mode 100644
index 0000000000..541b5d4276
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -0,0 +1,171 @@
+/* setjmp for PowerPC64.
+ Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+#include <novmxsetjmp.h>
+#else
+#include <bits/setjmp.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+#ifndef __NO_VMX__
+ .section ".toc","aw"
+.LC__dl_hwcap:
+#ifdef SHARED
+ .tc _rtld_global[TC],_rtld_global
+#else
+ .tc _dl_hwcap[TC],_dl_hwcap
+#endif
+ .section ".text"
+#endif
+
+ENTRY (BP_SYM (__sigsetjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+ std r1,(JB_GPR1*8)(3)
+ mflr r0
+ std r2,(JB_GPR2*8)(3)
+ std r14,((JB_GPRS+0)*8)(3)
+ stfd fp14,((JB_FPRS+0)*8)(3)
+ std r0,(JB_LR*8)(3)
+ std r15,((JB_GPRS+1)*8)(3)
+ stfd fp15,((JB_FPRS+1)*8)(3)
+ mfcr r0
+ std r16,((JB_GPRS+2)*8)(3)
+ stfd fp16,((JB_FPRS+2)*8)(3)
+ std r0,(JB_CR*8)(3)
+ std r17,((JB_GPRS+3)*8)(3)
+ stfd fp17,((JB_FPRS+3)*8)(3)
+ std r18,((JB_GPRS+4)*8)(3)
+ stfd fp18,((JB_FPRS+4)*8)(3)
+ std r19,((JB_GPRS+5)*8)(3)
+ stfd fp19,((JB_FPRS+5)*8)(3)
+ std r20,((JB_GPRS+6)*8)(3)
+ stfd fp20,((JB_FPRS+6)*8)(3)
+ std r21,((JB_GPRS+7)*8)(3)
+ stfd fp21,((JB_FPRS+7)*8)(3)
+ std r22,((JB_GPRS+8)*8)(3)
+ stfd fp22,((JB_FPRS+8)*8)(3)
+ std r23,((JB_GPRS+9)*8)(3)
+ stfd fp23,((JB_FPRS+9)*8)(3)
+ std r24,((JB_GPRS+10)*8)(3)
+ stfd fp24,((JB_FPRS+10)*8)(3)
+ std r25,((JB_GPRS+11)*8)(3)
+ stfd fp25,((JB_FPRS+11)*8)(3)
+ std r26,((JB_GPRS+12)*8)(3)
+ stfd fp26,((JB_FPRS+12)*8)(3)
+ std r27,((JB_GPRS+13)*8)(3)
+ stfd fp27,((JB_FPRS+13)*8)(3)
+ std r28,((JB_GPRS+14)*8)(3)
+ stfd fp28,((JB_FPRS+14)*8)(3)
+ std r29,((JB_GPRS+15)*8)(3)
+ stfd fp29,((JB_FPRS+15)*8)(3)
+ std r30,((JB_GPRS+16)*8)(3)
+ stfd fp30,((JB_FPRS+16)*8)(3)
+ std r31,((JB_GPRS+17)*8)(3)
+ stfd fp31,((JB_FPRS+17)*8)(3)
+#ifndef __NO_VMX__
+ ld r5,.LC__dl_hwcap@toc(r2)
+#ifdef SHARED
+ /* Load _rtld-global._dl_hwcap. */
+ ld r5,RTLD_GLOBAL_DL_HWCAP_OFFSET(r5)
+#else
+ ld r5,0(r5) /* Load extern _dl_hwcap. */
+#endif
+ andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq no_vmx
+ la r5,((JB_VRS)*8)(3)
+ andi. r6,r5,0xf
+ mfspr r0,VRSAVE
+ stw r0,((JB_VRSAVE)*8)(3)
+ addi r6,r5,16
+ beq+ aligned_save_vmx
+ lvsr v0,0,r5
+ vspltisb v1,-1 /* set v1 to all 1's */
+ vspltisb v2,0 /* set v2 to all 0's */
+ vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes
+ on left = misalignment */
+
+
+ /* Special case for v20 we need to preserve what is in save area
+ below v20 before obliterating it */
+ lvx v5,0,r5
+ vperm v20,v20,v20,v0
+ vsel v5,v5,v20,v3
+ vsel v20,v20,v2,v3
+ stvx v5,0,r5
+
+#define save_2vmx_partial(savevr,prev_savevr,hivr,shiftvr,maskvr,savegpr,addgpr) \
+ addi addgpr,addgpr,32; \
+ vperm savevr,savevr,savevr,shiftvr; \
+ vsel hivr,prev_savevr,savevr,maskvr; \
+ stvx hivr,0,savegpr;
+
+ save_2vmx_partial(v21,v20,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v22,v21,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v23,v22,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v24,v23,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v25,v24,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v26,v25,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v27,v26,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v28,v27,v5,v0,v3,r5,r6)
+ save_2vmx_partial(v29,v28,v5,v0,v3,r6,r5)
+ save_2vmx_partial(v30,v29,v5,v0,v3,r5,r6)
+
+ /* Special case for r31 we need to preserve what is in save area
+ above v31 before obliterating it */
+ addi r5,r5,32
+ vperm v31,v31,v31,v0
+ lvx v4,0,r5
+ vsel v5,v30,v31,v3
+ stvx v5,0,r6
+ vsel v4,v31,v4,v3
+ stvx v4,0,r5
+ b no_vmx
+
+aligned_save_vmx:
+ stvx 20,0,r5
+ addi r5,r5,32
+ stvx 21,0,r6
+ addi r6,r6,32
+ stvx 22,0,r5
+ addi r5,r5,32
+ stvx 23,0,r6
+ addi r6,r6,32
+ stvx 24,0,r5
+ addi r5,r5,32
+ stvx 25,0,r6
+ addi r6,r6,32
+ stvx 26,0,r5
+ addi r5,r5,32
+ stvx 27,0,r6
+ addi r6,r6,32
+ stvx 28,0,r5
+ addi r5,r5,32
+ stvx 29,0,r6
+ addi r6,r6,32
+ stvx 30,0,r5
+ stvx 31,0,r6
+no_vmx:
+#endif
+ b JUMPTARGET (BP_SYM (__sigjmp_save))
+END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc64/setjmp.S b/sysdeps/powerpc/powerpc64/setjmp.S
index 4ee6c9447a..77653836ad 100644
--- a/sysdeps/powerpc/powerpc64/setjmp.S
+++ b/sysdeps/powerpc/powerpc64/setjmp.S
@@ -1,6 +1,5 @@
-/* setjmp for PowerPC64.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+/* AltiVec (new) version of setjmp for PowerPC.
+ Copyright (C) 1995-97, 1999-2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,70 +17,28 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
-
-ENTRY (BP_SYM (__sigsetjmp))
- CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
-___sigsetjmp:
- std r1,(JB_GPR1*8)(3)
- mflr r0
- std r2,(JB_GPR2*8)(3)
- std r14,((JB_GPRS+0)*8)(3)
- stfd fp14,((JB_FPRS+0)*8)(3)
- std r0,(JB_LR*8)(3)
- std r15,((JB_GPRS+1)*8)(3)
- stfd fp15,((JB_FPRS+1)*8)(3)
- mfcr r0
- std r16,((JB_GPRS+2)*8)(3)
- stfd fp16,((JB_FPRS+2)*8)(3)
- std r0,(JB_CR*8)(3)
- std r17,((JB_GPRS+3)*8)(3)
- stfd fp17,((JB_FPRS+3)*8)(3)
- std r18,((JB_GPRS+4)*8)(3)
- stfd fp18,((JB_FPRS+4)*8)(3)
- std r19,((JB_GPRS+5)*8)(3)
- stfd fp19,((JB_FPRS+5)*8)(3)
- std r20,((JB_GPRS+6)*8)(3)
- stfd fp20,((JB_FPRS+6)*8)(3)
- std r21,((JB_GPRS+7)*8)(3)
- stfd fp21,((JB_FPRS+7)*8)(3)
- std r22,((JB_GPRS+8)*8)(3)
- stfd fp22,((JB_FPRS+8)*8)(3)
- std r23,((JB_GPRS+9)*8)(3)
- stfd fp23,((JB_FPRS+9)*8)(3)
- std r24,((JB_GPRS+10)*8)(3)
- stfd fp24,((JB_FPRS+10)*8)(3)
- std r25,((JB_GPRS+11)*8)(3)
- stfd fp25,((JB_FPRS+11)*8)(3)
- std r26,((JB_GPRS+12)*8)(3)
- stfd fp26,((JB_FPRS+12)*8)(3)
- std r27,((JB_GPRS+13)*8)(3)
- stfd fp27,((JB_FPRS+13)*8)(3)
- std r28,((JB_GPRS+14)*8)(3)
- stfd fp28,((JB_FPRS+14)*8)(3)
- std r29,((JB_GPRS+15)*8)(3)
- stfd fp29,((JB_FPRS+15)*8)(3)
- std r30,((JB_GPRS+16)*8)(3)
- stfd fp30,((JB_FPRS+16)*8)(3)
- std r31,((JB_GPRS+17)*8)(3)
- stfd fp31,((JB_FPRS+17)*8)(3)
- b JUMPTARGET (BP_SYM (__sigjmp_save))
-END (BP_SYM (__sigsetjmp))
-
-ENTRY (BP_SYM (_setjmp))
- li r4,0 /* Set second argument to 0. */
- b ___sigsetjmp
-END (BP_SYM (_setjmp))
-libc_hidden_def (_setjmp)
-
-ENTRY (BP_SYM (__setjmp))
- li r4,1 /* Set second argument to 1. */
- b ___sigsetjmp
-END (BP_SYM (__setjmp))
-
-strong_alias (__setjmp, setjmp)
+#include <libc-symbols.h>
+#include <rtld-global-offsets.h>
+#include <shlib-compat.h>
+
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+# include "setjmp-common.S"
+
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+# define __sigsetjmp __vmx__sigsetjmp
+# define __sigjmp_save __vmx__sigjmp_save
+# include "setjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)
+# undef __sigsetjmp
+# undef __sigjmp_save
+# define __NO_VMX__
+symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.3)
+# define __sigsetjmp __novmx__sigsetjmp
+# define __sigjmp_save __novmx__sigjmp_save
+# include "setjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/sigjmp.c b/sysdeps/powerpc/sigjmp.c
new file mode 100644
index 0000000000..de8a6cea8f
--- /dev/null
+++ b/sysdeps/powerpc/sigjmp.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1992, 1994, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Versioned copy of sysdeps/generic/sigjmp.c modified for AltiVec support. */
+
+#include <shlib-compat.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+ before doing a `__setjmp' on ENV[0].__jmpbuf.
+ Always return zero. */
+
+int
+__vmx__sigjmp_save (sigjmp_buf env, int savemask)
+{
+ env[0].__mask_was_saved = (savemask &&
+ __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+ &env[0].__saved_mask) == 0);
+
+ return 0;
+}
+
+#if defined NOT_IN_libc
+/* Build a none versioned object for rtld-*. */
+strong_alias (__vmx__sigjmp_save,__sigjmp_save)
+#else
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__sigjmp_save,__sigjmp_save,GLIBC_2.3.4);
+#endif