about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog274
-rw-r--r--Makeconfig3
-rw-r--r--catgets/gencat.c4
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure11
-rw-r--r--configure.in8
-rw-r--r--csu/version.c4
-rwxr-xr-xdebug/catchsegv.sh4
-rwxr-xr-xdebug/xtrace.sh4
-rw-r--r--dlfcn/bug-atexit1.c2
-rw-r--r--elf/ldconfig.c4
-rw-r--r--elf/ldd.bash.in4
-rw-r--r--elf/order2mod2.c2
-rw-r--r--elf/rtld.c7
-rw-r--r--elf/sprof.c4
-rw-r--r--elf/tst-tls13.c6
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in2
-rw-r--r--hurd/lookup-retry.c4
-rw-r--r--hurd/report-wait.c2
-rw-r--r--hurd/sigunwind.c11
-rw-r--r--iconv/iconv_prog.c4
-rw-r--r--iconv/iconvconfig.c4
-rw-r--r--iconvdata/bug-iconv4.c2
-rw-r--r--include/sys/xattr.h1
-rw-r--r--libio/iogetwline.c4
-rw-r--r--libio/obprintf.c4
-rw-r--r--locale/programs/locale.c4
-rw-r--r--locale/programs/localedef.c4
-rw-r--r--locale/programs/simple-hash.c4
-rwxr-xr-xmalloc/memusage.sh4
-rw-r--r--malloc/mtrace.pl4
-rw-r--r--manual/filesys.texi8
-rw-r--r--nptl/ChangeLog40
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/sigaction.c (renamed from nptl/sysdeps/pthread/sigaction.c)23
-rw-r--r--nptl/sysdeps/alpha/jmpbuf-unwind.h15
-rw-r--r--nptl/sysdeps/i386/jmpbuf-unwind.h15
-rw-r--r--nptl/sysdeps/mips/jmpbuf-unwind.h13
-rw-r--r--nptl/sysdeps/powerpc/jmpbuf-unwind.h15
-rw-r--r--nptl/sysdeps/s390/jmpbuf-unwind.h18
-rw-r--r--nptl/sysdeps/sh/jmpbuf-unwind.h17
-rw-r--r--nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h15
-rw-r--r--nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/Makefile5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S24
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h122
-rw-r--r--nptl/sysdeps/x86_64/jmpbuf-unwind.h15
-rw-r--r--nptl/tst-robust7.c195
-rw-r--r--nptl/tst-signal7.c59
-rw-r--r--nptl/version.c4
-rw-r--r--nscd/connections.c55
-rw-r--r--nscd/nscd.c14
-rw-r--r--nscd/nscd.h4
-rw-r--r--nscd/selinux.c30
-rw-r--r--nss/getent.c4
-rw-r--r--posix/bug-regex22.c10
-rw-r--r--posix/bug-regex5.c2
-rw-r--r--posix/getconf.c4
-rwxr-xr-xposix/transbug.c2
-rw-r--r--posix/tst-execle1.c2
-rw-r--r--posix/tst-execle2.c2
-rw-r--r--resolv/gethnamaddr.c9
-rw-r--r--resolv/herror.c1
-rw-r--r--resolv/res_debug.c10
-rw-r--r--stdio-common/tst-fgets.c2
-rw-r--r--stdio-common/tstdiomisc.c21
-rw-r--r--string/test-memccpy.c6
-rw-r--r--string/test-memchr.c13
-rw-r--r--string/test-memcmp.c8
-rw-r--r--string/test-memcpy.c10
-rw-r--r--string/test-memmove.c10
-rw-r--r--string/test-strcat.c9
-rw-r--r--string/test-strchr.c14
-rw-r--r--string/test-strcmp.c8
-rw-r--r--string/test-strcpy.c9
-rw-r--r--string/test-strlen.c9
-rw-r--r--string/test-strncpy.c10
-rw-r--r--string/test-strpbrk.c19
-rw-r--r--string/test-strrchr.c16
-rw-r--r--string/test-strspn.c14
-rw-r--r--sysdeps/alpha/bits/setjmp.h6
-rw-r--r--sysdeps/hppa/bits/setjmp.h7
-rw-r--r--sysdeps/i386/__longjmp.S32
-rw-r--r--sysdeps/i386/bits/setjmp.h6
-rw-r--r--sysdeps/i386/bsd-_setjmp.S3
-rw-r--r--sysdeps/i386/bsd-setjmp.S3
-rw-r--r--sysdeps/i386/setjmp.S3
-rw-r--r--sysdeps/m68k/bits/setjmp.h6
-rw-r--r--sysdeps/mach/hurd/errno.c1
-rw-r--r--sysdeps/mach/hurd/ioctl.c13
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c16
-rw-r--r--sysdeps/mips/bits/setjmp.h4
-rw-r--r--sysdeps/posix/libc_fatal.c7
-rw-r--r--sysdeps/powerpc/bits/setjmp.h6
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp-common.S1
-rw-r--r--sysdeps/powerpc/powerpc32/dl-start.S3
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S6
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp-common.S17
-rw-r--r--sysdeps/powerpc/powerpc32/hp-timing.h82
-rw-r--r--sysdeps/powerpc/powerpc32/setjmp-common.S9
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S5
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp-common.S18
-rw-r--r--sysdeps/s390/bits/setjmp.h6
-rw-r--r--sysdeps/sh/_mcount.S14
-rw-r--r--sysdeps/sh/bits/setjmp.h4
-rw-r--r--sysdeps/sh/sysdep.h11
-rw-r--r--sysdeps/sparc/sparc32/bits/setjmp.h6
-rw-r--r--sysdeps/unix/sh/sysdep.S10
-rw-r--r--sysdeps/unix/sysv/linux/clock_getres.c18
-rw-r--r--sysdeps/unix/sysv/linux/clock_gettime.c18
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/setjmp.h6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h36
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.c59
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.h27
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c110
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/gettimeofday.c42
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/libc-start.c (renamed from sysdeps/powerpc/elf/libc-start.c)89
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S284
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S374
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S290
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S400
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S516
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S707
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h114
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h121
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sh/makecontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.S4
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h9
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/setjmp.h10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigaction.c6
-rw-r--r--sysdeps/x86_64/__longjmp.S26
-rw-r--r--sysdeps/x86_64/bits/setjmp.h10
-rw-r--r--wcsmbs/tst-mbsrtowcs.c4
151 files changed, 3053 insertions, 1956 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d7a003cc0..02bd5423f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,283 @@
+2006-01-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/getconf.c: Update copyright year.
+	* nss/getent.c: Likewise.
+	* iconv/iconvconfig.c: Likewise.
+	* iconv/iconv_prog.c: Likewise.
+	* elf/ldconfig.c: Likewise.
+	* catgets/gencat.c: Likewise.
+	* csu/version.c: Likewise.
+	* elf/ldd.bash.in: Likewise.
+	* elf/sprof.c (print_version): Likewise.
+	* locale/programs/locale.c: Likewise.
+	* locale/programs/localedef.c: Likewise.
+	* nscd/nscd.c (print_version): Likewise.
+	* debug/xtrace.sh: Likewise.
+	* malloc/memusage.sh: Likewise.
+	* malloc/mtrace.pl: Likewise.
+	* debug/catchsegv.sh: Likewise.
+
+2005-12-31  Andreas Jaeger  <aj@suse.de>
+
+	[BZ #1395]
+	* manual/filesys.texi (Symbolic Links): Fix description of
+	canonicalize_file_name based on patch by Oskar Liljeblad
+	<oskar@osk.mine.nu>.
+
+2005-12-29  Andreas Jaeger  <aj@suse.de>
+
+	* resolv/res_debug.c (latlon2ul): Use ISO C function definition.
+	(precsize_aton): Likewise.
+	(precsize_ntoa): Likewise.
+
+	* resolv/gethnamaddr.c (_gethtbyname): Remove extra prototype.
+	(gethostbyname2): Likewise.
+	(gethostbyaddr): Likewise.
+	(getanswer): Use ISO C function definition.
+
+2005-12-29  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/sh/sysdep.h: Add cfi instrumentation to asm fragments.
+	* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
+	* sysdeps/sh/_mcount.S: Add cfi instrumentation.
+	* sysdeps/unix/sh/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/makecontext.S: Adjust cfi_startproc.
+	* sysdeps/unix/sysv/linux/sh/sh4/getcontext.S: Remove now duplicate
+	cfi_startproc and cfi_endproc.
+	* sysdeps/unix/sysv/linux/sh/sh4/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sh3/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sh3/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sysdep.S: Add cfi_endproc.
+
+2005-12-30  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/powerpc/powerpc64/setjmp-common.S: Make sure pointer guard
+	value doesn't survive in a registers when the function returns.
+	* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
+	* sysdeps/powerpc/powerpc32/setjmp-common.S: Likewise.
+
+2005-12-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Define
+	PTR_MANGLE2.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Define
+	PTR_MANGLE2 and PTR_DEMANGLE2.
+	* sysdeps/powerpc/powerpc64/__longjmp-common.S: Use PTR_DEMANGLE2.
+	* sysdeps/powerpc/powerpc64/setjmp-common.S: Use PTR_MANGLE2.
+	* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
+	* sysdeps/powerpc/powerpc32/setjmp-common.S: Likewise.
+
+2005-12-30  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ia64/bits/setjmp.h (_JMPBUF_UNWINDS):
+	Don't use _demangle parameter for now.
+
+	[BZ #2080]
+	* libio/iogetwline.c (_IO_getwline_info): Move return to correct
+	location.
+
+	* nscd/connections.c: Remove last remnants of -S option support.
+	* nscd/nscd.c: Likewise.
+	* nscd/nscd.h: Likewise.
+
+2005-12-30  Andreas Jaeger  <aj@suse.de>
+
+	[BZ #1067]
+	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Fix struct msghdr
+	for 64-bit mips kernel.
+
+2005-12-08  Steven Munroe  <sjmunroe@us.ibm.com>
+            Tom Gall <tom_gall@vnet.ibm.com>
+
+	* elf/rtld.c (dl_main): Initialize l_local_scope for sysinfo_map.
+	* sysdeps/powerpc/elf/libc-start.c: Move this...
+	* sysdeps/unix/sysv/linux/powerpc/libc-start.c: ...to here.
+	* sysdeps/powerpc/powerpc32/dl-start.S: Add _dl_main_dispatch label.
+	* sysdeps/powerpc/powerpc32/hp-timing.h: New file.
+	* sysdeps/unix/sysv/linux/powerpc/Versions: New file.
+	* sysdeps/unix/sysv/linux/clock_getres.c: If HAVE_CLOCK_GETRES_VSYSCALL
+	is not defined, redefine INTERNAL_VSYSCALL and INLINE_VSYSCALL to
+	INTERNAL_SYSCALL and INLINE_SYSCALL respectively.  Otherwise include
+	<bits/libc-vdso.h>.  Use INLINE_VSYSCALL and INTERNAL_SYSCALL instead
+	of the normal versions throughout the code.
+	* sysdeps/unix/sysv/linux/clock_gettime.c: Likewise if
+	HAVE_CLOCK_GETTIME_VSYSCALL is defined.
+	* sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h: New file.
+	* sysdeps/unix/sysv/linux/powerpc/dl-vdso.c: New file.
+	* sysdeps/unix/sysv/linux/powerpc/dl-vdso.h: New file.
+	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Use vDSO.
+	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: New file.
+	* sysdeps/unix/sysv/linux/powerpc/Makefile: Add dl-vdso to routines.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Define
+	INLINE_VSYSCALL, INTERNAL_VSYSCALL, INTERNAL_SYSCALL_NCS,
+	INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, HAVE_CLOCK_GETRES_VSYSCALL,
+	and HAVE_CLOCK_GETTIME_VSYSCALL.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
+
+2005-12-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h [ASSEMBLER]:
+	Define PTR_DEMANGLE2.
+	* sysdeps/powerpc/powerpc32/setjmp-common.S [PTR_MANGLE]: Also
+	mangle r1.
+	* sysdeps/powerpc/powerpc32/__longjmp-common.S [PTR_DEMANGLE]: Also
+	demangle r1.
+	* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S [PTR_MANGLE]: Mangle
+	r0 and r1.
+	* sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S [PTR_DEMANGLE]:
+	Demangle r0 and r1.
+
+	* sysdeps/powerpc/powerpc64/setjmp-common.S [PTR_MANGLE]: Also
+	mangle r1.
+	* sysdeps/powerpc/powerpc64/__longjmp-common.S [PTR_DEMANGLE]: Also
+	demangle  r1.
+
+2005-12-26  Steven Munroe  <sjmunroe@us.ibm.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S:
+	Move common function to...
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S:
+	New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S:
+	Move common function to...
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
+	New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S:
+	Move common function to...
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
+	New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
+	(_FRAME_BACKCHAIN, _FRAME_LR_SAVE, _FRAME_PARM_SAVE1,
+	_FRAME_PARM_SAVE2, _FRAME_PARM_SAVE3, _FRAME_PARM_SAVE4):
+	Remove unrelated stack frame defines.
+
+2005-12-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* stdio-common/tstdiomisc.c [FLT_EVAL_METHOD!=2] (dbl_max):
+	Defining as macro as before the last change.
+
+	* sysdeps/unix/sysv/linux/sigaction.c: If WRAPPER_INCLUDE is defined,
+	include the named file.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
+
+2005-12-29  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/mach/hurd/errno.c: New file.
+
+	* sysdeps/mach/hurd/ioctl.c (__ioctl): Use a union to avoid a cast.
+
+	* sysdeps/posix/libc_fatal.c (__libc_message): Add a const, a cast.
+
+	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Fix cast.
+	* hurd/report-wait.c (_S_msg_report_wait): Likewise.
+
+	* include/sys/xattr.h: New file.
+
+2005-12-28  Roland McGrath  <roland@redhat.com>
+
+	* hurd/sigunwind.c: Include <stdint.h>.
+	* sysdeps/mach/hurd/jmp-unwind.c: Likewise.
+
+2005-12-28  Ulrich Drepper  <drepper@redhat.com>
+
+	* nscd/selinux.c (log_callback): Use audit_log_user_avc_message.
+	Don't do anything if audit_fd is invalid.
+	(audit_init): Don't complain if kernel support is missing.
+	Patch by Steve Grubb <sgrubb@redhat.com>.
+
+	* sysdeps/i386/__longjmp.S [PTR_DEMANGLE]: Also demangle stack
+	pointer.  Add CFI.
+	* sysdeps/i386/bsd-_setjmp.S [PTR_MANGLE]: Also mangle stack pointer.
+	* sysdeps/i386/bsd-setjmp.S: Likewise.
+	* sysdeps/i386/setjmp.S: Likewise.
+
+	* sysdeps/x86_64/__longjmp.S: No need to make sure return value is
+	!= 0, the caller did that.
+
+2005-12-27  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/x86_64/__longjmp.S: Don't confuse unwinder by loading
+	mangled values in %rbp and %rsp registers and by wrong cfi.
+
+	* config.make.in (c++-sysincludes): New substituted variable.
+	* configure.in (CXX_SYSINCLUDES): New substituted variable.
+	* configure: Regenerated.
+	* Makeconfig (CXXFLAGS): Prepend $(c++-sysincludes) here.
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+	(PTR_MANGLE): Fix cast.
+
+	* sysdeps/alpha/bits/setjmp.h (_JMPBUF_UNWINDS): Take third argument
+	DEMANGLE, and pass SP value through it.
+	* sysdeps/hppa/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/i386/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/m68k/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/mips/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/powerpc/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/s390/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/sh/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/sparc/sparc32/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* sysdeps/unix/sysv/linux/ia64/bits/setjmp.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/setjmp.h: Likewise.
+	* sysdeps/x86_64/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise.
+	* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Pass inline
+	demangler function to _JMPBUF_UNWINDS.
+	* sysdeps/mach/hurd/jmp-unwind.c (demangle_ptr): New function.
+	(_longjmp_unwind): Pass it to _JMPBUF_UNWINDS.
+
+	* posix/tst-execle1.c (do_test): Add a const.
+	* posix/tst-execle2.c (do_test): Likewise.
+
+	* posix/transbug.c (run_test): Add some casts.
+	* posix/bug-regex22.c (main): Likewise.
+	* posix/bug-regex5.c (main): Likewise.
+	* wcsmbs/tst-mbsrtowcs.c (main): Likewise.
+	* string/test-strspn.c (do_test, do_random_tests): Likewise.
+	* string/test-strrchr.c (do_test, do_random_tests): Likewise.
+	* string/test-strlen.c (do_random_tests): Likewise.
+	* string/test-strpbrk.c (do_test, do_random_tests): Likewise.
+	* string/test-strcmp.c (do_random_tests): Likewise.
+	* string/test-strchr.c (do_test, do_random_tests): Likewise.
+	* string/test-strcat.c (do_test, do_random_tests): Likewise.
+	* string/test-strncpy.c (do_random_tests): Likewise.
+	* string/test-strcpy.c (do_test, do_random_tests): Likewise.
+	* string/test-memccpy.c (do_test): Likewise.
+	* string/test-memmove.c (do_test, do_random_tests): Likewise.
+	* string/test-memcpy.c (do_test, do_random_tests): Likewise.
+	* string/test-memcmp.c (do_test, do_random_tests): Likewise.
+	* string/test-memchr.c (do_test, do_random_tests): Likewise.
+	* dlfcn/bug-atexit1.c (do_test): Fix up prototype in cast.
+	* stdio-common/tst-fgets.c (do_test): Add a cast.
+	* iconvdata/bug-iconv4.c (xiconv): Add a cast.
+
+	* locale/programs/simple-hash.c (insert_entry_2): Remove useless casts.
+
+	* resolv/herror.c (herror): Remove unused extern decl.
+
+	* libio/obprintf.c: Include "strfile.h".
+
+	* elf/order2mod2.c (init): Cast ignored value to void.
+
 2005-12-27  Jakub Jelinek  <jakub@redhat.com>
 
 	* elf/ldconfig.c (search_dir): Skip prelink temporaries.
 
 2005-12-27  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/tst-tls13.c (do_test): Avoid using the library path when
+	looking for tst-tlsmod13a.so.
+
+	* stdio-common/tstdiomisc.c: If FLT_EVAL_METHOD is 2, use long
+	double math to generate NaN results.
+
 	* sysdeps/unix/sysv/linux/sparc/bits/errno.h: Define EOWNERDEAD
 	and ENOTRECOVERABLE if not already defined.
 	* sysdeps/unix/sysv/linux/alpha/bits/errno.h: Likewise.
diff --git a/Makeconfig b/Makeconfig
index f32a19eab6..67f85c0905 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -651,7 +651,8 @@ override CFLAGS	= -std=gnu99 \
 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
 		  $(CFLAGS-$(@F))
-override CXXFLAGS = $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
+override CXXFLAGS = $(c++-sysincludes) \
+		    $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
 		    $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
 
 # If everything is compiled with -fPIC (implicitly) we must tell this by
diff --git a/catgets/gencat.c b/catgets/gencat.c
index 2afecadcbe..e72754d526 100644
--- a/catgets/gencat.c
+++ b/catgets/gencat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 1996.
 
@@ -246,7 +246,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/config.make.in b/config.make.in
index 3af1e396e9..871c5d60de 100644
--- a/config.make.in
+++ b/config.make.in
@@ -34,6 +34,7 @@ with-cpu = @submachine@
 
 defines = @DEFINES@
 sysincludes = @SYSINCLUDES@
+c++-sysincludes = @CXX_SYSINCLUDES@
 all-warnings = @all_warnings@
 
 elf = @elf@
diff --git a/configure b/configure
index e8e8b363f1..d46bb19fb0 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine submachine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine submachine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -4487,9 +4487,17 @@ if test -n "$sysheaders"; then
   ccheaders=`$CC -print-file-name=include`
   SYSINCLUDES="-nostdinc -isystem $ccheaders \
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
+  if test -n "$CXX"; then
+    cxxversion=`$CXX -dumpversion 2>&5` &&
+    cxxmachine=`$CXX -dumpmachine 2>&5` &&
+    cxxheaders=`$CXX -print-file-name=../../../../include/c++/`"$cxxversion" &&
+    CXX_SYSINCLUDES="-isystem $cxxheaders \
+-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
+  fi
 fi
 
 
+
 # check if ranlib is necessary
 echo "$as_me:$LINENO: checking whether ranlib is necessary" >&5
 echo $ECHO_N "checking whether ranlib is necessary... $ECHO_C" >&6
@@ -8401,6 +8409,7 @@ s,@MAKEINFO@,$MAKEINFO,;t t
 s,@SED@,$SED,;t t
 s,@AUTOCONF@,$AUTOCONF,;t t
 s,@SYSINCLUDES@,$SYSINCLUDES,;t t
+s,@CXX_SYSINCLUDES@,$CXX_SYSINCLUDES,;t t
 s,@libc_cv_gcc_static_libgcc@,$libc_cv_gcc_static_libgcc,;t t
 s,@BASH@,$BASH,;t t
 s,@libc_cv_have_bash2@,$libc_cv_have_bash2,;t t
diff --git a/configure.in b/configure.in
index ba7ca30b2f..4ae30ae2c9 100644
--- a/configure.in
+++ b/configure.in
@@ -838,8 +838,16 @@ if test -n "$sysheaders"; then
   ccheaders=`$CC -print-file-name=include`
   SYSINCLUDES="-nostdinc -isystem $ccheaders \
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
+  if test -n "$CXX"; then
+    cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
+    cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
+    cxxheaders=`$CXX -print-file-name=../../../../include/c++/`"$cxxversion" &&
+    CXX_SYSINCLUDES="-isystem $cxxheaders \
+-isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
+  fi
 fi
 AC_SUBST(SYSINCLUDES)
+AC_SUBST(CXX_SYSINCLUDES)
 
 # check if ranlib is necessary
 AC_CACHE_CHECK(whether ranlib is necessary, libc_cv_ranlib_necessary, [dnl
diff --git a/csu/version.c b/csu/version.c
index 606246a6e1..2196d20432 100644
--- a/csu/version.c
+++ b/csu/version.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2002, 2003, 2004, 2006 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
@@ -25,7 +25,7 @@ static const char __libc_version[] = VERSION;
 
 static const char banner[] =
 "GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\
-Copyright (C) 2005 Free Software Foundation, Inc.\n\
+Copyright (C) 2006 Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.\n\
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
 PARTICULAR PURPOSE.\n\
diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh
index f7e79bce42..f4d971e34b 100755
--- a/debug/catchsegv.sh
+++ b/debug/catchsegv.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1998,1999,2001,2003,2004,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -39,7 +39,7 @@ if test $# -eq 0; then
       ;;
     --v | --ve | --ver | --vers | --versi | --versio | --version)
       echo 'catchsegv (GNU libc) @VERSION@'
-      echo 'Copyright (C) 2005 Free Software Foundation, Inc.
+      echo 'Copyright (C) 2006 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 Written by Ulrich Drepper.'
diff --git a/debug/xtrace.sh b/debug/xtrace.sh
index 077b58bd1f..950ea5d207 100755
--- a/debug/xtrace.sh
+++ b/debug/xtrace.sh
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999, 2001-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001-2004, 2005, 2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
@@ -64,7 +64,7 @@ do_version() {
   printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2005"
+" "2006"
   printf $"Written by %s.
 " "Ulrich Drepper"
   exit 0
diff --git a/dlfcn/bug-atexit1.c b/dlfcn/bug-atexit1.c
index 3bdb5587b1..e2d1d2f776 100644
--- a/dlfcn/bug-atexit1.c
+++ b/dlfcn/bug-atexit1.c
@@ -10,7 +10,7 @@ do_test (void)
   for (int i = 0; i < 2; ++i)
     {
       void *dso = dlopen ("$ORIGIN/bug-atexit1-lib.so", RTLD_NOW);
-      void (*fn) (void) = (void (*)()) dlsym (dso, "foo");
+      void (*fn) (void) = (void (*) (void)) dlsym (dso, "foo");
       fn ();
       dlclose (dso);
       puts ("round done");
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index beece51ad8..3963627aa0 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -286,7 +286,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"),
 	   "Andreas Jaeger");
 }
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 4587efd1cb..100d2335d2 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996-2004, 2005, 2006 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
@@ -39,7 +39,7 @@ while test $# -gt 0; do
     printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2005"
+" "2006"
     printf $"Written by %s and %s.
 " "Roland McGrath" "Ulrich Drepper"
     exit 0
diff --git a/elf/order2mod2.c b/elf/order2mod2.c
index b03fb60fa3..026cd2acc4 100644
--- a/elf/order2mod2.c
+++ b/elf/order2mod2.c
@@ -7,7 +7,7 @@ void
 __attribute__ ((constructor))
 init (void)
 {
-  foo () - bar ();
+  (void) (foo () - bar ());
 }
 
 static void
diff --git a/elf/rtld.c b/elf/rtld.c
index 71bcf0ab71..76d129a0a0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1307,6 +1307,13 @@ ld.so does not support TLS, but program uses it!\n");
 	  _dl_setup_hash (l);
 	  l->l_relocated = 1;
 
+	  /* Initialize l_local_scope to contain just this map.  This allows
+	     the use of dl_lookup_symbol_x to resolve symbols within the vdso.
+	     So we create a single entry list pointing to l_real as its only
+	     element */
+	  l->l_local_scope[0]->r_nlist = 1;
+	  l->l_local_scope[0]->r_list = &l->l_real;
+
 	  /* Now that we have the info handy, use the DSO image's soname
 	     so this object can be looked up by name.  Note that we do not
 	     set l_name here.  That field gives the file name of the DSO,
diff --git a/elf/sprof.c b/elf/sprof.c
index 9567e4689f..e53a7ba7a3 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -1,5 +1,5 @@
 /* Read and display shared object profiling data.
-   Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997-2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -357,7 +357,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
 "),
-	   "2005");
+	   "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/elf/tst-tls13.c b/elf/tst-tls13.c
index 55fb62e540..06bfbacb5c 100644
--- a/elf/tst-tls13.c
+++ b/elf/tst-tls13.c
@@ -2,17 +2,17 @@
 #include <dlfcn.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 
 static int
 do_test (void)
 {
-  int i;
-  for (i = 0; i < 1000;)
+  for (int i = 0; i < 1000;)
     {
       printf ("round %d\n",++i);
 
-      void *h = dlopen ("tst-tlsmod13a.so", RTLD_LAZY);
+      void *h = dlopen ("$ORIGIN/tst-tlsmod13a.so", RTLD_LAZY);
       if (h == NULL)
 	{
 	  printf ("cannot load: %s\n", dlerror ());
diff --git a/fedora/branch.mk b/fedora/branch.mk
index eb64c97cd4..bb723f9637 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc4
-fedora-sync-date := 2005-12-27 14:26 UTC
-fedora-sync-tag := fedora-glibc-20051227T1426
+fedora-sync-date := 2006-01-02 10:45 UTC
+fedora-sync-tag := fedora-glibc-20060102T1045
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 1d11a42b9e..ff6b489d91 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -602,7 +602,7 @@ rm -f $RPM_BUILD_ROOT/%{_lib}/libNoVersion*
 
 # NPTL <bits/stdio-lock.h> is not usable outside of glibc, so include
 # the generic one (#162634)
-cp -a sysdeps/generic/bits/stdio-lock.h $RPM_BUILD_ROOT%{_prefix}/include/bits/stdio-lock.h
+cp -a bits/stdio-lock.h $RPM_BUILD_ROOT%{_prefix}/include/bits/stdio-lock.h
 
 if [ -d $RPM_BUILD_ROOT%{_prefix}/info -a "%{_infodir}" != "%{_prefix}/info" ]; then
     mkdir -p $RPM_BUILD_ROOT%{_infodir}
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 1f53f911a7..0a886229f0 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -1,5 +1,5 @@
 /* hairy bits of Hurd file name lookup
-   Copyright (C) 1992,1993,1994,1995,1996,1997,1999,2001,2002,2003
+   Copyright (C) 1992,1993,1994,1995,1996,1997,1999,2001,2002,2003,2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -247,7 +247,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
 		  char *p;
 		  /* XXX want client's host */
 		  if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO,
-					 (natural_t *) &hostinfo,
+					 (integer_t *) &hostinfo,
 					 &hostinfocnt))
 		    return err;
 		  if (hostinfocnt != HOST_BASIC_INFO_COUNT)
diff --git a/hurd/report-wait.c b/hurd/report-wait.c
index da0ca3bdb2..296b2eec42 100644
--- a/hurd/report-wait.c
+++ b/hurd/report-wait.c
@@ -140,7 +140,7 @@ _S_msg_report_wait (mach_port_t msgport, thread_t thread,
 	  error_t err;
 
 	  err = __thread_get_state (thread, MACHINE_THREAD_STATE_FLAVOR,
-				    (integer_t *) &state, &count);
+				    (natural_t *) &state, &count);
 	  if (err)
 	    return err;
 	  assert (count == MACHINE_THREAD_STATE_COUNT);
diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c
index 2231518bd0..67f78c1ce5 100644
--- a/hurd/sigunwind.c
+++ b/hurd/sigunwind.c
@@ -21,6 +21,7 @@
 #include <thread_state.h>
 #include <setjmp.h>
 #include <assert.h>
+#include <stdint.h>
 
 
 /* _hurd_setup_sighandler puts a link on the `active resources' chain so that
@@ -70,11 +71,19 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
 
       struct hurd_userlink *link;
 
+      inline uintptr_t demangle_ptr (uintptr_t x)
+	{
+# ifdef PTR_DEMANGLE
+	  PTR_DEMANGLE (x);
+# endif
+	  return x;
+	}
+
       /* Continue _longjmp_unwind's job of running the unwind
 	 forms for frames being unwound, since we will not
 	 return to its loop like this one, which called us.  */
       for (link = ss->active_resources;
-	   link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link);
+	   link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr);
 	   link = link->thread.next)
 	if (_hurd_userlink_unlink (link))
 	  {
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index a7036af99c..033cd93f23 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -1,5 +1,5 @@
 /* Convert text in given files from the specified from-set to the to-set.
-   Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1998-2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -426,7 +426,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index 96a86191e9..9d23520314 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -1,5 +1,5 @@
 /* Generate fastloading iconv module configuration files.
-   Copyright (C) 2000-2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000-2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -395,7 +395,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/iconvdata/bug-iconv4.c b/iconvdata/bug-iconv4.c
index f6bfebd39f..4469034b93 100644
--- a/iconvdata/bug-iconv4.c
+++ b/iconvdata/bug-iconv4.c
@@ -15,7 +15,7 @@ xiconv (iconv_t cd, int out_size)
 {
   unsigned char euc[4];
   char *inp = (char *) UCS_STR;
-  char *outp = euc;
+  char *outp = (char *) euc;
   size_t inbytesleft = strlen (UCS_STR);
   size_t outbytesleft = out_size;
   size_t ret;
diff --git a/include/sys/xattr.h b/include/sys/xattr.h
new file mode 100644
index 0000000000..64f8f56809
--- /dev/null
+++ b/include/sys/xattr.h
@@ -0,0 +1 @@
+#include <misc/sys/xattr.h>
diff --git a/libio/iogetwline.c b/libio/iogetwline.c
index e529b7d832..45db478423 100644
--- a/libio/iogetwline.c
+++ b/libio/iogetwline.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997-2000,2002,2005 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
@@ -87,9 +87,9 @@ _IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
 		*ptr++ = wc;
 	      else if (extract_delim < 0)
 		INTUSE(_IO_sputbackc) (fp, wc);
-	      return ptr - buf;
 	      if (extract_delim > 0)
 		++len;
+	      return ptr - buf;
 	    }
 	  *ptr++ = wc;
 	  n--;
diff --git a/libio/obprintf.c b/libio/obprintf.c
index 19300e80a3..1167a93d0b 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -1,5 +1,6 @@
 /* Print output of stream to given obstack.
-   Copyright (C) 1996,1997,1999-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999,2000,2001,2002,2003,2004,2005
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -23,6 +24,7 @@
 #include <stdlib.h>
 #endif
 #include "libioP.h"
+#include "strfile.h"
 #include <assert.h>
 #include <string.h>
 #include <errno.h>
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 526eb2b929..a03974e8a1 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,5 +1,5 @@
 /* Implementation of the locale program according to POSIX 9945-2.
-   Copyright (C) 1995-1997, 1999-2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -275,7 +275,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index dfabaa9f8a..645a803c06 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -387,7 +387,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
 }
 
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index 86bbdd5b13..de8998cc7a 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -146,13 +146,13 @@ insert_entry_2 (htab, key, keylen, hval, idx, data)
   if ((hash_entry *) htab->first == NULL)
     {
       table[idx].next = &table[idx];
-      *(hash_entry **) &htab->first = &table[idx];
+      htab->first = &table[idx];
     }
   else
     {
       table[idx].next = ((hash_entry *) htab->first)->next;
       ((hash_entry *) htab->first)->next = &table[idx];
-      *(hash_entry **) &htab->first = &table[idx];
+      htab->first = &table[idx];
     }
 
   ++htab->filled;
diff --git a/malloc/memusage.sh b/malloc/memusage.sh
index b2e08c6039..16413cf868 100755
--- a/malloc/memusage.sh
+++ b/malloc/memusage.sh
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999-2004, 2005, 2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
@@ -71,7 +71,7 @@ do_version() {
   printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2005"
+" "2006"
   printf $"Written by %s.
 " "Ulrich Drepper"
   exit 0
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 0036f33f59..8a0fbc7e95 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -1,7 +1,7 @@
 #! @PERL@
 eval "exec @PERL@ -S $0 $*"
     if 0;
-# Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997-2004, 2005, 2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1997.
 # Based on the mtrace.awk script.
@@ -45,7 +45,7 @@ arglist: while (@ARGV) {
 	$ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" ||
 	$ARGV[0] eq "--versio" || $ARGV[0] eq "--version") {
 	print "mtrace (GNU $PACKAGE) $VERSION\n";
-	print "Copyright (C) 2005 Free Software Foundation, Inc.\n";
+	print "Copyright (C) 2006 Free Software Foundation, Inc.\n";
 	print "This is free software; see the source for copying conditions.  There is NO\n";
 	print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
 	print "Written by Ulrich Drepper <drepper\@gnu.org>\n";
diff --git a/manual/filesys.texi b/manual/filesys.texi
index dbc97f2f12..c8ae377266 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1250,10 +1250,10 @@ result is passed back as the return value of the function in a block of
 memory allocated with @code{malloc}.  If the result is not used anymore
 the memory should be freed with a call to @code{free}.
 
-In any of the path components except the last one is missing the
-function returns a NULL pointer.  This is also what is returned if the
-length of the path reaches or exceeds @code{PATH_MAX} characters.  In
-any case @code{errno} is set accordingly.
+If any of the path components is missing the function returns a NULL
+pointer.  This is also what is returned if the length of the path
+reaches or exceeds @code{PATH_MAX} characters.  In any case
+@code{errno} is set accordingly.
 
 @table @code
 @item ENAMETOOLONG
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0b29a61e0d..b56a261696 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,43 @@
+2006-01-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* version.c: Update copyright year.
+
+2005-12-29  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Remove explicit
+	.eh_frame section, use cfi_* directives.
+	* sysdeps/unix/sysv/linux/sh/lowlevellock.S: Add cfi instrumentation.
+
+2005-12-30  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Undo last change for
+	now.
+
+2005-12-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/pthread/sigaction.c: Removed.
+	* sigaction.c: New file.
+	* sysdeps/unix/sysv/linux/Makefile: Define CFLAGS-sigaction.c.
+
+2005-12-28  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile (tests): Add tst-signal7.
+	* tst-signal7.c: New file.
+
+2005-12-27  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/x86_64/jmpbuf-unwind.h (_jmpbuf_sp): New inline function.
+	(_JMPBUF_UNWINDS_ADJ): Use it, to PTR_DEMANGLE before comparison.
+	* sysdeps/alpha/jmpbuf-unwind.h: Likewise.
+	* sysdeps/i386/jmpbuf-unwind.h: Likewise.
+	* sysdeps/mips/jmpbuf-unwind.h: Likewise.
+	* sysdeps/powerpc/jmpbuf-unwind.h: Likewise.
+	* sysdeps/s390/jmpbuf-unwind.h: Likewise.
+	* sysdeps/sh/jmpbuf-unwind.h: Likewise.
+	* sysdeps/sparc/sparc32/jmpbuf-unwind.h: Likewise.
+	* sysdeps/sparc/sparc64/jmpbuf-unwind.h: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Likewise.
+
 2005-12-27  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Add __next
diff --git a/nptl/Makefile b/nptl/Makefile
index a3b11730a1..b15b8ad23a 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -229,7 +229,7 @@ tests = tst-typesizes \
 	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
-	tst-signal6 \
+	tst-signal6 tst-signal7 \
 	tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
 	tst-exit1 tst-exit2 tst-exit3 \
 	tst-stdio1 tst-stdio2 \
diff --git a/nptl/sysdeps/pthread/sigaction.c b/nptl/sigaction.c
index 445a2cb36f..60e1f1d355 100644
--- a/nptl/sysdeps/pthread/sigaction.c
+++ b/nptl/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -17,22 +17,17 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* This is tricky.  GCC doesn't like #include_next in the primary
-   source file and even if it did, the first #include_next is this
-   exact file anyway.  */
-#ifndef LIBC_SIGACTION
+
+/* This is no complete implementation.  The file is meant to be
+   included in the real implementation to provide the wrapper around
+   __libc_sigaction.  */
 
 #include <nptl/pthreadP.h>
 
 /* We use the libc implementation but we tell it to not allow
    SIGCANCEL or SIGTIMER to be handled.  */
-# define LIBC_SIGACTION	1
+#define LIBC_SIGACTION	1
 
-/* Note this include must be one that isn't found using a -I directory such
-   as -I. or -I.. for using an explicit <sysdeps/...> path, because that
-   would reset the search path starting position for the #include_next
-   below, to after that -I directory, and skip the search we want to do.  */
-# include "sigaction.c"
 
 int
 __sigaction (sig, act, oact)
@@ -50,9 +45,3 @@ __sigaction (sig, act, oact)
 }
 libc_hidden_weak (__sigaction)
 weak_alias (__sigaction, sigaction)
-
-#else
-
-# include_next <sigaction.c>
-
-#endif /* LIBC_SIGACTION */
diff --git a/nptl/sysdeps/alpha/jmpbuf-unwind.h b/nptl/sysdeps/alpha/jmpbuf-unwind.h
index 5cef8b1cf5..83b7a01a0e 100644
--- a/nptl/sysdeps/alpha/jmpbuf-unwind.h
+++ b/nptl/sysdeps/alpha/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/i386/jmpbuf-unwind.h b/nptl/sysdeps/i386/jmpbuf-unwind.h
index 5cef8b1cf5..83b7a01a0e 100644
--- a/nptl/sysdeps/i386/jmpbuf-unwind.h
+++ b/nptl/sysdeps/i386/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/mips/jmpbuf-unwind.h b/nptl/sysdeps/mips/jmpbuf-unwind.h
index 67cc969663..9ee03100e6 100644
--- a/nptl/sysdeps/mips/jmpbuf-unwind.h
+++ b/nptl/sysdeps/mips/jmpbuf-unwind.h
@@ -19,12 +19,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__sp;
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].__sp - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal longjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/powerpc/jmpbuf-unwind.h b/nptl/sysdeps/powerpc/jmpbuf-unwind.h
index 0b817160d3..d9090a591d 100644
--- a/nptl/sysdeps/powerpc/jmpbuf-unwind.h
+++ b/nptl/sysdeps/powerpc/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_GPR1];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_GPR1] - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/s390/jmpbuf-unwind.h b/nptl/sysdeps/s390/jmpbuf-unwind.h
index 9f7e1ad583..81fa582540 100644
--- a/nptl/sysdeps/s390/jmpbuf-unwind.h
+++ b/nptl/sysdeps/s390/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include <unwind.h>
 #include <bits/wordsize.h>
+#include <sysdep.h>
 
 /* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual
    %r15.  */
@@ -29,9 +30,18 @@
 		       (void *) (_Unwind_GetCFA (_context)	\
 				 - 32 - 2 * __WORDSIZE), _adj)
 
-#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj)		\
-  ((uintptr_t) (_address) - (_adj)				\
-   < (uintptr_t) (_jmpbuf)->__gregs[__JB_GPR15] - (_adj))
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__gregs[__JB_GPR15];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal longjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/sh/jmpbuf-unwind.h b/nptl/sysdeps/sh/jmpbuf-unwind.h
index cf6d25f041..3ef178b4d6 100644
--- a/nptl/sysdeps/sh/jmpbuf-unwind.h
+++ b/nptl/sysdeps/sh/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
-#define _JMPBUF_UNWINDS_ADJ(jmpbuf, address, adj) \
-  ((uintptr_t) (address) - (adj) < (uintptr_t) (jmpbuf)[0].__regs[7] - (adj))
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__regs[7];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h
index 5cef8b1cf5..83b7a01a0e 100644
--- a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h
+++ b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h
index 77321aad3f..7752fe971e 100644
--- a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h
+++ b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].uc_mcontext.mc_fp;
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].uc_mcontext.mc_fp - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/sysdeps/unix/sysv/linux/Makefile b/nptl/sysdeps/unix/sysv/linux/Makefile
index 991398242a..14f513c127 100644
--- a/nptl/sysdeps/unix/sysv/linux/Makefile
+++ b/nptl/sysdeps/unix/sysv/linux/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -32,3 +32,6 @@ CFLAGS-fork.c = -D_IO_MTSAFE_IO
 CFLAGS-getpid.o = -fomit-frame-pointer
 CFLAGS-getpid.os = -fomit-frame-pointer
 endif
+
+# Needed in both the signal and nptl subdir.
+CFLAGS-sigaction.c = -DWRAPPER_INCLUDE='<nptl/sigaction.c>'
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index b4826ef7aa..ac3169889f 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -32,8 +32,11 @@
 	.type	__lll_mutex_lock_wait,@function
 	.hidden	__lll_mutex_lock_wait
 	.align	5
+	cfi_startproc
 __lll_mutex_lock_wait:
 	mov.l	r8, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r8, 0)
 	mov	r4, r6
 	mov	r5, r8
 	mov	#0, r7		/* No timeout.  */
@@ -59,6 +62,7 @@ __lll_mutex_lock_wait:
 	mov.l	@r15+, r8
 	ret
 	 mov	r2, r0
+	cfi_endproc
 	.size	__lll_mutex_lock_wait,.-__lll_mutex_lock_wait
 
 
@@ -67,6 +71,7 @@ __lll_mutex_lock_wait:
 	.type	__lll_mutex_timedlock_wait,@function
 	.hidden	__lll_mutex_timedlock_wait
 	.align	5
+	cfi_startproc
 __lll_mutex_timedlock_wait:
 	/* Check for a valid timeout value.  */
 	mov.l	@(4,r6), r1
@@ -75,14 +80,21 @@ __lll_mutex_timedlock_wait:
 	bt	3f
 
 	mov.l	r10, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r10, 0)
 	mov.l	r9, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r9, 0)
 	mov.l	r8, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r8, 0)
 	mov	r4, r10
 	mov	r6, r9
 	mov	r5, r8
 
 	/* Stack frame for the timespec and timeval structs.  */
 	add	#-8, r15
+	cfi_adjust_cfa_offset(8)
 
 1:
 	/* Get current time.  */
@@ -162,6 +174,7 @@ __lll_mutex_timedlock_wait:
 5:
 	bra	6b
 	 mov	#ETIMEDOUT, r0
+	cfi_endproc
 
 .L1k:
 	.word	1000
@@ -178,6 +191,7 @@ __lll_mutex_timedlock_wait:
 	.type	lll_unlock_wake_cb,@function
 	.hidden	lll_unlock_wake_cb
 	.align	5
+	cfi_startproc
 lll_unlock_wake_cb:
 	DEC	(@r4, r2)
 	tst	r2, r2
@@ -195,6 +209,7 @@ lll_unlock_wake_cb:
 1:	
 	rts
 	 nop
+	cfi_endproc
 	.size	lll_unlock_wake_cb,.-lll_unlock_wake_cb
 #endif
 
@@ -203,6 +218,7 @@ lll_unlock_wake_cb:
 	.type	__lll_mutex_unlock_wake,@function
 	.hidden	__lll_mutex_unlock_wake
 	.align	5
+	cfi_startproc
 __lll_mutex_unlock_wake:
 	mov	#FUTEX_WAKE, r5
 	mov	#1, r6		/* Wake one thread.  */
@@ -214,6 +230,7 @@ __lll_mutex_unlock_wake:
 	SYSCALL_INST_PAD
 	rts
 	 nop
+	cfi_endproc
 	.size	__lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
 
 
@@ -222,14 +239,20 @@ __lll_mutex_unlock_wake:
 	.type	__lll_timedwait_tid,@function
 	.hidden	__lll_timedwait_tid
 	.align	5
+	cfi_startproc
 __lll_timedwait_tid:
 	mov.l	r9, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r9, 0)
 	mov.l	r8, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r8, 0)
 	mov	r4, r8
 	mov	r5, r9
 
 	/* Stack frame for the timespec and timeval structs.  */
 	add	#-8, r15
+	cfi_adjust_cfa_offset(8)
 
 2:
 	/* Get current time.  */
@@ -292,6 +315,7 @@ __lll_timedwait_tid:
 6:
 	bra	3b
 	 mov	#ETIMEDOUT, r0
+	cfi_endproc
 
 .L1k2:
 	.word	1000
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index fc3c2340b6..9a967eaf53 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 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
@@ -49,27 +49,32 @@
     .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
  .Lpseudo_cancel: \
     sts.l pr,@-r15; \
- .LCFI0: \
+    cfi_adjust_cfa_offset (4); \
+    cfi_rel_offset (pr, 0); \
     add _IMM16,r15; \
+    cfi_adjust_cfa_offset (16); \
     SAVE_ARGS_##args; \
- .LCFI1: \
     CENABLE; \
     LOAD_ARGS_##args; \
     add _IMP16,r15; \
- .LCFI2: \
+    cfi_adjust_cfa_offset (-16); \
     lds.l @r15+,pr; \
- .LCFI3: \
+    cfi_adjust_cfa_offset (-4); \
+    cfi_restore (pr); \
     DO_CALL(syscall_name, args); \
     SYSCALL_INST_PAD; \
     sts.l pr,@-r15; \
- .LCFI4: \
+    cfi_adjust_cfa_offset (4); \
+    cfi_rel_offset (pr, 0); \
     mov.l r0,@-r15; \
- .LCFI5: \
+    cfi_adjust_cfa_offset (4); \
+    cfi_rel_offset (r0, 0); \
     CDISABLE; \
     mov.l @r15+,r0; \
- .LCFI6: \
+    cfi_adjust_cfa_offset (-4); \
     lds.l @r15+,pr; \
- .LCFI7: \
+    cfi_adjust_cfa_offset (-4); \
+    cfi_restore (pr); \
     mov r0,r1; \
     mov _IMM12,r2; \
     shad r2,r1; \
@@ -78,106 +83,17 @@
     bf .Lpseudo_end; \
  .Lsyscall_error: \
     SYSCALL_ERROR_HANDLER; \
- .Lpseudo_end: \
- /* Create unwinding information for the syscall wrapper.  */ \
- .section .eh_frame,"a",@progbits; \
- .Lframe1: \
-    .ualong .LECIE1-.LSCIE1; \
- .LSCIE1: \
-    .ualong 0x0; \
-    .byte   0x1; \
-    AUGMENTATION_STRING; \
-    .uleb128 0x1; \
-    .sleb128 -4; \
-    .byte   0x11; \
-    AUGMENTATION_PARAM; \
-    .byte   0xc; \
-    .uleb128 0xf; \
-    .uleb128 0x0; \
-    .align 2; \
- .LECIE1: \
- .LSFDE1: \
-    .ualong .LEFDE1-.LASFDE1; \
- .LASFDE1: \
-    .ualong .LASFDE1-.Lframe1; \
-    START_SYMBOL_REF; \
-    .ualong .Lpseudo_end - .Lpseudo_start; \
-    AUGMENTATION_PARAM_FDE; \
-    .byte   0x4; \
-    .ualong .LCFI0-.Lpseudo_start; \
-    .byte   0xe; \
-    .uleb128 0x4; \
-    .byte   0x91; \
-    .uleb128 0x1; \
-    .byte   0x4; \
-    .ualong .LCFI1-.LCFI0; \
-    .byte   0xe; \
-    .uleb128 0x14; \
-    FRAME_REG_##args; \
-    .byte   0x4; \
-    .ualong .LCFI2-.LCFI1; \
-    .byte   0xe; \
-    .uleb128 0x4; \
-    .byte   0x4; \
-    .ualong .LCFI3-.LCFI2; \
-    .byte   0xe; \
-    .uleb128 0x0; \
-    .byte   0xd1; \
-    .byte   0x4; \
-    .ualong .LCFI4-.LCFI3; \
-    .byte   0xe; \
-    .uleb128 0x4; \
-    .byte   0x91; \
-    .uleb128 0x1; \
-    .byte   0x4; \
-    .ualong .LCFI5-.LCFI4; \
-    .byte   0xe; \
-    .uleb128 0x8; \
-    .byte   0x80; \
-    .uleb128 0x2; \
-    .byte   0x4; \
-    .ualong .LCFI6-.LCFI5; \
-    .byte   0xe; \
-    .uleb128 0x4; \
-    .byte   0xc0; \
-    .byte   0x4; \
-    .ualong .LCFI7-.LCFI6; \
-    .byte   0xe; \
-    .uleb128 0x0; \
-    .byte   0xd1; \
-    .align 2; \
- .LEFDE1: \
- .previous
-
-# ifdef SHARED
-#  define AUGMENTATION_STRING .string "zR"
-#  define AUGMENTATION_PARAM .uleb128 1; .byte 0x1b
-#  define AUGMENTATION_PARAM_FDE .uleb128 0
-#  define START_SYMBOL_REF .long .Lpseudo_start-.
-# else
-#  define AUGMENTATION_STRING .ascii "\0"
-#  define AUGMENTATION_PARAM
-#  define AUGMENTATION_PARAM_FDE
-#  define START_SYMBOL_REF .long .Lpseudo_start
-# endif
-
-# define FRAME_REG_0	/* Nothing.  */
-# define FRAME_REG_1	FRAME_REG_0; .byte 0x84; .uleb128 5
-# define FRAME_REG_2	FRAME_REG_1; .byte 0x85; .uleb128 4
-# define FRAME_REG_3	FRAME_REG_2; .byte 0x86; .uleb128 3
-# define FRAME_REG_4	FRAME_REG_3; .byte 0x87; .uleb128 2
-# define FRAME_REG_5	FRAME_REG_4
-# define FRAME_REG_6	FRAME_REG_5
+ .Lpseudo_end:
 
 # undef PSEUDO_END
 # define PSEUDO_END(sym) \
   END (sym)
 
 # define SAVE_ARGS_0	/* Nothing.  */
-# define SAVE_ARGS_1	SAVE_ARGS_0; mov.l r4,@(0,r15)
-# define SAVE_ARGS_2	SAVE_ARGS_1; mov.l r5,@(4,r15)
-# define SAVE_ARGS_3	SAVE_ARGS_2; mov.l r6,@(8,r15)
-# define SAVE_ARGS_4	SAVE_ARGS_3; mov.l r7,@(12,r15)
+# define SAVE_ARGS_1	SAVE_ARGS_0; mov.l r4,@(0,r15); cfi_offset (r4,-4)
+# define SAVE_ARGS_2	SAVE_ARGS_1; mov.l r5,@(4,r15); cfi_offset (r5,-8)
+# define SAVE_ARGS_3	SAVE_ARGS_2; mov.l r6,@(8,r15); cfi_offset (r6,-12)
+# define SAVE_ARGS_4	SAVE_ARGS_3; mov.l r7,@(12,r15); cfi_offset (r7,-16)
 # define SAVE_ARGS_5	SAVE_ARGS_4
 # define SAVE_ARGS_6	SAVE_ARGS_5
 
diff --git a/nptl/sysdeps/x86_64/jmpbuf-unwind.h b/nptl/sysdeps/x86_64/jmpbuf-unwind.h
index 345ed557c5..1a36c53d11 100644
--- a/nptl/sysdeps/x86_64/jmpbuf-unwind.h
+++ b/nptl/sysdeps/x86_64/jmpbuf-unwind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -20,12 +20,23 @@
 #include <setjmp.h>
 #include <stdint.h>
 #include <unwind.h>
+#include <sysdep.h>
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
 
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_RSP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
 #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
-  ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_RSP] - (_adj))
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
 
 /* We use the normal lobngjmp for unwinding.  */
 #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/nptl/tst-robust7.c b/nptl/tst-robust7.c
new file mode 100644
index 0000000000..2c5acb44ce
--- /dev/null
+++ b/nptl/tst-robust7.c
@@ -0,0 +1,195 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+
+static pthread_barrier_t b;
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t m;
+static bool first = true;
+
+
+static void *
+tf (void *arg)
+{
+  long int n = (long int) arg;
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      printf ("thread %ld: mutex_lock failed\n", n + 1);
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("thread %ld: barrier_wait failed\n", n + 1);
+      exit (1);
+    }
+
+  e = pthread_cond_wait (&c, &m);
+  if (first)
+    {
+      if (e != 0)
+	{
+	  printf ("thread %ld: cond_wait failed\n", n + 1);
+	  exit (1);
+	}
+      first = false;
+    }
+  else
+    {
+      if (e != EOWNERDEAD)
+	{
+	  printf ("thread %ld: cond_wait did not return EOWNERDEAD\n", n + 1);
+	  exit (1);
+	}
+    }
+
+  if (pthread_cancel (pthread_self ()) != 0)
+    {
+      printf ("thread %ld: cancel failed\n", n + 1);
+      exit (1);
+    }
+
+  pthread_testcancel ();
+
+  printf ("thread %ld: testcancel returned\n", n + 1);
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_mutexattr_t a;
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_setrobust_np (&a, PTHREAD_MUTEX_ROBUST_NP) != 0)
+    {
+      puts ("mutexattr_setrobust failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (&m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+#define N 5
+  pthread_t th[N];
+  for (long int n = 0; n < N; ++n)
+    {
+      if (pthread_create (&th[n], NULL, tf, (void *) n) != 0)
+	{
+	  printf ("pthread_create loop %ld failed\n", n + 1);
+	  return 1;
+	}
+
+      int e = pthread_barrier_wait (&b);
+      if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("parent: barrier_wait failed in round %ld\n", n + 1);
+	  return 1;
+	}
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("parent: mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("parent: mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_cond_broadcast (&c) != 0)
+    {
+      puts ("cond_broadcast failed");
+      return 1;
+    }
+
+  for (int n = 0; n < N; ++n)
+    {
+      void *res;
+      if (pthread_join (th[n], &res) != 0)
+	{
+	  printf ("join round %d failed\n", n + 1);
+	  return 1;
+	}
+      if (res != PTHREAD_CANCELED)
+	{
+	  printf ("thread %d not canceled\n", n + 1);
+	  return 1;
+	}
+    }
+
+  int e = pthread_mutex_lock (&m);
+  if (e == 0)
+    {
+      puts ("parent: 2nd mutex_lock succeeded");
+      return 1;
+    }
+  if (e != EOWNERDEAD)
+    {
+      puts ("parent: mutex_lock did not return EOWNERDEAD");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("parent: 2nd mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (&m) != 0)
+    {
+      puts ("mutex_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/tst-signal7.c b/nptl/tst-signal7.c
new file mode 100644
index 0000000000..82ef11c2d1
--- /dev/null
+++ b/nptl/tst-signal7.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+   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 <errno.h>
+#include <pthreadP.h>
+#include <signal.h>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  errno = 0;
+  if (sigaction (SIGCANCEL, NULL, NULL) == 0)
+    {
+      puts ("sigaction(SIGCANCEL) did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      puts ("sigaction(SIGCANCEL) did not set errno to EINVAL");
+      result = 1;
+    }
+
+  errno = 0;
+  if (sigaction (SIGSETXID, NULL, NULL) == 0)
+    {
+      puts ("sigaction(SIGSETXID) did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      puts ("sigaction(SIGSETXID) did not set errno to EINVAL");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/version.c b/nptl/version.c
index 1be6b7f4a5..b69556e948 100644
--- a/nptl/version.c
+++ b/nptl/version.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,7 +23,7 @@
 
 static const char banner[] =
 #include "banner.h"
-"Copyright (C) 2005 Free Software Foundation, Inc.\n\
+"Copyright (C) 2006 Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.\n\
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
 PARTICULAR PURPOSE.\n"
diff --git a/nscd/connections.c b/nscd/connections.c
index 632635845b..9c096e2e05 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -431,7 +431,7 @@ void
 nscd_init (void)
 {
   /* Secure mode and unprivileged mode are incompatible */
-  if (server_user != NULL && secure_in_use)
+  if (server_user != NULL)
     {
       dbg_log (_("Cannot run nscd in secure mode as unprivileged user"));
       exit (4);
@@ -1060,29 +1060,28 @@ cannot handle old request version %d; current version is %d"),
     case GETSTAT:
     case SHUTDOWN:
     case INVALIDATE:
-      if (! secure_in_use)
-	{
-	  /* Get the callers credentials.  */
+      {
+	/* Get the callers credentials.  */
 #ifdef SO_PEERCRED
-	  struct ucred caller;
-	  socklen_t optlen = sizeof (caller);
+	struct ucred caller;
+	socklen_t optlen = sizeof (caller);
 
-	  if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &caller, &optlen) < 0)
-	    {
-	      char buf[256];
+	if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &caller, &optlen) < 0)
+	  {
+	    char buf[256];
 
-	      dbg_log (_("error getting callers id: %s"),
-		       strerror_r (errno, buf, sizeof (buf)));
-	      break;
-	    }
+	    dbg_log (_("error getting callers id: %s"),
+		     strerror_r (errno, buf, sizeof (buf)));
+	    break;
+	  }
 
-	  uid = caller.uid;
+	uid = caller.uid;
 #else
-	  /* Some systems have no SO_PEERCRED implementation.  They don't
-	     care about security so we don't as well.  */
-	  uid = 0;
+	/* Some systems have no SO_PEERCRED implementation.  They don't
+	   care about security so we don't as well.  */
+	uid = 0;
 #endif
-	}
+      }
 
       /* Accept shutdown, getstat and invalidate only from root.  For
 	 the stat call also allow the user specified in the config file.  */
@@ -1376,25 +1375,7 @@ nscd_run (void *p)
 #ifdef SO_PEERCRED
       pid_t pid = 0;
 
-      if (secure_in_use)
-	{
-	  struct ucred caller;
-	  socklen_t optlen = sizeof (caller);
-
-	  if (getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &caller, &optlen) < 0)
-	    {
-	      dbg_log (_("error getting callers id: %s"),
-		       strerror_r (errno, buf, sizeof (buf)));
-	      goto close_and_out;
-	    }
-
-	  if (req.type < GETPWBYNAME || req.type > LASTDBREQ
-	      || serv2db[req.type]->secure)
-	    uid = caller.uid;
-
-	  pid = caller.pid;
-	}
-      else if (__builtin_expect (debug_level > 0, 0))
+      if (__builtin_expect (debug_level > 0, 0))
 	{
 	  struct ucred caller;
 	  socklen_t optlen = sizeof (caller);
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 3c65e20a60..2941cbdc15 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -70,7 +70,6 @@ int disabled_passwd;
 int disabled_group;
 int go_background = 1;
 
-int secure_in_use;
 static const char *conffile = _PATH_NSCDCONF;
 
 time_t start_time;
@@ -370,16 +369,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
 
     case 'S':
-#if 0
-      if (strcmp (arg, "passwd,yes") == 0)
-	secure_in_use = dbs[pwddb].secure = 1;
-      else if (strcmp (arg, "group,yes") == 0)
-	secure_in_use = dbs[grpdb].secure = 1;
-      else if (strcmp (arg, "hosts,yes") == 0)
-	secure_in_use = dbs[hstdb].secure = 1;
-#else
       error (0, 0, _("secure services not implemented anymore"));
-#endif
       break;
 
     default:
@@ -398,7 +388,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"),
 	   "Thorsten Kukuk and Ulrich Drepper");
 }
diff --git a/nscd/nscd.h b/nscd/nscd.h
index 3859d95d01..ed686bea7e 100644
--- a/nscd/nscd.h
+++ b/nscd/nscd.h
@@ -68,7 +68,6 @@ struct database_dyn
   const char *db_filename;
   time_t file_mtime;
   size_t suggested_module;
-  int secure;
 
   unsigned long int postimeout;	/* In seconds.  */
   unsigned long int negtimeout;	/* In seconds.  */
@@ -122,9 +121,6 @@ extern int nthreads;
 /* Maximum number of threads to use.  */
 extern int max_nthreads;
 
-/* Tables for which we cache data with uid.  */
-extern int secure_in_use; /* Is one of the above 1?  */
-
 /* User name to run server processes as.  */
 extern const char *server_user;
 
diff --git a/nscd/selinux.c b/nscd/selinux.c
index a15e522958..138d96d23a 100644
--- a/nscd/selinux.c
+++ b/nscd/selinux.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
+#include <unistd.h>
 #include <selinux/av_permissions.h>
 #include <selinux/avc.h>
 #include <selinux/flask.h>
@@ -114,11 +115,28 @@ static int audit_fd = -1;
 static void
 log_callback (const char *fmt, ...)
 {
-  va_list ap;
+  if (audit_fd >= 0)
+    {
+      va_list ap;
+      va_start (ap, fmt);
+
+      char *buf;
+      int e = vasprintf (&buf, fmt, ap);
+      if (e < 0)
+	{
+	  buf = alloca (BUFSIZ);
+	  vsnprintf (buf, BUFSIZ, fmt, ap);
+	}
+
+      /* FIXME: need to attribute this to real user, using getuid for now */
+      audit_log_user_avc_message (audit_fd, AUDIT_USER_AVC, buf, NULL, NULL,
+				  NULL, getuid ());
 
-  va_start (ap, fmt);
-  audit_log_avc (audit_fd, AUDIT_USER_AVC, fmt, ap);
-  va_end (ap);
+      if (e >= 0)
+	free (buf);
+
+      va_end (ap);
+    }
 }
 
 /* Initialize the connection to the audit system */
@@ -126,7 +144,9 @@ static void
 audit_init (void)
 {
   audit_fd = audit_open ();
-  if (audit_fd < 0)
+  if (audit_fd < 0
+      /* If kernel doesn't support audit, bail out */
+      && errno != EINVAL && errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT)
     dbg_log (_("Failed opening connection to the audit subsystem: %m"));
 }
 #endif /* HAVE_LIBAUDIT */
diff --git a/nss/getent.c b/nss/getent.c
index 489420ef79..14ec3c4755 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -84,7 +84,7 @@ print_version (FILE *stream, struct argp_state *state)
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
   fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
 }
 
diff --git a/posix/bug-regex22.c b/posix/bug-regex22.c
index 1636202d36..c5bc94869b 100644
--- a/posix/bug-regex22.c
+++ b/posix/bug-regex22.c
@@ -1,5 +1,5 @@
 /* Test re.translate != NULL.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
 
@@ -40,7 +40,7 @@ main (void)
   re_set_syntax (RE_SYNTAX_POSIX_EGREP);
 
   memset (&re, 0, sizeof (re));
-  re.translate = trans;
+  re.translate = (unsigned char *) trans;
   s = re_compile_pattern ("\\W", 2, &re);
 
   if (s != NULL)
@@ -68,7 +68,7 @@ main (void)
     }
 
   memset (&re, 0, sizeof (re));
-  re.translate = trans;
+  re.translate = (unsigned char *) trans;
   s = re_compile_pattern ("\\w", 2, &re);
 
   if (s != NULL)
@@ -96,7 +96,7 @@ main (void)
     }
 
   memset (&re, 0, sizeof (re));
-  re.translate = trans;
+  re.translate = (unsigned char *) trans;
   s = re_compile_pattern ("[[:DIGIT:]]", 11, &re);
   if (s == NULL)
     {
@@ -106,7 +106,7 @@ main (void)
     }
 
   memset (&re, 0, sizeof (re));
-  re.translate = trans;
+  re.translate = (unsigned char *) trans;
   s = re_compile_pattern ("[[:DIGIT:]]", 2, &re);
   if (s == NULL)
     {
diff --git a/posix/bug-regex5.c b/posix/bug-regex5.c
index ee4d652157..f199ffbfd3 100644
--- a/posix/bug-regex5.c
+++ b/posix/bug-regex5.c
@@ -41,7 +41,7 @@ main (void)
 	{
 	  char elem[256];
 	  idx = symb_table[2 * i + 1];
-	  strncpy (elem, extra + idx + 1, extra[idx]);
+	  strncpy (elem, (const char *) (extra + idx + 1), extra[idx]);
 	  elem[extra[idx]] = '\0';
 	  printf ("Found a collating element: %s\n", elem);
 	  ++found;
diff --git a/posix/getconf.c b/posix/getconf.c
index 57c1d6a5d6..66e582e995 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 1995-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 1995-2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -1007,7 +1007,7 @@ main (int argc, char *argv[])
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2005");
+"), "2006");
       fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
       return 0;
     }
diff --git a/posix/transbug.c b/posix/transbug.c
index 3ae4929593..d0983b4d44 100755
--- a/posix/transbug.c
+++ b/posix/transbug.c
@@ -79,7 +79,7 @@ run_test (const char *pattern, struct re_registers *regs)
       exit (1);
     }
 
-  pat.translate = (char *) casetable;
+  pat.translate = (unsigned char *) casetable;
 
   err = re_compile_pattern (pattern, strlen (pattern), &pat);
   if (err != NULL)
diff --git a/posix/tst-execle1.c b/posix/tst-execle1.c
index bacf51b1a2..84470703f1 100644
--- a/posix/tst-execle1.c
+++ b/posix/tst-execle1.c
@@ -6,7 +6,7 @@ static int
 do_test (void)
 {
   static const char prog[] = "does-not-exist";
-  char *env [] = {"FOO=BAR", NULL};
+  const char *env [] = {"FOO=BAR", NULL};
   errno = 0;
   execle (prog, prog, NULL, env);
 
diff --git a/posix/tst-execle2.c b/posix/tst-execle2.c
index 002d4c938f..0430b7b573 100644
--- a/posix/tst-execle2.c
+++ b/posix/tst-execle2.c
@@ -45,7 +45,7 @@ prepare (int argc, char *argv[])
 static int
 do_test (void)
 {
-  char *env[] = {"FOO=BAR", NULL};
+  const char *env[] = {"FOO=BAR", NULL};
   errno = 0;
   execle (copy, copy, NULL, env);
 
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index bab2535ceb..7be23158d0 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -176,11 +176,7 @@ Dprintf(msg, num)
 
 
 static struct hostent *
-getanswer(answer, anslen, qname, qtype)
-	const querybuf *answer;
-	int anslen;
-	const char *qname;
-	int qtype;
+getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
 {
 	register const HEADER *hp;
 	register const u_char *cp;
@@ -522,7 +518,6 @@ gethostbyname2(name, af)
 	char *bp;
 	int n, size, type, len;
 	struct hostent *ret;
-	extern struct hostent *_gethtbyname2();
 
 	if (__res_maybe_init (&_res, 0) == -1) {
 		__set_h_errno (NETDB_INTERNAL);
@@ -666,7 +661,6 @@ gethostbyaddr(addr, len, af)
 	u_long old_options;
 	char hname2[MAXDNAME+1];
 #endif /*SUNSECURITY*/
-	extern struct hostent *_gethtbyaddr();
 
 	if (__res_maybe_init (&_res, 0) == -1) {
 		__set_h_errno (NETDB_INTERNAL);
@@ -879,7 +873,6 @@ struct hostent *
 _gethtbyname(name)
 	const char *name;
 {
-	extern struct hostent *_gethtbyname2();
 	struct hostent *hp;
 
 	if (_res.options & RES_USE_INET6) {
diff --git a/resolv/herror.c b/resolv/herror.c
index c143cec28c..0aaf29f9db 100644
--- a/resolv/herror.c
+++ b/resolv/herror.c
@@ -80,7 +80,6 @@ const int	h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
 void
 herror(const char *s) {
 	struct iovec iov[4], *v = iov;
-	extern int * __h_errno();
 
 	if (s != NULL && *s != '\0') {
 		v->iov_base = (/*noconst*/ char *)s;
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 839069de3d..9b308b189a 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -626,8 +626,7 @@ static const unsigned int poweroften[10]=
 
 /* takes an XeY precision/size value, returns a string representation. */
 static const char *
-precsize_ntoa(prec)
-	u_int8_t prec;
+precsize_ntoa (u_int8_t prec)
 {
 	static char retbuf[sizeof "90000000.00"];	/* XXX nonreentrant */
 	unsigned long val;
@@ -644,8 +643,7 @@ precsize_ntoa(prec)
 
 /* converts ascii size/precision X * 10**Y(cm) to 0xXY.  moves pointer. */
 static u_int8_t
-precsize_aton(strptr)
-	const char **strptr;
+precsize_aton (const char **strptr)
 {
 	unsigned int mval = 0, cmval = 0;
 	u_int8_t retval = 0;
@@ -686,9 +684,7 @@ precsize_aton(strptr)
 
 /* converts ascii lat/lon to unsigned encoded 32-bit number.  moves pointer. */
 static u_int32_t
-latlon2ul(latlonstrptr,which)
-	const char **latlonstrptr;
-	int *which;
+latlon2ul (const char **latlonstrptr, int *which)
 {
 	const char *cp;
 	u_int32_t retval;
diff --git a/stdio-common/tst-fgets.c b/stdio-common/tst-fgets.c
index b8e205c7dc..0aa9030e3a 100644
--- a/stdio-common/tst-fgets.c
+++ b/stdio-common/tst-fgets.c
@@ -5,7 +5,7 @@
 static int
 do_test (void)
 {
-  FILE *fp = fmemopen ("hello", 5, "r");
+  FILE *fp = fmemopen ((char *) "hello", 5, "r");
   char buf[2];
   char *bp = fgets (buf, sizeof (buf), fp);
   printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index 452a21f9cb..e89487cb45 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -46,6 +46,16 @@ t2 (void)
   return result;
 }
 
+#if FLT_EVAL_METHOD == 2
+volatile long double dbl_max = LDBL_MAX;
+# define FLT_FLT_FMT "%Lf %LF"
+# define FLT_FLT_WFMT L"%Lf %LF"
+#else
+# define dbl_max DBL_MAX
+# define FLT_FLT_FMT "%f %F"
+# define FLT_FLT_WFMT L"%f %F"
+#endif
+
 static int
 F (void)
 {
@@ -53,8 +63,9 @@ F (void)
   wchar_t wbuf[10];
   int result;
 
-  snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX,
-	    DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX);
+  snprintf (buf, sizeof buf, FLT_FLT_FMT,
+	    dbl_max * dbl_max - dbl_max * dbl_max,
+	    dbl_max * dbl_max - dbl_max * dbl_max);
   result = strcmp (buf, "nan NAN") != 0;
   printf ("expected \"nan NAN\", got \"%s\"\n", buf);
 
@@ -62,9 +73,9 @@ F (void)
   result |= strcmp (buf, "inf INF") != 0;
   printf ("expected \"inf INF\", got \"%s\"\n", buf);
 
-  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
-	    DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX,
-	    DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX);
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), FLT_FLT_WFMT,
+	    dbl_max * dbl_max - dbl_max * dbl_max,
+	    dbl_max * dbl_max - dbl_max * dbl_max);
   result |= wcscmp (wbuf, L"nan NAN") != 0;
   printf ("expected L\"nan NAN\", got L\"%S\"\n", wbuf);
 
diff --git a/string/test-memccpy.c b/string/test-memccpy.c
index b581408f37..26532633df 100644
--- a/string/test-memccpy.c
+++ b/string/test-memccpy.c
@@ -1,5 +1,5 @@
 /* Test and measure memccpy functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -109,8 +109,8 @@ do_test (size_t align1, size_t align2, int c, size_t len, size_t n,
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len - 1; ++i)
     {
diff --git a/string/test-memchr.c b/string/test-memchr.c
index df866fe2d7..c233ead5dd 100644
--- a/string/test-memchr.c
+++ b/string/test-memchr.c
@@ -1,5 +1,5 @@
 /* Test and measure memchr functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -89,7 +89,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char)
     {
       buf1[align + pos] = seek_char;
       buf1[align + len] = -seek_char;
-      result = buf1 + align + pos;
+      result = (char *) (buf1 + align + pos);
     }
   else
     {
@@ -101,7 +101,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char)
     printf ("Length %4zd, alignment %2zd:", pos, align);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf1 + align, seek_char, len, result);
+    do_one_test (impl, (char *) (buf1 + align), seek_char, len, result);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -144,16 +144,17 @@ do_random_tests (void)
 	}
 
       if (pos < len)
-	result = p + pos + align;
+	result = (char *) (p + pos + align);
       else
 	result = NULL;
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align, seek_char, len) != result)
+	if (CALL (impl, (char *) (p + align), seek_char, len) != result)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
 		   n, impl->name, align, seek_char, len, pos,
-		   CALL (impl, p + align, seek_char, len), result, p);
+		   CALL (impl, (char *) (p + align), seek_char, len),
+		   result, p);
 	    ret = 1;
 	  }
     }
diff --git a/string/test-memcmp.c b/string/test-memcmp.c
index 89c104386b..af07a5e599 100644
--- a/string/test-memcmp.c
+++ b/string/test-memcmp.c
@@ -1,5 +1,5 @@
 /* Test and measure memcmp functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -88,8 +88,8 @@ do_test (size_t align1, size_t align2, size_t len, int exp_result)
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len; i++)
     s1[i] = s2[i] = 1 + 23 * i % 255;
@@ -161,7 +161,7 @@ do_random_tests (void)
 
       FOR_EACH_IMPL (impl, 1)
 	{
-	  r = CALL (impl, p1 + align1, p2 + align2, len);
+	  r = CALL (impl, (char *) (p1 + align1), (char *) (p2 + align2), len);
 	  /* Test whether on 64-bit architectures where ABI requires
 	     callee to promote has the promotion been done.  */
 	  asm ("" : "=g" (r) : "0" (r));
diff --git a/string/test-memcpy.c b/string/test-memcpy.c
index adc90da767..7b0723a65a 100644
--- a/string/test-memcpy.c
+++ b/string/test-memcpy.c
@@ -1,5 +1,5 @@
 /* Test and measure memcpy functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -102,8 +102,8 @@ do_test (size_t align1, size_t align2, size_t len)
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0, j = 1; i < len; i++, j += 23)
     s1[i] = j;
@@ -190,7 +190,9 @@ do_random_tests (void)
 	  if (j > size2)
 	    j = size2;
 	  memset (p2, c, j);
-	  res = CALL (impl, p2 + align2, p1 + align1, len);
+	  res = (unsigned char *) CALL (impl,
+					(char *) (p2 + align2),
+					(char *) (p1 + align1), len);
 	  if (res != MEMCPY_RESULT (p2 + align2, len))
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
diff --git a/string/test-memmove.c b/string/test-memmove.c
index 9531aa82d8..2f3a8f7631 100644
--- a/string/test-memmove.c
+++ b/string/test-memmove.c
@@ -101,8 +101,8 @@ do_test (size_t align1, size_t align2, size_t len)
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0, j = 1; i < len; i++, j += 23)
     s1[i] = j;
@@ -111,7 +111,7 @@ do_test (size_t align1, size_t align2, size_t len)
     printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, s2, buf2 + align1, s1, len);
+    do_one_test (impl, s2, (char *) (buf2 + align1), s1, len);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -179,7 +179,9 @@ do_random_tests (void)
 	{
 	  memset (p2 + dststart, c, dstend - dststart);
 	  memcpy (p2 + srcstart, p1 + srcstart, srcend - srcstart);
-	  res = CALL (impl, p2 + align2, p2 + align1, len);
+	  res = (unsigned char *) CALL (impl,
+					(char *) (p2 + align2),
+					(char *) (p2 + align1), len);
 	  if (res != p2 + align2)
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
diff --git a/string/test-strcat.c b/string/test-strcat.c
index 53c8462839..443752069c 100644
--- a/string/test-strcat.c
+++ b/string/test-strcat.c
@@ -1,5 +1,5 @@
 /* Test and measure strcat functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -91,8 +91,8 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, int max_char)
   if (align2 + len1 + len2 >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len1; ++i)
     s1[i] = 32 + 23 * i % (max_char - 32);
@@ -175,7 +175,8 @@ do_random_tests (void)
 	  memset (p2 - 64, '\1', align2 + 64);
 	  memset (p2 + align2 + len2 + 1, '\1', 512 - align2 - len2 - 1);
 	  memcpy (p2 + align2, buf1, len2 + 1);
-	  res = CALL (impl, p2 + align2, p1 + align1);
+	  res = (unsigned char *) CALL (impl, (char *) (p2 + align2),
+					(char *) (p1 + align1));
 	  if (res != p2 + align2)
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd %zd) %p != %p",
diff --git a/string/test-strchr.c b/string/test-strchr.c
index 1333ebc8bc..cf25b449d9 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -101,10 +101,10 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
   if (pos < len)
     {
       buf1[align + pos] = seek_char;
-      result = buf1 + align + pos;
+      result = (char *) (buf1 + align + pos);
     }
   else if (seek_char == 0)
-    result = buf1 + align + len;
+    result = (char *) (buf1 + align + len);
   else
     result = NULL;
 
@@ -112,7 +112,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
     printf ("Length %4zd, alignment %2zd:", pos, align);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf1 + align, seek_char, result);
+    do_one_test (impl, (char *) (buf1 + align), seek_char, result);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -166,18 +166,18 @@ do_random_tests (void)
 	}
 
       if (pos <= len)
-	result = p + pos + align;
+	result = (char *) (p + pos + align);
       else if (seek_char == 0)
-	result = p + len + align;
+	result = (char *) (p + len + align);
       else
 	result = NULL;
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align, seek_char) != result)
+	if (CALL (impl, (char *) (p + align), seek_char) != result)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
 		   n, impl->name, align, seek_char, len, pos,
-		   CALL (impl, p + align, seek_char), result, p);
+		   CALL (impl, (char *) (p + align), seek_char), result, p);
 	    ret = 1;
 	  }
     }
diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index af49f14fe1..769e9828fd 100644
--- a/string/test-strcmp.c
+++ b/string/test-strcmp.c
@@ -1,5 +1,5 @@
 /* Test and measure strcmp functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -103,8 +103,8 @@ do_test (size_t align1, size_t align2, size_t len, int max_char,
   if (align2 + len + 1 >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len; i++)
     s1[i] = s2[i] = 1 + 23 * i % max_char;
@@ -198,7 +198,7 @@ do_random_tests (void)
 
       FOR_EACH_IMPL (impl, 1)
 	{
-	  r = CALL (impl, p1 + align1, p2 + align2);
+	  r = CALL (impl, (char *) (p1 + align1), (char *) (p2 + align2));
 	  /* Test whether on 64-bit architectures where ABI requires
 	     callee to promote has the promotion been done.  */
 	  asm ("" : "=g" (r) : "0" (r));
diff --git a/string/test-strcpy.c b/string/test-strcpy.c
index dbfbb9294d..6a2ea2510e 100644
--- a/string/test-strcpy.c
+++ b/string/test-strcpy.c
@@ -1,5 +1,5 @@
 /* Test and measure strcpy functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -92,8 +92,8 @@ do_test (size_t align1, size_t align2, size_t len, int max_char)
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len; i++)
     s1[i] = 32 + 23 * i % (max_char - 32);
@@ -148,7 +148,8 @@ do_random_tests (void)
       FOR_EACH_IMPL (impl, 1)
 	{
 	  memset (p2 - 64, '\1', 512 + 64);
-	  res = CALL (impl, p2 + align2, p1 + align1);
+	  res = (unsigned char *) CALL (impl, (char *) (p2 + align2),
+					(char *) (p1 + align1));
 	  if (res != STRCPY_RESULT (p2 + align2, len))
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
diff --git a/string/test-strlen.c b/string/test-strlen.c
index 82ad95e5cc..e01befbf46 100644
--- a/string/test-strlen.c
+++ b/string/test-strlen.c
@@ -1,5 +1,5 @@
 /* Test and measure strlen functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -92,7 +92,7 @@ do_test (size_t align, size_t len, int max_char)
     printf ("Length %4zd, alignment %2zd:", len, align);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf1 + align, len);
+    do_one_test (impl, (char *) (buf1 + align), len);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -127,10 +127,11 @@ do_random_tests (void)
 	}
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align) != len)
+	if (CALL (impl, (char *) (p + align)) != len)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd) %zd != %zd, p %p",
-		   n, impl->name, align, CALL (impl, p + align), len, p);
+		   n, impl->name, align, CALL (impl, (char *) (p + align)),
+		   len, p);
 	    ret = 1;
 	  }
     }
diff --git a/string/test-strncpy.c b/string/test-strncpy.c
index 62b83166a3..d7a714cef1 100644
--- a/string/test-strncpy.c
+++ b/string/test-strncpy.c
@@ -1,5 +1,5 @@
 /* Test and measure strncpy functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -124,8 +124,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
   if (align2 + len >= page_size)
     return;
 
-  s1 = buf1 + align1;
-  s2 = buf2 + align2;
+  s1 = (char *) (buf1 + align1);
+  s2 = (char *) (buf2 + align2);
 
   for (i = 0; i < len; ++i)
     s1[i] = 32 + 23 * i % (max_char - 32);
@@ -215,7 +215,9 @@ do_random_tests (void)
       FOR_EACH_IMPL (impl, 1)
 	{
 	  memset (p2 - 64, '\1', 512 + 64);
-	  res = CALL (impl, p2 + align2, p1 + align1, size);
+	  res = (unsigned char *) CALL (impl,
+					(char *) (p2 + align2),
+					(char *) (p1 + align1), size);
 	  if (res != STRNCPY_RESULT (p2 + align2, len, size))
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
diff --git a/string/test-strpbrk.c b/string/test-strpbrk.c
index 2ec52fd286..f3ed2080bc 100644
--- a/string/test-strpbrk.c
+++ b/string/test-strpbrk.c
@@ -1,5 +1,5 @@
 /* Test and measure strpbrk functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -102,8 +102,8 @@ do_test (size_t align, size_t pos, size_t len)
   if (align + pos + 10 >= page_size || len > 240)
     return;
 
-  rej = buf2 + (random () & 255);
-  s = buf1 + align;
+  rej = (char *) (buf2 + (random () & 255));
+  s = (char *) (buf1 + align);
 
   for (i = 0; i < len; ++i)
     {
@@ -182,7 +182,7 @@ do_random_tests (void)
 	}
       rej[i] = '\0';
       for (c = 1; c <= 255; ++c)
-	if (strchr (rej, c) == NULL)
+	if (strchr ((char *) rej, c) == NULL)
 	  break;
       j = (pos > len ? pos : len) + align + 64;
       if (j > 512)
@@ -199,23 +199,24 @@ do_random_tests (void)
 	  else
 	    {
 	      p[i] = random () & 255;
-	      if (strchr (rej, p[i]))
+	      if (strchr ((char *) rej, p[i]))
 		{
 		  p[i] = random () & 255;
-		  if (strchr (rej, p[i]))
+		  if (strchr ((char *) rej, p[i]))
 		    p[i] = c;
 		}
 	    }
 	}
 
-      result = STRPBRK_RESULT (p + align, pos < len ? pos : len);
+      result = STRPBRK_RESULT ((char *) (p + align), pos < len ? pos : len);
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align, rej) != result)
+	if (CALL (impl, (char *) (p + align), (char *) rej) != result)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %p, %zd, %zd, %zd) %p != %p",
 		   n, impl->name, align, rej, rlen, pos, len,
-		   (void *) CALL (impl, p + align, rej), (void *) result);
+		   (void *) CALL (impl, (char *) (p + align), (char *) rej),
+		   (void *) result);
 	    ret = 1;
 	  }
     }
diff --git a/string/test-strrchr.c b/string/test-strrchr.c
index 5aff75aeba..92e8ab1bb1 100644
--- a/string/test-strrchr.c
+++ b/string/test-strrchr.c
@@ -1,5 +1,5 @@
 /* Test and measure strrchr functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -95,10 +95,10 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
   if (pos < len)
     {
       buf1[align + pos] = seek_char;
-      result = buf1 + align + pos;
+      result = (char *) (buf1 + align + pos);
     }
   else if (seek_char == 0)
-    result = buf1 + align + len;
+    result = (char *) (buf1 + align + len);
   else
     result = NULL;
 
@@ -106,7 +106,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
     printf ("Length %4zd, alignment %2zd:", pos, align);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf1 + align, seek_char, result);
+    do_one_test (impl, (char *) (buf1 + align), seek_char, result);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -165,18 +165,18 @@ do_random_tests (void)
 	}
 
       if (pos <= len)
-	result = p + pos + align;
+	result = (char *) (p + pos + align);
       else if (seek_char == 0)
-        result = p + len + align;
+        result = (char *) (p + len + align);
       else
 	result = NULL;
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align, seek_char) != result)
+	if (CALL (impl, (char *) (p + align), seek_char) != result)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
 		   n, impl->name, align, seek_char, len, pos,
-		   CALL (impl, p + align, seek_char), result, p);
+		   CALL (impl, (char *) (p + align), seek_char), result, p);
 	    ret = 1;
 	  }
     }
diff --git a/string/test-strspn.c b/string/test-strspn.c
index de7351fe8c..15cf4923f0 100644
--- a/string/test-strspn.c
+++ b/string/test-strspn.c
@@ -1,5 +1,5 @@
 /* Test and measure strspn functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -104,8 +104,8 @@ do_test (size_t align, size_t pos, size_t len)
   if (align + pos + 10 >= page_size || len > 240 || ! len)
     return;
 
-  acc = buf2 + (random () & 255);
-  s = buf1 + align;
+  acc = (char *) (buf2 + (random () & 255));
+  s = (char *) (buf1 + align);
 
   for (i = 0; i < len; ++i)
     {
@@ -183,7 +183,7 @@ do_random_tests (void)
 	  else if (i == pos + align)
 	    {
 	      p[i] = random () & 255;
-	      if (strchr (acc, p[i]))
+	      if (strchr ((char *) acc, p[i]))
 		p[i] = '\0';
 	    }
 	  else if (i < align || i > pos + align)
@@ -193,11 +193,13 @@ do_random_tests (void)
 	}
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, p + align, acc) != (pos < len ? pos : len))
+	if (CALL (impl, (char *) (p + align),
+		  (char *) acc) != (pos < len ? pos : len))
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %p, %zd, %zd, %zd) %zd != %zd",
 		   n, impl->name, align, acc, alen, pos, len,
-		   CALL (impl, p + align, acc), (pos < len ? pos : len));
+		   CALL (impl, (char *) (p + align), (char *) acc),
+		   (pos < len ? pos : len));
 	    ret = 1;
 	  }
     }
diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h
index c603a35554..71b7738c37 100644
--- a/sysdeps/alpha/bits/setjmp.h
+++ b/sysdeps/alpha/bits/setjmp.h
@@ -1,5 +1,5 @@
 /* Define the machine-dependent type `jmp_buf'.  Alpha version.
-   Copyright (C) 1992, 1997, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1997, 2003, 2005 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
@@ -80,8 +80,8 @@ typedef long int __jmp_buf[17];
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)				\
-     ((void *)(_address) < (void *)((_jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+  ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP]))
 #endif
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h
index 4395b8f562..07ea01eb97 100644
--- a/sysdeps/hppa/bits/setjmp.h
+++ b/sysdeps/hppa/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2005 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
@@ -39,7 +39,8 @@ typedef double __jmp_buf[21];
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)				\
-     ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle)			\
+  ((void *) (_address) >						\
+   (void *) _demangle ((((unsigned long *) _jmpbuf)[JB_SP])))
 
 #endif	/* bits/setjmp.h */
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index aced5f42c9..10a4650fb0 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -32,6 +32,36 @@
 ENTRY (BP_SYM (__longjmp))
 	ENTER
 
+#ifdef PTR_DEMANGLE
+	movl JBUF(%esp), %eax	/* User's jmp_buf in %eax.  */
+	CHECK_BOUNDS_BOTH_WIDE (%eax, JBUF(%esp), $JB_SIZE)
+
+	/* Save the return address now.  */
+	movl (JB_PC*4)(%eax), %edx
+	/* Get the stack pointer.  */
+	movl (JB_SP*4)(%eax), %ecx
+	PTR_DEMANGLE (%edx)
+	PTR_DEMANGLE (%ecx)
+	cfi_def_cfa(%eax, 0)
+	cfi_register(%eip, %edx)
+	cfi_register(%esp, %ecx)
+	cfi_offset(%ebx, JB_BX*4)
+	cfi_offset(%esi, JB_SI*4)
+	cfi_offset(%edi, JB_DI*4)
+	cfi_offset(%ebp, JB_BP*4)
+     	/* Restore registers.  */
+	movl (JB_BX*4)(%eax), %ebx
+	movl (JB_SI*4)(%eax), %esi
+	movl (JB_DI*4)(%eax), %edi
+	movl (JB_BP*4)(%eax), %ebp
+	cfi_restore(%ebx)
+	cfi_restore(%esi)
+	cfi_restore(%edi)
+	cfi_restore(%ebp)
+
+	movl VAL(%esp), %eax	/* Second argument is return value.  */
+	movl %ecx, %esp
+#else
 	movl JBUF(%esp), %ecx	/* User's jmp_buf in %ecx.  */
 	CHECK_BOUNDS_BOTH_WIDE (%ecx, JBUF(%esp), $JB_SIZE)
 
@@ -44,8 +74,6 @@ ENTRY (BP_SYM (__longjmp))
 	movl (JB_DI*4)(%ecx), %edi
 	movl (JB_BP*4)(%ecx), %ebp
 	movl (JB_SP*4)(%ecx), %esp
-#ifdef PTR_DEMANGLE
-	PTR_DEMANGLE (%edx)
 #endif
 	/* Jump to saved PC.  */
      	jmp *%edx
diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h
index 107fe58b35..d99a726ba3 100644
--- a/sysdeps/i386/bits/setjmp.h
+++ b/sysdeps/i386/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2001, 2003, 2005 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
@@ -40,7 +40,7 @@ typedef int __jmp_buf[6];
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_SP])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
 
 #endif	/* bits/setjmp.h */
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index f80d239323..99cc79160a 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -44,6 +44,9 @@ ENTRY (BP_SYM (_setjmp))
 	movl %esi, (JB_SI*4)(%edx)
 	movl %edi, (JB_DI*4)(%edx)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%edx)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
 #ifdef PTR_MANGLE
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index f4257a0dc5..02c76a8c79 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -46,6 +46,9 @@ ENTRY (BP_SYM (setjmp))
 	movl %esi, (JB_SI*4)(%eax)
 	movl %edi, (JB_DI*4)(%eax)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
 #ifdef PTR_MANGLE
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 747499adc2..94dcbf2e1f 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -40,6 +40,9 @@ ENTRY (BP_SYM (__sigsetjmp))
 	movl %esi, (JB_SI*4)(%eax)
 	movl %edi, (JB_DI*4)(%eax)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
 #ifdef PTR_MANGLE
diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h
index 193eec3509..612582af26 100644
--- a/sysdeps/m68k/bits/setjmp.h
+++ b/sysdeps/m68k/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2005 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
@@ -44,7 +44,7 @@ typedef struct
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)->__sp)
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)->__sp))
 
 #endif	/* bits/setjmp.h */
diff --git a/sysdeps/mach/hurd/errno.c b/sysdeps/mach/hurd/errno.c
new file mode 100644
index 0000000000..a29091b5e2
--- /dev/null
+++ b/sysdeps/mach/hurd/errno.c
@@ -0,0 +1 @@
+/* No definition of `errno' variable on the Hurd.  */
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 6a540241a4..bcc78bc84e 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -58,7 +58,16 @@ __ioctl (int fd, unsigned long int request, ...)
   struct
   {
 #ifdef MACH_MSG_TYPE_BIT
-    mig_reply_header_t header;
+    union
+    {
+      mig_reply_header_t header;
+      struct
+      {
+	mach_msg_header_t	Head;
+	int			RetCodeType;
+	kern_return_t		RetCode;
+      } header_typecheck;
+    };
     char data[3 * sizeof (mach_msg_type_t) +
 	     msg_align (_IOT_COUNT0 (type) * typesize (_IOT_TYPE0 (type))) +
 	     msg_align (_IOT_COUNT1 (type) * typesize (_IOT_TYPE1 (type))) +
@@ -192,7 +201,7 @@ __ioctl (int fd, unsigned long int request, ...)
 	return MIG_TYPE_ERROR;
 
 #ifdef MACH_MSG_TYPE_BIT
-      if (*(int *) &msg.header.RetCodeType !=
+      if (msg.header_typecheck.RetCodeType !=
 	  ((union { mach_msg_type_t t; int i; })
 	   { t: io2mach_type (1, _IOTS (msg.header.RetCode)) }).i)
 	return MIG_TYPE_ERROR;
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index 4624ad9e26..a522aa715a 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -1,5 +1,5 @@
 /* _longjmp_unwind -- Clean up stack frames unwound by longjmp.  Hurd version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2005 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
@@ -22,12 +22,22 @@
 #include <hurd/signal.h>
 #include <hurd/sigpreempt.h>
 #include <assert.h>
+#include <stdint.h>
 
 
 #ifndef _JMPBUF_UNWINDS
 #error "<bits/setjmp.h> fails to define _JMPBUF_UNWINDS"
 #endif
 
+static inline uintptr_t
+demangle_ptr (uintptr_t x)
+{
+# ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (x);
+# endif
+  return x;
+}
+
 /* This function is called by `longjmp' (with its arguments) to restore
    active resources to a sane state before the frames code using them are
    jumped out of.  */
@@ -46,7 +56,7 @@ _longjmp_unwind (jmp_buf env, int val)
 
   /* Remove local signal preemptors being unwound past.  */
   while (ss->preemptors &&
-	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors))
+	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors, demangle_ptr))
     ss->preemptors = ss->preemptors->next;
 
   __spin_unlock (&ss->lock);
@@ -56,7 +66,7 @@ _longjmp_unwind (jmp_buf env, int val)
      in stack frames being unwound by this jump.  */
 
   for (link = ss->active_resources;
-       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link);
+       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr);
        link = link->thread.next)
     /* Remove this link from the resource's users list,
        since the frame using the resource is being unwound.
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
index 74caae8cba..5f7c82b864 100644
--- a/sysdeps/mips/bits/setjmp.h
+++ b/sysdeps/mips/bits/setjmp.h
@@ -80,7 +80,7 @@ typedef struct
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[0].__sp)
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
 
 #endif /* _MIPS_BITS_SETJMP_H */
diff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c
index 9dfac68006..c611b84363 100644
--- a/sysdeps/posix/libc_fatal.c
+++ b/sysdeps/posix/libc_fatal.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1994,1995,1997,2000,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1994,1995,1997,2000,2004,2005
+	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
@@ -73,7 +74,7 @@ __libc_message (int do_abort, const char *fmt, ...)
   while (*cp != '\0')
     {
       /* Find the next "%s" or the end of the string.  */
-      char *next = cp;
+      const char *next = cp;
       while (next[0] != '%' || next[1] != 's')
 	{
 	  next = __strchrnul (next + 1, '%');
@@ -114,7 +115,7 @@ __libc_message (int do_abort, const char *fmt, ...)
 
       for (int cnt = nlist - 1; cnt >= 0; --cnt)
 	{
-	  iov[cnt].iov_base = list->str;
+	  iov[cnt].iov_base = (char *) list->str;
 	  iov[cnt].iov_len = list->len;
 	  total += list->len;
 	  list = list->next;
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h
index 3134916a51..6b35fb440b 100644
--- a/sysdeps/powerpc/bits/setjmp.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2005 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
@@ -74,7 +74,7 @@ typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16)));
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_GPR1])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1]))
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/powerpc/powerpc32/__longjmp-common.S b/sysdeps/powerpc/powerpc32/__longjmp-common.S
index 80f5905208..d3f5545579 100644
--- a/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -43,6 +43,7 @@ ENTRY (BP_SYM (__longjmp))
 	lwz r20,((JB_GPRS+6)*4)(r3)
 #ifdef PTR_DEMANGLE
 	PTR_DEMANGLE (r0, r25)
+	PTR_DEMANGLE2 (r1, r25)
 #endif
 	mtlr r0
 	lwz r21,((JB_GPRS+7)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
index e1f7f6e24a..7403a352fa 100644
--- a/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/sysdeps/powerpc/powerpc32/dl-start.S
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF startup code.  PowerPC version.
-   Copyright (C) 1995-2000, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2002, 2004, 2005 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
@@ -98,6 +98,7 @@ ENTRY(_dl_start_user)
    Take the opportunity to clear LR, so anyone who accidentally returns
    from _start gets SEGV.  Also clear the next few words of the stack.  */
 
+ENTRY(_dl_main_dispatch)
 	li	r31,0
 	stw	r31,0(r1)
 	mtlr	r31
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index 73cc8181f9..022d7ebbad 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -1,5 +1,5 @@
 /* longjmp for PowerPC.
-   Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-99, 2000, 2003, 2004, 2005 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
@@ -128,6 +128,10 @@ L(no_vmx):
 	lfd fp19,((JB_FPRS+5*2)*4)(r3)
 	lwz r20,((JB_GPRS+6)*4)(r3)
 	lfd fp20,((JB_FPRS+6*2)*4)(r3)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (r0, r25)
+	PTR_DEMANGLE2 (r1, r25)
+#endif
 	mtlr r0
 	lwz r21,((JB_GPRS+7)*4)(r3)
 	lfd fp21,((JB_FPRS+7*2)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index cf3f215f2d..3afcf66fb9 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -1,5 +1,5 @@
 /* setjmp for PowerPC.
-   Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2003, 2004, 2005 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
@@ -32,10 +32,19 @@
 ENTRY (BP_SYM (__sigsetjmp))
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 
+#ifdef PTR_MANGLE
+	mr   r5,r1
+	PTR_MANGLE(r5, r6)
+	stw  r5,(JB_GPR1*4)(3)
+#else
 	stw  r1,(JB_GPR1*4)(3)
+#endif
 	mflr r0
 	stw  r14,((JB_GPRS+0)*4)(3)
 	stfd fp14,((JB_FPRS+0*2)*4)(3)
+#ifdef PTR_MANGLE
+	PTR_MANGLE2 (r0, r6)
+#endif
 	stw  r0,(JB_LR*4)(3)
 	stw  r15,((JB_GPRS+1)*4)(3)
 	stfd fp15,((JB_FPRS+1*2)*4)(3)
@@ -95,9 +104,9 @@ ENTRY (BP_SYM (__sigsetjmp))
 	lwz     r5,0(r5)
 #  endif
 # else
-	lis	r5,_dl_hwcap@ha
-	lwz     r5,_dl_hwcap@l(r5)
-#endif
+	lis	r6,_dl_hwcap@ha
+	lwz     r5,_dl_hwcap@l(r6)
+# endif
 	andis.	r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
 	beq	L(no_vmx)
 	la	r5,((JB_VRS)*4)(3)
diff --git a/sysdeps/powerpc/powerpc32/hp-timing.h b/sysdeps/powerpc/powerpc32/hp-timing.h
new file mode 100644
index 0000000000..b62b0f2138
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/hp-timing.h
@@ -0,0 +1,82 @@
+/* High precision, low overhead timing functions.  Linux/PPC32 version.
+   Copyright (C) 2005 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.  */
+
+#ifndef _HP_TIMING_H
+#define _HP_TIMING_H	1
+
+
+/* There are no generic definitions for the times.  We could write something
+   using the `gettimeofday' system call where available but the overhead of
+   the system call might be too high.
+
+   In case a platform supports timers in the hardware the following macros
+   and types must be defined:
+
+   - HP_TIMING_AVAIL: test for availability.
+
+   - HP_TIMING_INLINE: this macro is non-zero if the functionality is not
+     implemented using function calls but instead uses some inlined code
+     which might simply consist of a few assembler instructions.  We have to
+     know this since we might want to use the macros here in places where we
+     cannot make function calls.
+
+   - hp_timing_t: This is the type for variables used to store the time
+     values.
+
+   - HP_TIMING_ZERO: clear `hp_timing_t' object.
+
+   - HP_TIMING_NOW: place timestamp for current time in variable given as
+     parameter.
+
+   - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the
+     HP_TIMING_DIFF macro.
+
+   - HP_TIMING_DIFF: compute difference between two times and store it
+     in a third.  Source and destination might overlap.
+
+   - HP_TIMING_ACCUM: add time difference to another variable.  This might
+     be a bit more complicated to implement for some platforms as the
+     operation should be thread-safe and 64bit arithmetic on 32bit platforms
+     is not.
+
+   - HP_TIMING_ACCUM_NT: this is the variant for situations where we know
+     there are no threads involved.
+
+   - HP_TIMING_PRINT: write decimal representation of the timing value into
+     the given string.  This operation need not be inline even though
+     HP_TIMING_INLINE is specified.
+
+*/
+
+/* Provide dummy definitions.  */
+#define HP_TIMING_AVAIL		(0)
+#define HP_TIMING_INLINE	(0)
+typedef unsigned long long int hp_timing_t;
+#define HP_TIMING_ZERO(Var)
+#define HP_TIMING_NOW(var)
+#define HP_TIMING_DIFF_INIT()
+#define HP_TIMING_DIFF(Diff, Start, End)
+#define HP_TIMING_ACCUM(Sum, Diff)
+#define HP_TIMING_ACCUM_NT(Sum, Diff)
+#define HP_TIMING_PRINT(Buf, Len, Val)
+
+/* Since this implementation is not available we tell the user about it.  */
+#define HP_TIMING_NONAVAIL	1
+
+#endif /* hp-timing.h */
diff --git a/sysdeps/powerpc/powerpc32/setjmp-common.S b/sysdeps/powerpc/powerpc32/setjmp-common.S
index 750075459c..69d36cce03 100644
--- a/sysdeps/powerpc/powerpc32/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/setjmp-common.S
@@ -33,11 +33,18 @@
 ENTRY (BP_SYM (__sigsetjmp))
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 
+#ifdef PTR_MANGLE
+	mr   r5,r1
+	PTR_MANGLE(r5, r10)
+	stw  r5,(JB_GPR1*4)(3)
+#else
 	stw  r1,(JB_GPR1*4)(3)
+#endif
 	mflr r0
 	stw  r14,((JB_GPRS+0)*4)(3)
 #ifdef PTR_MANGLE
-	PTR_MANGLE (r0, r10)
+	PTR_MANGLE2 (r0, r10)
+	li   r10,0
 #endif
 	stw  r0,(JB_LR*4)(3)
 	stw  r15,((JB_GPRS+1)*4)(3)
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
index 73967e0093..bf7e32446d 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -109,6 +109,9 @@ aligned_restore_vmx:
 L(no_vmx):
 #endif
 	ld r1,(JB_GPR1*8)(r3)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (r1, r25)
+#endif
 	ld r2,(JB_GPR2*8)(r3)
 	ld r0,(JB_LR*8)(r3)
 	ld r14,((JB_GPRS+0)*8)(r3)
@@ -129,7 +132,7 @@ L(no_vmx):
 	ld r20,((JB_GPRS+6)*8)(r3)
 	lfd fp20,((JB_FPRS+6)*8)(r3)
 #ifdef PTR_DEMANGLE
-	PTR_DEMANGLE (r0, r25)
+	PTR_DEMANGLE2 (r0, r25)
 #endif
 	mtlr r0
 /* 	std r2,40(r1)	Restore the TOC save area.  */
diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S
index 4098fd63f5..11ecedf2c1 100644
--- a/sysdeps/powerpc/powerpc64/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -46,7 +46,13 @@ ENTRY (BP_SYM (__sigsetjmp))
 	.hidden JUMPTARGET(GLUE(__sigsetjmp,_ent))
 JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#ifdef PTR_MANGLE
+	mr   r5, r1
+	PTR_MANGLE (r5, r6)
+	std  r5,(JB_GPR1*8)(3)
+#else
 	std  r1,(JB_GPR1*8)(3)
+#endif
 	mflr r0
 #if defined SHARED && !defined IS_IN_rtld
 	ld   r5,40(r1)	/* Retrieve the callers TOC.  */
@@ -57,7 +63,7 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	std  r14,((JB_GPRS+0)*8)(3)
 	stfd fp14,((JB_FPRS+0)*8)(3)
 #ifdef PTR_MANGLE
-	PTR_MANGLE (r0, r10)
+	PTR_MANGLE2 (r0, r6)
 #endif
 	std  r0,(JB_LR*8)(3)
 	std  r15,((JB_GPRS+1)*8)(3)
@@ -97,14 +103,14 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	std  r31,((JB_GPRS+17)*8)(3)
 	stfd fp31,((JB_FPRS+17)*8)(3)
 #ifndef __NO_VMX__
-	ld    r5,.LC__dl_hwcap@toc(r2)
+	ld    r6,.LC__dl_hwcap@toc(r2)
 # ifdef SHARED
 	/* Load _rtld-global._dl_hwcap.  */
-	ld    r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
+	ld    r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r6)
 # else
-	ld    r5,0(r5) /* Load extern _dl_hwcap.  */
+	ld    r6,0(r6) /* Load extern _dl_hwcap.  */
 # endif
-	andis.  r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	andis.  r6,r6,(PPC_FEATURE_HAS_ALTIVEC >> 16)
 	beq	L(no_vmx)
 	la	r5,((JB_VRS)*8)(3)
 	andi.	r6,r5,0xf
@@ -179,6 +185,8 @@ L(aligned_save_vmx):
 	stvx	30,0,r5
 	stvx	31,0,r6
 L(no_vmx):
+#else
+	li	r6,0
 #endif
 #if defined NOT_IN_libc && defined IS_IN_rtld
 	li	r3,0
diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h
index 4009514763..01533ca367 100644
--- a/sysdeps/s390/bits/setjmp.h
+++ b/sysdeps/s390/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2005 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
@@ -57,7 +57,7 @@ typedef struct {
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)->__gregs[__JB_GPR15])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15]))
 
 #endif /* __S390_SETJMP_H__ */
diff --git a/sysdeps/sh/_mcount.S b/sysdeps/sh/_mcount.S
index 1e7a1d95c9..069da13e98 100644
--- a/sysdeps/sh/_mcount.S
+++ b/sysdeps/sh/_mcount.S
@@ -1,5 +1,5 @@
 /* Machine-specific calling sequence for `mcount' profiling function.  SuperH
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
    Contributed by NIIBE Yutaka <gniibe@m17n.org>
    This file is part of the GNU C Library.
 
@@ -22,14 +22,25 @@
 
 	ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount)
 	ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(_mcount),function)
+	cfi_startproc
 	.align	5
 C_LABEL(_mcount)
 	/* Save registers.  */
 	mov.l	r4,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r4, 0)
 	mov.l	r5,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r5, 0)
 	mov.l	r6,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r6, 0)
 	mov.l	r7,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r7, 0)
 	sts.l	pr,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
 
 	mov.l	@(20,r15),r4
 	sts	pr,r5
@@ -61,6 +72,7 @@ C_LABEL(_mcount)
 #else
 1:	.long	C_SYMBOL_NAME(__mcount_internal)
 #endif
+	cfi_endproc
 ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h
index 242720ca53..8ebb5c598e 100644
--- a/sysdeps/sh/bits/setjmp.h
+++ b/sysdeps/sh/bits/setjmp.h
@@ -50,7 +50,7 @@ typedef struct
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[0].__regs[7])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/sh/sysdep.h b/sysdeps/sh/sysdep.h
index 202c701a10..743631ad71 100644
--- a/sysdeps/sh/sysdep.h
+++ b/sysdeps/sh/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembler macros for SH.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005 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
@@ -52,10 +52,12 @@
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function)			      \
   .align ALIGNARG(5);							      \
   C_LABEL(name)								      \
+  cfi_startproc;							      \
   CALL_MCOUNT
 
 #undef	END
 #define END(name)							      \
+  cfi_endproc;								      \
   ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
 
 /* If compiled for profiling, call `mcount' at the start of each function.  */
@@ -63,12 +65,17 @@
 #define CALL_MCOUNT					\
 	mov.l	1f,r1;					\
 	sts.l	pr,@-r15;				\
+	cfi_adjust_cfa_offset (4);			\
+	cfi_rel_offset (pr, 0);				\
 	mova	2f,r0;					\
 	jmp	@r1;					\
 	 lds	r0,pr;					\
 	.align	2;					\
 1:	.long	mcount;					\
-2:	lds.l	@r15+,pr
+2:	lds.l	@r15+,pr;				\
+	cfi_adjust_cfa_offset (-4);			\
+	cfi_restore (pr)
+
 #else
 #define CALL_MCOUNT		/* Do nothing.  */
 #endif
diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h
index 76d7af02c7..12250d6980 100644
--- a/sysdeps/sparc/sparc32/bits/setjmp.h
+++ b/sysdeps/sparc/sparc32/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2005 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
@@ -34,5 +34,5 @@ typedef int __jmp_buf[3];
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((int) (address) < (jmpbuf)[JB_SP])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((int) (address) < demangle ((jmpbuf)[JB_SP]))
diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S
index 6e4798e45a..802d51f3be 100644
--- a/sysdeps/unix/sh/sysdep.S
+++ b/sysdeps/unix/sh/sysdep.S
@@ -40,14 +40,21 @@ skip:
 #else
 	mov.l	.L3, r1
 	sts.l	pr, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
 	jsr	@r1
 	 mov.l	r0, @-r15
+	cfi_adjust_cfa_offset (4)
 	mov.l	@r15+, r1
+	cfi_adjust_cfa_offset (-4)
 	lds.l	@r15+, pr
+	cfi_adjust_cfa_offset (-4)
 	mov.l	r1, @r0
 #endif
 #else
 	mov.l	r12, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r12, 0)
 #ifndef _LIBC_REENTRANT
 	mov	r0, r2
         mov.l	0f, r12
@@ -58,7 +65,10 @@ skip:
 	mov.l	r2, @r1
 #else
 	mov.l	r0, @-r15
+	cfi_adjust_cfa_offset (4)
 	sts.l	pr, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
         mov.l	0f, r12
 	mova	0f, r0
 	add	r0, r12
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 2d0136dfeb..44dcccd150 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -1,5 +1,5 @@
 /* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 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
@@ -24,9 +24,17 @@
 
 #include "kernel-features.h"
 
+#ifndef HAVE_CLOCK_GETRES_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
 #define SYSCALL_GETRES \
-  retval = INLINE_SYSCALL (clock_getres, 2, clock_id, res); \
+  retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); \
   break
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -52,7 +60,7 @@ maybe_syscall_getres (clockid_t clock_id, struct timespec *res)
   if (!__libc_missing_posix_timers)
     {
       INTERNAL_SYSCALL_DECL (err);
-      int r = INTERNAL_SYSCALL (clock_getres, err, 2, clock_id, res);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
 	return 0;
 
@@ -109,7 +117,7 @@ maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
   if (!__libc_missing_posix_cpu_timers)
     {
       INTERNAL_SYSCALL_DECL (err);
-      int r = INTERNAL_SYSCALL (clock_getres, err, 2, clock_id, res);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
 	return 0;
 
@@ -128,7 +136,7 @@ maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
 	    {
 	      /* Check whether the kernel supports CPU clocks at all.
 		 If not, record it for the future.  */
-	      r = INTERNAL_SYSCALL (clock_getres, err, 2,
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
 				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
 				    NULL);
 	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index bd79642dd5..315d595edc 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -1,5 +1,5 @@
 /* clock_gettime -- Get current time from a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 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
@@ -23,9 +23,17 @@
 #include "kernel-posix-cpu-timers.h"
 #include "kernel-features.h"
 
+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
 #define SYSCALL_GETTIME \
-  retval = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp); \
+  retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
   break
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -51,7 +59,7 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
   if (!__libc_missing_posix_timers)
     {
       INTERNAL_SYSCALL_DECL (err);
-      int r = INTERNAL_SYSCALL (clock_gettime, err, 2, clock_id, tp);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
 	return 0;
 
@@ -108,7 +116,7 @@ maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
   if (!__libc_missing_posix_cpu_timers)
     {
       INTERNAL_SYSCALL_DECL (err);
-      int r = INTERNAL_SYSCALL (clock_gettime, err, 2, clock_id, tp);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
       if (!INTERNAL_SYSCALL_ERROR_P (r, err))
 	return 0;
 
@@ -127,7 +135,7 @@ maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
 	    {
 	      /* Check whether the kernel supports CPU clocks at all.
 		 If not, record it for the future.  */
-	      r = INTERNAL_SYSCALL (clock_getres, err, 2,
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
 				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
 				    NULL);
 	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index 9cb5b6e340..299574dac4 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-   Copyright (C) 1991,1995-2000,02,03, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-2000,2002-2004,2005 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
@@ -154,6 +154,10 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
index 76625753d9..80543976bb 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
@@ -1,5 +1,5 @@
 /* Define the machine-dependent type `jmp_buf'.  Linux/IA-64 version.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
@@ -34,7 +34,7 @@ typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)		\
-     ((void *)(_address) < (void *)(((long *)_jmpbuf)[0]))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+  ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/sigaction.c b/sysdeps/unix/sysv/linux/ia64/sigaction.c
index 6ec3cb1e61..fdbc93f0ed 100644
--- a/sysdeps/unix/sysv/linux/ia64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/ia64/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Linux/IA64 specific sigaction
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
@@ -48,6 +48,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_def (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
index 1dd82eb866..4c70eff421 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux/MIPS version.
-   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004
+   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -219,7 +219,7 @@ struct msghdr
     socklen_t msg_namelen;	/* Length of address data.  */
 
     struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    int msg_iovlen;		/* Number of elements in the vector.  */
+    size_t msg_iovlen;		/* Number of elements in the vector.  */
 
     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
     socklen_t msg_controllen;	/* Ancillary data buffer length.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 55d2d0d273..ecd8057951 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -6,3 +6,7 @@ endif
 ifeq ($(subdir),stdlib)
 gen-as-const-headers += ucontext_i.sym
 endif
+
+ifeq ($(subdir),elf)
+routines += dl-vdso
+endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/Versions b/sysdeps/unix/sysv/linux/powerpc/Versions
new file mode 100644
index 0000000000..1ef53b9e9c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -0,0 +1,7 @@
+libc {
+  GLIBC_PRIVATE {
+    __vdso_get_tbfreq;
+    __vdso_clock_gettime;
+    __vdso_clock_getres;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
new file mode 100644
index 0000000000..f20a5a175c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
@@ -0,0 +1,36 @@
+/* Resolve function pointers to VDSO functions.
+   Copyright (C) 2005 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.  */
+
+
+#ifndef _LIBC_VDSO_H
+#define _LIBC_VDSO_H
+
+#ifdef SHARED
+
+extern void *__vdso_gettimeofday;
+
+extern void *__vdso_clock_gettime;
+
+extern void *__vdso_clock_getres;
+
+extern void *__vdso_get_tbfreq;
+
+#endif
+
+#endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c
new file mode 100644
index 0000000000..e1be097734
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c
@@ -0,0 +1,59 @@
+/* ELF symbol resolve functions for VDSO objects.
+   Copyright (C) 2005 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 "config.h"
+#include <dl-hash.h>
+#include <ldsodefs.h>
+
+
+void *
+internal_function
+_dl_vdso_vsym (const char *name, const char *version)
+{
+  struct link_map *map = GLRO (dl_sysinfo_map);
+  void *value = NULL;
+
+
+  if (map != NULL)
+    {
+      /* Use a WEAK REF so we don't error out if the symbol is not found.  */
+      ElfW (Sym) wsym;
+      memset (&wsym, 0, sizeof (ElfW (Sym)));
+      wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE));
+
+      /* Compute hash value to the version string.  */
+      struct r_found_version vers;
+      vers.name = version;
+      vers.hidden = 1;
+      vers.hash = _dl_elf_hash (version);
+      /* We don't have a specific file where the symbol can be found.  */
+      vers.filename = NULL;
+
+      /* Search the scope of the vdso map.  */
+      const ElfW (Sym) *ref = &wsym;
+      lookup_t result = GLRO (dl_lookup_symbol_x) (name, map, &ref,
+						   map->l_local_scope,
+						   &vers, 0, 0, NULL);
+
+      if (ref != NULL)
+	value = DL_SYMBOL_ADDRESS (result, ref);
+    }
+
+  return value;
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
new file mode 100644
index 0000000000..a7dcb2e5ff
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
@@ -0,0 +1,27 @@
+/* ELF symbol resolve functions for VDSO objects.
+   Copyright (C) 2005 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.  */
+
+#ifndef _DL_VDSO_H
+#define _DL_VDSO_H	1
+
+/* Functions for resolving symbols in the VDSO link map.  */
+extern void *_dl_vdso_vsym (const char *name, const char *version)
+     internal_function attribute_hidden;
+
+#endif /* dl-vdso.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
index ddaff303c5..6d2e766aa4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
+++ b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -22,14 +22,15 @@
 #include <string.h>
 #include <unistd.h>
 #include <libc-internal.h>
-
+#include <sysdep.h>
+#include <bits/libc-vdso.h>
 
 hp_timing_t
 __get_clockfreq (void)
 {
   /* We read the information from the /proc filesystem.  /proc/cpuinfo
      contains at least one line like:
-        timebase        : 33333333
+     timebase        : 33333333
      We search for this line and convert the number into an integer.  */
   static hp_timing_t timebase_freq;
   hp_timing_t result = 0L;
@@ -38,67 +39,78 @@ __get_clockfreq (void)
   if (timebase_freq != 0)
     return timebase_freq;
 
-  int fd = open ("/proc/cpuinfo", O_RDONLY);
-  if (__builtin_expect (fd != -1, 1))
+  /* If we can use the vDSO to obtain the timebase even better.  */
+#ifdef SHARED
+  INTERNAL_SYSCALL_DECL (err);
+  timebase_freq = INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, 0);
+  if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
+      && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
+#endif
     {
-      /* The timebase will be in the 1st 1024 bytes for systems with up
-         to 8 processors.  If the first read returns less then 1024
-	 bytes read,  we have the whole cpuinfo and can start the scan.
-	 Otherwise we will have to read more to insure we have the
-	 timebase value in the scan.  */
-      char buf[1024];
-      ssize_t n;
+      int fd = open ("/proc/cpuinfo", O_RDONLY);
 
-      n = read (fd, buf, sizeof (buf));
-      if (n == sizeof (buf))
+      if (__builtin_expect (fd != -1, 1))
 	{
-	  /* We are here because the 1st read returned exactly sizeof
-	     (buf) bytes.  This implies that we are not at EOF and may
-	     not have read the timebase value yet.  So we need to read
-	     more bytes until we know we have EOF.  We copy the lower
-	     half of buf to the upper half and read sizeof (buf)/2
-	     bytes into the lower half of buf and repeat until we
-	     reach EOF.  We can assume that the timebase will be in
-	     the last 512 bytes of cpuinfo, so two 512 byte half_bufs
-	     will be sufficient to contain the timebase and will
-	     handle the case where the timebase spans the half_buf
-	     boundry.  */
-	  const ssize_t half_buf = sizeof (buf) / 2;
-	  while (n >= half_buf)
+	  /* The timebase will be in the 1st 1024 bytes for systems with up
+	     to 8 processors.  If the first read returns less then 1024
+	     bytes read,  we have the whole cpuinfo and can start the scan.
+	     Otherwise we will have to read more to insure we have the
+	     timebase value in the scan.  */
+	  char buf[1024];
+	  ssize_t n;
+
+	  n = read (fd, buf, sizeof (buf));
+	  if (n == sizeof (buf))
 	    {
-	      memcpy (buf, buf + half_buf, half_buf);
-	      n = read (fd, buf + half_buf, half_buf);
+	      /* We are here because the 1st read returned exactly sizeof
+	         (buf) bytes.  This implies that we are not at EOF and may
+	         not have read the timebase value yet.  So we need to read
+	         more bytes until we know we have EOF.  We copy the lower
+	         half of buf to the upper half and read sizeof (buf)/2
+	         bytes into the lower half of buf and repeat until we
+	         reach EOF.  We can assume that the timebase will be in
+	         the last 512 bytes of cpuinfo, so two 512 byte half_bufs
+	         will be sufficient to contain the timebase and will
+	         handle the case where the timebase spans the half_buf
+	         boundry.  */
+	      const ssize_t half_buf = sizeof (buf) / 2;
+	      while (n >= half_buf)
+		{
+		  memcpy (buf, buf + half_buf, half_buf);
+		  n = read (fd, buf + half_buf, half_buf);
+		}
+	      if (n >= 0)
+		n += half_buf;
 	    }
-	  if (n >= 0)
-	    n += half_buf;
-	}
-
-      if (__builtin_expect (n, 1) > 0)
-	{
-	  char *mhz = memmem (buf, n, "timebase", 7);
 
-	  if (__builtin_expect (mhz != NULL, 1))
+	  if (__builtin_expect (n, 1) > 0)
 	    {
-	      char *endp = buf + n;
-
-	      /* Search for the beginning of the string.  */
-	      while (mhz < endp && (*mhz < '0' || *mhz > '9') && *mhz != '\n')
-		++mhz;
+	      char *mhz = memmem (buf, n, "timebase", 7);
 
-	      while (mhz < endp && *mhz != '\n')
+	      if (__builtin_expect (mhz != NULL, 1))
 		{
-		  if (*mhz >= '0' && *mhz <= '9')
+		  char *endp = buf + n;
+
+		  /* Search for the beginning of the string.  */
+		  while (mhz < endp && (*mhz < '0' || *mhz > '9')
+			 && *mhz != '\n')
+		    ++mhz;
+
+		  while (mhz < endp && *mhz != '\n')
 		    {
-		      result *= 10;
-		      result += *mhz - '0';
-		    }
+		      if (*mhz >= '0' && *mhz <= '9')
+			{
+			  result *= 10;
+			  result += *mhz - '0';
+			}
 
-		  ++mhz;
+		      ++mhz;
+		    }
 		}
+	      timebase_freq = result;
 	    }
-	  timebase_freq = result;
+	  close (fd);
 	}
-      close (fd);
     }
 
   return timebase_freq;
diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
new file mode 100644
index 0000000000..b381baa285
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2005 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>
+#include <bp-checks.h>
+#include <stddef.h>
+#include <sys/time.h>
+#include <time.h>
+#include <hp-timing.h>
+
+#undef __gettimeofday
+#include <bits/libc-vdso.h>
+
+/* Get the current time of day and timezone information,
+   putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
+   Returns 0 on success, -1 on errors.  */
+
+int
+__gettimeofday (tv, tz)
+     struct timeval *tv;
+     struct timezone *tz;
+{
+  return INLINE_VSYSCALL (gettimeofday, 2, CHECK_1 (tv), CHECK_1 (tz));
+}
+
+INTDEF (__gettimeofday)
+weak_alias (__gettimeofday, gettimeofday)
diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
index 8a60af8d71..a8005c1163 100644
--- a/sysdeps/powerpc/elf/libc-start.c
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998,2000-2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2001,2002,2003,2004,2005 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
@@ -24,33 +24,61 @@
 
 extern int __cache_line_size;
 weak_extern (__cache_line_size)
-
 /* The main work is done in the generic function.  */
 #define LIBC_START_MAIN generic_start_main
 #define LIBC_START_DISABLE_INLINE
 #define LIBC_START_MAIN_AUXVEC_ARG
 #define MAIN_AUXVEC_ARG
+#define INIT_MAIN_ARGS
 #include <csu/libc-start.c>
 
-
 struct startup_info
-{
-  void *__unbounded sda_base;
-  int (*main) (int, char **, char **, void *);
-  int (*init) (int, char **, char **, void *);
-  void (*fini) (void);
-};
+  {
+    void *__unbounded sda_base;
+    int (*main) (int, char **, char **, void *);
+    int (*init) (int, char **, char **, void *);
+    void (*fini) (void);
+  };
+
+
+#ifdef SHARED
+# include <sys/time.h>
+# include <dl-vdso.h>
+# undef __gettimeofday
+# undef __clock_gettime
+# undef __clock_getres
+# include <bits/libc-vdso.h>
+
+void *__vdso_gettimeofday;
+void *__vdso_clock_gettime;
+void *__vdso_clock_getres;
+void *__vdso_get_tbfreq;
 
+static inline void _libc_vdso_platform_setup (void)
+  {
+    __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday",
+  				         "LINUX_2.6.15");
+
+    __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime",
+					  "LINUX_2.6.15");
+
+    __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres",
+				         "LINUX_2.6.15");
+
+    __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq",
+				       "LINUX_2.6.15");
+  }
+#endif
 
 int
 /* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the
    BPs in the arglist of startup_info.main and startup_info.init. */
-BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
-			    char *__unbounded *__unbounded ubp_ev,
-			    ElfW(auxv_t) *__unbounded auxvec,
-			    void (*rtld_fini) (void),
-			    struct startup_info *__unbounded stinfo,
-			    char *__unbounded *__unbounded stack_on_entry)
+  BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
+			      char *__unbounded *__unbounded ubp_ev,
+			      ElfW (auxv_t) * __unbounded auxvec,
+			      void (*rtld_fini) (void),
+			      struct startup_info *__unbounded stinfo,
+			      char *__unbounded *__unbounded stack_on_entry)
 {
 #if __BOUNDED_POINTERS__
   char **argv;
@@ -60,13 +88,13 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
 
   /* the PPC SVR4 ABI says that the top thing on the stack will
      be a NULL pointer, so if not we assume that we're being called
-     as a statically-linked program by Linux...	 */
+     as a statically-linked program by Linux...  */
   if (*stack_on_entry != NULL)
     {
-      char *__unbounded *__unbounded temp;
+      char *__unbounded * __unbounded temp;
       /* ...in which case, we have argc as the top thing on the
-	 stack, followed by argv (NULL-terminated), envp (likewise),
-	 and the auxilary vector.  */
+         stack, followed by argv (NULL-terminated), envp (likewise),
+         and the auxilary vector.  */
       /* 32/64-bit agnostic load from stack */
       argc = *(long int *__unbounded) stack_on_entry;
       ubp_av = stack_on_entry + 1;
@@ -74,25 +102,28 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
 #ifdef HAVE_AUX_VECTOR
       temp = ubp_ev;
       while (*temp != NULL)
-        ++temp;
-      auxvec = (ElfW(auxv_t) *)++temp;
+	++temp;
+      auxvec = (ElfW (auxv_t) *)++ temp;
 #endif
       rtld_fini = NULL;
     }
 
   /* Initialize the __cache_line_size variable from the aux vector.  */
-  for (ElfW(auxv_t) *av = auxvec; av->a_type != AT_NULL; ++av)
+  for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
     switch (av->a_type)
       {
       case AT_DCACHEBSIZE:
-        {
-          int *cls = & __cache_line_size;
-          if (cls != NULL)
-            *cls = av->a_un.a_val;
-        }
-        break;
+	{
+	  int *cls = &__cache_line_size;
+	  if (cls != NULL)
+	    *cls = av->a_un.a_val;
+	}
+	break;
       }
-
+#ifdef SHARED
+  /* Resolve and initialize function pointers for VDSO functions.  */
+  _libc_vdso_platform_setup ();
+#endif
   return generic_start_main (stinfo->main, argc, ubp_av, auxvec,
 			     stinfo->init, stinfo->fini, rtld_fini,
 			     stack_on_entry);
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
new file mode 100644
index 0000000000..0e04e4bb59
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -0,0 +1,284 @@
+/* Save current context, powerpc32 common.
+   Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of getcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	stwu	r1,-16(r1)
+/* Insure that the _UC_REGS start on a quadword boundary.  */
+	stw	r3,_FRAME_PARM_SAVE1(r1)
+	addi	r3,r3,_UC_REG_SPACE+12
+	clrrwi  r3,r3,4
+
+/* Save the general purpose registers */
+	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
+	mflr	r0
+	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
+	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+   return address.  */
+	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
+	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
+	stw	r0,_FRAME_LR_SAVE+16(r1)
+	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
+	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
+	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
+	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
+	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
+	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
+	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
+	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
+	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
+	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
+	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
+	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
+	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
+	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
+	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
+	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
+	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
+	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
+	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
+	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
+	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
+	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
+	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
+	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
+	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
+	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
+	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
+/* Save the value of R1.  We had to push the stack before we
+   had the address of uc_reg_space.  So compute the address of
+   the callers stack pointer and save it as R1.  */
+	addi	r8,r1,16
+	li	r0,0
+/* Save the count, exception and condition registers.  */
+	mfctr	r11
+	mfxer	r10
+	mfcr	r9
+	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
+	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
+	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
+	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success".  R3 is the only
+   register whose value is not preserved in the saved context.  */
+	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+
+/* Zero fill fields that can't be set in user state. */
+	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
+	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+#ifdef __CONTEXT_ENABLE_FPRS
+/* Save the floating-point registers */
+	stfd	fp0,_UC_FREGS+(0*8)(r3)
+	stfd	fp1,_UC_FREGS+(1*8)(r3)
+	stfd	fp2,_UC_FREGS+(2*8)(r3)
+	stfd	fp3,_UC_FREGS+(3*8)(r3)
+	stfd	fp4,_UC_FREGS+(4*8)(r3)
+	stfd	fp5,_UC_FREGS+(5*8)(r3)
+	stfd	fp6,_UC_FREGS+(6*8)(r3)
+	stfd	fp7,_UC_FREGS+(7*8)(r3)
+	stfd	fp8,_UC_FREGS+(8*8)(r3)
+	stfd	fp9,_UC_FREGS+(9*8)(r3)
+	stfd	fp10,_UC_FREGS+(10*8)(r3)
+	stfd	fp11,_UC_FREGS+(11*8)(r3)
+	stfd	fp12,_UC_FREGS+(12*8)(r3)
+	stfd	fp13,_UC_FREGS+(13*8)(r3)
+	stfd	fp14,_UC_FREGS+(14*8)(r3)
+	stfd	fp15,_UC_FREGS+(15*8)(r3)
+	stfd	fp16,_UC_FREGS+(16*8)(r3)
+	stfd	fp17,_UC_FREGS+(17*8)(r3)
+	stfd	fp18,_UC_FREGS+(18*8)(r3)
+	stfd	fp19,_UC_FREGS+(19*8)(r3)
+	stfd	fp20,_UC_FREGS+(20*8)(r3)
+	stfd	fp21,_UC_FREGS+(21*8)(r3)
+	stfd	fp22,_UC_FREGS+(22*8)(r3)
+	stfd	fp23,_UC_FREGS+(23*8)(r3)
+	stfd	fp24,_UC_FREGS+(24*8)(r3)
+	stfd	fp25,_UC_FREGS+(25*8)(r3)
+	stfd	fp26,_UC_FREGS+(26*8)(r3)
+	stfd	fp27,_UC_FREGS+(27*8)(r3)
+	stfd	fp28,_UC_FREGS+(28*8)(r3)
+	stfd	fp29,_UC_FREGS+(29*8)(r3)
+	mffs	fp0
+	stfd	fp30,_UC_FREGS+(30*8)(r3)
+	stfd	fp31,_UC_FREGS+(31*8)(r3)
+	stfd	fp0,_UC_FREGS+(32*8)(r3)
+
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
+	la	r10,(_UC_VREGS)(r3)
+	la	r9,(_UC_VREGS+16)(r3)
+	
+	beq	2f	/* L(no_vec) */
+/* address of the combined VSCR/VSAVE quadword.  */	
+	la	r8,(_UC_VREGS+512)(r3)
+
+/* Save the vector registers */
+	stvx  v0,0,r10
+	stvx  v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+   store order problems later with the VSAVE register that shares the
+   same quadword.  */
+	mfvscr	v0
+
+	stvx  v2,0,r10
+	stvx  v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx	v0,0,r8
+	
+	stvx  v4,0,r10
+	stvx  v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v6,0,r10
+	stvx  v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v8,0,r10
+	stvx  v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v10,0,r10
+	stvx  v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v12,0,r10
+	stvx  v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v14,0,r10
+	stvx  v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v16,0,r10
+	stvx  v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v18,0,r10
+	stvx  v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v20,0,r10
+	stvx  v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v22,0,r10
+	stvx  v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v24,0,r10
+	stvx  v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v26,0,r10
+	stvx  v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v28,0,r10
+	stvx  v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mfspr	r0,VRSAVE
+	stvx  v30,0,r10
+	stvx  v31,0,r9
+
+ 	stw	r0,0(r8)
+
+2: /* L(no_vec): */
+# endif
+#endif
+/* We need to set up parms and call sigprocmask which will clobber
+   volatile registers. So before the call we need to retrieve the
+   original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
+   (current R3).  */
+	lwz	r12,_FRAME_PARM_SAVE1(r1)
+	li	r4,0
+	stw	r3,_UC_REGS_PTR(r12)
+	addi	r5,r12,_UC_SIGMASK
+	li	r3,SIG_BLOCK
+	bl	__sigprocmask@local
+
+	lwz	r0,_FRAME_LR_SAVE+16(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+END(__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
index 10211458d5..dad1074034 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -14,369 +14,53 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__getcontext)
-	stwu	r1,-16(r1)
-/* Insure that the _UC_REGS start on a quadword boundary.  */
-	stw	r3,_FRAME_PARM_SAVE1(r1)
-	addi	r3,r3,_UC_REG_SPACE+12
-	clrrwi  r3,r3,4
+#define __CONTEXT_FUNC_NAME __getcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
 
-/* Save the general purpose registers */
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	mflr	r0
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
-   return address.  */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r0,_FRAME_LR_SAVE+16(r1)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-/* Save the value of R1.  We had to push the stack before we
-   had the address of uc_reg_space.  So compute the address of
-   the callers stack pointer and save it as R1.  */
-	addi	r8,r1,16
-	li	r0,0
-/* Save the count, exception and condition registers.  */
-	mfctr	r11
-	mfxer	r10
-	mfcr	r9
-	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
-	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
-	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
-	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
-/* Set the return value of getcontext to "success".  R3 is the only
-   register whose value is not preserved in the saved context.  */
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
 
-/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-
-#ifdef PIC
-	mflr    r8
-# ifdef HAVE_ASM_PPC_REL16
-	bcl	20,31,1f
-1:	mflr	r7
-	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
-	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
-# else
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# endif
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-
-	la	r10,(_UC_VREGS)(r3)
-	la	r9,(_UC_VREGS+16)(r3)
-	
-	beq	L(no_vec)
-/* address of the combined VSCR/VSAVE quadword.  */	
-	la	r8,(_UC_VREGS+512)(r3)
-
-/* Save the vector registers */
-	stvx  v0,0,r10
-	stvx  v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-/* We need to get the Vector Status and Control Register early to avoid
-   store order problems later with the VSAVE register that shares the
-   same quadword.  */
-	mfvscr	v0
-
-	stvx  v2,0,r10
-	stvx  v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx	v0,0,r8
-	
-	stvx  v4,0,r10
-	stvx  v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v6,0,r10
-	stvx  v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v8,0,r10
-	stvx  v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v10,0,r10
-	stvx  v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v12,0,r10
-	stvx  v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v14,0,r10
-	stvx  v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v16,0,r10
-	stvx  v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v18,0,r10
-	stvx  v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v20,0,r10
-	stvx  v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v22,0,r10
-	stvx  v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v24,0,r10
-	stvx  v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v26,0,r10
-	stvx  v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v28,0,r10
-	stvx  v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mfspr	r0,VRSAVE
-	stvx  v30,0,r10
-	stvx  v31,0,r9
-
- 	stw	r0,0(r8)
-
-L(no_vec):
-/* We need to set up parms and call sigprocmask which will clobber
-   volatile registers. So before the call we need to retrieve the
-   original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
-   (current R3).  */
-	lwz	r12,_FRAME_PARM_SAVE1(r1)
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__getcontext)
 	li	r4,0
-	stw	r3,_UC_REGS_PTR(r12)
-	addi	r5,r12,_UC_SIGMASK
-	li	r3,SIG_BLOCK
-	bl	__sigprocmask@local
-
-	lwz	r0,_FRAME_LR_SAVE+16(r1)
-	addi	r1,r1,16
-	mtlr	r0
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
 	blr
+1:
+	b	__syscall_error@local
 END(__getcontext)
+#else
+# include "getcontext-common.S"
+#endif
 
 versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
-
 	compat_text_section
-ENTRY(__novec_getcontext)
-	/*
-	 * Since we are not attempting to save the altivec registers,
-	 * there is no need to get the register storage space
-	 * aligned on a 16-byte boundary.
-	 */
-	addi	r3,r3,_UC_REG_SPACE
-	stw	r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	stw	r1,_UC_GREGS+(PT_R1*4)(r3)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	mfctr	r0
-	stw	r0,_UC_GREGS+(PT_CTR*4)(r3)
-	mfxer	r0
-	stw	r0,_UC_GREGS+(PT_XER*4)(r3)
-	mfcr	r0
-	stw	r0,_UC_GREGS+(PT_CCR*4)(r3)
-
-	/* Set the return value of getcontext to "success".  R3 is the only
-	   register whose value is not preserved in the saved context.  */
-	li	r0,0
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_getcontext
+# undef __CONTEXT_ENABLE_VRS
 
-	addi	r5,r3,_UC_SIGMASK - _UC_REG_SPACE
-	li	r4,0
-	li	r3,SIG_BLOCK
-	bl	__sigprocmask@local
+# clude "getcontext-common.S"
 
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
-END(__novec_getcontext)
 	.previous
 
 compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
@@ -385,8 +69,8 @@ compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__getcontext_stub)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
new file mode 100644
index 0000000000..c71fcd73d5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -0,0 +1,290 @@
+/* Jump to a new context powerpc32 common.
+   Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of setcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	mflr	r0
+	stwu	r1,-16(r1)
+	stw	r0,20(r1)
+	stw	r31,12(r1)
+	lwz	r31,_UC_REGS_PTR(r3)
+
+	/*
+	 * If this ucontext refers to the point where we were interrupted
+	 * by a signal, we have to use the rt_sigreturn system call to
+	 * return to the context so we get both LR and CTR restored.
+	 *
+	 * Otherwise, the context we are restoring is either just after
+	 * a procedure call (getcontext/swapcontext) or at the beginning
+	 * of a procedure call (makecontext), so we don't need to restore
+	 * r0, xer, ctr.  We don't restore r2 since it will be used as
+	 * the TLS pointer.
+	 */
+	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
+	cmpwi	r0,0
+	bne	4f	/* L(do_sigret) */
+
+	/* Restore the signal mask */
+	li	r5,0
+	addi	r4,r3,_UC_SIGMASK
+	li	r3,SIG_SETMASK
+	bl	__sigprocmask@local
+	cmpwi	r3,0
+	bne	3f	/* L(error_exit) */
+
+#ifdef __CONTEXT_ENABLE_FPRS
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	la	r10,(_UC_VREGS)(r31)
+	beq	2f	/* L(has_no_vec) */
+
+	lwz   r0,(32*16)(r10)
+	li    r9,(32*16)
+	cmpwi r0,0
+	mtspr VRSAVE,r0
+	beq	2f	/* L(has_no_vec) */
+
+	lvx   v19,r9,r10
+	la    r9,(16)(r10)
+
+	lvx   v0,0,r10
+	lvx   v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mtvscr  v19
+	lvx   v2,0,r10
+	lvx   v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v4,0,r10
+	lvx   v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v6,0,r10
+	lvx   v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v8,0,r10
+	lvx   v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v12,0,r10
+	lvx   v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v14,0,r10
+	lvx   v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v16,0,r10
+	lvx   v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v18,0,r10
+	lvx   v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v20,0,r10
+	lvx   v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v22,0,r10
+	lvx   v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v24,0,r10
+	lvx   v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v26,0,r10
+	lvx   v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v28,0,r10
+	lvx   v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v30,0,r10
+	lvx   v31,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+
+2: /* L(has_no_vec): */
+# endif /* __CONTEXT_ENABLE_VRS */
+	/* Restore the floating-point registers */
+	lfd	fp31,_UC_FREGS+(32*8)(r31)
+	lfd	fp0,_UC_FREGS+(0*8)(r31)
+	mtfsf	0xff,fp31
+	lfd	fp1,_UC_FREGS+(1*8)(r31)
+	lfd	fp2,_UC_FREGS+(2*8)(r31)
+	lfd	fp3,_UC_FREGS+(3*8)(r31)
+	lfd	fp4,_UC_FREGS+(4*8)(r31)
+	lfd	fp5,_UC_FREGS+(5*8)(r31)
+	lfd	fp6,_UC_FREGS+(6*8)(r31)
+	lfd	fp7,_UC_FREGS+(7*8)(r31)
+	lfd	fp8,_UC_FREGS+(8*8)(r31)
+	lfd	fp9,_UC_FREGS+(9*8)(r31)
+	lfd	fp10,_UC_FREGS+(10*8)(r31)
+	lfd	fp11,_UC_FREGS+(11*8)(r31)
+	lfd	fp12,_UC_FREGS+(12*8)(r31)
+	lfd	fp13,_UC_FREGS+(13*8)(r31)
+	lfd	fp14,_UC_FREGS+(14*8)(r31)
+	lfd	fp15,_UC_FREGS+(15*8)(r31)
+	lfd	fp16,_UC_FREGS+(16*8)(r31)
+	lfd	fp17,_UC_FREGS+(17*8)(r31)
+	lfd	fp18,_UC_FREGS+(18*8)(r31)
+	lfd	fp19,_UC_FREGS+(19*8)(r31)
+	lfd	fp20,_UC_FREGS+(20*8)(r31)
+	lfd	fp21,_UC_FREGS+(21*8)(r31)
+	lfd	fp22,_UC_FREGS+(22*8)(r31)
+	lfd	fp23,_UC_FREGS+(23*8)(r31)
+	lfd	fp24,_UC_FREGS+(24*8)(r31)
+	lfd	fp25,_UC_FREGS+(25*8)(r31)
+	lfd	fp26,_UC_FREGS+(26*8)(r31)
+	lfd	fp27,_UC_FREGS+(27*8)(r31)
+	lfd	fp28,_UC_FREGS+(28*8)(r31)
+	lfd	fp29,_UC_FREGS+(29*8)(r31)
+	lfd	fp30,_UC_FREGS+(30*8)(r31)
+	lfd	fp31,_UC_FREGS+(31*8)(r31)
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+	/* Restore LR and CCR, and set CTR to the NIP value */
+	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
+	mtlr	r3
+	mtctr	r4
+	mtcr	r5
+
+	/* Restore the general registers */
+	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
+	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
+	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
+	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
+	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
+	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
+	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
+	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
+	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
+	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
+	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
+	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
+	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
+	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
+	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
+	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
+	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
+	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
+	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
+	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
+	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
+	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
+	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
+	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
+	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
+	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
+	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
+	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
+
+	bctr
+
+3: /* L(error_exit): */
+	lwz	r31,12(r1)
+	lwz	r0,20(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+
+
+4: /* L(do_sigret): */
+	addi	r1,r3,-0xd0
+	li	r0,SYS_ify(rt_sigreturn)
+	sc
+	/* NOTREACHED */
+
+END (__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
index eff60f9bbf..7e9213c2d6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
@@ -1,5 +1,5 @@
 /* Jump to a new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
@@ -25,379 +25,43 @@
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__setcontext)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	lwz	r31,_UC_REGS_PTR(r3)
-
-	/*
-	 * If this ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(do_sigret)
-
-	/* Restore the signal mask */
-	li	r5,0
-	addi	r4,r3,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	__sigprocmask@local
-	cmpwi	r3,0
-	bne	L(error_exit)
-
-#ifdef PIC
-	mflr    r8
-# ifdef HAVE_ASM_PPC_REL16
-	bcl	20,31,1f
-1:	mflr	r7
-	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
-	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
-# else
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# endif
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
+#define __CONTEXT_FUNC_NAME __setcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
+
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
+
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__setcontext)
+	mr	r4,r3
+	li	r3,0
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
+	blr
+1:
+	b	__syscall_error@local
+END(__setcontext)
 #else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
+# include "setcontext-common.S"
 #endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-	la	r10,(_UC_VREGS)(r31)
-	beq	L(has_no_vec)
-
-	lwz   r0,(32*16)(r10)
-	li    r9,(32*16)
-	cmpwi r0,0
-	mtspr VRSAVE,r0
-	beq   L(has_no_vec)
-
-	lvx   v19,r9,r10
-	la    r9,(16)(r10)
-
-	lvx   v0,0,r10
-	lvx   v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mtvscr  v19
-	lvx   v2,0,r10
-	lvx   v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v4,0,r10
-	lvx   v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v6,0,r10
-	lvx   v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v8,0,r10
-	lvx   v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v12,0,r10
-	lvx   v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v14,0,r10
-	lvx   v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v16,0,r10
-	lvx   v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v18,0,r10
-	lvx   v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v20,0,r10
-	lvx   v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v22,0,r10
-	lvx   v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v24,0,r10
-	lvx   v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v26,0,r10
-	lvx   v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v28,0,r10
-	lvx   v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v30,0,r10
-	lvx   v31,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-
-L(has_no_vec):
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
-
-L(do_sigret):
-	addi	r1,r3,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
-END (__setcontext)
 
 versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 
 	compat_text_section
-ENTRY(__novec_setcontext)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	lwz	r31,_UC_REGS_PTR(r3)
-
-	/*
-	 * If this ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(novec_do_sigret)
-
-	/* Restore the signal mask */
-	li	r5,0
-	addi	r4,r3,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	__sigprocmask@local
-	cmpwi	r3,0
-	bne	L(novec_error_exit)
-
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(novec_error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_setcontext
+# undef __CONTEXT_ENABLE_VRS
 
-L(novec_do_sigret):
-	addi	r1,r3,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
+# include "setcontext-common.S"
 
-END (__novec_setcontext)
 	.previous
 
 compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
@@ -406,8 +70,8 @@ compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__setcontext_stub)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
new file mode 100644
index 0000000000..8b2998b8fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -0,0 +1,516 @@
+/* Save current context and jump to a new context.
+   Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of setcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	stwu	r1,-16(r1)
+/* Insure that the _UC_REGS start on a quadword boundary.  */
+	stw	r3,_FRAME_PARM_SAVE1(r1)
+	addi	r3,r3,_UC_REG_SPACE+12
+	stw	r4,_FRAME_PARM_SAVE2(r1)	/* new context pointer */
+	clrrwi  r3,r3,4
+
+/* Save the general purpose registers */
+	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
+	mflr	r0
+	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
+	stw	r4,_UC_GREGS+(PT_R4*4)(r3)			
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+   return address.  */
+	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
+	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
+	stw	r0,_FRAME_LR_SAVE+16(r1)
+	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
+	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
+	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
+	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
+	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
+	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
+	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
+	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
+	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
+	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
+	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
+	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
+	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
+	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
+	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
+	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
+	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
+	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
+	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
+	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
+	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
+	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
+	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
+	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
+	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
+	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
+	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
+	
+/* Save the value of R1.  We had to push the stack before we
+   had the address of uc_reg_space.  So compute the address of
+   the callers stack pointer and save it as R1.  */
+	addi	r8,r1,16
+	li	r0,0
+/* Save the count, exception and condition registers.  */
+	mfctr	r11
+	mfxer	r10
+	mfcr	r9
+	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
+	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
+	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
+	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success".  R3 is the only
+   register whose value is not preserved in the saved context.  */
+	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+
+	/* Zero fill fields that can't be set in user state. */
+	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
+	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+#ifdef __CONTEXT_ENABLE_FPRS
+	/* Save the floating-point registers */
+	stfd	fp0,_UC_FREGS+(0*8)(r3)
+	stfd	fp1,_UC_FREGS+(1*8)(r3)
+	stfd	fp2,_UC_FREGS+(2*8)(r3)
+	stfd	fp3,_UC_FREGS+(3*8)(r3)
+	stfd	fp4,_UC_FREGS+(4*8)(r3)
+	stfd	fp5,_UC_FREGS+(5*8)(r3)
+	stfd	fp6,_UC_FREGS+(6*8)(r3)
+	stfd	fp7,_UC_FREGS+(7*8)(r3)
+	stfd	fp8,_UC_FREGS+(8*8)(r3)
+	stfd	fp9,_UC_FREGS+(9*8)(r3)
+	stfd	fp10,_UC_FREGS+(10*8)(r3)
+	stfd	fp11,_UC_FREGS+(11*8)(r3)
+	stfd	fp12,_UC_FREGS+(12*8)(r3)
+	stfd	fp13,_UC_FREGS+(13*8)(r3)
+	stfd	fp14,_UC_FREGS+(14*8)(r3)
+	stfd	fp15,_UC_FREGS+(15*8)(r3)
+	stfd	fp16,_UC_FREGS+(16*8)(r3)
+	stfd	fp17,_UC_FREGS+(17*8)(r3)
+	stfd	fp18,_UC_FREGS+(18*8)(r3)
+	stfd	fp19,_UC_FREGS+(19*8)(r3)
+	stfd	fp20,_UC_FREGS+(20*8)(r3)
+	stfd	fp21,_UC_FREGS+(21*8)(r3)
+	stfd	fp22,_UC_FREGS+(22*8)(r3)
+	stfd	fp23,_UC_FREGS+(23*8)(r3)
+	stfd	fp24,_UC_FREGS+(24*8)(r3)
+	stfd	fp25,_UC_FREGS+(25*8)(r3)
+	stfd	fp26,_UC_FREGS+(26*8)(r3)
+	stfd	fp27,_UC_FREGS+(27*8)(r3)
+	stfd	fp28,_UC_FREGS+(28*8)(r3)
+	stfd	fp29,_UC_FREGS+(29*8)(r3)
+	mffs	fp0
+	stfd	fp30,_UC_FREGS+(30*8)(r3)
+	stfd	fp31,_UC_FREGS+(31*8)(r3)
+	stfd	fp0,_UC_FREGS+(32*8)(r3)
+	
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
+	la	r10,(_UC_VREGS)(r3)
+	la	r9,(_UC_VREGS+16)(r3)
+	
+/*	beq	L(no_vec)*/
+	beq	2f
+/* address of the combined VSCR/VSAVE quadword.  */	
+	la	r8,(_UC_VREGS+512)(r3)
+
+/* Save the vector registers */
+	stvx  v0,0,r10
+	stvx  v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+   store order problems later with the VSAVE register that shares the
+   same quadword.  */
+	mfvscr	v0
+
+	stvx  v2,0,r10
+	stvx  v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+	
+	stvx	v0,0,r8
+
+	stvx  v4,0,r10
+	stvx  v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v6,0,r10
+	stvx  v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v8,0,r10
+	stvx  v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v10,0,r10
+	stvx  v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v12,0,r10
+	stvx  v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v14,0,r10
+	stvx  v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v16,0,r10
+	stvx  v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v18,0,r10
+	stvx  v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v20,0,r10
+	stvx  v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v22,0,r10
+	stvx  v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v24,0,r10
+	stvx  v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v26,0,r10
+	stvx  v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v28,0,r10
+	stvx  v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mfvscr	v0
+	stvx  v30,0,r10
+	stvx  v31,0,r9
+ 	stw	r0,0(r8)
+	
+2: /*L(no_vec):*/
+# endif /* __CONTEXT_ENABLE_VRS */
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+/* Restore ucontext (parm1) from stack.  */
+	lwz	r12,_FRAME_PARM_SAVE1(r1)
+	li	r4,0
+	stw	r3,_UC_REGS_PTR(r12)
+	addi	r5,r12,_UC_SIGMASK
+	li	r3,SIG_SETMASK
+	bl	__sigprocmask@local
+	cmpwi	r3,0
+	bne	3f	/* L(error_exit) */
+
+	/*
+	 * If the new ucontext refers to the point where we were interrupted
+	 * by a signal, we have to use the rt_sigreturn system call to
+	 * return to the context so we get both LR and CTR restored.
+	 *
+	 * Otherwise, the context we are restoring is either just after
+	 * a procedure call (getcontext/swapcontext) or at the beginning
+	 * of a procedure call (makecontext), so we don't need to restore
+	 * r0, xer, ctr.  We don't restore r2 since it will be used as
+	 * the TLS pointer.
+	 */
+	lwz	r4,_FRAME_PARM_SAVE2(r1)
+	lwz	r31,_UC_REGS_PTR(r4)
+	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
+	cmpwi	r0,0
+	bne	4f	/* L(do_sigret) */
+
+#ifdef __CONTEXT_ENABLE_FPRS
+# ifdef __CONTEXT_ENABLE_VRS
+
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,5f
+5:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	la	r10,(_UC_VREGS)(r31)
+	beq	6f	/* L(has_no_vec) */
+
+	lwz   r0,(32*16)(r10)
+	li    r9,(32*16)
+	cmpwi r0,0
+	mtspr VRSAVE,r0
+	beq	6f	/* L(has_no_vec) */
+
+	lvx   v19,r9,r10
+	la    r9,(16)(r10)
+
+	lvx   v0,0,r10
+	lvx   v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mtvscr  v19
+	lvx   v2,0,r10
+	lvx   v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v4,0,r10
+	lvx   v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v6,0,r10
+	lvx   v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v8,0,r10
+	lvx   v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v12,0,r10
+	lvx   v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v14,0,r10
+	lvx   v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v16,0,r10
+	lvx   v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v18,0,r10
+	lvx   v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v20,0,r10
+	lvx   v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v22,0,r10
+	lvx   v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v24,0,r10
+	lvx   v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v26,0,r10
+	lvx   v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v28,0,r10
+	lvx   v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v30,0,r10
+	lvx   v31,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+
+6: /* L(has_no_vec): */
+# endif /* __CONTEXT_ENABLE_VRS */
+	/* Restore the floating-point registers */
+	lfd	fp31,_UC_FREGS+(32*8)(r31)
+	lfd	fp0,_UC_FREGS+(0*8)(r31)
+	mtfsf	0xff,fp31
+	lfd	fp1,_UC_FREGS+(1*8)(r31)
+	lfd	fp2,_UC_FREGS+(2*8)(r31)
+	lfd	fp3,_UC_FREGS+(3*8)(r31)
+	lfd	fp4,_UC_FREGS+(4*8)(r31)
+	lfd	fp5,_UC_FREGS+(5*8)(r31)
+	lfd	fp6,_UC_FREGS+(6*8)(r31)
+	lfd	fp7,_UC_FREGS+(7*8)(r31)
+	lfd	fp8,_UC_FREGS+(8*8)(r31)
+	lfd	fp9,_UC_FREGS+(9*8)(r31)
+	lfd	fp10,_UC_FREGS+(10*8)(r31)
+	lfd	fp11,_UC_FREGS+(11*8)(r31)
+	lfd	fp12,_UC_FREGS+(12*8)(r31)
+	lfd	fp13,_UC_FREGS+(13*8)(r31)
+	lfd	fp14,_UC_FREGS+(14*8)(r31)
+	lfd	fp15,_UC_FREGS+(15*8)(r31)
+	lfd	fp16,_UC_FREGS+(16*8)(r31)
+	lfd	fp17,_UC_FREGS+(17*8)(r31)
+	lfd	fp18,_UC_FREGS+(18*8)(r31)
+	lfd	fp19,_UC_FREGS+(19*8)(r31)
+	lfd	fp20,_UC_FREGS+(20*8)(r31)
+	lfd	fp21,_UC_FREGS+(21*8)(r31)
+	lfd	fp22,_UC_FREGS+(22*8)(r31)
+	lfd	fp23,_UC_FREGS+(23*8)(r31)
+	lfd	fp24,_UC_FREGS+(24*8)(r31)
+	lfd	fp25,_UC_FREGS+(25*8)(r31)
+	lfd	fp26,_UC_FREGS+(26*8)(r31)
+	lfd	fp27,_UC_FREGS+(27*8)(r31)
+	lfd	fp28,_UC_FREGS+(28*8)(r31)
+	lfd	fp29,_UC_FREGS+(29*8)(r31)
+	lfd	fp30,_UC_FREGS+(30*8)(r31)
+	lfd	fp31,_UC_FREGS+(31*8)(r31)
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+	/* Restore LR and CCR, and set CTR to the NIP value */
+	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
+	mtlr	r3
+	mtctr	r4
+	mtcr	r5
+
+	/* Restore the general registers */
+	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
+	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
+	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
+	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
+	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
+	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
+	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
+	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
+	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
+	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
+	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
+	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
+	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
+	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
+	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
+	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
+	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
+	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
+	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
+	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
+	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
+	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
+	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
+	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
+	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
+	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
+	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
+	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
+
+	bctr
+	
+3:/*L(error_exit):*/
+	lwz	r0,_FRAME_LR_SAVE+16(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+	
+4:/*L(do_sigret):*/
+	addi	r1,r4,-0xd0
+	li	r0,SYS_ify(rt_sigreturn)
+	sc
+	/* NOTREACHED */
+
+END(__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
index 6e46abadb0..0605f3d107 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and jump to a new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -14,698 +14,53 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__swapcontext)
-	stwu	r1,-16(r1)
-/* Insure that the _UC_REGS start on a quadword boundary.  */
-	stw	r3,_FRAME_PARM_SAVE1(r1)
-	addi	r3,r3,_UC_REG_SPACE+12
-	stw	r4,_FRAME_PARM_SAVE2(r1)	/* new context pointer */
-	clrrwi  r3,r3,4
-
-/* Save the general purpose registers */
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	mflr	r0
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)			
-/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
-   return address.  */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r0,_FRAME_LR_SAVE+16(r1)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	
-/* Save the value of R1.  We had to push the stack before we
-   had the address of uc_reg_space.  So compute the address of
-   the callers stack pointer and save it as R1.  */
-	addi	r8,r1,16
-	li	r0,0
-/* Save the count, exception and condition registers.  */
-	mfctr	r11
-	mfxer	r10
-	mfcr	r9
-	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
-	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
-	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
-	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
-/* Set the return value of getcontext to "success".  R3 is the only
-   register whose value is not preserved in the saved context.  */
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-#ifdef PIC
-	mflr    r8
-# ifdef HAVE_ASM_PPC_REL16
-	bcl	20,31,1f
-1:	mflr	r7
-	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
-	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
-# else
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# endif
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-
-	la	r10,(_UC_VREGS)(r3)
-	la	r9,(_UC_VREGS+16)(r3)
-	
-	beq	L(no_vec)
-/* address of the combined VSCR/VSAVE quadword.  */	
-	la	r8,(_UC_VREGS+512)(r3)
-
-/* Save the vector registers */
-	stvx  v0,0,r10
-	stvx  v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-/* We need to get the Vector Status and Control Register early to avoid
-   store order problems later with the VSAVE register that shares the
-   same quadword.  */
-	mfvscr	v0
-
-	stvx  v2,0,r10
-	stvx  v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-	
-	stvx	v0,0,r8
-
-	stvx  v4,0,r10
-	stvx  v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v6,0,r10
-	stvx  v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v8,0,r10
-	stvx  v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v10,0,r10
-	stvx  v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v12,0,r10
-	stvx  v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v14,0,r10
-	stvx  v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v16,0,r10
-	stvx  v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v18,0,r10
-	stvx  v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v20,0,r10
-	stvx  v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v22,0,r10
-	stvx  v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v24,0,r10
-	stvx  v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v26,0,r10
-	stvx  v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v28,0,r10
-	stvx  v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mfvscr	v0
-	stvx  v30,0,r10
-	stvx  v31,0,r9
-
- 	stw	r0,0(r8)
-
-L(no_vec):
-/* Restore ucontext (parm1) from stack.  */
-	lwz	r12,_FRAME_PARM_SAVE1(r1)
-	li	r4,0
-	stw	r3,_UC_REGS_PTR(r12)
-	addi	r5,r12,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	__sigprocmask@local
-	cmpwi	r3,0
-	bne	L(error_exit)
-
-	/*
-	 * If the new ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r4,_FRAME_PARM_SAVE2(r1)
-	lwz	r31,_UC_REGS_PTR(r4)
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(do_sigret)
-
-#ifdef PIC
-	mflr    r8
-# ifdef HAVE_ASM_PPC_REL16
-	bcl	20,31,1f
-1:	mflr	r7
-	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
-	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
-# else
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# endif
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-	la	r10,(_UC_VREGS)(r31)
-	beq	L(has_no_vec)
-
-	lwz   r0,(32*16)(r10)
-	li    r9,(32*16)
-	cmpwi r0,0
-	mtspr VRSAVE,r0
-	beq   L(has_no_vec)
-
-	lvx   v19,r9,r10
-	la    r9,(16)(r10)
-
-	lvx   v0,0,r10
-	lvx   v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mtvscr  v19
-	lvx   v2,0,r10
-	lvx   v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v4,0,r10
-	lvx   v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v6,0,r10
-	lvx   v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v8,0,r10
-	lvx   v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v12,0,r10
-	lvx   v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v14,0,r10
-	lvx   v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v16,0,r10
-	lvx   v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v18,0,r10
-	lvx   v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v20,0,r10
-	lvx   v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v22,0,r10
-	lvx   v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v24,0,r10
-	lvx   v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v26,0,r10
-	lvx   v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v28,0,r10
-	lvx   v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v30,0,r10
-	lvx   v31,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-
-L(has_no_vec):
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(error_exit):
-	lwz	r0,_FRAME_LR_SAVE+16(r1)
-	addi	r1,r1,16
-	mtlr	r0
+#define __CONTEXT_FUNC_NAME __swapcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
+
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
+
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__swapcontext)
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
 	blr
-
-L(do_sigret):
-	addi	r1,r4,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
+1:
+	b	__syscall_error@local
 END(__swapcontext)
+#else
+# include "swapcontext-common.S"
+#endif
 
 versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 
 	compat_text_section
-ENTRY(__novec_swapcontext)
-	/* Save the current context */
-	addi	r3,r3,_UC_REG_SPACE
-	stw	r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	stw	r1,_UC_GREGS+(PT_R1*4)(r3)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	mr	r31,r4			/* new context pointer */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	mfctr	r0
-	stw	r0,_UC_GREGS+(PT_CTR*4)(r3)
-	mfxer	r0
-	stw	r0,_UC_GREGS+(PT_XER*4)(r3)
-	mfcr	r0
-	stw	r0,_UC_GREGS+(PT_CCR*4)(r3)
-
-	/* Set the return value of swapcontext to "success".  R3 is the only
-	   register whose value is not preserved in the saved context.  */
-	li	r0,0
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-
-	addi	r5,r3,_UC_SIGMASK - _UC_REG_SPACE
-	addi	r4,r4,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	__sigprocmask@local
-	cmpwi	r3,0
-	bne	L(novec_error_exit)
-
-	/*
-	 * If the new ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	mr	r4,r31
-	lwz	r31,_UC_REGS_PTR(r31)
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(novec_do_sigret)
-
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(novec_error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_swapcontext
+# undef __CONTEXT_ENABLE_VRS
 
-L(novec_do_sigret):
-	addi	r1,r4,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
+# include "swapcontext-common.S"
 
-END(__novec_swapcontext)
 	.previous
 
 compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
@@ -714,8 +69,8 @@ compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__swapcontext_stub)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 546e712edc..470da5aa6e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -55,6 +55,109 @@
 
 # include <errno.h>
 
+# ifdef SHARED
+#  define INLINE_VSYSCALL(name, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    __label__ iserr;							      \
+    INTERNAL_SYSCALL_DECL (sc_err);					      \
+    long int sc_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+	  goto out;							      \
+	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
+	  goto iserr;							      \
+      }									      \
+									      \
+    sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args);		      \
+    if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+      {									      \
+      iserr:								      \
+        __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
+        sc_ret = -1L;							      \
+      }									      \
+  out:									      \
+    sc_ret;								      \
+  })
+# else
+#  define INLINE_VSYSCALL(name, nr, args...) \
+  INLINE_SYSCALL (name, nr, ##args)
+# endif
+
+# ifdef SHARED
+#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    long int v_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
+	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
+	  goto out;							      \
+      }									      \
+    v_ret = INTERNAL_SYSCALL (name, err, nr, ##args);			      \
+  out:									      \
+    v_ret;								      \
+  })
+# else
+#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif
+
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
+  ({									      \
+    long int sc_ret = ENOSYS;						      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+    else								      \
+      err = 1 << 28;							      \
+    sc_ret;								      \
+  })
+
+/* List of system calls which are supported as vsyscalls.  */
+# define HAVE_CLOCK_GETRES_VSYSCALL	1
+# define HAVE_CLOCK_GETTIME_VSYSCALL	1
+
+/* Define a macro which expands inline into the wrapper code for a VDSO
+   call. This use is for internal calls that do not need to handle errors
+   normally. It will never touch errno.
+   On powerpc a system call basically clobbers the same registers like a
+   function call, with the exception of LR (which is needed for the
+   "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
+   an error return status).  */
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+  ({									      \
+    register void *r0  __asm__ ("r0");					      \
+    register long int r3  __asm__ ("r3");				      \
+    register long int r4  __asm__ ("r4");				      \
+    register long int r5  __asm__ ("r5");				      \
+    register long int r6  __asm__ ("r6");				      \
+    register long int r7  __asm__ ("r7");				      \
+    register long int r8  __asm__ ("r8");				      \
+    register long int r9  __asm__ ("r9");				      \
+    register long int r10 __asm__ ("r10");				      \
+    register long int r11 __asm__ ("r11");				      \
+    register long int r12 __asm__ ("r12");				      \
+    LOADARGS_##nr (funcptr, args);					      \
+    __asm__ __volatile__						      \
+      ("mtctr %0\n\t"							      \
+       "bctrl\n\t"							      \
+       "mfcr %0"							      \
+       : "=&r" (r0),							      \
+	 "=&r" (r3), "=&r" (r4), "=&r" (r5),  "=&r" (r6),  "=&r" (r7),	      \
+	 "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12)	      \
+       : ASM_INPUT_##nr							      \
+       : "cr0", "ctr", "lr", "memory");					      \
+    err = (long int) r0;						      \
+    (int) r3;								      \
+  })
+
 # undef INLINE_SYSCALL
 # define INLINE_SYSCALL(name, nr, args...)				\
   ({									\
@@ -93,7 +196,7 @@
     register long int r10 __asm__ ("r10");				\
     register long int r11 __asm__ ("r11");				\
     register long int r12 __asm__ ("r12");				\
-    LOADARGS_##nr(name, args);						\
+    LOADARGS_##nr(name, args);					\
     __asm__ __volatile__						\
       ("sc   \n\t"							\
        "mfcr %0"							\
@@ -115,11 +218,11 @@
 # undef INTERNAL_SYSCALL_ERRNO
 # define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
 
-# define LOADARGS_0(name, dummy) \
+# define LOADARGS_0(name, dummy)					      \
 	r0 = name
 # define LOADARGS_1(name, __arg1) \
 	long int arg1 = (long int) (__arg1);	\
-	LOADARGS_0(name, 0); \
+  LOADARGS_0(name, 0);					   \
 	extern void __illegally_sized_syscall_arg1 (void); \
 	if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
 	  __illegally_sized_syscall_arg1 (); \
@@ -180,10 +283,13 @@
 #  define PTR_MANGLE(reg, tmpreg) \
 	lwz	tmpreg,POINTER_GUARD(r2); \
 	xor	reg,tmpreg,reg
+#  define PTR_MANGLE2(reg, tmpreg) \
+	xor	reg,tmpreg,reg
 #  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
 # else
 #  define PTR_MANGLE(var) \
-  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
 #  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
 # endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
index 662c693303..293761f260 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
@@ -7,14 +7,6 @@
 SIG_BLOCK
 SIG_SETMASK
 
--- XXX Do these correspond to some struct?
-_FRAME_BACKCHAIN	0
-_FRAME_LR_SAVE		4
-_FRAME_PARM_SAVE1	8
-_FRAME_PARM_SAVE2	12
-_FRAME_PARM_SAVE3	16
-_FRAME_PARM_SAVE4	20
-
 -- Offsets in ucontext_t.
 #define ucontext(member)	offsetof (ucontext_t, member)
 _UC_LINK		ucontext (uc_link)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 3ece017563..858b5c4757 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -62,12 +62,118 @@
 #ifdef __ASSEMBLER__
 
 /* This seems to always be the case on PPC.  */
-#define ALIGNARG(log2) log2
+# define ALIGNARG(log2) log2
 /* For ELF we need the `.type' directive to make shared libs work right.  */
-#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
-#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+# define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
+# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
 
-#endif	/* __ASSEMBLER__ */
+#endif /* __ASSEMBLER__ */
+
+/* This version is for kernels that implement system calls that
+   behave like function calls as far as register saving.
+   It falls back to the syscall in the case that the vDSO doesn't
+   exist or fails for ENOSYS */
+#ifdef SHARED
+# define INLINE_VSYSCALL(name, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    __label__ iserr;							      \
+    INTERNAL_SYSCALL_DECL (sc_err);					      \
+    long int sc_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+	  goto out;							      \
+	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
+	  goto iserr;							      \
+      }									      \
+									      \
+    sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args);		      \
+    if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+      {									      \
+      iserr:								      \
+        __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
+        sc_ret = -1L;							      \
+      }									      \
+  out:									      \
+    sc_ret;								      \
+  })
+#else
+# define INLINE_VSYSCALL(name, nr, args...) \
+  INLINE_SYSCALL (name, nr, ##args)
+#endif
+
+#ifdef SHARED
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    long int v_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
+	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
+	  goto out;							      \
+      }									      \
+    v_ret = INTERNAL_SYSCALL (name, err, nr, ##args);			      \
+  out:									      \
+    v_ret;								      \
+  })
+#else
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  INTERNAL_SYSCALL (name, err, nr, ##args)
+#endif
+
+/* This version is for internal uses when there is no desire
+   to set errno */
+#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
+  ({									      \
+    long int sc_ret = ENOSYS;						      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+    else								      \
+      err = 1 << 28;							      \
+    sc_ret;								      \
+  })
+
+/* List of system calls which are supported as vsyscalls.  */
+#define HAVE_CLOCK_GETRES_VSYSCALL	1
+#define HAVE_CLOCK_GETTIME_VSYSCALL	1
+
+/* Define a macro which expands inline into the wrapper code for a system
+   call. This use is for internal calls that do not need to handle errors
+   normally. It will never touch errno. This returns just what the kernel
+   gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
+   the negation of the return value in the kernel gets reverted.  */
+
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+  ({									\
+    register void *r0  __asm__ ("r0");					\
+    register long int r3  __asm__ ("r3");				\
+    register long int r4  __asm__ ("r4");				\
+    register long int r5  __asm__ ("r5");				\
+    register long int r6  __asm__ ("r6");				\
+    register long int r7  __asm__ ("r7");				\
+    register long int r8  __asm__ ("r8");				\
+    LOADARGS_##nr (funcptr, args);					\
+    __asm__ __volatile__						\
+      ("mtctr %0\n\t"							\
+       "bctrl\n\t"							\
+       "mfcr  %0\n\t"							\
+       "0:"								\
+       : "=&r" (r0),							\
+         "=&r" (r3), "=&r" (r4), "=&r" (r5),				\
+         "=&r" (r6), "=&r" (r7), "=&r" (r8)				\
+       : ASM_INPUT_##nr							\
+       : "r9", "r10", "r11", "r12",					\
+         "cr0", "ctr", "lr", "memory");					\
+	  err = (long int) r0;						\
+    (int) r3;								\
+  })
 
 #undef INLINE_SYSCALL
 
@@ -101,7 +207,7 @@
     register long int r6  __asm__ ("r6");				\
     register long int r7  __asm__ ("r7");				\
     register long int r8  __asm__ ("r8");				\
-    LOADARGS_##nr(name, args);						\
+    LOADARGS_##nr (name, ##args);					\
     __asm__ __volatile__						\
       ("sc\n\t"								\
        "mfcr  %0\n\t"							\
@@ -116,7 +222,7 @@
     (int) r3;  \
   })
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
-  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
+  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
 
 #undef INTERNAL_SYSCALL_DECL
 #define INTERNAL_SYSCALL_DECL(err) long int err
@@ -191,7 +297,10 @@
 #  define PTR_MANGLE(reg, tmpreg) \
 	ld	tmpreg,POINTER_GUARD(r13); \
 	xor	reg,tmpreg,reg
+#  define PTR_MANGLE2(reg, tmpreg) \
+	xor	reg,tmpreg,reg
 #  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
 # else
 #  define PTR_MANGLE(var) \
   (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
index 480ebd424c..eff4f17853 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 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
@@ -44,6 +44,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
index deb6181750..877d78d396 100644
--- a/sysdeps/unix/sysv/linux/sh/makecontext.S
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -32,7 +32,6 @@
 
 	.text
 	.align	5
-	cfi_startproc
 ENTRY(__makecontext)
 	mov	#4, r3
 	mov.l	@(oSS_SP,r4), r1
@@ -140,6 +139,7 @@ ENTRY(__makecontext)
 .L4:
 	.long	HIDDEN_JUMPTARGET(exit)
 #endif
+	cfi_startproc
 PSEUDO_END(__makecontext)
 
 weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
index 3ea47d4a5c..66b3daaa3b 100644
--- a/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__getcontext)
 
 	/* Return value of getcontext.  R0 is the only register whose
@@ -84,7 +83,6 @@ ENTRY(__getcontext)
 	rts
 	 nop
 
-	cfi_endproc
 PSEUDO_END(__getcontext)
 
 weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
index 30fbf7dec3..3136267aca 100644
--- a/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__setcontext)
 
 	mov	r4, r8
@@ -95,7 +94,6 @@ ENTRY(__setcontext)
 	jmp	@r0
 	 mov.l	@r15+, r0
 
-	cfi_endproc
 PSEUDO_END(__setcontext)
 
 weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
index aa0129e9ac..64035e5545 100644
--- a/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__swapcontext)
 
 	/* Return value of getcontext.  R0 is the only register whose
@@ -128,7 +127,6 @@ ENTRY(__swapcontext)
 	jmp	@r0
 	 mov.l	@r15+, r0
 	
-	cfi_endproc
 PSEUDO_END(__swapcontext)
 
 weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
index 380c4591dd..68bc235bcf 100644
--- a/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__getcontext)
 
 	/* Return value of getcontext.  R0 is the only register whose
@@ -127,7 +126,6 @@ ENTRY(__getcontext)
 	rts
 	 nop
 
-	cfi_endproc
 PSEUDO_END(__getcontext)
 
 weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
index 9e98910b4b..2bc546d1a1 100644
--- a/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__setcontext)
 
 	mov	r4, r8
@@ -135,7 +134,6 @@ ENTRY(__setcontext)
 	jmp	@r0
 	 mov.l	@r15+, r0
 
-	cfi_endproc
 PSEUDO_END(__setcontext)
 
 weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
index 1d58a40e70..1aeca1b1a7 100644
--- a/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
@@ -25,7 +25,6 @@
 
 	.text
 	.align  5
-	cfi_startproc
 ENTRY(__swapcontext)
 
 	/* Return value of getcontext.  R0 is the only register whose
@@ -210,7 +209,6 @@ ENTRY(__swapcontext)
 	jmp	@r0
 	 mov.l	@r15+, r0
 	
-	cfi_endproc
 PSEUDO_END(__swapcontext)
 
 weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/socket.S b/sysdeps/unix/sysv/linux/sh/socket.S
index eb1761b94b..c83b0f2601 100644
--- a/sysdeps/unix/sysv/linux/sh/socket.S
+++ b/sysdeps/unix/sysv/linux/sh/socket.S
@@ -88,7 +88,6 @@
 #endif
 
 .globl __socket
-	cfi_startproc
 ENTRY (__socket)
 	/* This will not work in the case of a socket call being interrupted
 	   by a signal.  If the signal handler uses any stack the arguments
@@ -169,7 +168,6 @@ ENTRY (__socket)
 	bra	.Lsyscall_error
 	 nop
 #endif
-	cfi_endproc
 
 	.align 2
 .L1:
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
index 33fdc748b5..176d99aab7 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.S
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2005
+   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
@@ -27,6 +28,7 @@
 
 ENTRY (__syscall_error)
 	neg r4, r0
+	cfi_endproc
 
 #define __syscall_error __syscall_error_1
 #include <sysdeps/unix/sh/sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index 1a412e53db..b41236299d 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -141,13 +141,22 @@
 #   define SYSCALL_ERROR_HANDLER \
 	neg r0,r1; \
 	mov.l r14,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r14, 0); \
 	mov.l r12,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r12, 0); \
 	mov.l r1,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r1, 0); \
 	mov.l 0f,r12; \
 	mova 0f,r0; \
 	add r0,r12; \
 	sts.l pr,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (pr, 0); \
 	mov r15,r14; \
+	cfi_def_cfa_register (r14); \
 	mov.l 1f,r1; \
 	bsrf r1; \
          nop; \
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 91c37824bc..a9ad6b18f3 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2005 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
@@ -129,6 +129,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
index dac9ac5cba..45aa2655ee 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1999,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2000,2003, 2005 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
@@ -59,8 +59,8 @@ typedef struct __sparc64_jmp_buf
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp)
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((unsigned long int) (address) < demangle ((jmpbuf)->uc_mcontext.mc_fp))
 
 #else
 
@@ -76,8 +76,8 @@ typedef int __jmp_buf[3];
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((int) (address) < (jmpbuf)[JB_SP])
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)	\
+  ((int) (address) < demangle ((jmpbuf)[JB_SP]))
 
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
index 7fb6459d77..3be801a932 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx), 1997.
 
@@ -132,6 +132,10 @@ __libc_sigaction (int sig, __const struct sigaction *act,
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
index 0a2d2c3dde..b5e35f4e40 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC64.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -65,6 +65,10 @@ __libc_sigaction (int sig, __const struct sigaction *act,
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
index 9123047092..d6f4558cef 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/x86-64.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 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
@@ -79,6 +79,10 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index dd797e8a7b..6e21092451 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -27,33 +27,33 @@
    void __longjmp (__jmp_buf env, int val).  */
 ENTRY(__longjmp)
 	/* Restore registers.  */
+	movq (JB_RSP*8)(%rdi),%r8
+	movq (JB_RBP*8)(%rdi),%r9
+	movq (JB_PC*8)(%rdi),%rdx
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (%r8)
+	PTR_DEMANGLE (%r9)
+	PTR_DEMANGLE (%rdx)
+#endif
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
+	cfi_register(%rsp,%r8)
+	cfi_register(%rbp,%r9)
+	cfi_register(%rip,%rdx)
 	cfi_offset(%rbx,JB_RBX*8)
 	cfi_offset(%rbp,JB_RBP*8)
 	cfi_offset(%r12,JB_R12*8)
 	cfi_offset(%r13,JB_R13*8)
 	cfi_offset(%r14,JB_R14*8)
 	cfi_offset(%r15,JB_R15*8)
-	cfi_offset(%rsp,JB_RSP*8)
-	cfi_offset(%rip,JB_PC*8)
 	movq (JB_RBX*8)(%rdi),%rbx
-	movq (JB_RBP*8)(%rdi),%rbp
 	movq (JB_R12*8)(%rdi),%r12
 	movq (JB_R13*8)(%rdi),%r13
 	movq (JB_R14*8)(%rdi),%r14
 	movq (JB_R15*8)(%rdi),%r15
 	/* Set return value for setjmp.  */
-	test %esi,%esi
-	mov $01,%eax
-	cmove %eax,%esi
 	mov %esi, %eax
-	movq (JB_PC*8)(%rdi),%rdx
-	movq (JB_RSP*8)(%rdi),%rsp
-#ifdef PTR_DEMANGLE
-	PTR_DEMANGLE (%rbp)
-	PTR_DEMANGLE (%rsp)
-	PTR_DEMANGLE (%rdx)
-#endif
+	movq %r8,%rsp
+	movq %r9,%rbp
 	jmpq *%rdx
 END (BP_SYM (__longjmp))
diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
index 96646efdda..1031d5027b 100644
--- a/sysdeps/x86_64/bits/setjmp.h
+++ b/sysdeps/x86_64/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 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
@@ -67,11 +67,11 @@ typedef int __jmp_buf[6];
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
 # if __WORDSIZE == 64
-#  define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_RSP])
+#  define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
 # else
-#  define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_SP])
+#  define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
 # endif
 #endif
 
diff --git a/wcsmbs/tst-mbsrtowcs.c b/wcsmbs/tst-mbsrtowcs.c
index eb6c8e21b1..cca5a80a39 100644
--- a/wcsmbs/tst-mbsrtowcs.c
+++ b/wcsmbs/tst-mbsrtowcs.c
@@ -1,5 +1,5 @@
 /* Test NUL handling of mbsrtowcs.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -32,7 +32,7 @@ main (void)
   mbstate_t state;
   memset (&state, '\0', sizeof (state));
 
-  const char *in = buf;
+  const char *in = (const char *) buf;
   size_t n = mbsrtowcs (out, &in, sizeof (out) / sizeof (wchar_t), &state);
 
   int result = 0;