about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/unix
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/Dist14
-rw-r--r--sysdeps/unix/Makefile35
-rw-r--r--sysdeps/unix/alarm.c7
-rw-r--r--sysdeps/unix/alpha/sysdep.h103
-rw-r--r--sysdeps/unix/arm/Dist1
-rw-r--r--sysdeps/unix/arm/brk.S56
-rw-r--r--sysdeps/unix/arm/dl-brk.S1
-rw-r--r--sysdeps/unix/arm/fork.S34
-rw-r--r--sysdeps/unix/arm/start.c97
-rw-r--r--sysdeps/unix/arm/sysdep.S71
-rw-r--r--sysdeps/unix/arm/sysdep.h30
-rw-r--r--sysdeps/unix/bsd/Dist5
-rw-r--r--sysdeps/unix/bsd/bsd4.4/Dist1
-rw-r--r--sysdeps/unix/bsd/init-posix.c4
-rw-r--r--sysdeps/unix/bsd/m68k/start.c3
-rw-r--r--sysdeps/unix/bsd/m68k/syscall.S26
-rw-r--r--sysdeps/unix/bsd/m68k/sysdep.S44
-rw-r--r--sysdeps/unix/bsd/sun/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/bits/signum.h69
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Makefile3
-rw-r--r--sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h30
-rw-r--r--sysdeps/unix/bsd/sun/m68k/dl-brk.S1
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sigtramp.c145
-rw-r--r--sysdeps/unix/bsd/sun/m68k/syscall.S28
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sysdep.h62
-rw-r--r--sysdeps/unix/bsd/sun/m68k/vfork.S56
-rw-r--r--sysdeps/unix/bsd/sun/sethostid.c1
-rw-r--r--sysdeps/unix/bsd/sun/sparc/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/sparc/Makefile7
-rw-r--r--sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h34
-rw-r--r--sysdeps/unix/bsd/sun/sparc/sethostid.S46
-rw-r--r--sysdeps/unix/bsd/sun/sparc/sigtramp.c247
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/.cvsignore4
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/Implies2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/Makefile7
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h142
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/mman.h68
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h174
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/termios.h212
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/utsname.h24
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/mmap.c42
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/speed.c118
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h100
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/syscalls.list6
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/system.c2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcflow.c30
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcflush.c30
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c32
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait.c1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait3.c1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait4.c50
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/waitpid.c1
-rw-r--r--sysdeps/unix/bsd/sun/syscalls.list3
-rw-r--r--sysdeps/unix/bsd/ulimit.c5
-rw-r--r--sysdeps/unix/clock_gettime.c123
-rw-r--r--sysdeps/unix/clock_settime.c92
-rw-r--r--sysdeps/unix/common/Dist1
-rw-r--r--sysdeps/unix/common/Makefile35
-rwxr-xr-xsysdeps/unix/common/configure195
-rw-r--r--sysdeps/unix/common/configure.in21
-rw-r--r--sysdeps/unix/common/glue-ctype.c91
-rwxr-xr-xsysdeps/unix/configure109
-rw-r--r--sysdeps/unix/configure.in7
-rw-r--r--sysdeps/unix/fdopendir.c (renamed from sysdeps/unix/bsd/sun/sunos4/tcsetattr.c)52
-rw-r--r--sysdeps/unix/get_child_max.c (renamed from sysdeps/unix/sysv/linux/hppa/umount.c)26
-rw-r--r--sysdeps/unix/i386/brk.S6
-rw-r--r--sysdeps/unix/i386/sysdep.S12
-rw-r--r--sysdeps/unix/make_errlist.c82
-rw-r--r--sysdeps/unix/mips/brk.S48
-rw-r--r--sysdeps/unix/mips/dl-brk.S1
-rw-r--r--sysdeps/unix/mips/fork.S32
-rw-r--r--sysdeps/unix/mips/mips32/sysdep.h52
-rw-r--r--sysdeps/unix/mips/mips64/n32/sysdep.h57
-rw-r--r--sysdeps/unix/mips/mips64/n64/sysdep.h57
-rw-r--r--sysdeps/unix/mips/pipe.S33
-rw-r--r--sysdeps/unix/mips/rt-sysdep.S1
-rw-r--r--sysdeps/unix/mips/sigreturn.S31
-rw-r--r--sysdeps/unix/mips/sysdep.S100
-rw-r--r--sysdeps/unix/mips/sysdep.h79
-rw-r--r--sysdeps/unix/mips/wait.S47
-rw-r--r--sysdeps/unix/mkfifoat.c (renamed from sysdeps/unix/bsd/sun/sunos4/tcgetattr.c)21
-rw-r--r--sysdeps/unix/nice.c22
-rw-r--r--sysdeps/unix/opendir.c40
-rw-r--r--sysdeps/unix/rewinddir.c3
-rw-r--r--sysdeps/unix/sh/sysdep.S14
-rw-r--r--sysdeps/unix/sockatmark.c6
-rw-r--r--sysdeps/unix/sparc/brk.S6
-rw-r--r--sysdeps/unix/sysv/Dist2
-rw-r--r--sysdeps/unix/sysv/i386/signal.S31
-rw-r--r--sysdeps/unix/sysv/i386/sigreturn.S27
-rw-r--r--sysdeps/unix/sysv/linux/Dist85
-rw-r--r--sysdeps/unix/sysv/linux/Makefile16
-rw-r--r--sysdeps/unix/sysv/linux/Versions11
-rw-r--r--sysdeps/unix/sysv/linux/aio_sigqueue.c7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Dist19
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Makefile10
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Versions4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/adjtime.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/errno.h8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h55
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/termios.h85
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/wordsize.h (renamed from sysdeps/unix/bsd/m68k/pipe.S)25
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/dl-sysdep.c9
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fxstatat.c99
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getcontext.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getitimer.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrusage.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/gettimeofday.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/glob.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/msgctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/oldglob.c3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/select.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/semctl.c5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setitimer.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/settimeofday.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/shmctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigaction.c2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigsuspend.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscall.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/utimes.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/wait4.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/wordexp.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/xstatconv.h4
-rw-r--r--sysdeps/unix/sysv/linux/arm/Dist14
-rw-r--r--sysdeps/unix/sysv/linux/arm/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/arm/Versions37
-rw-r--r--sysdeps/unix/sysv/linux/arm/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/armsigctx.h73
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/fcntl.h189
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/mman.h99
-rw-r--r--sysdeps/unix/sysv/linux/arm/chown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/clone.S60
-rw-r--r--sysdeps/unix/sysv/linux/arm/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/arm/dl-procinfo.h86
-rw-r--r--sysdeps/unix/sysv/linux/arm/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/ioperm.c274
-rw-r--r--sysdeps/unix/sysv/linux/arm/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap.S92
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap64.S80
-rw-r--r--sysdeps/unix/sysv/linux/arm/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/profil-counter.h37
-rw-r--r--sysdeps/unix/sysv/linux/arm/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/register-dump.h166
-rw-r--r--sysdeps/unix/sysv/linux/arm/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigaction.c165
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigcontextinfo.h51
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigrestorer.S33
-rw-r--r--sysdeps/unix/sysv/linux/arm/socket.S123
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/elf.h26
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/io.h48
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/procfs.h123
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/user.h72
-rw-r--r--sysdeps/unix/sysv/linux/arm/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.S34
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.h236
-rw-r--r--sysdeps/unix/sysv/linux/arm/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/vfork.S59
-rw-r--r--sysdeps/unix/sysv/linux/arm/xstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/bits/errno.h11
-rw-r--r--sysdeps/unix/sysv/linux/bits/in.h27
-rw-r--r--sysdeps/unix/sysv/linux/bits/poll.h6
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/uio.h10
-rw-r--r--sysdeps/unix/sysv/linux/bits/waitflags.h4
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c143
-rw-r--r--sysdeps/unix/sysv/linux/clock_getcpuclockid.c103
-rw-r--r--sysdeps/unix/sysv/linux/clock_getres.c185
-rw-r--r--sysdeps/unix/sysv/linux/clock_gettime.c185
-rw-r--r--sysdeps/unix/sysv/linux/clock_nanosleep.c23
-rw-r--r--sysdeps/unix/sysv/linux/clock_settime.c77
-rw-r--r--sysdeps/unix/sysv/linux/configure48
-rw-r--r--sysdeps/unix/sysv/linux/configure.in48
-rw-r--r--sysdeps/unix/sysv/linux/device-nrs.h6
-rw-r--r--sysdeps/unix/sysv/linux/dl-execstack.c28
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h226
-rw-r--r--sysdeps/unix/sysv/linux/dl-sbrk.c2
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.c6
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.h (renamed from sysdeps/unix/bsd/sun/m68k/brk.S)38
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c143
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c106
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c99
-rw-r--r--sysdeps/unix/sysv/linux/fstatvfs64.c5
-rw-r--r--sysdeps/unix/sysv/linux/ftruncate64.c7
-rw-r--r--sysdeps/unix/sysv/linux/futimes.c69
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c119
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c141
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c167
-rw-r--r--sysdeps/unix/sysv/linux/gai_sigqueue.c4
-rw-r--r--sysdeps/unix/sysv/linux/getcwd.c7
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c8
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c6
-rw-r--r--sysdeps/unix/sysv/linux/getloadavg.c4
-rw-r--r--sysdeps/unix/sysv/linux/getsourcefilter.c28
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c184
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Dist5
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Versions25
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/errno.h51
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/fcntl.h181
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/ioctls.h37
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/ipc.h63
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/mman.h83
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/msq.h84
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/sem.h92
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/shm.h106
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/sigaction.h75
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/signum.h82
-rw-r--r--sysdeps/unix/sysv/linux/hppa/brk.c42
-rw-r--r--sysdeps/unix/sysv/linux/hppa/clone.S99
-rw-r--r--sysdeps/unix/sysv/linux/hppa/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h18
-rw-r--r--sysdeps/unix/sysv/linux/hppa/kernel_stat.h31
-rw-r--r--sysdeps/unix/sysv/linux/hppa/mmap.c50
-rw-r--r--sysdeps/unix/sysv/linux/hppa/profil-counter.h25
-rw-r--r--sysdeps/unix/sysv/linux/hppa/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sys/procfs.h113
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sys/ucontext.h67
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscall.S19
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscalls.list37
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sysdep.c64
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sysdep.h419
-rw-r--r--sysdeps/unix/sysv/linux/i386/Dist17
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile6
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/i386/call_pselect6.S65
-rw-r--r--sysdeps/unix/sysv/linux/i386/chown.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S16
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-cache.h59
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchown.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c110
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstat.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c176
-rw-r--r--sysdeps/unix/sysv/linux/i386/getcontext.S8
-rw-r--r--sysdeps/unix/sysv/linux/i386/getegid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/geteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getmsg.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getresgid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/getresuid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/getrlimit.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getrlimit64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/glob64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/lchown.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/lockf64.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/lxstat.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S8
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S25
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap64.S38
-rw-r--r--sysdeps/unix/sysv/linux/i386/msgctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fadvise64.S33
-rw-r--r--sysdeps/unix/sysv/linux/i386/pselect.c18
-rw-r--r--sysdeps/unix/sysv/linux/i386/putmsg.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/semctl.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/semtimedop.S14
-rw-r--r--sysdeps/unix/sysv/linux/i386/setcontext.S19
-rw-r--r--sysdeps/unix/sysv/linux/i386/setegid.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/seteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setregid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c7
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c7
-rw-r--r--sysdeps/unix/sysv/linux/i386/setreuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setrlimit.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/shmctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sync_file_range.S72
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysconf.c61
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h112
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.h41
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.sym30
-rw-r--r--sysdeps/unix/sysv/linux/i386/vfork.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/xstat.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/Dist13
-rw-r--r--sysdeps/unix/sysv/linux/ia64/__longjmp.S5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/setjmp.h7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/shm.h7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c23
-rw-r--r--sysdeps/unix/sysv/linux/ia64/clone2.S6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-cache.h27
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.h5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/has_cpuclock.c12
-rw-r--r--sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setjmp.S20
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigsuspend.c49
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sys/ptrace.h28
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.h25
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c12
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c138
-rw-r--r--sysdeps/unix/sysv/linux/ifreq.c3
-rw-r--r--sysdeps/unix/sysv/linux/ifreq.h41
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c39
-rw-r--r--sysdeps/unix/sysv/linux/internal_statvfs.c29
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h163
-rw-r--r--sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h18
-rw-r--r--sysdeps/unix/sysv/linux/lddlibc4.c4
-rw-r--r--sysdeps/unix/sysv/linux/ldsodefs.h4
-rw-r--r--sysdeps/unix/sysv/linux/libc_fatal.c32
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c115
-rw-r--r--sysdeps/unix/sysv/linux/linux_fsinfo.h5
-rw-r--r--sysdeps/unix/sysv/linux/local-setxid.h23
-rw-r--r--sysdeps/unix/sysv/linux/lxstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Dist9
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Makefile17
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Versions32
-rw-r--r--sysdeps/unix/sysv/linux/m68k/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/a.out.h3
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/fcntl.h188
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/mman.h99
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/poll.h43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/stat.h164
-rw-r--r--sysdeps/unix/sysv/linux/m68k/chown.c69
-rw-r--r--sysdeps/unix/sysv/linux/m68k/clone.S66
-rw-r--r--sysdeps/unix/sysv/linux/m68k/dl-librecon.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getpagesize.c50
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getsysstats.c37
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/ldconfig.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mmap.S43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mremap.S29
-rw-r--r--sysdeps/unix/sysv/linux/m68k/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/putmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/register-dump.h214
-rw-r--r--sysdeps/unix/sysv/linux/m68k/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semtimedop.S60
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h26
-rw-r--r--sysdeps/unix/sysv/linux/m68k/socket.S111
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/procfs.h126
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/reg.h89
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscall.S33
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.S49
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.h295
-rw-r--r--sysdeps/unix/sysv/linux/m68k/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/vfork.S76
-rw-r--r--sysdeps/unix/sysv/linux/m68k/xstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/Dist13
-rw-r--r--sysdeps/unix/sysv/linux/mips/Makefile56
-rw-r--r--sysdeps/unix/sysv/linux/mips/Versions31
-rw-r--r--sysdeps/unix/sysv/linux/mips/_test_and_set.c30
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/endian.h16
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/errno.h48
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h194
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h76
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ipc.h55
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/mman.h92
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/msq.h74
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/poll.h48
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/resource.h214
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sem.h85
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/shm.h94
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigaction.h89
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigcontext.h105
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/siginfo.h309
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/signum.h79
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigstack.h55
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h316
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h209
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h72
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/termios.h218
-rw-r--r--sysdeps/unix/sysv/linux/mips/brk.c56
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S114
-rwxr-xr-xsysdeps/unix/sysv/linux/mips/configure76
-rw-r--r--sysdeps/unix/sysv/linux/mips/configure.in76
-rw-r--r--sysdeps/unix/sysv/linux/mips/dl-cache.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/entry.h5
-rw-r--r--sysdeps/unix/sysv/linux/mips/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/ftruncate64.c76
-rw-r--r--sysdeps/unix/sysv/linux/mips/getmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/getsysstats.c36
-rw-r--r--sysdeps/unix/sysv/linux/mips/ipc_priv.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_sigaction.h40
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_stat.h57
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_termios.h35
-rw-r--r--sysdeps/unix/sysv/linux/mips/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h36
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/sysdep.h283
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h26
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/llseek.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c28
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h242
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S42
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h242
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/recv.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/send.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscall.S53
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscalls.list21
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/umount.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pipe.S1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread.c109
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread64.c107
-rw-r--r--sysdeps/unix/sysv/linux/mips/profil-counter.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/ptrace.c111
-rw-r--r--sysdeps/unix/sysv/linux/mips/putmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite.c109
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite64.c108
-rw-r--r--sysdeps/unix/sysv/linux/mips/readelflib.c71
-rw-r--r--sysdeps/unix/sysv/linux/mips/register-dump.h108
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigaction.c188
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigcontextinfo.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/cachectl.h42
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/procfs.h128
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ptrace.h136
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/syscall.h42
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/sysmips.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/tas.h67
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/user.h219
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list31
-rw-r--r--sysdeps/unix/sysv/linux/mips/truncate64.c76
-rw-r--r--sysdeps/unix/sysv/linux/mips/xmknod.c51
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c86
-rw-r--r--sysdeps/unix/sysv/linux/mmap64.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_close.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_getattr.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_notify.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_open.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_receive.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_send.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_unlink.c4
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c8
-rw-r--r--sysdeps/unix/sysv/linux/net/if_arp.h10
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_tr.h78
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h7
-rw-r--r--sysdeps/unix/sysv/linux/not-cancel.h47
-rw-r--r--sysdeps/unix/sysv/linux/nscd_setup_thread.c22
-rw-r--r--sysdeps/unix/sysv/linux/openat.c175
-rw-r--r--sysdeps/unix/sysv/linux/openat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/opendir.c4
-rw-r--r--sysdeps/unix/sysv/linux/paths.h2
-rw-r--r--sysdeps/unix/sysv/linux/poll.c5
-rw-r--r--sysdeps/unix/sysv/linux/posix_madvise.c (renamed from sysdeps/unix/sysv/linux/m68k/brk.c)36
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Dist8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Implies4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Makefile8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/aix/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h (renamed from sysdeps/unix/bsd/sun/sigreturn.S)24
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/shm.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/termios.h84
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h19
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/chown.c140
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure135
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure.in37
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.c59
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.h (renamed from sysdeps/unix/bsd/m68k/wait.S)24
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c110
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c117
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (renamed from sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c)28
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/libc-start.c130
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S24
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c12
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S286
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S369
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S293
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S396
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S517
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S695
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h138
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c15
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h43
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S16
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h77
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S25
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h150
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h60
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym50
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h21
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h4
-rw-r--r--sysdeps/unix/sysv/linux/ppoll.c76
-rw-r--r--sysdeps/unix/sysv/linux/pread.c4
-rw-r--r--sysdeps/unix/sysv/linux/pread64.c5
-rw-r--r--sysdeps/unix/sysv/linux/prof-freq.c4
-rw-r--r--sysdeps/unix/sysv/linux/pselect.c100
-rw-r--r--sysdeps/unix/sysv/linux/ptrace.c16
-rw-r--r--sysdeps/unix/sysv/linux/pwrite.c4
-rw-r--r--sysdeps/unix/sysv/linux/pwrite64.c5
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c2
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c90
-rw-r--r--sysdeps/unix/sysv/linux/readonly-area.c17
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c184
-rw-r--r--sysdeps/unix/sysv/linux/s390/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/s390/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/s390/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h53
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/s390/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/s390/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/s390/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/chown.c4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/lchown.c4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c20
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h47
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h35
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c19
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c47
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/socket.S1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h44
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h36
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/user.h63
-rw-r--r--sysdeps/unix/sysv/linux/s390/ucontext_i.sym23
-rw-r--r--sysdeps/unix/sysv/linux/sched_getaffinity.c9
-rw-r--r--sysdeps/unix/sysv/linux/sched_setaffinity.c4
-rw-r--r--sysdeps/unix/sysv/linux/segfault.c2
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/setegid.c4
-rw-r--r--sysdeps/unix/sysv/linux/seteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/setsourcefilter.c9
-rw-r--r--sysdeps/unix/sysv/linux/sh/Dist8
-rw-r--r--sysdeps/unix/sysv/linux/sh/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h106
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/mman.h8
-rw-r--r--sysdeps/unix/sysv/linux/sh/chown.c70
-rw-r--r--sysdeps/unix/sysv/linux/sh/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/makecontext.S145
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread.c96
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread64.c97
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite.c96
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite64.c99
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/getcontext.S88
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/setcontext.S99
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S132
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h (renamed from sysdeps/unix/sysv/linux/arm/sys/ucontext.h)32
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym38
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/getcontext.S131
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/setcontext.S139
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S214
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h (renamed from sysdeps/unix/sysv/linux/sh/sys/ucontext.h)12
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym73
-rw-r--r--sysdeps/unix/sysv/linux/sh/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.S4
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h35
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c9
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.c5
-rw-r--r--sysdeps/unix/sysv/linux/sigprocmask.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigqueue.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigreturn.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigstack.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c35
-rw-r--r--sysdeps/unix/sysv/linux/sigtimedwait.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigwait.c15
-rw-r--r--sysdeps/unix/sysv/linux/sigwaitinfo.c4
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/errno.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/poll.h9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/setjmp.h19
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/stat.h41
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/termios.h88
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/wordsize.h20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/rt-sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/chown.c2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S46
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h75
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S26
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/socket.S39
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h177
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/brk.S8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S75
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h76
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h46
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pause.c8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/socket.S39
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S17
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h157
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c (renamed from sysdeps/unix/sysv/linux/mips/xstatconv.c)80
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/ptrace.h24
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.S1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/statvfs64.c4
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c87
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c (renamed from sysdeps/unix/sysv/linux/mips/ustat.c)34
-rw-r--r--sysdeps/unix/sysv/linux/sys/epoll.h9
-rw-r--r--sysdeps/unix/sysv/linux/sys/inotify.h92
-rw-r--r--sysdeps/unix/sysv/linux/sys/kd.h10
-rw-r--r--sysdeps/unix/sysv/linux/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h91
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list17
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c24
-rw-r--r--sysdeps/unix/sysv/linux/sysctl.c3
-rw-r--r--sysdeps/unix/sysv/linux/syslog.c10
-rw-r--r--sysdeps/unix/sysv/linux/system.c3
-rw-r--r--sysdeps/unix/sysv/linux/tcflow.c32
-rw-r--r--sysdeps/unix/sysv/linux/tcflush.c32
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c47
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c32
-rw-r--r--sysdeps/unix/sysv/linux/testrtsig.h4
-rw-r--r--sysdeps/unix/sysv/linux/time.c (renamed from sysdeps/unix/bsd/sun/m68k/sethostid.S)39
-rw-r--r--sysdeps/unix/sysv/linux/truncate64.c7
-rw-r--r--sysdeps/unix/sysv/linux/tst-clone.c (renamed from sysdeps/unix/sysv/linux/arm/brk.c)47
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c29
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c32
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c97
-rw-r--r--sysdeps/unix/sysv/linux/updwtmp.c4
-rw-r--r--sysdeps/unix/sysv/linux/utimes.c4
-rw-r--r--sysdeps/unix/sysv/linux/utmp_file.c4
-rw-r--r--sysdeps/unix/sysv/linux/vfork.c2
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c109
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/getdents.c2
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Dist11
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/brk.c43
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/clone.S8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getcontext.S18
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c22
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/setcontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/swapcontext.S12
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/epoll.h9
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysconf.c54
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h39
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.h47
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym34
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/umount.c32
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c95
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/xstatconv.h5
-rw-r--r--sysdeps/unix/sysv/tcflow.c4
-rw-r--r--sysdeps/unix/x86_64/sysdep.S4
819 files changed, 11648 insertions, 20378 deletions
diff --git a/sysdeps/unix/Dist b/sysdeps/unix/Dist
deleted file mode 100644
index b3c3880a79..0000000000
--- a/sysdeps/unix/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-errnos-tmpl.c
-errnos.awk
-ioctls-tmpl.c
-ioctls.awk
-snarf-ioctls
-make_errlist.c
-mk-local_lim.c
-s-proto.S
-make-syscalls.sh
-i386/dl-brk.S
-mips/dl-brk.S
-sparc/dl-brk.S
-s-proto-bp.S
-s-proto-cancel.S
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 5b326e032c..4ab06ba33e 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003
+# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003, 2006
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -212,24 +212,6 @@ common-generated := $(common-generated) \
 		    bits/ioctls.h ioctls make-ioctls make-ioctls.c
 endif
 
-ifeq ($(subdir),stdio-common)
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/errlist.c))))))
-
-before-compile: $(objpfx)errlist.c
-$(objpfx)errlist.c: $(objpfx)make_errlist
-	@rm -f $@
-	$(dir $<)$(notdir $<) > $@-tmp
-	mv $@-tmp $@
-
-$(objpfx)make_errlist: $(sysdep_dir)/unix/make_errlist.c
-	$(native-compile)
-
-generated := $(generated) make_errlist errlist.c
-
-endif
-endif # stdio-common
-
 ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
 	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/sys/syscall.h))))))
 
@@ -294,7 +276,13 @@ sysdep_routines += stub-syscalls
 $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
 			  $(..)sysdeps/unix/Makefile
 	$(make-target-directory)
-	(echo '#include <errno.h>'; \
+	(for call in $(unix-stub-syscalls); do \
+	   echo "#define $$call RENAMED_$$call"; \
+	 done; \
+	 echo '#include <errno.h>'; \
+	 for call in $(unix-stub-syscalls); do \
+	   echo "#undef $$call"; \
+	 done; \
 	 echo 'long int _no_syscall (void)'; \
 	 echo '{ __set_errno (ENOSYS); return -1L; }'; \
 	 for call in $(unix-stub-syscalls); do \
@@ -317,9 +305,6 @@ generated += stub-syscalls.c
 endif
 endif
 
-export sysdirs
-export asm_CPP := $(COMPILE.S) -E -x assembler-with-cpp
-
 # This is the end of the pipeline for compiling the syscall stubs.
 # The stdin in assembler with cpp using sysdep.h macros.
 # Be sure to disable debugging info since it would all just say "<stdin>".
@@ -330,7 +315,9 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
 	for dir in $(+sysdep_dirs); do \
 	  test -f $$dir/syscalls.list && \
-	  { $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
+	  { sysdirs='$(sysdirs)' \
+	    asm_CPP='$(COMPILE.S) -E -x assembler-with-cpp' \
+	    $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
 	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@
diff --git a/sysdeps/unix/alarm.c b/sysdeps/unix/alarm.c
index ae77782c54..84ab5a52fe 100644
--- a/sysdeps/unix/alarm.c
+++ b/sysdeps/unix/alarm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994,1997,2002,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,7 +41,10 @@ alarm (seconds)
     return 0;
 
   retval = old.it_value.tv_sec;
-  if (old.it_value.tv_usec)
+  /* Round to the nearest second, but never report zero seconds when
+     the alarm is still set.  */
+  if (old.it_value.tv_usec >= 500000
+      || (retval == 0 && old.it_value.tv_usec > 0))
     ++retval;
   return retval;
 }
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index f9f1dd6e41..2e5bc798eb 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004
+/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
@@ -242,9 +242,10 @@ __LABEL(name)						\
 	register long _sc_0 inline_syscall_r0_asm;		\
 	register long _sc_16 __asm__("$16");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
+	_sc_16 = _tmp_16;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3"				\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -261,10 +262,12 @@ __LABEL(name)						\
 	register long _sc_16 __asm__("$16");			\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -282,11 +285,14 @@ __LABEL(name)						\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -305,12 +311,16 @@ __LABEL(name)						\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -330,13 +340,18 @@ __LABEL(name)						\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
 	register long _sc_20 __asm__("$20");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
+	register long _tmp_20 = (long) (arg5);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
-	_sc_20 = (long) (arg5);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
+	_sc_20 = _tmp_20;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7"		\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -357,14 +372,20 @@ __LABEL(name)						\
 	register long _sc_19 __asm__("$19");			\
 	register long _sc_20 __asm__("$20");			\
 	register long _sc_21 __asm__("$21");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
+	register long _tmp_20 = (long) (arg5);			\
+	register long _tmp_21 = (long) (arg6);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
-	_sc_20 = (long) (arg5);					\
-	_sc_21 = (long) (arg6);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
+	_sc_20 = _tmp_20;					\
+	_sc_21 = _tmp_21;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8"		\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -376,4 +397,42 @@ __LABEL(name)						\
 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
 }
 
+/* Pointer mangling support.  Note that tls access is slow enough that
+   we don't deoptimize things by placing the pointer check value there.  */
+
+#include <stdint.h>
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)				\
+	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
+	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
+	xor	src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)				\
+	xor	src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+#  define PTR_MANGLE(var)	\
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)		\
+	ldq	tmp, __pointer_chk_guard;	\
+	xor	src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)		\
+	xor	src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+#  define PTR_MANGLE(var)	\
+	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#endif
+
 #endif /* ASSEMBLER */
diff --git a/sysdeps/unix/arm/Dist b/sysdeps/unix/arm/Dist
deleted file mode 100644
index 7785d5ee70..0000000000
--- a/sysdeps/unix/arm/Dist
+++ /dev/null
@@ -1 +0,0 @@
-dl-brk.S
diff --git a/sysdeps/unix/arm/brk.S b/sysdeps/unix/arm/brk.S
deleted file mode 100644
index 914e8a8bbe..0000000000
--- a/sysdeps/unix/arm/brk.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 95, 97, 98 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>
-
-#ifndef	SYS_brk
-#define	SYS_brk	17
-#endif
-
-.data
-.globl C_SYMBOL_NAME(__curbrk)
-C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
-	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
-
-.text
-SYSCALL__ (brk, 1)
-#ifdef PIC
-	ldr r1, 1f
-	ldr r2, _cb_addr
-2:	add r1, pc, r1
-	add r1, r1, r2
-#else
-	ldr r1, _cb_addr
-#endif
-	str r0, [r1]
-	mov r0, $0
-	DO_RET (r14)
-#ifdef PIC
-1:	.long _GLOBAL_OFFSET_TABLE_ - 2b - 8
-_cb_addr:
-	.long C_SYMBOL_NAME(__curbrk)(GOTOFF)
-#else
-_cb_addr:
-	.long C_SYMBOL_NAME(__curbrk)
-#endif
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/arm/dl-brk.S b/sysdeps/unix/arm/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/arm/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/arm/fork.S b/sysdeps/unix/arm/fork.S
deleted file mode 100644
index bd00c92cfe..0000000000
--- a/sysdeps/unix/arm/fork.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991,92,94,95,97,2002 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>
-
-/* ARM version.  */
-
-SYSCALL__ (fork, 0)
-	/* R1 is now 0 for the parent and 1 for the child.  Decrement it to
-	   make it -1 (all bits set) for the parent, and 0 (no bits set)
-	   for the child.  Then AND it with R0, so the parent gets
-	   R0&-1==R0, and the child gets R0&0==0.  */
-	sub r1, r1, $1
-	and r0, r0, r1
-	DO_RET (r14)
-PSEUDO_END (__fork)
-libc_hidden_def (__fork)
-
-weak_alias (__fork, fork)
diff --git a/sysdeps/unix/arm/start.c b/sysdeps/unix/arm/start.c
deleted file mode 100644
index 6bf08b1d7f..0000000000
--- a/sysdeps/unix/arm/start.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Special startup code for ARM a.out binaries.
-   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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 <stdlib.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* The first piece of initialized data.  */
-int __data_start = 0;
-#ifdef HAVE_WEAK_SYMBOLS
-weak_alias (__data_start, data_start)
-#endif
-
-extern void __libc_init (int argc, char **argv, char **envp);
-extern int main (int argc, char **argv, char **envp);
-
-/* N.B.: It is important that this be the first function.
-   This file is the first thing in the text section.  */
-
-/* If this was in C it might create its own stack frame and
-   screw up the arguments.  */
-#ifdef NO_UNDERSCORES
-asm (".text; .globl _start; _start: B start1");
-#else
-asm (".text; .globl __start; __start: B _start1");
-
-/* Make an alias called `start' (no leading underscore, so it can't
-   conflict with C symbols) for `_start'.  This is the name vendor crt0.o's
-   tend to use, and thus the name most linkers expect.  */
-asm (".set start, __start");
-#endif
-
-/* Fool gcc into thinking that more args are passed.  This makes it look
-   on the stack (correctly) for the real arguments.  It causes somewhat
-   strange register usage in start1(), but we aren't too bothered about
-   that at the moment. */
-#define DUMMIES a1, a2, a3, a4
-
-#ifdef	DUMMIES
-#define	ARG_DUMMIES	DUMMIES,
-#define	DECL_DUMMIES	int DUMMIES;
-#else
-#define	ARG_DUMMIES
-#define	DECL_DUMMIES
-#endif
-
-/* ARGSUSED */
-static void
-start1 (ARG_DUMMIES argc, argv, envp)
-     DECL_DUMMIES
-     int argc;
-     char **argv;
-     char **envp;
-{
-  /* Store a pointer to the environment.  */
-  __environ = envp;
-
-  /* Do C library initializations.  */
-  __libc_init (argc, argv, __environ);
-
-  /* Call the user program.  */
-  exit (main (argc, argv, __environ));
-}
diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S
deleted file mode 100644
index 4810805d85..0000000000
--- a/sysdeps/unix/arm/sysdep.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,03 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-
-.globl C_SYMBOL_NAME(errno)
-.globl syscall_error
-
-#undef syscall_error
-#ifdef NO_UNDERSCORES
-__syscall_error:
-#else
-syscall_error:
-#endif
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK?  */
-	moveq r0, $EAGAIN	/* Yes; translate it to EAGAIN.  */
-#endif
-
-#ifdef _LIBC_REENTRANT
-	str lr, [sp, #-4]!
-	str r0, [sp, #-4]!
-	bl PLTJMP(C_SYMBOL_NAME(__errno_location))
-	ldr r1, [sp], #4
-	str r1, [r0]
-	mvn r0, $0
-	ldr pc, [sp], #4	
-#else
-#ifndef	PIC
-	ldr r1, 1f
-	str r0, [r1]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.long C_SYMBOL_NAME(errno)
-#else
-	@ we have to establish our PIC register
-	ldr r2, 1f
-	ldr r1, 2f
-0:	add r2, pc, r2
-	str r0, [r1, r2]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.word _GLOBAL_OFFSET_TABLE_ - 0b - 8
-2:	.word C_SYMBOL_NAME(errno)(GOTOFF)
-#endif
-#endif
-
-#undef	__syscall_error
-END (__syscall_error)
diff --git a/sysdeps/unix/arm/sysdep.h b/sysdeps/unix/arm/sysdep.h
deleted file mode 100644
index 5f36272f27..0000000000
--- a/sysdeps/unix/arm/sysdep.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1997, 1998 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 <sysdeps/unix/sysdep.h>
-#include <sysdeps/arm/sysdep.h>
-
-/* Some definitions to allow the assembler in sysdeps/unix/ to build
-   without needing ARM-specific versions of all the files.  */
-
-#ifdef __ASSEMBLER__
-
-#define ret		DO_RET (r14)
-#define MOVE(a,b)	mov b,a
-
-#endif
diff --git a/sysdeps/unix/bsd/Dist b/sysdeps/unix/bsd/Dist
deleted file mode 100644
index e81952e015..0000000000
--- a/sysdeps/unix/bsd/Dist
+++ /dev/null
@@ -1,5 +0,0 @@
-setrgid.c
-setruid.c
-bsdstat.h
-bsdtty.h
-vax/dl-brk.S
diff --git a/sysdeps/unix/bsd/bsd4.4/Dist b/sysdeps/unix/bsd/bsd4.4/Dist
deleted file mode 100644
index 2562aac1b6..0000000000
--- a/sysdeps/unix/bsd/bsd4.4/Dist
+++ /dev/null
@@ -1 +0,0 @@
-cmsg_nxthdr.c
diff --git a/sysdeps/unix/bsd/init-posix.c b/sysdeps/unix/bsd/init-posix.c
index 06f727684f..b5ea8846f7 100644
--- a/sysdeps/unix/bsd/init-posix.c
+++ b/sysdeps/unix/bsd/init-posix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 94, 95, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 97, 98, 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
@@ -30,6 +30,4 @@ __init_posix (void)
   _posix_start_time = time ((time_t *) NULL);
 }
 
-#ifdef	HAVE_GNU_LD
 text_set_element(__libc_subinit, __init_posix);
-#endif
diff --git a/sysdeps/unix/bsd/m68k/start.c b/sysdeps/unix/bsd/m68k/start.c
deleted file mode 100644
index 1067853d61..0000000000
--- a/sysdeps/unix/bsd/m68k/start.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	DUMMIES	ignore0
-
-#include <sysdeps/unix/start.c>
diff --git a/sysdeps/unix/bsd/m68k/syscall.S b/sysdeps/unix/bsd/m68k/syscall.S
deleted file mode 100644
index eb1a8ec7a9..0000000000
--- a/sysdeps/unix/bsd/m68k/syscall.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1993, 1997 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>
-
-ENTRY (syscall)
-	movel sp@+, a0		/* Pop return address into A0.  */
-	DO_CALL (sp@, 0)	/* Do system call.  */
-	jmp a0@			/* Return to A0.  */
-error:	movel a0, sp@-		/* Error; push return address */
-	jmp syscall_error	/* and jump to error handler.  */
diff --git a/sysdeps/unix/bsd/m68k/sysdep.S b/sysdeps/unix/bsd/m68k/sysdep.S
deleted file mode 100644
index 90f35c9bcc..0000000000
--- a/sysdeps/unix/bsd/m68k/sysdep.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1997 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.  */
-
-#define _ERRNO_H
-#include <bits/errno.h>
-
-.globl syscall_error
-syscall_error:
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-#ifdef __motorola__
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	cmp.l #EWOULDBLOCK_sys, d0
-	bne store
-	moveq.l #EAGAIN, d0
-#endif
-store:	move.l d0, _errno
-	moveq.l #-1, d0
-#else
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	cmpl #EWOULDBLOCK_sys, d0
-	bne store
-	moveq #EAGAIN, d0
-#endif
-store:	movel d0, _errno
-	moveq #-1, d0
-#endif
-	rts
diff --git a/sysdeps/unix/bsd/sun/Dist b/sysdeps/unix/bsd/sun/Dist
deleted file mode 100644
index ccd3a610ee..0000000000
--- a/sysdeps/unix/bsd/sun/Dist
+++ /dev/null
@@ -1 +0,0 @@
-m68k/dl-brk.S
diff --git a/sysdeps/unix/bsd/sun/bits/signum.h b/sysdeps/unix/bsd/sun/bits/signum.h
deleted file mode 100644
index c13e7cd742..0000000000
--- a/sysdeps/unix/bsd/sun/bits/signum.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Signal number definitions.  SunOS version.
-   Copyright (C) 1994, 1996 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.  */
-
-#ifdef	_SIGNAL_H
-
-/* This file defines the fake signal functions and signal
-   number constants for SunOS 3 and 4 Unix systems.  */
-
-/* Fake signal functions.  */
-#define	SIG_ERR	((__sighandler_t) -1) /* Error return.  */
-#define	SIG_DFL	((__sighandler_t) 0) /* Default action.  */
-#define	SIG_IGN	((__sighandler_t) 1) /* Ignore signal.  */
-
-
-/* Signals.  */
-#define	SIGHUP		1	/* Hangup (POSIX).  */
-#define	SIGINT		2	/* Interrupt (ANSI).  */
-#define	SIGQUIT		3	/* Quit (POSIX).  */
-#define	SIGILL		4	/* Illegal instruction (ANSI).  */
-#define	SIGABRT		SIGIOT	/* Abort (ANSI).  */
-#define	SIGTRAP		5	/* Trace trap (POSIX).  */
-#define	SIGIOT		6	/* IOT trap (4.2 BSD).  */
-#define	SIGEMT		7	/* EMT trap (4.2 BSD).  */
-#define	SIGFPE		8	/* Floating-point exception (ANSI).  */
-#define	SIGKILL		9	/* Kill, unblockable (POSIX).  */
-#define	SIGBUS		10	/* Bus error (4.2 BSD).  */
-#define	SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define	SIGSYS		12	/* Bad argument to system call (4.2 BSD).  */
-#define	SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define	SIGALRM		14	/* Alarm clock (POSIX).  */
-#define	SIGTERM		15	/* Termination (ANSI).  */
-#define	SIGURG		16	/* Urgent condition on socket (4.2 BSD).  */
-#define	SIGSTOP		17	/* Stop, unblockable (POSIX).  */
-#define	SIGTSTP		18	/* Keyboard stop (POSIX).  */
-#define	SIGCONT		19	/* Continue (POSIX).  */
-#define	SIGCHLD		20	/* Child status has changed (POSIX).  */
-#define	SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define	SIGTTIN		21	/* Background read from tty (POSIX).  */
-#define	SIGTTOU		22	/* Background write to tty (POSIX).  */
-#define	SIGIO		23	/* I/O now possible (4.2 BSD).  */
-#define	SIGPOLL		SIGIO	/* Same as SIGIO? (SVID).  */
-#define	SIGXCPU		24	/* CPU limit exceeded (4.2 BSD).  */
-#define	SIGXFSZ		25	/* File size limit exceeded (4.2 BSD).  */
-#define	SIGVTALRM	26	/* Virtual alarm clock (4.2 BSD).  */
-#define	SIGPROF		27	/* Profiling alarm clock (4.2 BSD).  */
-#define	SIGWINCH	28	/* Window size change (4.3 BSD, Sun).  */
-#define SIGLOST		29	/* Resource lost (Sun).  */
-#define	SIGUSR1		30	/* User-defined signal 1 (POSIX).  */
-#define	SIGUSR2		31	/* User-defined signal 2 (POSIX).  */
-
-#endif	/* <signal.h> included.  */
-
-#define	_NSIG		32	/* Biggest signal number + 1.  */
diff --git a/sysdeps/unix/bsd/sun/m68k/Dist b/sysdeps/unix/bsd/sun/m68k/Dist
deleted file mode 100644
index cd893ff463..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sigtramp.c
diff --git a/sysdeps/unix/bsd/sun/m68k/Makefile b/sysdeps/unix/bsd/sun/m68k/Makefile
deleted file mode 100644
index ac4121dc2c..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
diff --git a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
deleted file mode 100644
index 99a0506a8d..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Structure describing state saved while handling a signal.  Sun 3 version.
-   Copyright (C) 1993, 1994, 1997 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 _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
-  {
-    int sc_onstack;
-    __sigset_t sc_mask;
-
-    int sc_sp, sc_pc, sc_ps;
-  };
diff --git a/sysdeps/unix/bsd/sun/m68k/dl-brk.S b/sysdeps/unix/bsd/sun/m68k/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/bsd/sun/m68k/sigtramp.c b/sysdeps/unix/bsd/sun/m68k/sigtramp.c
deleted file mode 100644
index 5a3ca3cf10..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/sigtramp.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright (C) 1993, 1996, 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'.  */
-#define	KERNEL
-#define	sigvec		sun_sigvec
-#define	sigstack	sun_sigstack
-#define	sigcontext	sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef	sigvec
-#undef	sigstack
-#undef	sigcontext
-#undef	NSIG
-#undef	SIGABRT
-#undef	SIGCLD
-#undef	SV_ONSTACK
-#undef	SV_RESETHAND
-#undef	SV_INTERRUPT
-#undef	SA_ONSTACK
-#undef	SA_NOCLDSTOP
-#undef	SIG_ERR
-#undef	SIG_DFL
-#undef	SIG_IGN
-#undef	sigmask
-#undef	SIG_BLOCK
-#undef	SIG_UNBLOCK
-#undef	SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S.  */
-extern int __raw_sigvec (int sig, const struct sigvec *vec,
-			 struct sigvec *ovec);
-
-/* User-specified signal handlers.  */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
-   Saves and restores the general regs %g2-%g7, the %y register, and
-   all the FPU regs (including %fsr), around calling the user's handler.  */
-static void
-trampoline (sig, code, context, addr)
-     int sig;
-     int code;
-     struct sigcontext *context;
-     void *addr;
-{
-  int save[4];
-
-  /* Save the call-clobbered registers.  */
-  asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0]));
-
-  /* XXX should save/restore FP regs */
-
-  /* Call the user's handler.  */
-  (*((void (*) (int sig, int code, struct sigcontext *context,
-		PTR addr)) handlers[sig]))
-    (sig, code, context, addr);
-
-  /* Restore the call-clobbered registers.  */
-  asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) :
-		"d0", "d1", "a0", "a1");
-
-  __sigreturn (context);
-}
-
-#endif
-
-int
-__sigvec (sig, vec, ovec)
-     int sig;
-     const struct sigvec *vec;
-     struct sigvec *ovec;
-{
-#ifndef	mytramp
-  extern void _sigtramp (int);
-#define	trampoline	_sigtramp
-#endif
-  struct sigvec myvec;
-  int mask;
-  __sighandler_t ohandler;
-
-  if (sig <= 0 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  mask = __sigblock(sigmask(sig));
-
-  ohandler = handlers[sig];
-
-  if (vec != NULL &&
-      vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
-    {
-      handlers[sig] = vec->sv_handler;
-      myvec = *vec;
-      myvec.sv_handler = trampoline;
-      vec = &myvec;
-    }
-
-  if (__raw_sigvec(sig, vec, ovec) < 0)
-    {
-      int save = errno;
-      (void) __sigsetmask(mask);
-      errno = save;
-      return -1;
-    }
-
-  if (ovec != NULL && ovec->sv_handler == trampoline)
-    ovec->sv_handler = ohandler;
-
-  (void) __sigsetmask(mask);
-
-  return 0;
-}
diff --git a/sysdeps/unix/bsd/sun/m68k/syscall.S b/sysdeps/unix/bsd/sun/m68k/syscall.S
deleted file mode 100644
index 1d4d5be42f..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/syscall.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1993, 1997 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>
-
-ENTRY (syscall)
-	movel sp@, d0		/* Save return address in D0.  */
-	movel sp@(4), sp@	/* Put syscall number at top of stack.  */
-	movel d0, sp@(4)	/* Put return address under it.  */
-	trap #0			/* Do syscall; pops number from stack.  */
-	jcs error
-	ret
-error:	jmp syscall_error
diff --git a/sysdeps/unix/bsd/sun/m68k/sysdep.h b/sysdeps/unix/bsd/sun/m68k/sysdep.h
deleted file mode 100644
index e51ab0a8e4..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/sysdep.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1995, 1997 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 <sysdeps/unix/sysdep.h>
-
-#ifdef	__ASSEMBLER__
-
-#define	POUND	#
-
-#ifdef	__STDC__
-#define	ENTRY(name)							      \
-  .globl _##name;							      \
-  .even;								      \
-  _##name##:
-#else
-#define	ENTRY(name)							      \
-  .globl _/**/name;							      \
-  .even;								      \
-  _/**/name/**/:
-#endif
-
-#ifdef	__STDC__
-#define	PSEUDO(name, syscall_name, args)				      \
-  .even;								      \
-  .globl syscall_error;							      \
-  error: jmp syscall_error;						      \
-  ENTRY (name)								      \
-  pea SYS_##syscall_name;						      \
-  trap POUND 0;								      \
-  bcs error
-#else
-#define	PSEUDO(name, syscall_name, args)				      \
-  .even;								      \
-  .globl syscall_error;							      \
-  error: jmp syscall_error;						      \
-  ENTRY (name)								      \
-  pea SYS_/**/syscall_name;						      \
-  trap POUND 0;								      \
-  bcs error
-#endif
-
-#define	ret	rts
-#define	r0	d0
-#define	r1	d1
-#define	MOVE(x,y)	movel x , y
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/unix/bsd/sun/m68k/vfork.S b/sysdeps/unix/bsd/sun/m68k/vfork.S
deleted file mode 100644
index cf9e2e9e1a..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/vfork.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97, 2002 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>
-
-#ifndef	SYS_vfork
-#define	SYS_vfork	66
-#endif
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-.globl ___vfork
-___vfork:
-	/* Pop the return PC value into A0.  */
-	movel sp@+, a0
-
-	/* Push the syscall number and trap into the kernel.  */
-	movel #SYS_vfork, sp@-
-	trap #0
-	bcs error		/* Branch forward if it failed.  */
-
-	/* It succeeded.  See which fork we're in.  D1 is now 0 for the
-	   parent and 1 for the child.  Decrement it to make it -1 (all
-	   bits set) for the parent, and 0 (no bits set) for the child.
-	   Then AND it with D0, so the parent gets D0&-1==R0, and the child
-	   gets D0&0==0.  */
-	subql #1, d1
-	andl d1, d0
-
-	/* Jump to the return PC.  */
-	jmp a0@
-
-error:
-	movel d0, _errno
-	moveq #-1, d0
-	jmp a0@
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/bsd/sun/sethostid.c b/sysdeps/unix/bsd/sun/sethostid.c
deleted file mode 100644
index aeb2940f42..0000000000
--- a/sysdeps/unix/bsd/sun/sethostid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/generic/sethostid.c>
diff --git a/sysdeps/unix/bsd/sun/sparc/Dist b/sysdeps/unix/bsd/sun/sparc/Dist
deleted file mode 100644
index cd893ff463..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sigtramp.c
diff --git a/sysdeps/unix/bsd/sun/sparc/Makefile b/sysdeps/unix/bsd/sun/sparc/Makefile
deleted file mode 100644
index 59d10dbdbf..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# Basically `-e start' is magical to the Sun linker.  You would think that
-# having start.o first would be enough, but you would be wrong.
-LDFLAGS := $(LDFLAGS) -Xlinker -e -Xlinker start
-
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
diff --git a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
deleted file mode 100644
index 7c4bca6049..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Structure describing state saved while handling a signal.  Sparc version.
-   Copyright (C) 1992, 1994, 1997 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 _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
-  {
-    int sc_onstack;
-    __sigset_t sc_mask;
-
-#define	SPARC_MAXREGWINDOW 31	/* Maximum usable register windows.  */
-    int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0;
-    int sc_wbcnt;		/* Number of outstanding windows.  */
-    __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window.  */
-    int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows.  */
-  };
diff --git a/sysdeps/unix/bsd/sun/sparc/sethostid.S b/sysdeps/unix/bsd/sun/sparc/sethostid.S
deleted file mode 100644
index d07fd3800c..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/sethostid.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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>
-
-#ifdef	 SYS_sethostid
-
-SYSCALL (sethostid, 1)
-	ret
-
-#else
-
-/* <bits/errno.h> only defines E* #ifdef _ERRNO_H.  */
-#define	_ERRNO_H
-#include <bits/errno.h>
-
-ENTRY (sethostid)
-	mov ENOSYS, %o0
-	sethi %hi(_errno), %g1
-	st %o0, [%g1 + %lo(_errno)]
-	retl
-	sub %g0, 1, %o0
-
-#ifdef	HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
-
-#endif
diff --git a/sysdeps/unix/bsd/sun/sparc/sigtramp.c b/sysdeps/unix/bsd/sun/sparc/sigtramp.c
deleted file mode 100644
index e11f7e51d3..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/sigtramp.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* Copyright (C) 1991,1992,1994,1996,1997,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'.  */
-#define	KERNEL
-#define	sigvec		sun_sigvec
-#define	sigstack	sun_sigstack
-#define	sigcontext	sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef	sigvec
-#undef	sigstack
-#undef	sigcontext
-#undef	NSIG
-#undef	SIGABRT
-#undef	SIGCLD
-#undef	SV_ONSTACK
-#undef	SV_RESETHAND
-#undef	SV_INTERRUPT
-#undef	SA_ONSTACK
-#undef	SA_NOCLDSTOP
-#undef	SIG_ERR
-#undef	SIG_DFL
-#undef	SIG_IGN
-#undef	sigmask
-#undef	SIG_BLOCK
-#undef	SIG_UNBLOCK
-#undef	SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S.  */
-extern int __raw_sigvec (int sig, CONST struct sigvec *vec,
-			 struct sigvec *ovec);
-
-/* User-specified signal handlers.  */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
-   Saves and restores the general regs %g2-%g7, the %y register, and
-   all the FPU regs (including %fsr), around calling the user's handler.  */
-static void
-trampoline (sig)
-     int sig;
-{
-  /* We use `double' and `long long int' so `std' (store doubleword) insns,
-     which might be faster than single-word stores, will be generated.  */
-  register double f0 asm("%f0");
-  register double f2 asm("%f2");
-  register double f4 asm("%f4");
-  register double f6 asm("%f6");
-  register double f8 asm("%f8");
-  register double f10 asm("%f10");
-  register double f12 asm("%f12");
-  register double f14 asm("%f14");
-  register double f16 asm("%f16");
-  register double f18 asm("%f18");
-  register double f20 asm("%f20");
-  register double f22 asm("%f22");
-  register double f24 asm("%f24");
-  register double f26 asm("%f26");
-  register double f28 asm("%f28");
-  register double f30 asm("%f30");
-  register long long int g2 asm("%g2");
-  register long long int g4 asm("%g4");
-  register long long int g6 asm("%g6");
-  register int *fp asm("%fp");
-
-  int code;
-  register struct sigcontext *context asm("%i0"); /* See end of fn.  */
-  void *addr;
-  int y;
-  double fpsave[16];
-  int fsr;
-  int savefpu;
-  long long int glsave[3];
-
-  /* SIG isn't really passed as an arg.
-     The args to the signal handler are at fp[16..19].  */
-  sig = fp[16];
-  code = fp[17];
-  context = (struct sigcontext *) fp[18];
-  addr = (PTR) fp[19];
-
-  /* Save the Y register.  */
-  asm("rd %%y, %0" : "=r" (y));
-
-  /* Save the FPU regs if the FPU enable bit is set in the PSR,
-     and the signal isn't an FP exception.  */
-  savefpu = (context->sc_psr & 0x1000) && sig != SIGFPE;
-  if (savefpu)
-    {
-      fpsave[0] = f0;
-      fpsave[1] = f2;
-      fpsave[2] = f4;
-      fpsave[3] = f6;
-      fpsave[4] = f8;
-      fpsave[5] = f10;
-      fpsave[6] = f12;
-      fpsave[7] = f14;
-      fpsave[8] = f16;
-      fpsave[9] = f18;
-      fpsave[10] = f20;
-      fpsave[11] = f22;
-      fpsave[12] = f24;
-      fpsave[13] = f26;
-      fpsave[14] = f28;
-      fpsave[15] = f30;
-
-      /* Force it into a stack slot so the asm won't barf.  Sigh.  */
-      (void) &fsr;
-      asm("st %%fsr, %0" : "=m" (fsr));
-    }
-
-  /* Save the global registers (except for %g1, which is a scratch reg).  */
-  glsave[0] = g2;
-  glsave[1] = g4;
-  glsave[2] = g6;
-
-  /* Call the user's handler.  */
-  (*((void (*) (int sig, int code, struct sigcontext *context,
-		void *addr)) handlers[sig]))
-    (sig, code, context, addr);
-
-  /* Restore the Y register.  */
-  asm("mov %0, %%y" : : "r" (y));
-
-  if (savefpu)
-    {
-      /* Restore the FPU regs.  */
-      f0 = fpsave[0];
-      f2 = fpsave[1];
-      f4 = fpsave[2];
-      f6 = fpsave[3];
-      f8 = fpsave[4];
-      f10 = fpsave[5];
-      f12 = fpsave[6];
-      f14 = fpsave[7];
-      f16 = fpsave[8];
-      f18 = fpsave[9];
-      f20 = fpsave[10];
-      f22 = fpsave[11];
-      f24 = fpsave[12];
-      f26 = fpsave[13];
-      f28 = fpsave[14];
-      f30 = fpsave[15];
-
-      asm("ld %0, %%fsr" : : "m" (fsr));
-    }
-
-  /* Restore the globals.  */
-  g2 = glsave[0];
-  g4 = glsave[1];
-  g6 = glsave[2];
-
-  /* Unwind a frame, and do a "sigcleanup" system call.
-     The system call apparently does a return.
-     I don't know what it's for.  Ask Sun.  */
-  asm("restore %%g0, 139, %%g1\n"
-      "ta 0\n"
-      "! this should be i0: %0"	/* Useless insn that will never be executed, */
-				/* here to make the compiler happy.  */
-      : /* No outputs.  */ :
-      /* CONTEXT is bound to %i0.  We reference it as an input here to make
-	 sure the compiler considers it live at this point, and preserves
-	 the value in that register.  The restore makes %i0 become %o0, the
-	 argument to the system call.  */
-      "r" (context));
-}
-#endif
-
-int
-__sigvec (sig, vec, ovec)
-     int sig;
-     const struct sigvec *vec;
-     struct sigvec *ovec;
-{
-#ifndef	mytramp
-  extern void _sigtramp (int);
-#define	trampoline	_sigtramp
-#endif
-  struct sigvec myvec;
-  int mask;
-  __sighandler_t ohandler;
-
-  if (sig <= 0 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  mask = __sigblock (sigmask(sig));
-
-  ohandler = handlers[sig];
-
-  if (vec != NULL &&
-      vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
-    {
-      handlers[sig] = vec->sv_handler;
-      myvec = *vec;
-      myvec.sv_handler = trampoline;
-      vec = &myvec;
-    }
-
-  if (__raw_sigvec(sig, vec, ovec) < 0)
-    {
-      int save = errno;
-      (void) __sigsetmask(mask);
-      errno = save;
-      return -1;
-    }
-
-  if (ovec != NULL && ovec->sv_handler == trampoline)
-    ovec->sv_handler = ohandler;
-
-  (void) __sigsetmask (mask);
-
-  return 0;
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/.cvsignore b/sysdeps/unix/bsd/sun/sunos4/.cvsignore
deleted file mode 100644
index 1f69fd919a..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.gz *.Z *.tar *.tgz
-=*
-TODO COPYING* AUTHORS copyr-* copying.*
-glibc-*
diff --git a/sysdeps/unix/bsd/sun/sunos4/Implies b/sysdeps/unix/bsd/sun/sunos4/Implies
deleted file mode 100644
index c99e256ac1..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/Implies
+++ /dev/null
@@ -1,2 +0,0 @@
-# SunOS 4 has the canonical set of <sys/mman.h> system calls.
-unix/mman
diff --git a/sysdeps/unix/bsd/sun/sunos4/Makefile b/sysdeps/unix/bsd/sun/sunos4/Makefile
deleted file mode 100644
index d17654a30f..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifeq ($(subdir),posix)
-sysdep_routines := $(sysdep_routines) sys_wait4
-endif
-
-ifeq ($(subdir),misc)
-sysdep_routines := $(sysdep_routines) sys_mmap
-endif
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h b/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
deleted file mode 100644
index a30b352592..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* O_*, F_*, FD_* bit values for SunOS 4.
-   Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'.  */
-#define	O_RDONLY	0	/* Open read-only.  */
-#define	O_WRONLY	1	/* Open write-only.  */
-#define	O_RDWR		2	/* Open read/write.  */
-
-
-/* Bits OR'd into the second argument to open.  */
-#define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
-#define	O_EXCL		0x0800	/* Fail if file already exists.  */
-#define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-#define	O_NOCTTY	0x8000	/* Don't assign a controlling terminal.  */
-#if defined __USE_BSD || defined __USE_SVID
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x2000	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
-#endif
-
-/* File status flags for `open' and `fcntl'.  */
-#define	O_APPEND	0x0008	/* Writes append to the file.  */
-#define	O_NONBLOCK	0x4000	/* Non-blocking I/O.  */
-
-/* Sun defines O_NDELAY one way for BSD behavior and another for System V
-   behavior.  In the GNU C library, you get the BSD behavior unless you
-   define _USG_SOURCE without also defining _BSD_SOURCE or _GNU_SOURCE.  */
-#ifdef __USE_BSD
-#define	O_NDELAY	0x0004
-#endif
-#if !defined (O_NDELAY) && defined (__USE_SVID)
-#define	O_NDELAY	0x1000
-#endif
-
-#ifdef __USE_BSD
-/* Bits in the file status flags returned by F_GETFL.
-   These are all the O_* flags, plus FREAD and FWRITE, which are
-   independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
-   given to `open'.  */
-#define FREAD		1
-#define	FWRITE		2
-
-/* Traditional Unix names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNONBIO		O_NONBLOCK
-#define FNDELAY		0x0004	/* BSD O_NDELAY.  */
-#define	FNBIO		0x1000	/* System V O_NDELAY.  */
-#endif
-
-/* Mask for file access modes.  This is system-dependent in case
-   some system ever wants to define some other flavor of access.  */
-#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'.  */
-#define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
-#define	F_GETFD		1	/* Get file descriptor flags.  */
-#define	F_SETFD		2	/* Set file descriptor flags.  */
-#define	F_GETFL		3	/* Get file status flags.  */
-#define	F_SETFL		4	/* Set file status flags.  */
-#if defined __USE_BSD || defined __USE_UNIX98
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
-#endif
-#define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info (non-blocking).  */
-#define	F_SETLKW	9	/* Set record locking info (blocking).  */
-#ifdef	__USE_BSD
-#define	F_RGETLK	10	/* Get remote record locking info.  */
-#define	F_RSETLK	11	/* Set remote locking info (non-blocking).  */
-#define	F_CNVT		12	/* Convert a fhandle to an open fd.  */
-#define	F_RSETLKW	13	/* Set remote locking info (blocking).  */
-#endif
-
-/* File descriptor flags used with F_GETFD and F_SETFD.  */
-#define	FD_CLOEXEC	1	/* Close on exec.  */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock.  This is the type of the third
-   argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    short int l_pid;	/* Process holding the lock.  */
-    short int l_xxx;	/* Reserved for future use.  */
-  };
-
-#ifdef	__USE_BSD
-/* The structure describing a remote advisory lock.  This is the type of the
-   third arg to `fcntl' for the F_RGETLK, F_RSETLK, and F_RSETLKW requests.  */
-struct eflock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    short int l_pid;	/* Process holding the lock.  */
-    short int l_xxx;	/* Reserved for future use.  */
-    long int l_rpid;	/* Remote process ID wanting this lock.  */
-    long int l_rsys;	/* Remote system ID wanting this lock.  */
-  };
-
-#endif
-
-
-/* Values for the `l_type' field of a `struct flock'.  */
-#define	F_RDLCK	1	/* Read lock.  */
-#define	F_WRLCK	2	/* Write lock.  */
-#define	F_UNLCK	3	/* Remove lock.  */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/mman.h b/sysdeps/unix/bsd/sun/sunos4/bits/mman.h
deleted file mode 100644
index fdef46522a..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/mman.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Definitions for BSD-style memory management.  SunOS 4 version.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 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	_BITS_MMAN_H
-#define	_BITS_MMAN_H	1
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define	PROT_NONE	0x00	/* No access.  */
-#define	PROT_READ	0x01	/* Pages can be read.  */
-#define	PROT_WRITE	0x02	/* Pages can be written.  */
-#define	PROT_EXEC	0x04	/* Pages can be executed.  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define	MAP_SHARED	0x01	/* Share changes.  */
-#define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
-#ifdef __USE_BSD
-# define MAP_TYPE	0x0f	/* Mask for sharing type.  */
-#endif
-
-/* Other flags.  */
-#define	MAP_FIXED	0x10	/* Map address must be exactly as requested. */
-/* The following three flags are not actually implemented in SunOS 4.1.  */
-#ifdef __USE_BSD
-# define MAP_RENAME	0x20	/* Rename private pages to file.  */
-# define MAP_NORESERVE	0x40	/* Don't reserve needed swap area.  */
-# define MAP_INHERIT	0x80	/* Region is retained after exec.  */
-#endif
-
-/* This is an internal flag that is always set in `mmap' system calls.  In
-   older versions of SunOS 4 `mmap' did not return the actual mapping
-   address, but always returned zero.  This flag says to return the
-   address; the `mmap' C library function always sets it.  */
-#define	_MAP_NEW	0x80000000
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	0	/* No further special treatment.  */
-# define MADV_RANDOM	1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL	2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	3	/* Will need these pages.  */
-# define MADV_DONTNEED	4	/* Don't need these pages.  */
-#endif
-
-/* Flags to `msync'.  */
-#define	MS_ASYNC	0x1		/* Return immediately, don't fsync.  */
-#define	MS_INVALIDATE	0x2		/* Invalidate caches.  */
-
-#endif /* bits/mman.h */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
deleted file mode 100644
index 2f0d2dc73f..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Bit values for resource limits.  SunOS 4 version.
-   Copyright (C) 1994, 1996, 1997 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 _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-/* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
-   subset of these kinds of resource limit.  In systems where `getrlimit'
-   and `setrlimit' are not system calls, these are the values used by the C
-   library to emulate them.  */
-
-#include <bits/types.h>
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-  {
-    /* Per-process CPU limit, in seconds.  */
-    RLIMIT_CPU,
-#define	RLIMIT_CPU	RLIMIT_CPU
-    /* Largest file that can be created, in bytes.  */
-    RLIMIT_FSIZE,
-#define	RLIMIT_FSIZE	RLIMIT_FSIZE
-    /* Maximum size of data segment, in bytes.  */
-    RLIMIT_DATA,
-#define	RLIMIT_DATA	RLIMIT_DATA
-    /* Maximum size of stack segment, in bytes.  */
-    RLIMIT_STACK,
-#define	RLIMIT_STACK	RLIMIT_STACK
-    /* Largest core file that can be created, in bytes.  */
-    RLIMIT_CORE,
-#define	RLIMIT_CORE	RLIMIT_CORE
-    /* Largest resident set size, in bytes.
-       This affects swapping; processes that are exceeding their
-       resident set size will be more likely to have physical memory
-       taken from them.  */
-    RLIMIT_RSS,
-#define	RLIMIT_RSS	RLIMIT_RSS
-    /* Number of open files.  */
-    RLIMIT_NOFILE,
-    RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
-#define	RLIMIT_NOFILE	RLIMIT_NOFILE
-#define	RLIMIT_OFILE	RLIMIT_OFILE
-
-    RLIM_NLIMITS
-  };
-
-/* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY 0x7fffffff
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-
-/* Type to represent quantities in resource limits.  */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-
-struct rlimit
-  {
-    /* The current (soft) limit.  */
-    rlim_t rlim_cur;
-    /* The hard limit.  */
-    rlim_t rlim_max;
-  };
-
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-
-struct rlimit64
-  {
-    /* The current (soft) limit.  */
-    rlim64_t rlim_cur;
-    /* The hard limit.  */
-    rlim64_t rlim_max;
-  };
-#endif
-
-/* Whose usage statistics do you want?  */
-enum __rusage_who
-/* The macro definitions are necessary because some programs want
-   to test for operating system features with #ifdef RUSAGE_SELF.
-   In ISO C the reflexive definition is a no-op.  */
-  {
-    /* The calling process.  */
-    RUSAGE_SELF = 0,
-#define RUSAGE_SELF     RUSAGE_SELF
-    /* All of its terminated child processes.  */
-    RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-  };
-
-#define __need_timeval
-#include <bits/time.h>           /* For `struct timeval'.  */
-
-/* Structure which says how much of each resource has been used.  */
-struct rusage
-  {
-    /* Total amount of user time used.  */
-    struct timeval ru_utime;
-    /* Total amount of system time used.  */
-    struct timeval ru_stime;
-    /* Maximum resident set size (in kilobytes).  */
-    long int ru_maxrss;
-    /* Amount of sharing of text segment memory
-       with other processes (kilobyte-seconds).  */
-    long int ru_ixrss;
-    /* Amount of data segment memory used (kilobyte-seconds).  */
-    long int ru_idrss;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN        -20     /* Minimum priority a process can have.  */
-#define PRIO_MAX        20      /* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-  {
-    PRIO_PROCESS = 0,           /* WHO is a process ID.  */
-    PRIO_PGRP = 1,              /* WHO is a process group ID.  */
-    PRIO_USER = 2               /* WHO is a user ID.  */
-  };
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
deleted file mode 100644
index 97612c8f0b..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* termios type and macro definitions.  SunOS 4 version.
-   Copyright (C) 1993, 1994, 1996, 1997 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 _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-/* Type of terminal control flag masks.  */
-typedef unsigned long int tcflag_t;
-
-/* Type of control characters.  */
-typedef unsigned char cc_t;
-
-/* Type of baud rate specifiers.  */
-typedef unsigned int speed_t;
-
-/* Terminal control structure.  */
-struct termios
-{
-  /* Input modes.  */
-  tcflag_t c_iflag;
-#define	IGNBRK	0x0001		/* Ignore break condition.  */
-#define	BRKINT	0x0002		/* Signal interrupt on break.  */
-#define	IGNPAR	0x0004		/* Ignore characters with parity errors.  */
-#define	PARMRK	0x0008		/* Mark parity and framing errors.  */
-#define	INPCK	0x0010		/* Enable input parity check.  */
-#define	ISTRIP	0x0020		/* Strip 8th bit off characters.  */
-#define	INLCR	0x0040		/* Map NL to CR on input.  */
-#define	IGNCR	0x0080		/* Ignore CR.  */
-#define	ICRNL	0x0100		/* Map CR to NL on input.  */
-#ifdef __USE_BSD
-# define IUCLC	0x0200		/* Map upper case to lower case on input.  */
-#endif
-#define	IXON	0x0400		/* Enable start/stop output control.  */
-#define	IXOFF	0x1000		/* Enable start/stop input control.  */
-#ifdef	__USE_BSD
-# define IXANY	0x0800		/* Any character will restart after stop.  */
-# define IMAXBEL	0x2000		/* Ring bell when input queue is full.  */
-#endif
-
-  /* Output modes.  */
-  tcflag_t c_oflag;
-#define	OPOST	0x0001		/* Perform output processing.  */
-#ifdef	__USE_BSD
-# define OLCUC	0x00000002	/* Map lower case to upper case on output.  */
-# define ONLCR	0x00000004	/* Map NL to CR-NL on output.  */
-# define OCRNL	0x00000008
-# define ONOCR	0x00000010
-# define ONLRET	0x00000020
-# define OFILL	0x00000040
-# define OFDEL	0x00000080
-# define NLDLY	0x00000100
-# define NL0	0
-# define NL1	0x00000100
-# define CRDLY	0x00000600
-# define CR0	0
-# define CR1	0x00000200
-# define CR2	0x00000400
-# define CR3	0x00000600
-# define TABDLY	0x00001800
-# define TAB0	0
-# define TAB1	0x00000800
-# define TAB2	0x00001000
-# define XTABS	0x00001800
-# define TAB3	XTABS
-# define BSDLY	0x00002000
-# define BS0	0
-# define BS1	0x00002000
-# define VTDLY	0x00004000
-# define VT0	0
-# define VT1	0x00004000
-# define FFDLY	0x00008000
-# define FF0	0
-# define FF1	0x00008000
-# define PAGEOUT 0x00010000
-# define WRAP	0x00020000
-#endif
-
-  /* Control modes.  */
-  tcflag_t c_cflag;
-#define	CSIZE	(CS5|CS6|CS7|CS8) /* Number of bits per byte (mask).  */
-#define	CS5	0		/* 5 bits per byte.  */
-#define	CS6	0x00000010	/* 6 bits per byte.  */
-#define	CS7	0x00000020	/* 7 bits per byte.  */
-#define	CS8	0x00000030	/* 8 bits per byte.  */
-#define	CSTOPB	0x00000040	/* Two stop bits instead of one.  */
-#define	CREAD	0x00000080	/* Enable receiver.  */
-#define	PARENB	0x00000100	/* Parity enable.  */
-#define	PARODD	0x00000200	/* Odd parity instead of even.  */
-#define	HUPCL	0x00000400	/* Hang up on last close.  */
-#define	CLOCAL	0x00000800	/* Ignore modem status lines.  */
-#ifdef	__USE_BSD
-# define LOBLK	0x00001000
-# define CRTSCTS	0x80000000
-# define CIBAUD	0x000f0000	/* Mask for input speed from c_cflag.  */
-# define CBAUD	0x0000000f	/* Mask for output speed from c_cflag.  */
-# define IBSHIFT	16		/* Bits to shift for input speed.  */
-#endif
-
-  /* Input and output baud rates.  These are encoded in c_cflag.  */
-#define B0      0
-#define B50     1
-#define B75     2
-#define B110    3
-#define B134    4
-#define B150    5
-#define B200    6
-#define B300    7
-#define B600    8
-#define B1200   9
-#define B1800   10
-#define B2400   11
-#define B4800   12
-#define B9600   13
-#define B19200  14
-#define B38400  15
-#ifdef __USE_BSD
-# define EXTA   14
-# define EXTB   15
-#endif
-
-  /* Local modes.  */
-  tcflag_t c_lflag;
-#ifdef	__USE_BSD
-# define ECHOKE	0x00000800	/* Visual erase for KILL.  */
-#endif
-#define	ECHOE	0x00000010	/* Visual erase for ERASE.  */
-#define	ECHOK	0x00000020	/* Echo NL after KILL.  */
-#define	ECHO	0x00000008	/* Enable echo.  */
-#define	ECHONL	0x00000040	/* Echo NL even if ECHO is off.  */
-#ifdef	__USE_BSD
-# define ECHOPRT	0x00000400	/* Hardcopy visual erase.  */
-# define ECHOCTL	0x00000200	/* Echo control characters as ^X.  */
-#endif
-#define	ISIG	0x00000001	/* Enable signals.  */
-#define	ICANON	0x00000002	/* Do erase and kill processing.  */
-#define	IEXTEN	0x00008000	/* Enable DISCARD and LNEXT.  */
-#define	TOSTOP	0x00000100	/* Send SIGTTOU for background output.  */
-#ifdef	__USE_BSD
-# define PENDIN	0x00004000	/* Retype pending input (state).  */
-#endif
-#define	NOFLSH	0x00000080	/* Disable flush after interrupt.  */
-
-  char c_line;			/* Line discipline (?) */
-
-  /* Control characters.  */
-#define	VEOF	4		/* End-of-file character [ICANON].  */
-#define	VEOL	5		/* End-of-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VEOL2	6		/* Second EOL character [ICANON].  */
-# define VSWTCH	7		/* ??? */
-#endif
-#define	VERASE	2		/* Erase character [ICANON].  */
-#ifdef	__USE_BSD
-# define VWERASE	14		/* Word-erase character [ICANON].  */
-#endif
-#define	VKILL	3		/* Kill-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VREPRINT 12		/* Reprint-line character [ICANON].  */
-#endif
-#define	VINTR	0		/* Interrupt character [ISIG].  */
-#define	VQUIT	1		/* Quit character [ISIG].  */
-#define	VSUSP	10		/* Suspend character [ISIG].  */
-#ifdef	__USE_BSD
-# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
-#endif
-#define	VSTART	8		/* Start (X-ON) character [IXON, IXOFF].  */
-#define	VSTOP	9		/* Stop (X-OFF) character [IXON, IXOFF].  */
-#ifdef	__USE_BSD
-# define VLNEXT	15		/* Literal-next character [IEXTEN].  */
-# define VDISCARD 13		/* Discard character [IEXTEN].  */
-#endif
-#define	VMIN	VEOF		/* Minimum number of bytes read at once [!ICANON].  */
-#define	VTIME	VEOL		/* Time-out value (tenths of a second) [!ICANON].  */
-#define	NCCS	17
-  cc_t c_cc[NCCS];
-};
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define	TCSANOW		0	/* Change immediately.  */
-#define	TCSADRAIN	1	/* Change when pending output is written.  */
-#define	TCSAFLUSH	2	/* Flush pending input before changing.  */
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define	TCIFLUSH	0	/* Discard data received but not yet read.  */
-#define	TCOFLUSH	1	/* Discard data written but not yet sent.  */
-#define	TCIOFLUSH	2	/* Discard all pending data.  */
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define	TCOOFF	0		/* Suspend output.  */
-#define	TCOON	1		/* Restart suspended output.  */
-#define	TCIOFF	2		/* Send a STOP character.  */
-#define	TCION	3		/* Send a START character.  */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
deleted file mode 100644
index a0246c2a36..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 1997, 2002 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 _SYS_UTSNAME_H
-# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
-#endif
-
-#define _UTSNAME_LENGTH 9
-#define _UTSNAME_NODENAME_LENGTH 65
diff --git a/sysdeps/unix/bsd/sun/sunos4/mmap.c b/sysdeps/unix/bsd/sun/sunos4/mmap.c
deleted file mode 100644
index c513ae27eb..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/mmap.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997 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 <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  from
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-extern __ptr_t __mmap_syscall (__ptr_t addr, size_t len,
-			       int prot, int flags, int fd, off_t offset);
-
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-  return __mmap_syscall (addr, len, prot, flags | _MAP_NEW, fd, offset);
-}
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/bsd/sun/sunos4/speed.c b/sysdeps/unix/bsd/sun/sunos4/speed.c
deleted file mode 100644
index 262d70fdfb..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/speed.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* `struct termios' speed frobnication functions.  SunOS 4 version.
-   Copyright (C) 1991,1992,1993,1996,1997,2002 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 <stddef.h>
-#include <errno.h>
-#include <termios.h>
-
-static const speed_t speeds[] =
-  {
-    0,
-    50,
-    75,
-    110,
-    134,
-    150,
-    200,
-    300,
-    600,
-    1200,
-    1800,
-    2400,
-    4800,
-    9600,
-    19200,
-    38400,
-  };
-
-
-/* Return the output baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetospeed (termios_p)
-     const struct termios *termios_p;
-{
-  return termios_p->c_cflag & CBAUD;
-}
-
-/* Return the input baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetispeed (termios_p)
-     const struct termios *termios_p;
-{
-  return (termios_p->c_cflag & CIBAUD) >> IBSHIFT;
-}
-
-/* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetospeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  register unsigned int i;
-
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* This allows either B1200 or 1200 to work.	XXX
-     Do we really want to try to support this, given that
-     fetching the speed must return one or the other?  */
-
-  for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
-    if (i == speed || speeds[i] == speed)
-      {
-	termios_p->c_cflag &= ~CBAUD;
-	termios_p->c_cflag |= i;
-	return 0;
-      }
-
-  __set_errno (EINVAL);
-  return -1;
-}
-libc_hidden_def (cfsetospeed)
-
-/* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetispeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  register unsigned int i;
-
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* See comment in cfsetospeed (above).  */
-  for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
-    if (i == speed || speeds[i] == speed)
-      {
-	termios_p->c_cflag &= ~CIBAUD;
-	termios_p->c_cflag |= i << IBSHIFT;
-	return 0;
-      }
-
-  __set_errno (EINVAL);
-  return -1;
-}
-libc_hidden_def (cfsetispeed)
diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h b/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
deleted file mode 100644
index d18433c6fe..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
- */
-
-/*
- * System wide defaults for terminal state.  SunOS 4 version.
- */
-#ifndef _SYS_TTYDEFAULTS_H_
-#define	_SYS_TTYDEFAULTS_H_
-
-/*
- * Defaults on "first" open.
- */
-#define	TTYDEF_IFLAG	(BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
-#define TTYDEF_OFLAG	(OPOST | ONLCR | XTABS)
-#define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
-#define TTYDEF_CFLAG	(CREAD | CS7 | PARENB | HUPCL)
-#define TTYDEF_SPEED	(B9600)
-
-/*
- * Control Character Defaults
- */
-#define CTRL(x)	(x&037)
-#define	CEOF		CTRL('d')
-#ifdef _POSIX_VDISABLE
-# define CEOL		_POSIX_VDISABLE
-#else
-# define CEOL		((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
-#endif
-#define	CERASE		0177
-#define	CINTR		CTRL('c')
-#ifdef _POSIX_VDISABLE
-# define CSTATUS	_POSIX_VDISABLE
-#else
-# define CSTATUS	((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
-#endif
-#define	CKILL		CTRL('u')
-#define	CMIN		1
-#define	CQUIT		034		/* FS, ^\ */
-#define	CSUSP		CTRL('z')
-#define	CTIME		0
-#define	CDSUSP		CTRL('y')
-#define	CSTART		CTRL('q')
-#define	CSTOP		CTRL('s')
-#define	CLNEXT		CTRL('v')
-#define	CDISCARD 	CTRL('o')
-#define	CWERASE 	CTRL('w')
-#define	CREPRINT 	CTRL('r')
-#define	CEOT		CEOF
-/* compat */
-#define	CBRK		CEOL
-#define CRPRNT		CREPRINT
-#define	CFLUSH		CDISCARD
-
-/* PROTECTED INCLUSION ENDS HERE */
-#endif /* !_SYS_TTYDEFAULTS_H_ */
-
-/*
- * #define TTYDEFCHARS to include an array of default control characters.
- */
-#ifdef TTYDEFCHARS
-cc_t	ttydefchars[NCCS] = {
-	CEOF,	CEOL,	CEOL,	CERASE, CWERASE, CKILL, CREPRINT,
-	_POSIX_VDISABLE, CINTR,	CQUIT,	CSUSP,	CDSUSP,	CSTART,	CSTOP,	CLNEXT,
-	CDISCARD, CMIN,	CTIME,  CSTATUS, _POSIX_VDISABLE
-};
-#undef TTYDEFCHARS
-#endif
diff --git a/sysdeps/unix/bsd/sun/sunos4/syscalls.list b/sysdeps/unix/bsd/sun/sunos4/syscalls.list
deleted file mode 100644
index 59992eed53..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/syscalls.list
+++ /dev/null
@@ -1,6 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-msync		-	msync		3	msync
-poll		-	poll		3	poll
-sys_mmap	mmap	mmap		5	__mmap_syscall
-sys_wait4	wait4	wait4		4	__wait4_syscall
diff --git a/sysdeps/unix/bsd/sun/sunos4/system.c b/sysdeps/unix/bsd/sun/sunos4/system.c
deleted file mode 100644
index 2c8e634bc8..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/system.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SunOS 4 does have `waitpid'.  Avoid unix/system.c, which says we don't.  */
-#include <sysdeps/posix/system.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflow.c b/sysdeps/unix/bsd/sun/sunos4/tcflow.c
deleted file mode 100644
index 6fcc606f61..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcflow.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1993, 1997 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 <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Suspend or restart transmission on FD.  */
-int
-tcflow (fd, action)
-     int fd;
-     int action;
-{
-  return __ioctl (fd, TCXONC, action);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflush.c b/sysdeps/unix/bsd/sun/sunos4/tcflush.c
deleted file mode 100644
index 9e78aadd07..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcflush.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1993, 1997 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 <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Flush pending data on FD.  */
-int
-tcflush (fd, queue_selector)
-     int fd;
-     int queue_selector;
-{
-  return __ioctl (fd, TCFLSH, queue_selector);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c b/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c
deleted file mode 100644
index db5ea8c831..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1993, 1997 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 <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/termio.h>		/* Sun header file.  */
-
-/* Send zero bits on FD.  */
-int
-tcsendbreak (fd, duration)
-     int fd;
-     int duration;
-{
-  /* According to SunOS 4.1's termios(4), you can't specify a duration.  */
-  return __ioctl (fd, TCSBRK, 0);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait.c b/sysdeps/unix/bsd/sun/sunos4/wait.c
deleted file mode 100644
index 79d54580fd..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/wait.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait3.c b/sysdeps/unix/bsd/sun/sunos4/wait3.c
deleted file mode 100644
index 0b3bdee771..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait3.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/wait3.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait4.c b/sysdeps/unix/bsd/sun/sunos4/wait4.c
deleted file mode 100644
index 097c15e7d9..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait4.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This implements wait4 with the 4.4 BSD semantics (also those documented in
-   SunOS 4.1) on top of SunOS's wait4 system call, which has semantics
-   different from those documented.  Go Sun!
-   Copyright (C) 1991,1992,1993,1995,1997,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-extern pid_t __wait4_syscall (pid_t pid, __WAIT_STATUS_DEFN stat_loc,
-			      int options, struct rusage *usage);
-
-pid_t
-__wait4 (pid, stat_loc, options, usage)
-     pid_t pid;
-     __WAIT_STATUS_DEFN stat_loc;
-     int options;
-     struct rusage *usage;
-{
-  switch (pid)
-    {
-    case WAIT_ANY:
-      pid = 0;
-      break;
-
-    case WAIT_MYPGRP:
-      pid = - getpgrp ();
-      break;
-    }
-
-  return __wait4_syscall (pid, stat_loc, options, usage);
-}
-
-weak_alias (__wait4, wait4)
diff --git a/sysdeps/unix/bsd/sun/sunos4/waitpid.c b/sysdeps/unix/bsd/sun/sunos4/waitpid.c
deleted file mode 100644
index 8378982ac7..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/waitpid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/waitpid.c>
diff --git a/sysdeps/unix/bsd/sun/syscalls.list b/sysdeps/unix/bsd/sun/syscalls.list
deleted file mode 100644
index 079aa9157a..0000000000
--- a/sysdeps/unix/bsd/sun/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-sigvec		-	sigvec		3	__raw_sigvec
diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c
index 91d77e926a..963d156e2c 100644
--- a/sysdeps/unix/bsd/ulimit.c
+++ b/sysdeps/unix/bsd/ulimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 96, 97, 98, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-1998,2001,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,6 @@
 #include <unistd.h>
 #include <sys/resource.h>
 
-#ifndef	 HAVE_GNU_LD
-#define	 _etext	etext
-#endif
 
 extern int _etext;
 
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 7a3db29744..f698f0151b 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* clock_gettime -- Get the current time from a POSIX clockid_t.  Unix version.
+   Copyright (C) 1999-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
@@ -35,89 +36,99 @@ static hp_timing_t freq;
 extern int __pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq,
 				    struct timespec *tp)
      __attribute__ ((__weak__));
+
+static int
+hp_timing_gettime (clockid_t clock_id, struct timespec *tp)
+{
+  hp_timing_t tsc;
+
+  if (__builtin_expect (freq == 0, 0))
+    {
+      /* This can only happen if we haven't initialized the `freq'
+	 variable yet.  Do this now. We don't have to protect this
+	 code against multiple execution since all of them should
+	 lead to the same result.  */
+      freq = __get_clockfreq ();
+      if (__builtin_expect (freq == 0, 0))
+	/* Something went wrong.  */
+	return -1;
+    }
+
+  if (clock_id != CLOCK_PROCESS_CPUTIME_ID
+      && __pthread_clock_gettime != NULL)
+    return __pthread_clock_gettime (clock_id, freq, tp);
+
+  /* Get the current counter.  */
+  HP_TIMING_NOW (tsc);
+
+  /* Compute the offset since the start time of the process.  */
+  tsc -= GL(dl_cpuclock_offset);
+
+  /* Compute the seconds.  */
+  tp->tv_sec = tsc / freq;
+
+  /* And the nanoseconds.  This computation should be stable until
+     we get machines with about 16GHz frequency.  */
+  tp->tv_nsec = ((tsc % freq) * UINT64_C (1000000000)) / freq;
+
+  return 0;
+}
 #endif
 
 
+static inline int
+realtime_gettime (struct timespec *tp)
+{
+  struct timeval tv;
+  int retval = gettimeofday (&tv, NULL);
+  if (retval == 0)
+    /* Convert into `timespec'.  */
+    TIMEVAL_TO_TIMESPEC (&tv, tp);
+  return retval;
+}
+
+
 /* Get current value of CLOCK and store it in TP.  */
 int
 clock_gettime (clockid_t clock_id, struct timespec *tp)
 {
   int retval = -1;
+  struct timeval tv;
 
   switch (clock_id)
     {
-#define HANDLE_REALTIME \
-      do {								      \
-        struct timeval tv;						      \
-	retval = gettimeofday (&tv, NULL);				      \
-	if (retval == 0)						      \
-	  /* Convert into `timespec'.  */				      \
-	  TIMEVAL_TO_TIMESPEC (&tv, tp);				      \
-      } while (0)
-
 #ifdef SYSDEP_GETTIME
       SYSDEP_GETTIME;
 #endif
 
 #ifndef HANDLED_REALTIME
     case CLOCK_REALTIME:
-      HANDLE_REALTIME;
+      retval = gettimeofday (&tv, NULL);
+      if (retval == 0)
+	TIMEVAL_TO_TIMESPEC (&tv, tp);
       break;
 #endif
 
     default:
+#ifdef SYSDEP_GETTIME_CPU
+      SYSDEP_GETTIME_CPU;
+#endif
 #if HP_TIMING_AVAIL
       if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
-	  != CLOCK_THREAD_CPUTIME_ID)
+	  == CLOCK_THREAD_CPUTIME_ID)
+	retval = hp_timing_gettime (clock_id, tp);
+      else
 #endif
-	{
-	  __set_errno (EINVAL);
-	  break;
-	}
+	__set_errno (EINVAL);
+      break;
 
-#if HP_TIMING_AVAIL
-      /* FALLTHROUGH.  */
+#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
     case CLOCK_PROCESS_CPUTIME_ID:
-      {
-	hp_timing_t tsc;
-
-	if (__builtin_expect (freq == 0, 0))
-	  {
-	    /* This can only happen if we haven't initialized the `freq'
-	       variable yet.  Do this now. We don't have to protect this
-	       code against multiple execution since all of them should
-	       lead to the same result.  */
-	    freq = __get_clockfreq ();
-	    if (__builtin_expect (freq == 0, 0))
-	      /* Something went wrong.  */
-	      break;
-	  }
-
-	if (clock_id != CLOCK_PROCESS_CPUTIME_ID
-	    && __pthread_clock_gettime != NULL)
-	  {
-	    retval = __pthread_clock_gettime (clock_id, freq, tp);
-	    break;
-	  }
-
-	/* Get the current counter.  */
-	HP_TIMING_NOW (tsc);
-
-	/* Compute the offset since the start time of the process.  */
-	tsc -= GL(dl_cpuclock_offset);
-
-	/* Compute the seconds.  */
-	tp->tv_sec = tsc / freq;
-
-	/* And the nanoseconds.  This computation should be stable until
-	   we get machines with about 16GHz frequency.  */
-	tp->tv_nsec = ((tsc % freq) * UINT64_C (1000000000)) / freq;
-
-	retval = 0;
-      }
-    break;
+      retval = hp_timing_gettime (clock_id, tp);
+      break;
 #endif
     }
 
   return retval;
 }
+librt_hidden_def (clock_gettime)
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index 0194999b36..a93be6349b 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999-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
@@ -36,6 +36,43 @@ extern void __pthread_clock_settime (clockid_t clock_id, hp_timing_t offset)
 #endif
 
 
+#if HP_TIMING_AVAIL
+static int
+hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
+{
+  hp_timing_t tsc;
+  hp_timing_t usertime;
+
+  /* First thing is to get the current time.  */
+  HP_TIMING_NOW (tsc);
+
+  if (__builtin_expect (freq == 0, 0))
+    {
+      /* This can only happen if we haven't initialized the `freq'
+	 variable yet.  Do this now. We don't have to protect this
+	 code against multiple execution since all of them should lead
+	 to the same result.  */
+      freq = __get_clockfreq ();
+      if (__builtin_expect (freq == 0, 0))
+	/* Something went wrong.  */
+	return -1;
+    }
+
+  /* Convert the user-provided time into CPU ticks.  */
+  usertime = tp->tv_sec * freq + (tp->tv_nsec * freq) / 1000000000ull;
+
+  /* Determine the offset and use it as the new base value.  */
+  if (clock_id == CLOCK_PROCESS_CPUTIME_ID
+      || __pthread_clock_settime == NULL)
+    GL(dl_cpuclock_offset) = tsc - usertime;
+  else
+    __pthread_clock_settime (clock_id, tsc - usertime);
+
+  return 0;
+}
+#endif
+
+
 /* Set CLOCK to value TP.  */
 int
 clock_settime (clockid_t clock_id, const struct timespec *tp)
@@ -70,55 +107,22 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
 #endif
 
     default:
-#if HP_TIMING_AVAIL
-      if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
-	  != CLOCK_THREAD_CPUTIME_ID)
+#ifdef SYSDEP_SETTIME_CPU
+      SYSDEP_SETTIME_CPU;
 #endif
+#ifndef HANDLED_CPUTIME
+# if HP_TIMING_AVAIL
+      if (CPUCLOCK_WHICH (clock_id) == CLOCK_PROCESS_CPUTIME_ID
+	  || CPUCLOCK_WHICH (clock_id) == CLOCK_THREAD_CPUTIME_ID)
+	retval = hp_timing_settime (clock_id, tp);
+      else
+# endif
 	{
 	  __set_errno (EINVAL);
 	  retval = -1;
-	  break;
 	}
-
-#if HP_TIMING_AVAIL
-      /* FALLTHROUGH.  */
-    case CLOCK_PROCESS_CPUTIME_ID:
-      {
-	hp_timing_t tsc;
-	hp_timing_t usertime;
-
-	/* First thing is to get the current time.  */
-	HP_TIMING_NOW (tsc);
-
-	if (__builtin_expect (freq == 0, 0))
-	  {
-	    /* This can only happen if we haven't initialized the `freq'
-	       variable yet.  Do this now. We don't have to protect this
-	       code against multiple execution since all of them should
-	       lead to the same result.  */
-	    freq = __get_clockfreq ();
-	    if (__builtin_expect (freq == 0, 0))
-	      {
-		/* Something went wrong.  */
-		retval = -1;
-		break;
-	      }
-	  }
-
-	/* Convert the user-provided time into CPU ticks.  */
-	usertime = tp->tv_sec * freq + (tp->tv_nsec * freq) / 1000000000ull;
-
-	/* Determine the offset and use it as the new base value.  */
-	if (clock_id == CLOCK_PROCESS_CPUTIME_ID
-	    || __pthread_clock_settime == NULL)
-	  GL(dl_cpuclock_offset) = tsc - usertime;
-	else
-	  __pthread_clock_settime (clock_id, tsc - usertime);
-
-	retval = 0;
-      }
-      break;
 #endif
+      break;
     }
 
   return retval;
diff --git a/sysdeps/unix/common/Dist b/sysdeps/unix/common/Dist
deleted file mode 100644
index 0c47cabcfa..0000000000
--- a/sysdeps/unix/common/Dist
+++ /dev/null
@@ -1 +0,0 @@
-glue-ctype.c
diff --git a/sysdeps/unix/common/Makefile b/sysdeps/unix/common/Makefile
deleted file mode 100644
index ea3a8d58f2..0000000000
--- a/sysdeps/unix/common/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 1991, 1992, 1993, 1994, 1997 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 inhibit-glue
-ifeq ($(subdir),ctype)
-
-sysdep_routines := $(sysdep_routines) ctype-glue
-
-generated := $(generated) glue-ctype ctype-glue.c
-
-$(objpfx)ctype-glue.c: $(objpfx)glue-ctype
-	@rm -f $@
-	$(dir $<)$(notdir $<) > $@-t
-	mv $@-t $@
-
-$(objpfx)glue-ctype: $(sysdep_dir)/unix/common/glue-ctype.c
-	$(native-compile)
-
-endif
-endif
diff --git a/sysdeps/unix/common/configure b/sysdeps/unix/common/configure
deleted file mode 100755
index 7bbc9cb2e5..0000000000
--- a/sysdeps/unix/common/configure
+++ /dev/null
@@ -1,195 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
-
-if test -z "$inhibit_glue"; then
-
-# Find out what this system calls `sys_siglist'.
-
-echo "$as_me:$LINENO: checking for sys_siglist" >&5
-echo $ECHO_N "checking for sys_siglist... $ECHO_C" >&6
-if test "${ac_cv_check_symbol_sys_siglist+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-extern char *sys_siglist[]; puts(*sys_siglist);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  	    ac_cv_check_symbol_sys_siglist=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_check_symbol_sys_siglist=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-if test "$ac_cv_check_symbol_sys_siglist" = yes; then
-  ac_tr_symbol=`echo sys_siglist | tr '[a-z]' '[A-Z]'`
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_${ac_tr_symbol} 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_check_symbol_sys_siglist" >&5
-echo "${ECHO_T}$ac_cv_check_symbol_sys_siglist" >&6
-echo "$as_me:$LINENO: checking for _sys_siglist" >&5
-echo $ECHO_N "checking for _sys_siglist... $ECHO_C" >&6
-if test "${ac_cv_check_symbol__sys_siglist+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-extern char *_sys_siglist[]; puts(*_sys_siglist);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  	    ac_cv_check_symbol__sys_siglist=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_check_symbol__sys_siglist=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-if test "$ac_cv_check_symbol__sys_siglist" = yes; then
-  ac_tr_symbol=`echo _sys_siglist | tr '[a-z]' '[A-Z]'`
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_${ac_tr_symbol} 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_check_symbol__sys_siglist" >&5
-echo "${ECHO_T}$ac_cv_check_symbol__sys_siglist" >&6
-
-# Find out the name of the table the system's <ctype.h> uses for character
-# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
-echo "$as_me:$LINENO: checking ctype array name for glue" >&5
-echo $ECHO_N "checking ctype array name for glue... $ECHO_C" >&6
-if test "${libc_cv_ctype_glue+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-int
-main ()
-{
-$ctype[13];
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  libc_cv_ctype_glue="$ctype"; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-done
-fi
-
-echo "$as_me:$LINENO: result: $libc_cv_ctype_glue" >&5
-echo "${ECHO_T}$libc_cv_ctype_glue" >&6
-cat >>confdefs.h <<_ACEOF
-#define HAVE_`echo $libc_cv_ctype_glue | tr 'a-z' 'A-Z'` 1
-_ACEOF
-
-
-fi
diff --git a/sysdeps/unix/common/configure.in b/sysdeps/unix/common/configure.in
deleted file mode 100644
index 9597d68f3d..0000000000
--- a/sysdeps/unix/common/configure.in
+++ /dev/null
@@ -1,21 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-
-if test -z "$inhibit_glue"; then
-
-# Find out what this system calls `sys_siglist'.
-AC_CHECK_SYMBOL(sys_siglist)
-AC_CHECK_SYMBOL(_sys_siglist)
-
-# Find out the name of the table the system's <ctype.h> uses for character
-# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
-AC_MSG_CHECKING(ctype array name for glue)
-AC_CACHE_VAL(libc_cv_ctype_glue, [dnl
-for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
-AC_TRY_LINK([#include <ctype.h>],
-	    [$ctype[13];],
-	    [libc_cv_ctype_glue="$ctype"; break])
-done])
-AC_MSG_RESULT($libc_cv_ctype_glue)
-AC_DEFINE_UNQUOTED(HAVE_`echo $libc_cv_ctype_glue | tr '[a-z]' '[A-Z]'`)
-
-fi
diff --git a/sysdeps/unix/common/glue-ctype.c b/sysdeps/unix/common/glue-ctype.c
deleted file mode 100644
index 2e065a77c9..0000000000
--- a/sysdeps/unix/common/glue-ctype.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 1992, 1993, 1994, 1997 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.  */
-
-/* Different systems have different names for the array.
-   This order is important for some systems.  */
-
-#if !defined(TABLE) && defined(HAVE__LOCP)
-/* OSF/1 has the name _ctype defined as a macro, which points down into
-   the _locp structure.  Jesus.  We'll hope this works.  We need to
-   check for LOCP first, since there is no symbol actually named _ctype
-   in their library.  */
-#include <sys/types.h> /* for wchar_t used by localdef.h */
-#include <sys/localedef.h>
-extern loc_t *_locp;
-#define TABLE		(_locp->lc_chrtbl)->lc_ctype
-#undef _ctype
-#define TABLE_NAME	_ctype
-#endif
-#ifdef	HAVE__CTYPE__
-#define	TABLE	_ctype__
-#endif
-#if !defined(TABLE) && defined(HAVE__CTYPE)
-#define TABLE   _ctype
-#endif
-#if !defined(TABLE) && defined(HAVE__CTYPE_)
-#define	TABLE	_ctype_
-#endif
-#if !defined(TABLE) && defined(HAVE___CTYPE_)
-#define	TABLE	__ctype_
-#endif
-#if !defined(TABLE) && defined(HAVE___CTYPE)
-#define	TABLE	__ctype
-#endif
-
-#if defined (__STDC__) && __STDC__
-#define	STRINGIFY(arg)	#arg
-#else
-#define	STRINGIFY(arg)	"arg"
-#endif
-
-#define EVALLED_STRINGIFY(x)	STRINGIFY (x)
-
-int
-main ()
-{
-#ifdef TABLE
-
-  int i;
-
-#ifndef HAVE__LOCP
-  /* This won't work for the define to look into _locp.  */
-  extern unsigned char TABLE[];
-#endif
-
-#ifdef TABLE_NAME
-  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE_NAME));
-#else
-  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE));
-#endif
-
-  for (i = -1; i < 256; ++i)
-    printf ("    %d,\n", (int) ((TABLE+1)[i]));
-
-  puts ("  };");
-
-#else
-
-  puts ("/* I don't know what the ctype table is called on this system.");
-  puts ("   If there is a table, and you want the ctype glue to work,");
-  puts ("   edit configure.in and glue-ctype.c in sysdeps/unix/common/");
-  puts ("   to check for the right name.  */");
-
-#endif
-
-  exit (0);
-}
diff --git a/sysdeps/unix/configure b/sysdeps/unix/configure
deleted file mode 100755
index b910353cd9..0000000000
--- a/sysdeps/unix/configure
+++ /dev/null
@@ -1,109 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
- # Local configure fragment for sysdeps/unix.
-
-if test -z "$inhibit_glue"; then
-# For make_errlist.c, used in make_errlist.
-
-
-for ac_func in strerror
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-fi
diff --git a/sysdeps/unix/configure.in b/sysdeps/unix/configure.in
deleted file mode 100644
index de7feccb25..0000000000
--- a/sysdeps/unix/configure.in
+++ /dev/null
@@ -1,7 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-# Local configure fragment for sysdeps/unix.
-
-if test -z "$inhibit_glue"; then
-# For make_errlist.c, used in make_errlist.
-AC_CHECK_FUNCS(strerror)
-fi
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c b/sysdeps/unix/fdopendir.c
index 934c4c8cf8..565ce1ed72 100644
--- a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c
+++ b/sysdeps/unix/fdopendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -16,35 +16,37 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <dirent.h>
 #include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Set the state of FD to *TERMIOS_P.  */
-int
-tcsetattr (fd, optional_actions, termios_p)
-     int fd;
-     int optional_actions;
-     const struct termios *termios_p;
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <not-cancel.h>
+
+
+DIR *
+__fdopendir (int fd)
 {
-  unsigned long cmd;
+  struct stat64 statbuf;
+
+  if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+    return NULL;
+  if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+    {
+      __set_errno (ENOTDIR);
+      return NULL;
+    }
 
-  switch (optional_actions)
+  /* Make sure the descriptor allows for reading.  */
+  int flags = __fcntl (fd, F_GETFL);
+  if (__builtin_expect (flags == -1, 0))
+    return NULL;
+  if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
     {
-    case TCSANOW:
-      cmd = TCSETS;
-      break;
-    case TCSADRAIN:
-      cmd = TCSETSW;
-      break;
-    case TCSAFLUSH:
-      cmd = TCSETSF;
-      break;
-    default:
       __set_errno (EINVAL);
-      return -1;
+      return NULL;
     }
 
-  return __ioctl (fd, cmd, termios_p);
+  return __alloc_dir (fd, false, &statbuf);
 }
-libc_hidden_def (tcsetattr)
+weak_alias (__fdopendir, fdopendir)
diff --git a/sysdeps/unix/sysv/linux/hppa/umount.c b/sysdeps/unix/get_child_max.c
index e7c5690890..c59e4d8953 100644
--- a/sysdeps/unix/sysv/linux/hppa/umount.c
+++ b/sysdeps/unix/get_child_max.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Get POSIX {CHILD_MAX} run-time limit value.  Unix version.
+   Copyright (C) 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,15 +17,21 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* Since we don't have an oldumount system call, do what the kernel
-   does down here.  */
-
-extern long int __umount2 (const char *name, int flags);
+#include <limits.h>
+#include <sys/sysinfo.h>
+#include <sys/resource.h>
 
+#ifndef CHILD_MAX
 long int
-__umount (const char *name)
+__get_child_max (void)
 {
-  return __umount2 (name, 0);
-}
+# ifdef RLIMIT_NPROC
+  struct rlimit limit;
+  if (__getrlimit (RLIMIT_NPROC, &limit) == 0
+      && limit.rlim_cur != RLIM_INFINITY)
+    return limit.rlim_cur;
+# endif
 
-weak_alias (__umount, umount);
+  return -1;
+}
+#endif
diff --git a/sysdeps/unix/i386/brk.S b/sysdeps/unix/i386/brk.S
index a7604d7e7a..d8dd96b4ce 100644
--- a/sysdeps/unix/i386/brk.S
+++ b/sysdeps/unix/i386/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,95,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,97,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
@@ -25,11 +25,7 @@
 .data
 .globl C_SYMBOL_NAME(__curbrk)
 C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
 	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
 
 .text
 SYSCALL__ (brk, 1)
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index 6056cbeef2..3bc872add8 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000, 2002, 2004
+/* Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2000,2002,2004,2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -47,7 +47,12 @@ notb:
 #endif
 #ifndef	PIC
 # if USE___THREAD
+#  ifndef NO_TLS_DIRECT_SEG_REFS
 	movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
+#  else
+	movl %gs:0, %ecx
+	movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
+#  endif
 # elif !defined _LIBC_REENTRANT
 	movl %eax, C_SYMBOL_NAME(errno)
 # else
@@ -66,7 +71,12 @@ notb:
 
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
+#  ifndef NO_TLS_DIRECT_SEG_REFS
+	addl %gs:0, %ecx
+	movl %eax, (%ecx)
+#  else
 	movl %eax, %gs:0(%ecx)
+#  endif
 # elif RTLD_PRIVATE_ERRNO
 	movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
 
diff --git a/sysdeps/unix/make_errlist.c b/sysdeps/unix/make_errlist.c
deleted file mode 100644
index 8b2b972a8a..0000000000
--- a/sysdeps/unix/make_errlist.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C) 1991,1992,1995,1997,1999,2001 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 <stdio.h>
-#include <time.h>
-
-/* Make a definition for sys_errlist.  */
-
-extern int sys_nerr;
-#ifndef HAVE_STRERROR
-extern const char *const sys_errlist[];
-#endif
-
-int
-main (void)
-{
-  register int i;
-  struct tm timenow;
-  time_t now;
-  int year;
-
-  now = time (NULL);
-  timenow = *localtime (&now);
-
-  year = timenow.tm_year + 1900;
-
-  printf ("/* Copyright (C) %d Free Software Foundation, Inc.\n\
-   This file is part of the GNU C Library.\n\
-\n\
-   The GNU C Library is free software; you can redistribute it and/or\n\
-   modify it under the terms of the GNU Lesser General Public\n\
-   License as published by the Free Software Foundation; either\n\
-   version 2.1 of the License, or (at your option) any later version.\n\
-\n\
-   The GNU C Library is distributed in the hope that it will be useful,\n\
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\
-   Lesser General Public License for more details.\n\
-\n\
-   You should have received a copy of the GNU Lesser General Public\n\
-   License along with the GNU C Library; if not, write to the Free\n\
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\n\
-   02111-1307 USA.  */\n", year);
-
-  puts ("#include <stddef.h>\n");
-  puts ("#include <libintl.h>\n");
-  puts ("\n/* This is a list of all known `errno' codes.  */\n");
-
-  printf ("\nconst int _sys_nerr = %d;\n\n", sys_nerr);
-  puts ("const char *const _sys_errlist[] =\n  {");
-
-  for (i = 0; i < sys_nerr; ++i)
-    printf ("    N_(\"%s\"),\n",
-#ifdef HAVE_STRERROR
-	  strerror (i)
-#else /* ! HAVE_STRERROR */
-	  sys_errlist[i]
-#endif /* HAVE_STRERROR */
-	  );
-
-  puts ("    NULL\n  };\n");
-
-  puts ("weak_alias (_sys_errlist, sys_errlist)");
-  puts ("weak_alias (_sys_nerr, sys_nerr)");
-
-  exit (0);
-}
diff --git a/sysdeps/unix/mips/brk.S b/sysdeps/unix/mips/brk.S
deleted file mode 100644
index a35b8b9113..0000000000
--- a/sysdeps/unix/mips/brk.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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 <sys/asm.h>
-
-#ifndef SYS_brk
-#define SYS_brk 17
-#endif
-
-#ifndef       HAVE_GNU_LD
-#define _end           end
-#endif
-
-	.data
-ENTRY(__curbrk)
-	.word 0
-	.end __curbrk
-
-	.text
-SYSCALL__(brk, 1)
-	.set	reorder
-	/* Handle the query case.  */
-	bnez a0, 1f
-	move a0, v0
-1:	/* Update __curbrk and exit cleanly.  */
-	PTR_S a0, __curbrk
-	move v0, zero
-	jr ra
-PSEUDO_END(__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/mips/dl-brk.S b/sysdeps/unix/mips/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/mips/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/mips/fork.S b/sysdeps/unix/mips/fork.S
deleted file mode 100644
index a7848acb6b..0000000000
--- a/sysdeps/unix/mips/fork.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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>
-
-SYSCALL__ (fork, 0)
-	beq v1, zero, parent /* Branch if parent.  */
-	nop
-	/* We are the child.  Return zero.  */
-	move v0, zero
-parent:
-	ret
-PSEUDO_END(__fork)
-
-libc_hidden_def (__fork)
-weak_alias (__fork, fork)
diff --git a/sysdeps/unix/mips/mips32/sysdep.h b/sysdeps/unix/mips/mips32/sysdep.h
deleted file mode 100644
index 0b5d1186bb..0000000000
--- a/sysdeps/unix/mips/mips32/sysdep.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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 <sysdeps/unix/mips/sysdep.h>
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99: la t9,__syscall_error;						      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  .cpload t9;								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  nop;									      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
diff --git a/sysdeps/unix/mips/mips64/n32/sysdep.h b/sysdeps/unix/mips/mips64/n32/sysdep.h
deleted file mode 100644
index ec93fadc04..0000000000
--- a/sysdeps/unix/mips/mips64/n32/sysdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
-   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 <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99:;									      \
-  .set noat;								      \
-  .cpsetup t9, $1, name;						      \
-  .set at;								      \
-  la t9,__syscall_error;						      \
-  .cpreturn;								      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/mips64/n64/sysdep.h b/sysdeps/unix/mips/mips64/n64/sysdep.h
deleted file mode 100644
index 502b66797b..0000000000
--- a/sysdeps/unix/mips/mips64/n64/sysdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
-   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 <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99:;									      \
-  .set noat;								      \
-  .cpsetup t9, $1, name;						      \
-  .set at;								      \
-  dla t9,__syscall_error;						      \
-  .cpreturn;								      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/pipe.S b/sysdeps/unix/mips/pipe.S
deleted file mode 100644
index ee7b76d635..0000000000
--- a/sysdeps/unix/mips/pipe.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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>
-
-SYSCALL__ (pipe, 1)
-	/* Plop in the two descriptors.  */
-	sw v0, 0(a0)
-	sw v1, 4(a0)
-
-	/* Go out with a clean status.  */
-	move v0, zero
-	j ra
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/mips/rt-sysdep.S b/sysdeps/unix/mips/rt-sysdep.S
deleted file mode 100644
index f966bf1e59..0000000000
--- a/sysdeps/unix/mips/rt-sysdep.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdep.S>
diff --git a/sysdeps/unix/mips/sigreturn.S b/sysdeps/unix/mips/sigreturn.S
deleted file mode 100644
index 2cb3adb6de..0000000000
--- a/sysdeps/unix/mips/sigreturn.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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>
-
-#ifndef SYS_sigreturn
-#define SYS_sigreturn 103
-#endif
-
-ENTRY(__sigreturn)
-	li v0, SYS_sigreturn
-	syscall
-	.end __sigreturn
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S
deleted file mode 100644
index 8c172db190..0000000000
--- a/sysdeps/unix/mips/sysdep.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2002, 2003 
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-#include <sys/asm.h>
-
-#ifdef _LIBC_REENTRANT
-
-LOCALSZ= 3
-FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
-RAOFF= FRAMESZ-(1*SZREG)
-GPOFF= FRAMESZ-(2*SZREG)
-V0OFF= FRAMESZ-(3*SZREG)
-	
-ENTRY(__syscall_error)
-#ifdef __PIC__
-	.set noat
-	SETUP_GPX (AT)
-	.set at
-#endif
-	PTR_SUBU sp, FRAMESZ
-	.set noat
-	SETUP_GPX64(GPOFF,AT)
-	.set at
-#ifdef __PIC__
-	SAVE_GP(GPOFF)
-#endif
-	REG_S	v0, V0OFF(sp)
-	REG_S	ra, RAOFF(sp)
-
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	bne	v0, EWOULDBLOCK_sys, L(skip)
-	nop
-	li	v0, EAGAIN
-L(skip):
-#endif
-	/* Find our per-thread errno address  */
-	jal	__errno_location
-
-	/* Store the error value.  */
-	REG_L	t0, V0OFF(sp)
-	sw	t0, 0(v0)
-
-	/* And just kick back a -1.  */
-	REG_L	ra, RAOFF(sp)
-	RESTORE_GP64
-	PTR_ADDU sp, FRAMESZ
-	li	v0, -1
-	j	ra
-	END(__syscall_error)
-
-#else /* _LIBC_REENTRANT */
-
-
-ENTRY(__syscall_error)
-#ifdef __PIC__
-	SETUP_GPX (AT)
-#endif
-	SETUP_GPX64 (t9, AT)
-	
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	bne v0, EWOULDBLOCK_sys, L(skip)
-	li v0, EAGAIN
-L(skip):
-#endif
-	/* Store it in errno... */
-	sw v0, errno
-
-	/* And just kick back a -1.  */
-	li v0, -1
-
-	RESTORE_GP64
-	j ra
-	END(__syscall_error)
-#endif  /* _LIBC_REENTRANT  */
diff --git a/sysdeps/unix/mips/sysdep.h b/sysdeps/unix/mips/sysdep.h
deleted file mode 100644
index 714830147d..0000000000
--- a/sysdeps/unix/mips/sysdep.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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 <sgidefs.h>
-#include <sysdeps/unix/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-#include <regdef.h>
-
-#define ENTRY(name) \
-  .globl name;								      \
-  .align 2;								      \
-  .ent name,0;								      \
-  name##:
-
-#undef END
-#define	END(function)                                   \
-		.end	function;		        \
-		.size	function,.-function
-
-#define ret	j ra ; nop
-
-#undef PSEUDO_END
-#define PSEUDO_END(sym) .end sym; .size sym,.-sym
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)	\
-  .align 2;						\
-  ENTRY(name)						\
-  .set noreorder;					\
-  li v0, SYS_ify(syscall_name);				\
-  syscall
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym
-
-#define ret_NOERRNO ret
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)	\
-  .align 2;						\
-  ENTRY(name)						\
-  .set noreorder;					\
-  li v0, SYS_ify(syscall_name);				\
-  syscall
-
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
-
-#define ret_ERRVAL ret
-
-#define r0	v0
-#define r1	v1
-/* The mips move insn is d,s.  */
-#define MOVE(x,y)	move y , x
-
-#if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-#else
-# define L(label) .L ## label
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/wait.S b/sysdeps/unix/mips/wait.S
deleted file mode 100644
index de0f6ebfae..0000000000
--- a/sysdeps/unix/mips/wait.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1992, 1994, 1995, 1997, 2002, 2003
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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>
-
-.set noreorder
-
-ENTRY(__wait)
-	/* Prep it for wait.  */
-	move a1, zero
-	move a2, zero
-
-	li v0, SYS_wait
-	syscall
-	beqz a3, L(noerror)
-	nop
-	j __syscall_error
-	nop
-
-L(noerror):
-	/* If the arg is not NULL, store v1 there.  */
-	beqz a0, L(noarg)
-	nop
-	sw v1, 0(a0)
-	nop
-L(noarg):
-	ret
-	.end __wait
-
-weak_alias (__wait, wait)
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c b/sysdeps/unix/mkfifoat.c
index ab74fddf24..5c4da2a982 100644
--- a/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c
+++ b/sysdeps/unix/mkfifoat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,18 +16,17 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-#include <sys/ioctl.h>
+#include <sys/stat.h>
 
-/* Put the state of FD into *TERMIOS_P.  */
+
+/* Create a new FIFO with permission bits MODE.  But interpret
+   relative PATH names relative to the directory associated with FD.  */
 int
-__tcgetattr (fd, termios_p)
+mkfifoat (fd, file, mode)
      int fd;
-     struct termios *termios_p;
+     const char *file;
+     mode_t mode;
 {
-  return __ioctl (fd, TCGETS, termios_p);
+  dev_t dev = 0;
+  return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev);
 }
-
-weak_alias (__tcgetattr, tcgetattr)
diff --git a/sysdeps/unix/nice.c b/sysdeps/unix/nice.c
index 700305c0e9..6e75b0327b 100644
--- a/sysdeps/unix/nice.c
+++ b/sysdeps/unix/nice.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 2001, 2002, 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
@@ -41,10 +42,17 @@ nice (int incr)
 	__set_errno (save);
     }
 
-  result = setpriority (PRIO_PROCESS, 0, prio + incr);
-  if (result != -1)
-    return getpriority (PRIO_PROCESS, 0);
-  else
-    return -1;
-
+  prio += incr;
+  if (prio < PRIO_MIN)
+    prio = PRIO_MIN;
+  else if (prio >= PRIO_MAX)
+    prio = PRIO_MAX - 1;
+  result = setpriority (PRIO_PROCESS, 0, prio);
+  if (result == -1)
+    {
+      if (errno == EACCES)
+	errno = EPERM;
+      return -1;
+    }
+  return getpriority (PRIO_PROCESS, 0);
 }
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 5e03ed9b20..6aa738fb69 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1996,98,2000-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1996,98,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
@@ -78,11 +78,7 @@ tryopen_o_directory (void)
 DIR *
 __opendir (const char *name)
 {
-  DIR *dirp;
   struct stat64 statbuf;
-  int fd;
-  size_t allocation;
-  int save_errno;
 
   if (__builtin_expect (name[0], '\1') == '\0')
     {
@@ -113,7 +109,7 @@ __opendir (const char *name)
 	 }
     }
 
-  fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
+  int fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
   if (__builtin_expect (fd, 0) < 0)
     return NULL;
 
@@ -129,18 +125,30 @@ __opendir (const char *name)
     {
       if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
 	{
-	  save_errno = ENOTDIR;
-	  goto lose;
+	  __set_errno (ENOTDIR);
+	lose:
+	  close_not_cancel_no_status (fd);
+	  return NULL;
 	}
     }
 
+  return __alloc_dir (fd, true, &statbuf);
+}
+weak_alias (__opendir, opendir)
+
+
+DIR *
+internal_function
+__alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
+{
   if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
     goto lose;
 
+  size_t allocation;
 #ifdef _STATBUF_ST_BLKSIZE
-  if (__builtin_expect ((size_t) statbuf.st_blksize >= sizeof (struct dirent64),
+  if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
 			1))
-    allocation = statbuf.st_blksize;
+    allocation = statp->st_blksize;
   else
 #endif
     allocation = (BUFSIZ < sizeof (struct dirent64)
@@ -148,13 +156,16 @@ __opendir (const char *name)
 
   const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
 
-  dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
+  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
   if (dirp == NULL)
   lose:
     {
-      save_errno = errno;
-      close_not_cancel_no_status (fd);
-      __set_errno (save_errno);
+      if (close_fd)
+	{
+	  int save_errno = errno;
+	  close_not_cancel_no_status (fd);
+	  __set_errno (save_errno);
+	}
       return NULL;
     }
   memset (dirp, '\0', sizeof (DIR));
@@ -166,4 +177,3 @@ __opendir (const char *name)
 
   return dirp;
 }
-weak_alias (__opendir, opendir)
diff --git a/sysdeps/unix/rewinddir.c b/sysdeps/unix/rewinddir.c
index 9f3724fc6a..051e93595e 100644
--- a/sysdeps/unix/rewinddir.c
+++ b/sysdeps/unix/rewinddir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995-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
@@ -30,6 +30,7 @@ rewinddir (dirp)
 {
   __libc_lock_lock (dirp->lock);
   (void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
+  dirp->filepos = 0;
   dirp->offset = 0;
   dirp->size = 0;
   __libc_lock_unlock (dirp->lock);
diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S
index 074b74333c..802d51f3be 100644
--- a/sysdeps/unix/sh/sysdep.S
+++ b/sysdeps/unix/sh/sysdep.S
@@ -1,4 +1,4 @@
-/* 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
@@ -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
@@ -98,5 +108,3 @@ skip:
 #endif
 #endif
 END(__syscall_error)
-
-weak_alias (__syscall_error, syscall_error)
diff --git a/sysdeps/unix/sockatmark.c b/sysdeps/unix/sockatmark.c
index 306ab36ee1..a2476415ac 100644
--- a/sysdeps/unix/sockatmark.c
+++ b/sysdeps/unix/sockatmark.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 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,5 +24,7 @@ int
 sockatmark (fd)
      int fd;
 {
-  return __ioctl (fd, SIOCATMARK);
+  int answ;
+
+  return __ioctl (fd, SIOCATMARK, &answ) == -1 ? -1 : answ;
 }
diff --git a/sysdeps/unix/sparc/brk.S b/sysdeps/unix/sparc/brk.S
index 2a16463b0f..29255fc68e 100644
--- a/sysdeps/unix/sparc/brk.S
+++ b/sysdeps/unix/sparc/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 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
@@ -29,11 +29,7 @@
 .data
 .global C_SYMBOL_NAME(__curbrk)
 C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
 	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
 
 .text
 ENTRY (__brk)
diff --git a/sysdeps/unix/sysv/Dist b/sysdeps/unix/sysv/Dist
deleted file mode 100644
index 6ad8e0f653..0000000000
--- a/sysdeps/unix/sysv/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-direct.h
-sysv_termio.h
diff --git a/sysdeps/unix/sysv/i386/signal.S b/sysdeps/unix/sysv/i386/signal.S
deleted file mode 100644
index af51bc5182..0000000000
--- a/sysdeps/unix/sysv/i386/signal.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992, 1997 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>
-
-/* This is just a standard system call, except we need to load %edx
-   with the address of the `__sigreturn' function.  */
-
-	.globl syscall_error
-	.globl C_SYMBOL_NAME(__sigreturn)
-ENTRY (signal)
-	lea SYS_signal, %eax
-	lea C_SYMBOL_NAME(__sigreturn), %edx
-	.byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- GAS bug.  */
-	jb syscall_error
-	ret
diff --git a/sysdeps/unix/sysv/i386/sigreturn.S b/sysdeps/unix/sysv/i386/sigreturn.S
deleted file mode 100644
index edf4418c5b..0000000000
--- a/sysdeps/unix/sysv/i386/sigreturn.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997 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>
-
-.text
-ENTRY (__sigreturn)
-	addl $4, %esp		/* Pop the return PC.  */
-	lcall $0xf, $0		/* Do the magic sigreturn trap.  */
-	/* NOTREACHED */
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
deleted file mode 100644
index e621041a24..0000000000
--- a/sysdeps/unix/sysv/linux/Dist
+++ /dev/null
@@ -1,85 +0,0 @@
-bits/initspin.h
-cmsg_nxthdr.c
-dl-brk.c
-dl-sbrk.c
-exit-thread.S
-fatal-prepare.h
-getdirentries.c
-getdirentries64.c
-ipc_priv.h
-kernel-features.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-ldd-rewrite.sed
-lddlibc4.c
-linux_fsinfo.h
-llseek.c
-makedev.c
-ntp_gettime.c
-readahead.c
-s_pread64.c
-s_pwrite64.c
-siglist.h
-sizes.h
-socketcall.h
-sysctl.c
-termio.h
-netlinkaccess.h
-net/ethernet.h
-net/if_arp.h
-net/if_packet.h
-net/if_ppp.h
-net/if_shaper.h
-net/if_slip.h
-net/ppp-comp.h
-net/ppp_defs.h
-net/route.h
-netash/ash.h
-netatalk/at.h
-netax25/ax25.h
-neteconet/ec.h
-netinet/if_fddi.h
-netinet/if_tr.h
-netpacket/packet.h
-netipx/ipx.h
-netrom/netrom.h
-netrose/rose.h
-nfs/nfs.h
-pathconf.h
-rt_sigaction.c
-rt_sigpending.c
-rt_sigprocmask.c
-rt_sigqueueinfo.c
-rt_sigreturn.c
-rt_sigsuspend.c
-rt_sigtimedwait.c
-sa_len.c
-scsi/sg.h
-scsi/scsi.h
-scsi/scsi_ioctl.h
-sys/acct.h
-sys/epoll.h
-sys/fsuid.h
-sys/kd.h
-sys/kdaemon.h
-sys/klog.h
-sys/mount.h
-sys/pci.h
-sys/personality.h
-sys/prctl.h
-sys/procfs.h
-sys/quota.h
-sys/raw.h
-sys/soundcard.h
-sys/sysctl.h
-sys/sysinfo.h
-sys/timex.h
-sys/ultrasound.h
-sys/user.h
-sys/vt.h
-xstatconv.c
-xstatconv.h
-getdents64.c
-umount.S
-umount2.S
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 37be75e964..8bec6cdb85 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -24,10 +24,12 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
 		  sys/quota.h sys/fsuid.h \
 		  scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
 		  sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
-		  bits/a.out.h
+		  bits/a.out.h sys/inotify.h
 
 install-others += $(inst_includedir)/bits/syscall.h
 
+tests += tst-clone
+
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
 # we generate a file that uses <bits/wordsize.h>.
@@ -107,11 +109,6 @@ ifeq ($(subdir),termios)
 sysdep_headers += termio.h
 endif
 
-ifeq ($(subdir),stdio-common)
-# Just disable the auto generation in sysdeps/generic
-inhibit-siglist := yes
-endif
-
 ifeq ($(subdir),posix)
 sysdep_headers += bits/initspin.h
 
@@ -152,6 +149,11 @@ CFLAGS-mq_receive.c += -fexceptions
 endif
 
 ifeq ($(subdir),nscd)
-CFLAGS-connections.c += -DHAVE_EPOLL
+CFLAGS-connections.c += -DHAVE_EPOLL -DHAVE_SENDFILE
+CFLAGS-pwdcache.c += -DHAVE_SENDFILE
+CFLAGS-grpcache.c += -DHAVE_SENDFILE
+CFLAGS-hstcache.c += -DHAVE_SENDFILE
+CFLAGS-aicache.c += -DHAVE_SENDFILE
+CFLAGS-initgrcache.c += -DHAVE_SENDFILE
 CFLAGS-gai.c += -DNEED_NETLINK
 endif
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 980724e519..7c015b1d62 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -115,6 +115,17 @@ libc {
   GLIBC_2.3.4 {
     sched_getaffinity; sched_setaffinity;
   }
+  GLIBC_2.4 {
+    inotify_init; inotify_add_watch; inotify_rm_watch;
+
+    unshare;
+
+    #errlist-compat	132
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
+  GLIBC_2.5 {
+    splice; sync_file_range; tee; vmsplice;
+  }
   GLIBC_PRIVATE {
     # functions used in other libraries
     __syscall_rt_sigqueueinfo;
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index 44ff22ea7d..30e9fbf7e5 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,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
@@ -25,7 +26,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 #ifdef __NR_rt_sigqueueinfo
 
@@ -52,5 +53,5 @@ __aio_sigqueue (sig, val, caller_pid)
 			 sig, __ptrvalue (&info));
 }
 #else
-# include <sysdeps/generic/aio_sigqueue.c>
+# include <rt/aio_sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist
deleted file mode 100644
index bba6642b42..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/Dist
+++ /dev/null
@@ -1,19 +0,0 @@
-alpha/ptrace.h
-alpha/regdef.h
-clone.S
-dl-brk.S
-ieee_get_fp_control.S
-ieee_set_fp_control.S
-ioperm.c
-ipc_priv.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-oldglob.c
-rt_sigaction.S
-sizes.h
-sys/acct.h
-sys/io.h
-sys/procfs.h
-sys/user.h
-xstatconv.c
diff --git a/sysdeps/unix/sysv/linux/alpha/Implies b/sysdeps/unix/sysv/linux/alpha/Implies
index 8d91c80097..1616efecbe 100644
--- a/sysdeps/unix/sysv/linux/alpha/Implies
+++ b/sysdeps/unix/sysv/linux/alpha/Implies
@@ -1 +1,4 @@
 unix/sysv/linux/wordsize-64
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 37a9214fe9..f64f23fd7a 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -26,3 +26,13 @@ endif
 ifeq ($(subdir),signal)
 sysdep_routines += rt_sigaction
 endif
+
+ifeq ($(subdir),math)
+# These 2 routines are normally in libgcc{.a,_s.so.1}.
+# However, alpha -mlong-double-128 libgcc relies on
+# glibc providing _Ots* routines and without these files
+# glibc relies on __multc3/__divtc3 only provided
+# by libgcc if configured with -mlong-double-128.
+# Provide these routines here as well.
+libm-routines += multc3 divtc3
+endif   # math
diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
index ca79c7e444..8709dd2a38 100644
--- a/sysdeps/unix/sysv/linux/alpha/Versions
+++ b/sysdeps/unix/sysv/linux/alpha/Versions
@@ -73,6 +73,10 @@ libc {
     #errlist-compat	132
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
+  GLIBC_2.4 {
+    #errlist-compat	138
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
   GLIBC_PRIVATE {
     __libc_alpha_cache_shape;
   }
diff --git a/sysdeps/unix/sysv/linux/alpha/adjtime.c b/sysdeps/unix/sysv/linux/alpha/adjtime.c
index e206cb4727..1700524d34 100644
--- a/sysdeps/unix/sysv/linux/alpha/adjtime.c
+++ b/sysdeps/unix/sysv/linux/alpha/adjtime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -19,7 +19,7 @@
 #include <shlib-compat.h>
 #include <sysdep.h>
 #include <sys/time.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if !defined __ASSUME_TIMEVAL64 || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 struct timeval32
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/errno.h b/sysdeps/unix/sysv/linux/alpha/bits/errno.h
index 9cdc167bf7..8b2f152a1c 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux/Alpha specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,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
@@ -31,6 +31,12 @@
 #  define ECANCELED	131
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		136
+#  define ENOTRECOVERABLE	137
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index ce4a5da37f..f17dc2bdc1 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 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
@@ -21,8 +21,10 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -44,9 +46,9 @@
 #define O_ASYNC		020000	/* fcntl, for BSD compatibility */
 
 #ifdef __USE_GNU
-# define O_DIRECT	040000	/* Direct disk access.  */
 # define O_DIRECTORY	0100000	/* Must be a directory.  */
 # define O_NOFOLLOW	0200000	/* Do not follow links.  */
+# define O_DIRECT	02000000 /* Direct disk access.  */
 # define O_NOATIME	04000000 /* Do not set atime.  */
 #endif
 
@@ -92,7 +94,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* for F_[GET|SET]FL */
+/* for F_[GET|SET]FD */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
@@ -173,10 +175,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
index bb41887479..2f0e564916 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/Alpha version.
-   Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2003, 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
@@ -86,6 +86,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -95,6 +96,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED   3	/* Will need these pages.  */
 # define MADV_DONTNEED   6	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 54d6819412..2163745840 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Alpha/Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/shm.h b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
index bbee434ea0..35226c16ce 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
@@ -71,6 +71,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index f26e84c9f6..966ccf94da 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  Linux version.
-   Copyright (C) 1993,1994,1995,1996,1997,1999,2003
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2003, 2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -91,34 +91,42 @@ struct termios
 
 #define OFILL	00000100
 #define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	00001400
+# define   NL0	00000000
+# define   NL1	00000400
+# define   NL2	00001000
+# define   NL3	00001400
+# define TABDLY	00006000
+# define   TAB0	00000000
+# define   TAB1	00002000
+# define   TAB2	00004000
+# define   TAB3	00006000
+# define CRDLY	00030000
+# define   CR0	00000000
+# define   CR1	00010000
+# define   CR2	00020000
+# define   CR3	00030000
+# define FFDLY	00040000
+# define   FF0	00000000
+# define   FF1	00040000
+# define BSDLY	00100000
+# define   BS0	00000000
+# define   BS1	00100000
+#endif
+
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+
+#ifdef __USE_MISC
+# define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+#endif
 
 /* c_cflag bit meaning */
-#define CBAUD	0000037
+#ifdef __USE_MISC
+# define CBAUD	0000037
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -135,9 +143,11 @@ struct termios
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CBAUDEX 0000000
+#ifdef __USE_MISC
+# define EXTA B19200
+# define EXTB B38400
+# define CBAUDEX 0000000
+#endif
 #define  B57600   00020
 #define  B115200  00021
 #define  B230400  00022
@@ -169,23 +179,30 @@ struct termios
 #define HUPCL	00040000
 
 #define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
+#ifdef __USE_MISC
+# define CMSPAR	  010000000000		/* mark or space (stick) parity */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000080
 #define ICANON	0x00000100
-#define XCASE	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00004000
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000002
 #define ECHOK	0x00000004
 #define ECHONL	0x00000010
 #define NOFLSH	0x80000000
 #define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000040
+# define ECHOPRT	0x00000020
+# define ECHOKE	0x00000001
+# define FLUSHO	0x00800000
+# define PENDIN	0x20000000
+#endif
 #define IEXTEN	0x00000400
 
 /* Values for the ACTION argument to `tcflow'.  */
diff --git a/sysdeps/unix/bsd/m68k/pipe.S b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
index d7b8ec28d5..22fc64109c 100644
--- a/sysdeps/unix/bsd/m68k/pipe.S
+++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1995,1997,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
@@ -16,18 +16,15 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+#define __WORDSIZE	64
 
-SYSCALL__ (pipe, 1)
-#ifdef	__motorola__
-	move.l 4(sp), a0
-	movem.l d0-d1, (a0)
-#else
-	movel sp@(4), a0
-	moveml d0-d1, a0@
-#endif
-	clrl d0
-	rts
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
 
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
+/* Signal that we didn't used to have a `long double'. The changes all
+   the `long double' function variants to be redirects to the double
+   functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL	1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH		1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index 1c450d1737..5e0b21ea15 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -146,4 +146,4 @@ thread_start:
 
 	.end thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
index a0214b0072..d95e46f6f1 100644
--- a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
@@ -1,5 +1,5 @@
-/* Operating system support for run-time dynamic linker.  Linux/PPC version.
-   Copyright (C) 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
+/* Operating system support for run-time dynamic linker.  Linux/Alpha version.
+   Copyright (C) 1997, 1998, 2001, 2003, 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
@@ -17,9 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-
-#include "config.h"
-#include "kernel-features.h"
+#include <config.h>
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 extern long __libc_alpha_cache_shape[4];
diff --git a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
index 07f055886e..5e63be5cc7 100644
--- a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
+++ b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -19,7 +19,7 @@
 #include <fenv_libc.h>
 #include <sysdep.h>
 #include <float.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include "kernel_sysinfo.h"
 
 
diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
new file mode 100644
index 0000000000..497694619a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
@@ -0,0 +1,99 @@
+/* Copyright (C) 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
+   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.  */
+
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <xstatconv.h>
+
+#undef __fxstatat64
+
+
+/* Get information about the file NAME in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+  int result, errno_out;
+  struct kernel_stat kst;
+
+  if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	return result;
+      errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+      if (errno_out != ENOSYS)
+	goto fail;
+      __libc_missing_axp_stat64 = 1;
+    }
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+
+ fail:
+  __atfct_seterrno (errno_out, fd, buf);
+
+  return -1;
+}
+libc_hidden_def (__fxstatat)
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_ver(__fxstatat, __fxstatat64);
diff --git a/sysdeps/unix/sysv/linux/alpha/getcontext.S b/sysdeps/unix/sysv/linux/alpha/getcontext.S
index 3566890cf9..f010f337e6 100644
--- a/sysdeps/unix/sysv/linux/alpha/getcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -41,7 +41,7 @@ ENTRY (__getcontext)
 	ret
 
 END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
 
 
 /* An internal routine used by getcontext and setcontext.
@@ -57,6 +57,8 @@ weak_alias(__getcontext, getcontext)
 __getcontext_x:
 	cfi_register (64, 0)
 
+	.set noat
+
 	/* Return value of getcontext.  $0 is the only register
 	   whose value is not preserved. */
 	stq	$31, UC_SIGCTX+SC_REGS($16)
diff --git a/sysdeps/unix/sysv/linux/alpha/getitimer.S b/sysdeps/unix/sysv/linux/alpha/getitimer.S
index c2bc565afc..6644a5c36d 100644
--- a/sysdeps/unix/sysv/linux/alpha/getitimer.S
+++ b/sysdeps/unix/sysv/linux/alpha/getitimer.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/getrusage.S b/sysdeps/unix/sysv/linux/alpha/getrusage.S
index 2c34e98ce6..0bca4b5f23 100644
--- a/sysdeps/unix/sysv/linux/alpha/getrusage.S
+++ b/sysdeps/unix/sysv/linux/alpha/getrusage.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
@@ -145,5 +145,5 @@ strong_alias(__getrusage_tv64, ____getrusage_tv64)
 default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1)
 default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1)
 #else
-weak_alias(__getrusage, getrusage)
+weak_alias (__getrusage, getrusage)
 #endif
diff --git a/sysdeps/unix/sysv/linux/alpha/gettimeofday.S b/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
index 1a6f88b03a..7c9183a4fe 100644
--- a/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
+++ b/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2002, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/alpha/glob.c
index a51020d51f..84573899d6 100644
--- a/sysdeps/unix/sysv/linux/alpha/glob.c
+++ b/sysdeps/unix/sysv/linux/alpha/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 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
@@ -35,7 +35,7 @@ extern int __new_glob (const char *__pattern, int __flags,
 		       glob_t *__pglob);
 extern void __new_globfree (glob_t *__pglob);
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 #undef glob
 #undef globfree
diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c
index 1b75af2b80..a59911fe40 100644
--- a/sysdeps/unix/sysv/linux/alpha/msgctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_msqid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h b/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/alpha/oldglob.c b/sysdeps/unix/sysv/linux/alpha/oldglob.c
index 9d39176f6b..6d9b79f2c3 100644
--- a/sysdeps/unix/sysv/linux/alpha/oldglob.c
+++ b/sysdeps/unix/sysv/linux/alpha/oldglob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 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
@@ -91,6 +91,7 @@ __old_globfree (old_glob_t *pglob)
   /* We only need these two symbols.  */
   correct.gl_pathc = pglob->gl_pathc;
   correct.gl_pathv = pglob->gl_pathv;
+  correct.gl_offs = pglob->gl_offs;
 
   globfree (&correct);
 }
diff --git a/sysdeps/unix/sysv/linux/alpha/select.S b/sysdeps/unix/sysv/linux/alpha/select.S
index 458cda9246..35a81e949f 100644
--- a/sysdeps/unix/sysv/linux/alpha/select.S
+++ b/sysdeps/unix/sysv/linux/alpha/select.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2002,2003,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
@@ -19,7 +19,7 @@
 #include <sysdep-cancel.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
@@ -63,7 +63,7 @@ LEAF(SELECT, 64)
 	ldl	t0, __libc_missing_axp_tv64
 #endif
 
-	/* Save timeout early, since we'll need to recover this after 
+	/* Save timeout early, since we'll need to recover this after
 	   the system call.  */
 	stq	a4, 48(sp)
 
diff --git a/sysdeps/unix/sysv/linux/alpha/semctl.c b/sysdeps/unix/sysv/linux/alpha/semctl.c
index 6925c3f058..9957f983bf 100644
--- a/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/semctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +27,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_semid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.S
index 7d443d41c7..27abfd0c12 100644
--- a/sysdeps/unix/sysv/linux/alpha/setcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/setcontext.S
@@ -32,4 +32,4 @@
 PSEUDO(__setcontext, sigreturn, 1)
 	ret
 PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/setitimer.S b/sysdeps/unix/sysv/linux/alpha/setitimer.S
index 16bbd2227f..59caeac680 100644
--- a/sysdeps/unix/sysv/linux/alpha/setitimer.S
+++ b/sysdeps/unix/sysv/linux/alpha/setitimer.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/settimeofday.S b/sysdeps/unix/sysv/linux/alpha/settimeofday.S
index b49c770a0a..e39eadc208 100644
--- a/sysdeps/unix/sysv/linux/alpha/settimeofday.S
+++ b/sysdeps/unix/sysv/linux/alpha/settimeofday.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/shmctl.c b/sysdeps/unix/sysv/linux/alpha/shmctl.c
index 4a9d9445ef..e63211fa00 100644
--- a/sysdeps/unix/sysv/linux/alpha/shmctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -27,7 +27,7 @@
 #include <bits/wordsize.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_shmid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/sigaction.c b/sysdeps/unix/sysv/linux/alpha/sigaction.c
index 21a2063c30..26b081d9a3 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigaction.c
+++ b/sysdeps/unix/sysv/linux/alpha/sigaction.c
@@ -17,6 +17,8 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <sys/cdefs.h>
+#include <stddef.h>
 
 /*
  * In order to get the hidden arguments for rt_sigaction set up
diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
index e5de55faeb..48c3f271c7 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
+++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
@@ -29,5 +29,5 @@ PSEUDO(__sigsuspend, sigsuspend, 1)
 	ret
 PSEUDO_END(__sigsuspend)
 libc_hidden_def (__sigsuspend)
-weak_alias(__sigsuspend, sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
index 5f6615e0b6..1221f67f78 100644
--- a/sysdeps/unix/sysv/linux/alpha/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
@@ -48,4 +48,4 @@ ENTRY(__swapcontext)
 #endif
 
 END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscall.S b/sysdeps/unix/sysv/linux/alpha/syscall.S
index 10a32d5dc8..0c4081363a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscall.S
+++ b/sysdeps/unix/sysv/linux/alpha/syscall.S
@@ -74,4 +74,4 @@ $error:
 
 END(__syscall)
 
-weak_alias(__syscall, syscall)
+weak_alias (__syscall, syscall)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 3bbce1c6fd..7b3f233566 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -16,7 +16,6 @@ oldsemctl	EXTRA	semctl		i:iiii	__old_semctl	semctl@GLIBC_2.0
 sigstack	-	sigstack	2	sigstack
 vfork		-	vfork		0	__vfork		vfork
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 open		-	open		Ci:siv	__libc_open	__open open !__libc_open64 __open64 open64
 open64		open	-
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index c3de78f4bb..a22da71d60 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -22,10 +22,8 @@
 #define _LINUX_ALPHA_SYSDEP_H 1
 
 #ifdef __ASSEMBLER__
-
 #include <asm/pal.h>
 #include <alpha/regdef.h>
-
 #endif
 
 /* There is some commonality.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/utimes.S b/sysdeps/unix/sysv/linux/alpha/utimes.S
index c210e1d12f..0dd0a9372b 100644
--- a/sysdeps/unix/sysv/linux/alpha/utimes.S
+++ b/sysdeps/unix/sysv/linux/alpha/utimes.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/wait4.S b/sysdeps/unix/sysv/linux/alpha/wait4.S
index 8d89e3d46e..634993deb8 100644
--- a/sysdeps/unix/sysv/linux/alpha/wait4.S
+++ b/sysdeps/unix/sysv/linux/alpha/wait4.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/wordexp.c b/sysdeps/unix/sysv/linux/alpha/wordexp.c
index 1921a03388..c2972e40c2 100644
--- a/sysdeps/unix/sysv/linux/alpha/wordexp.c
+++ b/sysdeps/unix/sysv/linux/alpha/wordexp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 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
@@ -22,7 +22,7 @@
 #define wordexp(words, pwordexp, flags) \
   __new_wordexp (words, pwordexp, flags)
 
-#include <sysdeps/generic/wordexp.c>
+#include <posix/wordexp.c>
 
 versioned_symbol (libc, __new_wordexp, wordexp, GLIBC_2_2_2);
 
diff --git a/sysdeps/unix/sysv/linux/alpha/xstatconv.h b/sysdeps/unix/sysv/linux/alpha/xstatconv.h
index 846bb02994..094d11e5c9 100644
--- a/sysdeps/unix/sysv/linux/alpha/xstatconv.h
+++ b/sysdeps/unix/sysv/linux/alpha/xstatconv.h
@@ -1,5 +1,5 @@
 /* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __libc_missing_axp_stat64 attribute_hidden;
 extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
diff --git a/sysdeps/unix/sysv/linux/arm/Dist b/sysdeps/unix/sysv/linux/arm/Dist
deleted file mode 100644
index aa9eb1a227..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-clone.S
-dl-procinfo.h
-ioperm.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sigrestorer.S
-bits/armsigctx.h
-sys/elf.h
-sys/io.h
-sys/procfs.h
-sys/user.h
-oldgetrlimit64.c
diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
deleted file mode 100644
index 0ccdbe81f6..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-ifeq ($(subdir),misc)
-sysdep_routines += ioperm
-sysdep_headers += sys/elf.h sys/io.h
-endif
-
-ifeq ($(subdir),signal)
-sysdep_routines += sigrestorer
-endif
-
-ifeq ($(subdir),resource)
-sysdep_routines += oldgetrlimit64
-endif
diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions
deleted file mode 100644
index 2ddb2af2b7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Versions
+++ /dev/null
@@ -1,37 +0,0 @@
-libc {
-  GLIBC_2.0 {
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-  }
-  GLIBC_2.1 {
-    ioperm; iopl;
-    inb; inw; inl;
-    outb; outw; outl;
-  }
-  GLIBC_2.2 {
-    # functions used in other libraries
-    __xstat64; __fxstat64; __lxstat64;
-
-    # a*
-    alphasort64;
-
-    # g*
-    glob64;
-
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64;
-
-    # r*
-    readdir64; readdir64_r;
-
-    # s*
-    scandir64;
-
-    # v*
-    versionsort64;
-  }
-  GLIBC_2.3.3 {
-    posix_fadvise64; posix_fallocate64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/arm/alphasort64.c b/sysdeps/unix/sysv/linux/arm/alphasort64.c
deleted file mode 100644
index 0b5ae47d2f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/alphasort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
deleted file mode 100644
index 4530cdbda9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Definition of `struct sigcontext' for Linux/ARM
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 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.  */
-
-/* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
-   Fortunately 2.0 puts a magic number in the first word and this is not
-   a legal value for `trap_no', so we can tell them apart.  */
-
-/* Early 2.2 and 2.3 kernels do not have the `fault_address' member in
-   the sigcontext structure.  Unfortunately there is no reliable way
-   to test for its presence and this word will contain garbage for too-old
-   kernels.  Versions 2.2.14 and 2.3.35 (plus later versions) are known to
-   include this element.  */
-
-#ifndef __ARMSIGCTX_H
-#define __ARMSIGCTX_H	1
-
-#include <asm/ptrace.h>
-
-union k_sigcontext
-  {
-    struct
-      {
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-	unsigned long int arm_r0;
-	unsigned long int arm_r1;
-	unsigned long int arm_r2;
-	unsigned long int arm_r3;
-	unsigned long int arm_r4;
-	unsigned long int arm_r5;
-	unsigned long int arm_r6;
-	unsigned long int arm_r7;
-	unsigned long int arm_r8;
-	unsigned long int arm_r9;
-	unsigned long int arm_r10;
-	unsigned long int arm_fp;
-	unsigned long int arm_ip;
-	unsigned long int arm_sp;
-	unsigned long int arm_lr;
-	unsigned long int arm_pc;
-	unsigned long int arm_cpsr;
-	unsigned long fault_address;
-      } v21;
-    struct
-      {
-	unsigned long int magic;
-	struct pt_regs reg;
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-      } v20;
-};
-
-#define SIGCONTEXT_2_0_MAGIC	0x4B534154
-
-#endif	/* bits/armsigctx.h */
diff --git a/sysdeps/unix/sysv/linux/arm/bits/fcntl.h b/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
deleted file mode 100644
index 3574e750ff..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1998, 2000, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define O_FSYNC		O_SYNC
-#define O_ASYNC		020000
-
-#ifdef __USE_GNU
-# define O_DIRECTORY	040000	/* Must be a directory.	 */
-# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
-# define O_DIRECT	0200000	/* Direct disk access.	*/
-# define O_NOATIME	01000000 /* Do not set atime.  */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0400000
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
-   We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.	*/
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-#define F_GETLK64	12	/* Get record locking info.  */
-#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* For F_[GET|SET]FL.  */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/arm/bits/mman.h b/sysdeps/unix/sysv/linux/arm/bits/mman.h
deleted file mode 100644
index 4ec6839685..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/mman.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/ARM version.
-   Copyright (C) 1997, 2000, 2003 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 _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0
-# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/chown.c b/sysdeps/unix/sysv/linux/arm/chown.c
deleted file mode 100644
index 1961622564..0000000000
--- a/sysdeps/unix/sysv/linux/arm/chown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S
deleted file mode 100644
index bf07fb3952..0000000000
--- a/sysdeps/unix/sysv/linux/arm/clone.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Pat Beirne <patb@corelcomputer.com>
-
-   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.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-        .text
-ENTRY(__clone)
-	@ sanity check args
-	cmp	r0, #0
-	cmpne	r1, #0
-	moveq	r0, #-EINVAL
-	beq	PLTJMP(syscall_error)
-
-	@ insert the args onto the new stack
-	str	r3, [r1, #-4]!
-	str	r0, [r1, #-4]!
-
-	@ do the system call
-	@ get flags
-	mov	r0, r2
-	@ new sp is already in r1
-	swi	SYS_ify(clone)
-	movs	a1, a1
-	blt	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-	RETINSTR(ne, lr)
-
-	@ pick the function arg and call address off the stack and execute
-	ldr	r0, [sp, #4]
-	mov	lr, pc
-	ldr 	pc, [sp]
-
-	@ and we are done, passing the return value through r0
-	b	PLTJMP(_exit)
-
-PSEUDO_END (__clone)
-
-weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.c b/sysdeps/unix/sysv/linux/arm/dl-procinfo.c
deleted file mode 100644
index 9b87a2003d..0000000000
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/ARM version of processor capability information.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT and
-   _DL_PLATFORM_COUNT definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_arm_cap_flags
-#else
-PROCINFO_CLASS const char _dl_arm_cap_flags[8][10]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "swp", "half", "thumb", "26bit", "fast-mult", "fpa", "vfp", "edsp",
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
deleted file mode 100644
index 35b333479b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Linux/ARM version of processor capability information handling macros.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 8
-
-/* The kernel provides platform data but it is not interesting.  */
-#define _DL_HWCAP_PLATFORM 	0
-
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_arm_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_arm_cap_flags)[idx];
-};
-
-enum
-{
-  HWCAP_ARM_SWP	      = 1 << 0,
-  HWCAP_ARM_HALF      = 1 << 1,
-  HWCAP_ARM_THUMB     = 1 << 2,
-  HWCAP_ARM_26BIT     = 1 << 3,
-  HWCAP_ARM_FAST_MULT = 1 << 4,
-  HWCAP_ARM_FPA       = 1 << 5,
-  HWCAP_ARM_VFP       = 1 << 6,
-  HWCAP_ARM_EDSP      = 1 << 7,
-
-  HWCAP_IMPORTANT = (HWCAP_ARM_HALF | HWCAP_ARM_FAST_MULT)
-};
-
-static inline int
-__attribute__ ((unused))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_arm_cap_flags)[i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/arm/fchown.c b/sysdeps/unix/sysv/linux/arm/fchown.c
deleted file mode 100644
index 3a69ecc9e7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/fcntl.c b/sysdeps/unix/sysv/linux/arm/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/fxstat.c b/sysdeps/unix/sysv/linux/arm/fxstat.c
deleted file mode 100644
index 4f219f0b9d..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fxstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getdents64.c b/sysdeps/unix/sysv/linux/arm/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getegid.c b/sysdeps/unix/sysv/linux/arm/getegid.c
deleted file mode 100644
index 37b4b4a530..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/geteuid.c b/sysdeps/unix/sysv/linux/arm/geteuid.c
deleted file mode 100644
index ebcb555b5e..0000000000
--- a/sysdeps/unix/sysv/linux/arm/geteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getgid.c b/sysdeps/unix/sysv/linux/arm/getgid.c
deleted file mode 100644
index 0a4d6061f0..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getgroups.c b/sysdeps/unix/sysv/linux/arm/getgroups.c
deleted file mode 100644
index 102ea24e14..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getresgid.c b/sysdeps/unix/sysv/linux/arm/getresgid.c
deleted file mode 100644
index b703a414cc..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getresuid.c b/sysdeps/unix/sysv/linux/arm/getresuid.c
deleted file mode 100644
index 0b14cefe34..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getrlimit.c b/sysdeps/unix/sysv/linux/arm/getrlimit.c
deleted file mode 100644
index fc06dbd641..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getrlimit64.c b/sysdeps/unix/sysv/linux/arm/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getuid.c b/sysdeps/unix/sysv/linux/arm/getuid.c
deleted file mode 100644
index d682c79a49..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/glob64.c b/sysdeps/unix/sysv/linux/arm/glob64.c
deleted file mode 100644
index 82a9a296a7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/ioperm.c b/sysdeps/unix/sysv/linux/arm/ioperm.c
deleted file mode 100644
index 558b485b61..0000000000
--- a/sysdeps/unix/sysv/linux/arm/ioperm.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Phil Blundell, based on the Alpha version by
-   David Mosberger.
-
-   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.  */
-
-/* I/O port access on the ARM is something of a fiction.  What we do is to
-   map an appropriate area of /dev/mem into user space so that a program
-   can blast away at the hardware in such a way as to generate I/O cycles
-   on the bus.  To insulate user code from dependencies on particular
-   hardware we don't allow calls to inb() and friends to be inlined, but
-   force them to come through code in here every time.  Performance-critical
-   registers tend to be memory mapped these days so this should be no big
-   problem.  */
-
-/* Once upon a time this file used mprotect to enable and disable
-   access to particular areas of I/O space.  Unfortunately the
-   mprotect syscall also has the side effect of enabling caching for
-   the area affected (this is a kernel limitation).  So we now just
-   enable all the ports all of the time.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <asm/page.h>
-#include <sys/sysctl.h>
-
-#define PATH_ARM_SYSTYPE	"/etc/arm_systype"
-#define PATH_CPUINFO		"/proc/cpuinfo"
-
-#define MAX_PORT	0x10000
-
-static struct {
-  unsigned long int	base;
-  unsigned long int	io_base;
-  unsigned int		shift;
-  unsigned int		initdone;	/* since all the above could be 0 */
-} io;
-
-#define IO_BASE_FOOTBRIDGE	0x7c000000
-#define IO_SHIFT_FOOTBRIDGE	0
-
-static struct platform {
-  const char		*name;
-  unsigned long int	io_base;
-  unsigned int		shift;
-} platform[] = {
-  /* All currently supported platforms are in fact the same. :-)  */
-  {"Chalice-CATS",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"DEC-EBSA285",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"Corel-NetWinder",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"Rebel-NetWinder",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-};
-
-#define IO_ADDR(port)	(io.base + ((port) << io.shift))
-
-/*
- * Initialize I/O system.  There are several ways to get the information
- * we need.  Each is tried in turn until one succeeds.
- *
- * 1. Sysctl (CTL_BUS, BUS_ISA, ISA_*).  This is the preferred method
- *    but not all kernels support it.
- *
- * 2. Read the value (not the contents) of symlink PATH_ARM_SYSTYPE.
- *    - If it matches one of the entries in the table above, use the
- *      corresponding values.
- *    - If it begins with a number, assume this is a previously
- *      unsupported system and the values encode, in order,
- *      "<io_base>,<port_shift>".
- *
- * 3. Lookup the "system type" field in /proc/cpuinfo.  Again, if it
- *    matches an entry in the platform[] table, use the corresponding
- *    values.
- */
-
-static int
-init_iosys (void)
-{
-  char systype[256];
-  int i, n;
-  static int iobase_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_BASE };
-  static int ioshift_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_SHIFT };
-  size_t len = sizeof(io.base);
-
-  if (! sysctl (iobase_name, 3, &io.io_base, &len, NULL, 0)
-      && ! sysctl (ioshift_name, 3, &io.shift, &len, NULL, 0))
-    {
-      io.initdone = 1;
-      return 0;
-    }
-
-  n = readlink (PATH_ARM_SYSTYPE, systype, sizeof (systype) - 1);
-  if (n > 0)
-    {
-      systype[n] = '\0';
-      if (isdigit (systype[0]))
-	{
-	  if (sscanf (systype, "%li,%i", &io.io_base, &io.shift) == 2)
-	    {
-	      io.initdone = 1;
-	      return 0;
-	    }
-	  /* else we're likely going to fail with the system match below */
-	}
-    }
-  else
-    {
-      FILE * fp;
-
-      fp = fopen (PATH_CPUINFO, "r");
-      if (! fp)
-	return -1;
-      while ((n = fscanf (fp, "Hardware\t: %256[^\n]\n", systype))
-	     != EOF)
-	{
-	  if (n == 1)
-	    break;
-	  else
-	    fgets (systype, 256, fp);
-	}
-      fclose (fp);
-
-      if (n == EOF)
-	{
-	  /* this can happen if the format of /proc/cpuinfo changes...  */
-	  fprintf (stderr,
-		   "ioperm: Unable to determine system type.\n"
-		   "\t(May need " PATH_ARM_SYSTYPE " symlink?)\n");
-	  __set_errno (ENODEV);
-	  return -1;
-	}
-    }
-
-  /* translate systype name into i/o system: */
-  for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i)
-    {
-      if (strcmp (platform[i].name, systype) == 0)
-	{
-	  io.shift = platform[i].shift;
-	  io.io_base = platform[i].io_base;
-	  io.initdone = 1;
-	  return 0;
-	}
-    }
-
-  /* systype is not a known platform name... */
-  __set_errno (ENODEV);
-  return -1;
-}
-
-int
-_ioperm (unsigned long int from, unsigned long int num, int turn_on)
-{
-  if (! io.initdone && init_iosys () < 0)
-    return -1;
-
-  /* this test isn't as silly as it may look like; consider overflows! */
-  if (from >= MAX_PORT || from + num > MAX_PORT)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (turn_on)
-    {
-      if (! io.base)
-	{
-	  int fd;
-
-	  fd = open ("/dev/mem", O_RDWR);
-	  if (fd < 0)
-	    return -1;
-
-	  io.base =
-	    (unsigned long int) __mmap (0, MAX_PORT << io.shift,
-					PROT_READ | PROT_WRITE,
-					MAP_SHARED, fd, io.io_base);
-	  close (fd);
-	  if ((long) io.base == -1)
-	    return -1;
-	}
-    }
-
-  return 0;
-}
-
-
-int
-_iopl (unsigned int level)
-{
-    if (level > 3)
-      {
-	__set_errno (EINVAL);
-	return -1;
-      }
-    if (level)
-      {
-	return _ioperm (0, MAX_PORT, 1);
-      }
-    return 0;
-}
-
-
-void
-_outb (unsigned char b, unsigned long int port)
-{
-  *((volatile unsigned char *)(IO_ADDR (port))) = b;
-}
-
-
-void
-_outw (unsigned short b, unsigned long int port)
-{
-  *((volatile unsigned short *)(IO_ADDR (port))) = b;
-}
-
-
-void
-_outl (unsigned int b, unsigned long int port)
-{
-  *((volatile unsigned long *)(IO_ADDR (port))) = b;
-}
-
-
-unsigned int
-_inb (unsigned long int port)
-{
-  return *((volatile unsigned char *)(IO_ADDR (port)));
-}
-
-
-unsigned int
-_inw (unsigned long int port)
-{
-  return *((volatile unsigned short *)(IO_ADDR (port)));
-}
-
-
-unsigned int
-_inl (unsigned long int port)
-{
-  return *((volatile unsigned long *)(IO_ADDR (port)));
-}
-
-weak_alias (_ioperm, ioperm);
-weak_alias (_iopl, iopl);
-weak_alias (_inb, inb);
-weak_alias (_inw, inw);
-weak_alias (_inl, inl);
-weak_alias (_outb, outb);
-weak_alias (_outw, outw);
-weak_alias (_outl, outl);
diff --git a/sysdeps/unix/sysv/linux/arm/lchown.c b/sysdeps/unix/sysv/linux/arm/lchown.c
deleted file mode 100644
index c89de99ba2..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/lockf64.c b/sysdeps/unix/sysv/linux/arm/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/lxstat.c b/sysdeps/unix/sysv/linux/arm/lxstat.c
deleted file mode 100644
index 2371cd9719..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lxstat.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
-
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
deleted file mode 100644
index cf6f253378..0000000000
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003 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 <kernel-features.h>
-
-#define	EINVAL		22
-
-	.text
-
-ENTRY (__mmap)
-# ifdef __ASSUME_MMAP2_SYSCALL
-	/* This code is actually a couple of cycles slower than the
-	   sys_mmap version below, so it might seem like a loss.  But the
-	   code path inside the kernel is sufficiently much shorter to
-	   make it a net gain to use mmap2 when it's known to be
-	   available.  */
-
-	/* shuffle args */
-	str	r5, [sp, #-4]!
-	ldr	r5, [sp, #8]
-	str	r4, [sp, #-4]!
-	ldr	r4, [sp, #8]
-
-	/* convert offset to pages */
-	movs	ip, r5, lsl #20
-	bne	.Linval
-	mov	r5, r5, lsr #12
-	
-	/* do the syscall */
-	swi	SYS_ify (mmap2)
-
-	/* restore registers */
-2:
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-
-	cmn	r0, $4096
-	RETINSTR(cc, lr)
-	b	PLTJMP(syscall_error)
-
-.Linval:
-	mov	r0, #-EINVAL
-	b	2b
-# else
-	/* Because we can only get five args through the syscall interface, and
-	   mmap() takes six, we need to build a parameter block and pass its
-	   address instead.  The 386 port does a similar trick.  */
-
-	/* This code previously moved sp into ip and stored the args using
-	   stmdb ip!, {a1-a4}.  It did not modify sp, so the stack never had
-	   to be restored after the syscall completed.  It saved an
-	   instruction and meant no stack cleanup work was required.
-
-	   This will not work in the case of a mmap call being interrupted
-	   by a signal.  If the signal handler uses any stack the arguments
-	   to mmap will be trashed.  The results of a restart of mmap are
-	   then unpredictable. */
-
-	/* store args on the stack */
-	stmdb	sp!, {a1-a4}
-
-	/* do the syscall */
-	mov	a1, sp
-	swi	SYS_ify (mmap)
-
-	/* pop args off the stack. */
-	add	sp, sp, #16
-
-	cmn	r0, $4096
-	RETINSTR(cc, lr)
-	b	PLTJMP(syscall_error);
-#endif
-
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/arm/mmap64.S b/sysdeps/unix/sysv/linux/arm/mmap64.S
deleted file mode 100644
index b4b712c2f2..0000000000
--- a/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#define	EINVAL		22
-#define	ENOSYS		38
-
-#include "kernel-features.h"
-
-	/* The mmap2 system call takes six arguments, all in registers.  */
-	.text
-ENTRY (__mmap64)
-#ifdef __NR_mmap2
-	ldr	ip, [sp, $4]		@ offset low part
-	str	r5, [sp, #-4]!
-	ldr	r5, [sp, $12]		@ offset high part
-	str	r4, [sp, #-4]!
-	movs	r4, ip, lsl $20		@ check that offset is page-aligned
-	mov	ip, ip, lsr $12
-	moveqs	r4, r5, lsr $12		@ check for overflow
-	bne	.Linval
-	ldr	r4, [sp, $8]		@ load fd
-	orr	r5, ip, r5, lsl $20	@ compose page offset
-	mov	ip, r0
-	swi	SYS_ify (mmap2)
-	cmn	r0, $4096
-# ifdef __ASSUME_MMAP2_SYSCALL
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-	RETINSTR(cc, lr)	
-	b	PLTJMP(syscall_error)
-# else
-	ldrcc	r4, [sp], #4
-	ldrcc	r5, [sp], #4
-	RETINSTR(cc, lr)
-	cmn	r0, $ENOSYS
-	bne	.Lerror
-	/* The current kernel does not support mmap2.  Fall back to plain
-	   mmap if the offset is small enough.  */
-	ldr	r5, [sp, $16]
-	mov	r0, ip			@ first arg was clobbered
-	teq	r5, $0
-	ldreq	r4, [sp], #4
-	ldreq	r5, [sp], #4
-	beq	PLTJMP(__mmap)
-# endif
-.Linval:
-	mov	r0, $-EINVAL
-.Lerror:
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-	b	PLTJMP(syscall_error)
-#else
-	/* The kernel headers do not support mmap2.  Fall back to plain
-	   mmap if the offset is small enough.  */
-	ldr	ip, [sp, $8]
-	teq	ip, $0
-	beq	PLTJMP(__mmap)
-	mov	r0, $-EINVAL
-	b	PLTJMP(syscall_error)
-#endif
-PSEUDO_END (__mmap64)
-
-weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c
deleted file mode 100644
index 9f9b8431a3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c
deleted file mode 100644
index 4c27e957bf..0000000000
--- a/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h
deleted file mode 100644
index 7639883f10..0000000000
--- a/sysdeps/unix/sysv/linux/arm/profil-counter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Low-level statistical profiling support function.  Linux/ARM version.
-   Copyright (C) 1996, 1997, 1998, 2002 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 <signal.h>
-#include <bits/armsigctx.h>
-
-void
-profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc)
-{
-  void *pc;
-  if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC)
-    pc = (void *) sc.v20.reg.ARM_pc;
-  else
-    pc = (void *) sc.v21.arm_pc;
-  profil_count (pc);
-
-  /* This is a hack to prevent the compiler from implementing the
-     above function call as a sibcall.  The sibcall would overwrite
-     the signal context.  */
-  asm volatile ("");
-}
diff --git a/sysdeps/unix/sysv/linux/arm/readdir64.c b/sysdeps/unix/sysv/linux/arm/readdir64.c
deleted file mode 100644
index 2ea26dd409..0000000000
--- a/sysdeps/unix/sysv/linux/arm/readdir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/readdir64_r.c b/sysdeps/unix/sysv/linux/arm/readdir64_r.c
deleted file mode 100644
index 9f54f897e3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/readdir64_r.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h
deleted file mode 100644
index 2baccb2cb7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/register-dump.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Dump registers.
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <pb@nexus.co.uk>, 1998.
-
-   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 <sys/uio.h>
-#include <stdio-common/_itoa.h>
-#include <bits/armsigctx.h>
-
-/* We will print the register dump in this format:
-
- R0: XXXXXXXX   R1: XXXXXXXX   R2: XXXXXXXX   R3: XXXXXXXX
- R4: XXXXXXXX   R5: XXXXXXXX   R6: XXXXXXXX   R7: XXXXXXXX
- R8: XXXXXXXX   R9: XXXXXXXX   SL: XXXXXXXX   FP: XXXXXXXX
- IP: XXXXXXXX   SP: XXXXXXXX   LR: XXXXXXXX   PC: XXXXXXXX
-
- CPSR: XXXXXXXX
-
- Trap: XXXXXXXX   Error: XXXXXXXX   OldMask: XXXXXXXX
- Addr: XXXXXXXX
-
- */
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, union k_sigcontext *ctx)
-{
-  char regs[21][8];
-  struct iovec iov[97];
-  size_t nr = 0;
-
-#define ADD_STRING(str) \
-  iov[nr].iov_base = (char *) str;					      \
-  iov[nr].iov_len = strlen (str);					      \
-  ++nr
-#define ADD_MEM(str, len) \
-  iov[nr].iov_base = str;						      \
-  iov[nr].iov_len = len;						      \
-  ++nr
-
-  /* Generate strings of register contents.  */
-  if (ctx->v20.magic == SIGCONTEXT_2_0_MAGIC)
-    {
-      hexvalue (ctx->v20.reg.ARM_r0, regs[0], 8);
-      hexvalue (ctx->v20.reg.ARM_r1, regs[1], 8);
-      hexvalue (ctx->v20.reg.ARM_r2, regs[2], 8);
-      hexvalue (ctx->v20.reg.ARM_r3, regs[3], 8);
-      hexvalue (ctx->v20.reg.ARM_r4, regs[4], 8);
-      hexvalue (ctx->v20.reg.ARM_r5, regs[5], 8);
-      hexvalue (ctx->v20.reg.ARM_r6, regs[6], 8);
-      hexvalue (ctx->v20.reg.ARM_r7, regs[7], 8);
-      hexvalue (ctx->v20.reg.ARM_r8, regs[8], 8);
-      hexvalue (ctx->v20.reg.ARM_r9, regs[9], 8);
-      hexvalue (ctx->v20.reg.ARM_r10, regs[10], 8);
-      hexvalue (ctx->v20.reg.ARM_fp, regs[11], 8);
-      hexvalue (ctx->v20.reg.ARM_ip, regs[12], 8);
-      hexvalue (ctx->v20.reg.ARM_sp, regs[13], 8);
-      hexvalue (ctx->v20.reg.ARM_lr, regs[14], 8);
-      hexvalue (ctx->v20.reg.ARM_pc, regs[15], 8);
-      hexvalue (ctx->v20.reg.ARM_cpsr, regs[16], 8);
-      hexvalue (ctx->v20.trap_no, regs[17], 8);
-      hexvalue (ctx->v20.error_code, regs[18], 8);
-      hexvalue (ctx->v20.oldmask, regs[19], 8);
-    }
-  else
-    {
-      hexvalue (ctx->v21.arm_r0, regs[0], 8);
-      hexvalue (ctx->v21.arm_r1, regs[1], 8);
-      hexvalue (ctx->v21.arm_r2, regs[2], 8);
-      hexvalue (ctx->v21.arm_r3, regs[3], 8);
-      hexvalue (ctx->v21.arm_r4, regs[4], 8);
-      hexvalue (ctx->v21.arm_r5, regs[5], 8);
-      hexvalue (ctx->v21.arm_r6, regs[6], 8);
-      hexvalue (ctx->v21.arm_r7, regs[7], 8);
-      hexvalue (ctx->v21.arm_r8, regs[8], 8);
-      hexvalue (ctx->v21.arm_r9, regs[9], 8);
-      hexvalue (ctx->v21.arm_r10, regs[10], 8);
-      hexvalue (ctx->v21.arm_fp, regs[11], 8);
-      hexvalue (ctx->v21.arm_ip, regs[12], 8);
-      hexvalue (ctx->v21.arm_sp, regs[13], 8);
-      hexvalue (ctx->v21.arm_lr, regs[14], 8);
-      hexvalue (ctx->v21.arm_pc, regs[15], 8);
-      hexvalue (ctx->v21.arm_cpsr, regs[16], 8);
-      hexvalue (ctx->v21.trap_no, regs[17], 8);
-      hexvalue (ctx->v21.error_code, regs[18], 8);
-      hexvalue (ctx->v21.oldmask, regs[19], 8);
-      hexvalue (ctx->v21.fault_address, regs[20], 8);
-    }
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n R0: ");
-  ADD_MEM (regs[0], 8);
-  ADD_STRING ("   R1: ");
-  ADD_MEM (regs[1], 8);
-  ADD_STRING ("   R2: ");
-  ADD_MEM (regs[2], 8);
-  ADD_STRING ("   R3: ");
-  ADD_MEM (regs[3], 8);
-  ADD_STRING ("\n R4: ");
-  ADD_MEM (regs[4], 8);
-  ADD_STRING ("   R5: ");
-  ADD_MEM (regs[5], 8);
-  ADD_STRING ("   R6: ");
-  ADD_MEM (regs[6], 8);
-  ADD_STRING ("   R7: ");
-  ADD_MEM (regs[7], 8);
-  ADD_STRING ("\n R8: ");
-  ADD_MEM (regs[8], 8);
-  ADD_STRING ("   R9: ");
-  ADD_MEM (regs[9], 8);
-  ADD_STRING ("   SL: ");
-  ADD_MEM (regs[10], 8);
-  ADD_STRING ("   FP: ");
-  ADD_MEM (regs[11], 8);
-  ADD_STRING ("\n IP: ");
-  ADD_MEM (regs[12], 8);
-  ADD_STRING ("   SP: ");
-  ADD_MEM (regs[13], 8);
-  ADD_STRING ("   LR: ");
-  ADD_MEM (regs[14], 8);
-  ADD_STRING ("   PC: ");
-  ADD_MEM (regs[15], 8);
-  ADD_STRING ("\n\n CPSR: ");
-  ADD_MEM (regs[16], 8);
-  ADD_STRING ("\n\n Trap: ");
-  ADD_MEM (regs[17], 8);
-  ADD_STRING ("   Error: ");
-  ADD_MEM (regs[18], 8);
-  ADD_STRING ("   OldMask: ");
-  ADD_MEM (regs[19], 8);
-  if (ctx->v20.magic != SIGCONTEXT_2_0_MAGIC)
-    {
-      ADD_STRING ("\n Addr: ");
-      ADD_MEM (regs[20], 8);
-    }
-
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, nr);
-}
-
-
-#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/arm/scandir64.c b/sysdeps/unix/sysv/linux/arm/scandir64.c
deleted file mode 100644
index 506fd8877c..0000000000
--- a/sysdeps/unix/sysv/linux/arm/scandir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/semctl.c b/sysdeps/unix/sysv/linux/arm/semctl.c
deleted file mode 100644
index e9b1a483c9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setegid.c b/sysdeps/unix/sysv/linux/arm/setegid.c
deleted file mode 100644
index 2e3a54c893..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/seteuid.c b/sysdeps/unix/sysv/linux/arm/seteuid.c
deleted file mode 100644
index 18e41d08c1..0000000000
--- a/sysdeps/unix/sysv/linux/arm/seteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsgid.c b/sysdeps/unix/sysv/linux/arm/setfsgid.c
deleted file mode 100644
index 0886712569..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setfsgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsuid.c b/sysdeps/unix/sysv/linux/arm/setfsuid.c
deleted file mode 100644
index a9f22eb8ab..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setfsuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgid.c b/sysdeps/unix/sysv/linux/arm/setgid.c
deleted file mode 100644
index 377021d9ec..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgroups.c b/sysdeps/unix/sysv/linux/arm/setgroups.c
deleted file mode 100644
index 0e7086278f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setregid.c b/sysdeps/unix/sysv/linux/arm/setregid.c
deleted file mode 100644
index 99c57ad20f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setregid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresgid.c b/sysdeps/unix/sysv/linux/arm/setresgid.c
deleted file mode 100644
index daca1a4833..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresuid.c b/sysdeps/unix/sysv/linux/arm/setresuid.c
deleted file mode 100644
index 3aeabe9ad7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setreuid.c b/sysdeps/unix/sysv/linux/arm/setreuid.c
deleted file mode 100644
index 8ad61226e9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setreuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setrlimit.c b/sysdeps/unix/sysv/linux/arm/setrlimit.c
deleted file mode 100644
index bfaef74c38..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setuid.c b/sysdeps/unix/sysv/linux/arm/setuid.c
deleted file mode 100644
index de394379be..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/shmctl.c b/sysdeps/unix/sysv/linux/arm/shmctl.c
deleted file mode 100644
index 7eac6380dd..0000000000
--- a/sysdeps/unix/sysv/linux/arm/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/sigaction.c b/sysdeps/unix/sysv/linux/arm/sigaction.c
deleted file mode 100644
index 81b29adb2b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigaction.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 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 <errno.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <kernel-features.h>
-
-/* The difference here is that the sigaction structure used in the
-   kernel is not the same as we use in the libc.  Therefore we must
-   translate it here.  */
-#include <kernel_sigaction.h>
-
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  */
-int __libc_missing_rt_sigs;
-
-#define SA_RESTORER	0x04000000
-
-extern void __default_sa_restorer(void);
-extern void __default_rt_sa_restorer(void);
-
-/* When RT signals are in use we need to use a different return stub.  */
-#ifdef __NR_rt_sigreturn
-#define choose_restorer(flags)					\
-  (flags & SA_SIGINFO) ? __default_rt_sa_restorer		\
-  : __default_sa_restorer
-#else
-#define choose_restorer(flags)					\
-  __default_sa_restorer
-#endif
-
-/* If ACT is not NULL, change the action for SIG to *ACT.
-   If OACT is not NULL, put the old action for SIG in *OACT.  */
-int
-__libc_sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-#ifndef __ASSUME_REALTIME_SIGNALS
-  struct old_kernel_sigaction k_sigact, k_osigact;
-#endif
-  int result;
-
-#ifdef __NR_rt_sigaction
-  /* First try the RT signals.  */
-# ifndef __ASSUME_REALTIME_SIGNALS
-  if (!__libc_missing_rt_sigs)
-# endif
-    {
-      struct kernel_sigaction kact, koact;
-# ifndef __ASSUME_REALTIME_SIGNALS
-      int saved_errno = errno;
-# endif
-
-      if (act)
-	{
-	  kact.k_sa_handler = act->sa_handler;
-	  memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
-	  kact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-	  /* If the user specified SA_ONSTACK this means she is trying to
-	     use the old-style stack switching.  Unfortunately this
-	     requires the sa_restorer field so we cannot install our own
-	     handler.  (In fact the user is likely to be out of luck anyway
-	     since the kernel currently only supports stack switching via
-	     the X/Open sigaltstack interface, but we allow for the
-	     possibility that this might change in the future.)  */
-	  if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
-	    kact.sa_restorer = act->sa_restorer;
-	  else
-	    {
-	      kact.sa_restorer = choose_restorer (kact.sa_flags);
-	      kact.sa_flags |= SA_RESTORER;
-	    }
-# endif
-	}
-
-      /* XXX The size argument hopefully will have to be changed to the
-	 real size of the user-level sigset_t.  */
-      result = INLINE_SYSCALL (rt_sigaction, 4, sig,
-			       act ? __ptrvalue (&kact) : NULL,
-			       oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
-
-# ifndef __ASSUME_REALTIME_SIGNALS
-      if (result >= 0 || errno != ENOSYS)
-# endif
-	{
-	  if (oact && result >= 0)
-	    {
-	      oact->sa_handler = koact.k_sa_handler;
-	      memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
-	      oact->sa_flags = koact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-	      oact->sa_restorer = koact.sa_restorer;
-# endif
-	    }
-	  return result;
-	}
-
-# ifndef __ASSUME_REALTIME_SIGNALS
-      __set_errno (saved_errno);
-      __libc_missing_rt_sigs = 1;
-# endif
-    }
-#endif
-
-#ifndef __ASSUME_REALTIME_SIGNALS
-  if (act)
-    {
-      k_sigact.k_sa_handler = act->sa_handler;
-      k_sigact.sa_mask = act->sa_mask.__val[0];
-      k_sigact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-      /* See the comments above for why we test SA_ONSTACK.  */
-      if (k_sigact.sa_flags & (SA_RESTORER | SA_ONSTACK))
-	k_sigact.sa_restorer = act->sa_restorer;
-      else
-	{
-	  k_sigact.sa_restorer = choose_restorer (k_sigact.sa_flags);
-	  k_sigact.sa_flags |= SA_RESTORER;
-	}
-# endif
-    }
-  result = INLINE_SYSCALL (sigaction, 3, sig,
-			   act ? __ptrvalue (&k_sigact) : NULL,
-			   oact ? __ptrvalue (&k_osigact) : NULL);
-  if (oact && result >= 0)
-    {
-      oact->sa_handler = k_osigact.k_sa_handler;
-      oact->sa_mask.__val[0] = k_osigact.sa_mask;
-      oact->sa_flags = k_osigact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-      oact->sa_restorer = k_osigact.sa_restorer;
-# endif
-    }
-  return result;
-#endif
-}
-libc_hidden_def (__libc_sigaction)
-
-#ifndef LIBC_SIGACTION
-weak_alias (__libc_sigaction, __sigaction)
-libc_hidden_weak (__sigaction)
-weak_alias (__libc_sigaction, sigaction)
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
deleted file mode 100644
index 30c2e3a6ce..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 1999.
-
-   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 <bits/armsigctx.h>
-#include "kernel-features.h"
-
-#define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
-#define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
-
-/* The sigcontext structure changed between 2.0 and 2.1 kernels.  On any
-   modern system we should be able to assume that the "new" format will be
-   in use.  */
-#if __LINUX_KERNEL_VERSION > 131328
-
-#define GET_PC(ctx)	((void *) ctx.v21.arm_pc)
-#define GET_FRAME(ctx)	ADVANCE_STACK_FRAME ((void *) ctx.v21.arm_fp)
-#define GET_STACK(ctx)	((void *) ctx.v21.arm_sp)
-
-#else
-
-#define GET_PC(ctx)	((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
-#define GET_FRAME(ctx)	\
-	ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
-#define GET_STACK(ctx)	((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
-
-#endif
-
-#define ADVANCE_STACK_FRAME(frm)	\
-			((struct layout *)frm - 1)
-
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/arm/sigrestorer.S b/sysdeps/unix/sysv/linux/arm/sigrestorer.S
deleted file mode 100644
index 98e33cb8bc..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigrestorer.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1999 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>
-
-/* If no SA_RESTORER function was specified by the application we use
-   one of these.  This avoids the need for the kernel to synthesise a return
-   instruction on the stack, which would involve expensive cache flushes. */
-
-ENTRY(__default_sa_restorer)
-	swi	SYS_ify(sigreturn)
-
-#ifdef __NR_rt_sigreturn
-
-ENTRY(__default_rt_sa_restorer)
-	swi	SYS_ify(rt_sigreturn)
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S
deleted file mode 100644
index 212a489afe..0000000000
--- a/sysdeps/unix/sysv/linux/arm/socket.S
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2003 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-cancel.h>
-#include <socketcall.h>
-
-#define P(a, b) P2(a, b)
-#define P2(a, b) a##b
-
-	.text
-/* The socket-oriented system calls are handled unusally in Linux.
-   They are all gated through the single `socketcall' system call number.
-   `socketcall' takes two arguments: the first is the subcode, specifying
-   which socket function is being called; and the second is a pointer to
-   the arguments to the specific function.
-
-   The .S files for the other calls just #define socket and #include this.  */
-
-#ifndef __socket
-#define __socket P(__,socket)
-#endif
-
-#define PUSHARGS_1	str a1, [sp, $-4]!
-#define PUSHARGS_2	stmfd sp!, {a1, a2}
-#define PUSHARGS_3	stmfd sp!, {a1, a2, a3}
-#define PUSHARGS_4	stmfd sp!, {a1, a2, a3, a4}
-#define PUSHARGS_5	stmfd sp!, {a1, a2, a3, a4}	/* Caller has already pushed arg 5 */
-#define PUSHARGS_6	stmfd sp!, {a1, a2, a3, a4}
-
-#define POPARGS_1	add sp, sp, #4
-#define POPARGS_2	add sp, sp, #8
-#define POPARGS_3	add sp, sp, #12
-#define POPARGS_4	add sp, sp, #16
-#define POPARGS_5	add sp, sp, #16
-#define POPARGS_6	add sp, sp, #16 
-
-#ifndef NARGS
-#define NARGS 3			/* If we were called with no wrapper, this is really socket() */
-#endif
-
-#if defined NEED_CANCELLATION && defined CENABLE
-	PSEUDO_PROLOGUE
-#endif
-
-.globl __socket
-ENTRY (__socket)
-	/* This code previously moved sp into ip and stored the args using
-	   stmdb ip!, {a1-a4}.  It did not modify sp, so the stack never had 
-	   to be restored after the syscall completed.  It saved an 
-	   instruction and meant no stack cleanup work was required.
-
-	   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
-	   to socket will be trashed.  The results of a restart of any
-	   socket call are then unpredictable. */
-
-	/* Push args onto the stack.  */
-	P(PUSHARGS_,NARGS)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-#ifdef PIC
-	SINGLE_THREAD_P_PIC(r3)
-#else
-	SINGLE_THREAD_P
-#endif
-	bne 1f
-#endif
-
-        /* Do the system call trap.  */
-	mov a1, $P(SOCKOP_,socket)
-	mov a2, sp
-	swi SYS_ify(socketcall)
-
-	/* Pop args off the stack */
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-1:
-	str lr, [sp, #-4]!
-	CENABLE
-	mov ip, r0
-
-	mov r0, #P(SOCKOP_,socket)
-	add r1, sp, #4
-	swi SYS_ify(socketcall)
-
-	str r0, [sp, #-4]!
-	mov r0, ip
-	CDISABLE
-	ldr r0, [sp], #4
-	ldr lr, [sp], #4
-
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-#endif
-
-PSEUDO_END (__socket)
-
-weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/arm/sys/elf.h b/sysdeps/unix/sysv/linux/arm/sys/elf.h
deleted file mode 100644
index faa7310682..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/elf.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2001 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 _SYS_ELF_H
-#define _SYS_ELF_H	1
-
-#warning "This header is obsolete; use <sys/procfs.h> instead."
-
-#include <sys/procfs.h>
-
-#endif	/* sys/elf.h */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/io.h b/sysdeps/unix/sysv/linux/arm/sys/io.h
deleted file mode 100644
index 68639902c7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/io.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1996, 1998, 1999 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	_SYS_IO_H
-
-#define	_SYS_IO_H	1
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* If TURN_ON is TRUE, request for permission to do direct i/o on the
-   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
-   permission off for that range.  This call requires root privileges.  */
-extern int ioperm (unsigned long int __from, unsigned long int __num,
-		   int __turn_on) __THROW;
-
-/* Set the I/O privilege level to LEVEL.  If LEVEL is nonzero,
-   permission to access any I/O port is granted.  This call requires
-   root privileges. */
-extern int iopl (int __level) __THROW;
-
-/* The functions that actually perform reads and writes.  */
-extern unsigned char inb (unsigned long int port) __THROW;
-extern unsigned short int inw (unsigned long int port) __THROW;
-extern unsigned long int inl (unsigned long int port) __THROW;
-
-extern void outb (unsigned char value, unsigned long int port) __THROW;
-extern void outw (unsigned short value, unsigned long int port) __THROW;
-extern void outl (unsigned long value, unsigned long int port) __THROW;
-
-__END_DECLS
-
-#endif /* _SYS_IO_H */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/procfs.h b/sysdeps/unix/sysv/linux/arm/sys/procfs.h
deleted file mode 100644
index 3b3736324f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/procfs.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2001 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 _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-
-__BEGIN_DECLS
-
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We could have used `struct
-   user_regs' directly in the typedef, but tradition says that
-   the register set is an array, which does have some peculiar
-   semantics, so leave it that way.  */
-#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/* Register set for the floating-point registers.  */
-typedef struct user_fpregs elf_fpregset_t;
-
-/* Signal info.  */
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/user.h b/sysdeps/unix/sysv/linux/arm/sys/user.h
deleted file mode 100644
index 3fae43f83f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/user.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 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 _SYS_USER_H
-#define _SYS_USER_H	1
-
-/* The whole purpose of this file is for GDB and GDB only.  Don't read
-   too much into it.  Don't use it for anything other than GDB unless
-   you know what you are doing.  */
-
-struct user_fpregs
-{
-  struct fp_reg
-  {
-    unsigned int sign1:1;
-    unsigned int unused:15;
-    unsigned int sign2:1;
-    unsigned int exponent:14;
-    unsigned int j:1;
-    unsigned int mantissa1:31;
-    unsigned int mantissa0:32;
-  } fpregs[8];
-  unsigned int fpsr:32;
-  unsigned int fpcr:32;
-  unsigned char ftype[8];
-  unsigned int init_flag;
-};
-
-struct user_regs
-{
-  unsigned long int uregs[18];
-};
-
-struct user
-{
-  struct user_regs regs;	/* General registers */
-  int u_fpvalid;		/* True if math co-processor being used. */
-
-  unsigned long int u_tsize;	/* Text segment size (pages). */
-  unsigned long int u_dsize;	/* Data segment size (pages). */
-  unsigned long int u_ssize;	/* Stack segment size (pages). */
-
-  unsigned long start_code;	/* Starting virtual address of text. */
-  unsigned long start_stack;	/* Starting virtual address of stack. */
-
-  long int signal;     		/* Signal that caused the core dump. */
-  int reserved;			/* No longer used */
-  struct user_regs *u_ar0;	/* help gdb to find the general registers. */
-
-  unsigned long magic;		/* uniquely identify a core file */
-  char u_comm[32];		/* User command that was responsible */
-  int u_debugreg[8];
-  struct user_fpregs u_fp;	/* Floating point registers */
-  struct user_fpregs *u_fp0;	/* help gdb to find the FP registers. */
-};
-
-#endif  /* sys/user.h */
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
deleted file mode 100644
index 1db0030b5b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-syscall		-	syscall		7	syscall
-oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
-oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.S b/sysdeps/unix/sysv/linux/arm/sysdep.S
deleted file mode 100644
index 1a4de2adb3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sysdep.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 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>
-
-	.text
-
-/* The syscall stubs jump here when they detect an error.
-   The code for Linux is almost identical to the canonical Unix
-   code, except that the error number in R0 is negated.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0.  */
-
-ENTRY (__syscall_error)
-	rsb r0, r0, $0
-
-#define __syscall_error __syscall_error_1
-#include <sysdeps/unix/arm/sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h
deleted file mode 100644
index 668aa1a2f1..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Copyright (C) 1992, 93, 1995-2000, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
-   ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
-
-   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 _LINUX_ARM_SYSDEP_H
-#define _LINUX_ARM_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/arm/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#define SWI_BASE  (0x900000)
-#define SYS_ify(syscall_name)	(__NR_##syscall_name)
-
-
-#ifdef __ASSEMBLER__
-
-/* Linux uses a negative return value to indicate syscall errors,
-   unlike most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be
-   negative even if the call succeeded.  E.g., the `lseek' system call
-   might return a large offset.  Therefore we must not anymore test
-   for < 0, but test for a real error by making sure the value in R0
-   is a real error number.  Linus said he will make sure the no syscall
-   returns a value in -1 .. -4095 as a valid result so we can savely
-   test with -4095.  */
-
-#undef	PSEUDO
-#define	PSEUDO(name, syscall_name, args)				      \
-  .text;								      \
-  ENTRY (name);								      \
-    DO_CALL (syscall_name, args);					      \
-    cmn r0, $4096;
-
-#define PSEUDO_RET							      \
-    RETINSTR(cc, lr);							      \
-    b PLTJMP(SYSCALL_ERROR)
-#undef ret
-#define ret PSEUDO_RET
-
-#undef	PSEUDO_END
-#define	PSEUDO_END(name)						      \
-  SYSCALL_ERROR_HANDLER							      \
-  END (name)
-
-#undef	PSEUDO_NOERRNO
-#define	PSEUDO_NOERRNO(name, syscall_name, args)			      \
-  .text;								      \
-  ENTRY (name);								      \
-    DO_CALL (syscall_name, args);
-
-#define PSEUDO_RET_NOERRNO						      \
-    DO_RET (lr);
-
-#undef ret_NOERRNO
-#define ret_NOERRNO PSEUDO_RET_NOERRNO
-
-#undef	PSEUDO_END_NOERRNO
-#define	PSEUDO_END_NOERRNO(name)					      \
-  END (name)
-
-/* The function has to return the error code.  */
-#undef	PSEUDO_ERRVAL
-#define	PSEUDO_ERRVAL(name, syscall_name, args) \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    rsb r0, r0, #0
-
-#undef	PSEUDO_END_ERRVAL
-#define	PSEUDO_END_ERRVAL(name) \
-  END (name)
-
-#define ret_ERRVAL PSEUDO_RET_NOERRNO
-
-#if NOT_IN_libc
-# define SYSCALL_ERROR __local_syscall_error
-# define SYSCALL_ERROR_HANDLER					\
-__local_syscall_error:						\
-	str	lr, [sp, #-4]!;					\
-	str	r0, [sp, #-4]!;					\
-	bl	PLTJMP(C_SYMBOL_NAME(__errno_location)); 	\
-	ldr	r1, [sp], #4;					\
-	rsb	r1, r1, #0;					\
-	str	r1, [r0];					\
-	mvn	r0, #0;						\
-	ldr	pc, [sp], #4;
-#else
-# define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
-# define SYSCALL_ERROR __syscall_error
-#endif
-
-/* Linux takes system call args in registers:
-	syscall number	in the SWI instruction
-	arg 1		r0
-	arg 2		r1
-	arg 3		r2
-	arg 4		r3
-	arg 5		r4	(this is different from the APCS convention)
-	arg 6		r5
-	arg 7		r6
-
-   The compiler is going to form a call by coming here, through PSEUDO, with
-   arguments
-   	syscall number	in the DO_CALL macro
-   	arg 1		r0
-   	arg 2		r1
-   	arg 3		r2
-   	arg 4		r3
-   	arg 5		[sp]
-	arg 6		[sp+4]
-	arg 7		[sp+8]
-
-   We need to shuffle values between R4..R6 and the stack so that the
-   caller's v1..v3 and stack frame are not corrupted, and the kernel
-   sees the right arguments.
-
-*/
-
-#undef	DO_CALL
-#define DO_CALL(syscall_name, args)		\
-    DOARGS_##args				\
-    swi SYS_ify (syscall_name); 		\
-    UNDOARGS_##args
-
-#define DOARGS_0 /* nothing */
-#define DOARGS_1 /* nothing */
-#define DOARGS_2 /* nothing */
-#define DOARGS_3 /* nothing */
-#define DOARGS_4 /* nothing */
-#define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $4];
-#define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmia ip, {r4, r5};
-#define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmia ip, {r4, r5, r6};
-
-#define UNDOARGS_0 /* nothing */
-#define UNDOARGS_1 /* nothing */
-#define UNDOARGS_2 /* nothing */
-#define UNDOARGS_3 /* nothing */
-#define UNDOARGS_4 /* nothing */
-#define UNDOARGS_5 ldr r4, [sp], $4;
-#define UNDOARGS_6 ldmfd sp!, {r4, r5};
-#define UNDOARGS_7 ldmfd sp!, {r4, r5, r6};
-
-#else /* not __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				\
-  ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))	\
-       {								\
-	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
-	 _sys_result = (unsigned int) -1;				\
-       }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)		\
-  ({ unsigned int _sys_result;					\
-     {								\
-       register int _a1 asm ("a1");				\
-       LOAD_ARGS_##nr (args)					\
-       asm volatile ("swi	%1	@ syscall " #name	\
-		     : "=r" (_a1)				\
-		     : "i" (SYS_ify(name)) ASM_ARGS_##nr	\
-		     : "memory");				\
-       _sys_result = _a1;					\
-     }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define LOAD_ARGS_0()
-#define ASM_ARGS_0
-#define LOAD_ARGS_1(a1)				\
-  _a1 = (int) (a1);				\
-  LOAD_ARGS_0 ()
-#define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
-#define LOAD_ARGS_2(a1, a2)			\
-  register int _a2 asm ("a2") = (int) (a2);	\
-  LOAD_ARGS_1 (a1)
-#define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
-#define LOAD_ARGS_3(a1, a2, a3)			\
-  register int _a3 asm ("a3") = (int) (a3);	\
-  LOAD_ARGS_2 (a1, a2)
-#define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
-#define LOAD_ARGS_4(a1, a2, a3, a4)		\
-  register int _a4 asm ("a4") = (int) (a4);	\
-  LOAD_ARGS_3 (a1, a2, a3)
-#define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
-#define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  register int _v1 asm ("v1") = (int) (a5);	\
-  LOAD_ARGS_4 (a1, a2, a3, a4)
-#define ASM_ARGS_5	ASM_ARGS_4, "r" (_v1)
-#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)	\
-  register int _v2 asm ("v2") = (int) (a6);	\
-  LOAD_ARGS_5 (a1, a2, a3, a4, a5)
-#define ASM_ARGS_6	ASM_ARGS_5, "r" (_v2)
-#define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7)	\
-  register int _v3 asm ("v3") = (int) (a7);	\
-  LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6)
-#define ASM_ARGS_7	ASM_ARGS_6, "r" (_v3)
-
-#endif	/* __ASSEMBLER__ */
-
-#endif /* linux/arm/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/arm/versionsort64.c b/sysdeps/unix/sysv/linux/arm/versionsort64.c
deleted file mode 100644
index 144b691e56..0000000000
--- a/sysdeps/unix/sysv/linux/arm/versionsort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
deleted file mode 100644
index 9ef5114b24..0000000000
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-
-#ifdef __NR_vfork
-	swi	__NR_vfork
-	cmn	a1, #4096
-	RETINSTR(cc, lr)
-
-# ifdef __ASSUME_VFORK_SYSCALL
-	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-# else
-	/* Check if vfork syscall is known at all.  */
-	cmn	a2, #ENOSYS
-	bne	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-	swi	__NR_fork
-	cmn	a1, #4096
-	RETINSTR(cc, lr)
-    	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-#elif !defined __NR_vfork
-# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
-#endif
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/arm/xstat.c b/sysdeps/unix/sysv/linux/arm/xstat.c
deleted file mode 100644
index e9869f5508..0000000000
--- a/sysdeps/unix/sysv/linux/arm/xstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/bits/errno.h b/sysdeps/unix/sysv/linux/bits/errno.h
index 724dabaf10..4de8cbba57 100644
--- a/sysdeps/unix/sysv/linux/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux specific version.
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 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,12 +27,17 @@
 /* Linux has no ENOTSUP error code.  */
 # define ENOTSUP EOPNOTSUPP
 
-/* Linux also had no ECANCELED error code.  Since it is not used here
-   we define it to an invalid value.  */
+/* Older Linux versions also had no ECANCELED error code.  */
 # ifndef ECANCELED
 #  define ECANCELED	125
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		130
+#  define ENOTRECOVERABLE	131
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index 9d587897ad..6880a2e636 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -105,13 +105,13 @@ struct in_pktinfo
    The first word in the comment at the right is the data type used;
    "bool" means a boolean value stored in an `int'.  */
 #define IPV6_ADDRFORM		1
-#define IPV6_PKTINFO		2
-#define IPV6_HOPOPTS		3
-#define IPV6_DSTOPTS		4
-#define IPV6_RTHDR		5
-#define IPV6_PKTOPTIONS		6
+#define IPV6_2292PKTINFO	2
+#define IPV6_2292HOPOPTS	3
+#define IPV6_2292DSTOPTS	4
+#define IPV6_2292RTHDR		5
+#define IPV6_2292PKTOPTIONS	6
 #define IPV6_CHECKSUM		7
-#define IPV6_HOPLIMIT		8
+#define IPV6_2292HOPLIMIT	8
 
 #define SCM_SRCRT		IPV6_RXSRCRT
 
@@ -133,6 +133,21 @@ struct in_pktinfo
 #define IPV6_IPSEC_POLICY	34
 #define IPV6_XFRM_POLICY	35
 
+#define IPV6_RECVPKTINFO	49
+#define IPV6_PKTINFO		50
+#define IPV6_RECVHOPLIMIT	51
+#define IPV6_HOPLIMIT		52
+#define IPV6_RECVHOPOPTS	53
+#define IPV6_HOPOPTS		54
+#define IPV6_RTHDRDSTOPTS	55
+#define IPV6_RECVRTHDR		56
+#define IPV6_RTHDR		57
+#define IPV6_RECVDSTOPTS	58
+#define IPV6_DSTOPTS		59
+
+#define IPV6_RECVTCLASS		66
+#define IPV6_TCLASS		67
+
 /* Obsolete synonyms for the above.  */
 #define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
 #define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h
index dccb8b6665..d7996b46c5 100644
--- a/sysdeps/unix/sysv/linux/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 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
@@ -36,8 +36,10 @@
 #endif
 
 #ifdef __USE_GNU
-/* This is an extension for Linux.  */
+/* These are extensions for Linux.  */
 # define POLLMSG	0x400
+# define POLLREMOVE	0x1000
+# define POLLRDHUP	0x2000
 #endif
 
 /* Event types always implicitly polled for.  These bits need not be set in
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index c186a3a5d0..526cdaf53c 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 24495e2b34..4a95a263f7 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -1,6 +1,6 @@
 /* Definitions of constants and data structure for POSIX 1003.1b-1993
    scheduling interface.
-   Copyright (C) 1996-1999,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2001-2003,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
@@ -29,6 +29,9 @@
 #define SCHED_OTHER	0
 #define SCHED_FIFO	1
 #define SCHED_RR	2
+#ifdef __USE_GNU
+# define SCHED_BATCH	3
+#endif
 
 #ifdef __USE_MISC
 /* Cloning flags.  */
@@ -66,10 +69,13 @@ struct sched_param
 
 __BEGIN_DECLS
 
-/* Clone current process.  */
 #ifdef __USE_MISC
+/* Clone current process.  */
 extern int clone (int (*__fn) (void *__arg), void *__child_stack,
-		  int __flags, void *__arg) __THROW;
+		  int __flags, void *__arg, ...) __THROW;
+
+/* Unshare the specified resources.  */
+extern int unshare (int __flags) __THROW;
 #endif
 
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 225b89db2d..318d601aed 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -73,6 +73,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 77e9b83c92..356a2ece74 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,1992,1994-2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1994-2001,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
@@ -221,7 +221,10 @@ struct msghdr
     size_t msg_iovlen;		/* Number of elements in the vector.  */
 
     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    size_t msg_controllen;	/* Ancillary data buffer length.  */
+    size_t msg_controllen;	/* Ancillary data buffer length.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
 
     int msg_flags;		/* Flags on received message.  */
   };
@@ -230,7 +233,10 @@ struct msghdr
 struct cmsghdr
   {
     size_t cmsg_len;		/* Length of data in cmsg_data plus length
-				   of cmsghdr structure.  */
+				   of cmsghdr structure.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
 #if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 1b71f60faf..c71e4ad1fe 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  Linux version.
-   Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2003
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -172,6 +172,7 @@ struct termios
 #define __MAX_BAUD B4000000
 #ifdef __USE_MISC
 # define CIBAUD	  002003600000		/* input baud rate (not used) */
+# define CMSPAR   010000000000		/* mark or space (stick) parity */
 # define CRTSCTS  020000000000		/* flow control */
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
index 84b4805fe8..6a283ed771 100644
--- a/sysdeps/unix/sysv/linux/bits/uio.h
+++ b/sysdeps/unix/sysv/linux/bits/uio.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 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
@@ -16,10 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _SYS_UIO_H
+#if !defined _SYS_UIO_H && !defined _FCNTL_H
 # error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
 #endif
 
+#ifndef _BITS_UIO_H
+#define _BITS_UIO_H	1
 
 #include <sys/types.h>
 
@@ -31,7 +33,7 @@
 /* Size of object which can be written atomically.
 
    This macro has different values in different kernel versions.  The
-   latest versions of ther kernel use 1024 and this is good choice.  Since
+   latest versions of the kernel use 1024 and this is good choice.  Since
    the C library implementation of readv/writev is able to emulate the
    functionality even if the currently running kernel does not support
    this large value the readv/writev call will not fail because of this.  */
@@ -44,3 +46,5 @@ struct iovec
     void *iov_base;	/* Pointer to data.  */
     size_t iov_len;	/* Length of data.  */
   };
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h
index e3f80f6814..464cedb1fc 100644
--- a/sysdeps/unix/sysv/linux/bits/waitflags.h
+++ b/sysdeps/unix/sysv/linux/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996, 1997, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1992,1996,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
@@ -32,5 +32,7 @@
 #define WCONTINUED	8	/* Report continued child.  */
 #define WNOWAIT		0x01000000 /* Don't reap, just poll status.  */
 
+#define __WNOTHREAD     0x20000000 /* Don't wait on children of other threads
+				      in this group */
 #define __WALL		0x40000000 /* Wait for any child.  */
 #define __WCLONE	0x80000000 /* Wait for cloned process.  */
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 69924769bc..46161a806a 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,9 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
 #include <netdb.h>
+#include <stddef.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
@@ -29,16 +31,30 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "kernel-features.h"
+#include <not-cancel.h>
+#include <kernel-features.h>
+
+
+#ifndef IFA_F_TEMPORARY
+# define IFA_F_TEMPORARY IFA_F_SECONDARY
+#endif
+#ifndef IFA_F_HOMEADDRESS
+# define IFA_F_HOMEADDRESS 0
+#endif
 
 
 static int
-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
+make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
+	      struct in6addrinfo **in6ai, size_t *in6ailen)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    /* struct rtgenmsg consists of a single byte.  This means there
+       are three bytes of padding included in the REQ definition.
+       We make them explicit here.  */
+    char pad[3];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -49,20 +65,50 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
   req.nlh.nlmsg_seq = time (NULL);
   req.g.rtgen_family = AF_UNSPEC;
 
+  assert (sizeof (req) - offsetof (struct req, pad) == 3);
+  memset (req.pad, '\0', sizeof (req.pad));
+
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
   if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0,
 				    (struct sockaddr *) &nladdr,
 				    sizeof (nladdr))) < 0)
-    return -1;
+    goto out_fail;
 
   *seen_ipv4 = false;
   *seen_ipv6 = false;
 
   bool done = false;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
+  struct in6ailist
+  {
+    struct in6addrinfo info;
+    struct in6ailist *next;
+  } *in6ailist = NULL;
+  size_t in6ailistlen = 0;
 
   do
     {
@@ -76,10 +122,10 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 
       ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
       if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+	goto out_fail;
 
       struct nlmsghdr *nlmh;
       for (nlmh = (struct nlmsghdr *) buf;
@@ -101,6 +147,47 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 		  break;
 		case AF_INET6:
 		  *seen_ipv6 = true;
+
+		  if (ifam->ifa_flags & (IFA_F_DEPRECATED
+					 | IFA_F_TEMPORARY
+					 | IFA_F_HOMEADDRESS))
+		    {
+		      struct rtattr *rta = IFA_RTA (ifam);
+		      size_t len = (nlmh->nlmsg_len
+				    - NLMSG_LENGTH (sizeof (*ifam)));
+		      void *local = NULL;
+		      void *address = NULL;
+		      while (RTA_OK (rta, len))
+			{
+			  switch (rta->rta_type)
+			    {
+			    case IFA_LOCAL:
+			      local = RTA_DATA (rta);
+			      break;
+
+			    case IFA_ADDRESS:
+			      address = RTA_DATA (rta);
+			      break;
+			    }
+
+			  rta = RTA_NEXT (rta, len);
+			}
+
+		      struct in6ailist *newp = alloca (sizeof (*newp));
+		      newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED)
+					   ? in6ai_deprecated : 0)
+					  | ((ifam->ifa_flags
+					      & IFA_F_TEMPORARY)
+					     ? in6ai_temporary : 0)
+					  | ((ifam->ifa_flags
+					      & IFA_F_HOMEADDRESS)
+					     ? in6ai_homeaddress : 0));
+		      memcpy (newp->info.addr, address ?: local,
+			      sizeof (newp->info.addr));
+		      newp->next = in6ailist;
+		      in6ailist = newp;
+		      ++in6ailistlen;
+		    }
 		  break;
 		default:
 		  /* Ignore.  */
@@ -110,14 +197,36 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 	  else if (nlmh->nlmsg_type == NLMSG_DONE)
 	    /* We found the end, leave the loop.  */
 	    done = true;
-	  else ;
 	}
     }
   while (! done);
 
-  __close (fd);
+  close_not_cancel_no_status (fd);
+
+  if (in6ailist != NULL)
+    {
+      *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
+      if (*in6ai == NULL)
+	goto out_fail;
+
+      *in6ailen = in6ailistlen;
 
+      do
+	{
+	  (*in6ai)[--in6ailistlen] = in6ailist->info;
+	  in6ailist = in6ailist->next;
+	}
+      while (in6ailist != NULL);
+    }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -133,8 +242,12 @@ extern int __no_netlink_support attribute_hidden;
 
 void
 attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+	    struct in6addrinfo **in6ai, size_t *in6ailen)
 {
+  *in6ai = NULL;
+  *in6ailen = 0;
+
   if (! __no_netlink_support)
     {
       int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
@@ -148,7 +261,8 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       if (fd >= 0
 	  && __bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
 	  && __getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0
-	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6) == 0)
+	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6,
+			   in6ai, in6ailen) == 0)
 	/* It worked.  */
 	return;
 
@@ -178,9 +292,6 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       return;
     }
 
-  *seen_ipv4 = false;
-  *seen_ipv6 = false;
-
   struct ifaddrs *runp;
   for (runp = ifa; runp != NULL; runp = runp->ifa_next)
     if (runp->ifa_addr->sa_family == PF_INET)
diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
new file mode 100644
index 0000000000..04bf49e45f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -0,0 +1,103 @@
+/* clock_getcpuclockid -- Get a clockid_t for process CPU time.  Linux version.
+   Copyright (C) 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
+   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 <time.h>
+#include <unistd.h>
+#include <kernel-features.h>
+#include "kernel-posix-cpu-timers.h"
+
+#ifndef HAS_CPUCLOCK
+# define HAS_CPUCLOCK 1
+#endif
+
+int
+clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
+{
+#ifdef __NR_clock_getres
+  /* The clockid_t value is a simple computation from the PID.
+     But we do a clock_getres call to validate it.  */
+
+  const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED);
+
+# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
+  extern int __libc_missing_posix_cpu_timers attribute_hidden;
+#  if !(__ASSUME_POSIX_TIMERS > 0)
+  extern int __libc_missing_posix_timers attribute_hidden;
+  if (__libc_missing_posix_timers && !__libc_missing_posix_cpu_timers)
+    __libc_missing_posix_cpu_timers = 1;
+#  endif
+  if (!__libc_missing_posix_cpu_timers)
+# endif
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	{
+	  *clock_id = pidclock;
+	  return 0;
+	}
+
+# if !(__ASSUME_POSIX_TIMERS > 0)
+      if (INTERNAL_SYSCALL_ERRNO (r, err) == ENOSYS)
+	{
+	  /* The kernel doesn't support these calls at all.  */
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	}
+      else
+# endif
+	if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
+	  {
+# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
+	    if (pidclock == MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED)
+		|| INTERNAL_SYSCALL_ERROR_P (INTERNAL_SYSCALL
+					     (clock_getres, err, 2,
+					      MAKE_PROCESS_CPUCLOCK
+					      (0, CPUCLOCK_SCHED), NULL),
+					     err))
+	      /* The kernel doesn't support these clocks at all.  */
+	      __libc_missing_posix_cpu_timers = 1;
+	    else
+# endif
+	      /* The clock_getres system call checked the PID for us.  */
+	      return ESRCH;
+	  }
+	else
+	  return INTERNAL_SYSCALL_ERRNO (r, err);
+    }
+#endif
+
+  /* We don't allow any process ID but our own.  */
+  if (pid != 0 && pid != getpid ())
+    return EPERM;
+
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+  if (HAS_CPUCLOCK)
+    {
+      /* Store the number.  */
+      *clock_id = CLOCK_PROCESS_CPUTIME_ID;
+
+      return 0;
+    }
+#endif
+
+  /* We don't have a timer for that.  */
+  return ENOENT;
+}
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 442fbd5705..813d3ebbf9 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
+   Copyright (C) 2003,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
@@ -17,60 +18,176 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <errno.h>
+#include <time.h>
+#include "kernel-posix-cpu-timers.h"
+#include <kernel-features.h>
 
-#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_VSYSCALL (clock_getres, 2, clock_id, res); \
+  break
 
 #ifdef __ASSUME_POSIX_TIMERS
+
 /* This means the REALTIME and MONOTONIC clock are definitely
    supported in the kernel.  */
-# define SYSDEP_GETRES \
+# define SYSDEP_GETRES							      \
+  SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    retval = INLINE_SYSCALL (clock_getres, 2, clock_id, res);		      \
-    break
+    SYSCALL_GETRES
+
+# define __libc_missing_posix_timers 0
 #elif defined __NR_clock_getres
 /* Is the syscall known to exist?  */
 extern int __libc_missing_posix_timers attribute_hidden;
 
+static inline int
+maybe_syscall_getres (clockid_t clock_id, struct timespec *res)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  e = EINVAL;
+	}
+    }
+
+  return e;
+}
+
 /* The REALTIME and MONOTONIC clock might be available.  Try the
    syscall first.  */
-# define SYSDEP_GETRES \
+# define SYSDEP_GETRES							      \
+  SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    {									      \
-      int e = EINVAL;							      \
-									      \
-      if (!__libc_missing_posix_timers)					      \
-	{								      \
-	  INTERNAL_SYSCALL_DECL (err);					      \
-	  int r = INTERNAL_SYSCALL (clock_getres, err, 2, clock_id, res);     \
-	  if (!INTERNAL_SYSCALL_ERROR_P (r, err))			      \
-	    {								      \
-	      retval = 0;						      \
-	      break;							      \
-	    }								      \
-									      \
-	  e = INTERNAL_SYSCALL_ERRNO (r, err);				      \
-	  if (e == ENOSYS)						      \
-	    {								      \
-	      __libc_missing_posix_timers = 1;				      \
-	      e = EINVAL;						      \
-	    }								      \
-	}								      \
-									      \
-      /* Fallback code.  */						      \
-      if (e == EINVAL && clock_id == CLOCK_REALTIME)			      \
-	HANDLE_REALTIME;						      \
-      else								      \
-	__set_errno (e);						      \
-    }									      \
-    break
+    retval = maybe_syscall_getres (clock_id, res);			      \
+    if (retval == 0)							      \
+      break;								      \
+    /* Fallback code.  */						      \
+    if (retval == EINVAL && clock_id == CLOCK_REALTIME)			      \
+      retval = realtime_getres (res);					      \
+    else								      \
+      {									      \
+	__set_errno (retval);						      \
+	retval = -1;							      \
+      }									      \
+    break;
 #endif
 
 #ifdef __NR_clock_getres
 /* We handled the REALTIME clock here.  */
 # define HANDLED_REALTIME	1
+# define HANDLED_CPUTIME	1
+
+# if __ASSUME_POSIX_CPU_TIMERS > 0
+
+#  define SYSDEP_GETRES_CPU SYSCALL_GETRES
+#  define SYSDEP_GETRES_CPUTIME	/* Default catches them too.  */
+
+# else
+
+extern int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				    NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+
+#  define SYSDEP_GETRES_CPU						      \
+  retval = maybe_syscall_getres_cpu (clock_id, res);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  retval = -1 /* Otherwise continue on to the HP_TIMING version.  */;
+
+static inline int
+maybe_syscall_getres_cputime (clockid_t clock_id, struct timespec *res)
+{
+  return maybe_syscall_getres_cpu
+    (clock_id == CLOCK_THREAD_CPUTIME_ID
+     ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
+     : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+     res);
+}
+
+#  define SYSDEP_GETRES_CPUTIME						      \
+    case CLOCK_PROCESS_CPUTIME_ID:					      \
+    case CLOCK_THREAD_CPUTIME_ID:					      \
+      retval = maybe_syscall_getres_cputime (clock_id, res);		      \
+      if (retval == 0)							      \
+	break;								      \
+      if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+	{								      \
+	  __set_errno (retval);						      \
+	  retval = -1;							      \
+	  break;							      \
+	}								      \
+      retval = hp_timing_getres (res);					      \
+      break;
+#  if !HP_TIMING_AVAIL
+#   define hp_timing_getres(res) (__set_errno (EINVAL), -1)
+#  endif
+
+# endif
 #endif
 
 #include <sysdeps/posix/clock_getres.c>
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 522fac32a7..5afe20feb5 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* clock_gettime -- Get current time from a POSIX clockid_t.  Linux version.
+   Copyright (C) 2003,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
@@ -17,60 +18,176 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <errno.h>
+#include <time.h>
+#include "kernel-posix-cpu-timers.h"
+#include <kernel-features.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_VSYSCALL (clock_gettime, 2, clock_id, tp); \
+  break
 
 #ifdef __ASSUME_POSIX_TIMERS
+
 /* This means the REALTIME and MONOTONIC clock are definitely
    supported in the kernel.  */
-# define SYSDEP_GETTIME \
+# define SYSDEP_GETTIME							      \
+  SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    retval = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp);		      \
-    break
+    SYSCALL_GETTIME
+
+# define __libc_missing_posix_timers 0
 #elif defined __NR_clock_gettime
 /* Is the syscall known to exist?  */
 int __libc_missing_posix_timers attribute_hidden;
 
+static inline int
+maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  e = EINVAL;
+	}
+    }
+
+  return e;
+}
+
 /* The REALTIME and MONOTONIC clock might be available.  Try the
    syscall first.  */
-# define SYSDEP_GETTIME \
+# define SYSDEP_GETTIME							      \
+  SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    {									      \
-      int e = EINVAL;							      \
-									      \
-      if (!__libc_missing_posix_timers)					      \
-	{								      \
-	  INTERNAL_SYSCALL_DECL (err);					      \
-	  int r = INTERNAL_SYSCALL (clock_gettime, err, 2, clock_id, tp);     \
-	  if (!INTERNAL_SYSCALL_ERROR_P (r, err))			      \
-	    {								      \
-	      retval = 0;						      \
-	      break;							      \
-	    }								      \
-									      \
-	  e = INTERNAL_SYSCALL_ERRNO (r, err);				      \
-	  if (e == ENOSYS)						      \
-	    {								      \
-	      __libc_missing_posix_timers = 1;				      \
-	      e = EINVAL;						      \
-	    }								      \
-	}								      \
-									      \
-      /* Fallback code.  */						      \
-      if (e == EINVAL && clock_id == CLOCK_REALTIME)			      \
-	HANDLE_REALTIME;						      \
-      else								      \
-	__set_errno (e);						      \
-    }									      \
-    break
+    retval = maybe_syscall_gettime (clock_id, tp);			      \
+    if (retval == 0)							      \
+      break;								      \
+    /* Fallback code.  */						      \
+    if (retval == EINVAL && clock_id == CLOCK_REALTIME)			      \
+      retval = realtime_gettime (tp);					      \
+    else 								      \
+      {									      \
+	__set_errno (retval);						      \
+	retval = -1;							      \
+      }									      \
+    break;
 #endif
 
 #ifdef __NR_clock_gettime
 /* We handled the REALTIME clock here.  */
 # define HANDLED_REALTIME	1
+# define HANDLED_CPUTIME	1
+
+# if __ASSUME_POSIX_CPU_TIMERS > 0
+
+#  define SYSDEP_GETTIME_CPU SYSCALL_GETTIME
+#  define SYSDEP_GETTIME_CPUTIME	/* Default catches them too.  */
+
+# else
+
+int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				    NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+
+#  define SYSDEP_GETTIME_CPU						      \
+  retval = maybe_syscall_gettime_cpu (clock_id, tp);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  retval = -1 /* Otherwise continue on to the HP_TIMING version.  */;
+
+static inline int
+maybe_syscall_gettime_cputime (clockid_t clock_id, struct timespec *tp)
+{
+  return maybe_syscall_gettime_cpu
+    (clock_id == CLOCK_THREAD_CPUTIME_ID
+     ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
+     : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+     tp);
+}
+
+#  define SYSDEP_GETTIME_CPUTIME					      \
+    case CLOCK_PROCESS_CPUTIME_ID:					      \
+    case CLOCK_THREAD_CPUTIME_ID:					      \
+      retval = maybe_syscall_gettime_cputime (clock_id, tp);		      \
+      if (retval == 0)							      \
+	break;								      \
+      if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+	{								      \
+	  __set_errno (retval);						      \
+	  retval = -1;							      \
+	  break;							      \
+	}								      \
+      retval = hp_timing_gettime (clock_id, tp);			      \
+      break;
+#  if !HP_TIMING_AVAIL
+#   define hp_timing_gettime(clock_id, tp) (__set_errno (EINVAL), -1)
+#  endif
+
+# endif
 #endif
 
 #include <sysdeps/unix/clock_gettime.c>
diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 2a3dd411a1..7645262cee 100644
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -17,9 +17,11 @@
    02111-1307 USA.  */
 
 #include <time.h>
+#include <errno.h>
 
 #include <sysdep-cancel.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
+#include "kernel-posix-cpu-timers.h"
 
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -32,6 +34,11 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
   INTERNAL_SYSCALL_DECL (err);
   int r;
 
+  if (clock_id == CLOCK_THREAD_CPUTIME_ID)
+    return EINVAL;
+  if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
+    clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
+
   if (SINGLE_THREAD_P)
     r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem);
   else
@@ -58,12 +65,20 @@ extern int __libc_missing_posix_timers attribute_hidden;
 #  define SYSDEP_NANOSLEEP \
   if (!__libc_missing_posix_timers)					      \
     {									      \
+      clockid_t syscall_clockid;					      \
       INTERNAL_SYSCALL_DECL (err);					      \
 									      \
+      if (clock_id == CLOCK_THREAD_CPUTIME_ID)				      \
+	return EINVAL;							      \
+      if (clock_id == CLOCK_PROCESS_CPUTIME_ID)				      \
+	syscall_clockid = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);	      \
+      else								      \
+	syscall_clockid = clock_id;					      \
+									      \
       int oldstate = LIBC_CANCEL_ASYNC ();				      \
 									      \
-      int r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags,     \
-				req, rem);				      \
+      int r = INTERNAL_SYSCALL (clock_nanosleep, err, 4,		      \
+				syscall_clockid, flags, req, rem);	      \
 									      \
       LIBC_CANCEL_RESET (oldstate);					      \
 									      \
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index 5d19a09bf8..217ae3f29b 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -16,9 +16,64 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include "kernel-posix-cpu-timers.h"
+#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
+
+#if __ASSUME_POSIX_CPU_TIMERS <= 0 && defined __NR_clock_settime
+extern int __libc_missing_posix_timers attribute_hidden;
+extern int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_settime_cpu (clockid_t clock_id, const struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_SYSCALL (clock_settime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+        return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				     MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				     NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+#endif
 
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -73,4 +128,22 @@ extern int __libc_missing_posix_timers attribute_hidden;
 # define HANDLED_REALTIME	1
 #endif
 
+#if __ASSUME_POSIX_CPU_TIMERS > 0
+# define HANDLED_CPUTIME 1
+# define SYSDEP_SETTIME_CPU \
+  retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp)
+#elif defined __NR_clock_settime
+# define SYSDEP_SETTIME_CPU \
+  retval = maybe_syscall_settime_cpu (clock_id, tp);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  do { } while (0)
+#endif
+
 #include <sysdeps/unix/clock_settime.c>
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index d059143396..a8a9cc4702 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -115,10 +115,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -138,6 +134,10 @@ case "$machine" in
     arch_minimum_kernel=2.3.99
     libc_cv_gcc_unwind_find_fde=yes
     ;;
+  sparc/sparc64*)
+    libc_cv_gcc_unwind_find_fde=yes
+    arch_minimum_kernel=2.4.21
+    ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -224,10 +224,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -235,14 +237,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -257,38 +251,29 @@ case "$prefix" in
   ;;
 esac
 
-# Under Linux the LinuxThreads or NPTL add-on should be available.
+# Under Linux the NPTL add-on should be available.
 case $add_ons in
-  # Only one of the add-ons should be available.
-  *linuxthreads*nptl*|*nptl*linuxthreads*)
-    echo "\
-*** LinuxThreads and NPTL add-ons are both available.  Only one must be used."
-    exit 1
-    ;;
   # It is available.  Good.
-  *linuxthreads*)
-    linuxthreads_missing=
-    ;;
   *nptl*)
-    linuxthreads_missing=
+    nptl_missing=
     ;;
   *)
-    linuxthreads_missing=yes
+    nptl_missing=yes
     ;;
 esac
 
-if test "$linuxthreads_missing"; then
+if test "$nptl_missing"; then
   if test $enable_sanity = yes; then
     echo "\
 *** On GNU/Linux systems it is normal to compile GNU libc with the
-*** \`linuxthreads' add-on.  Without that, the library will be
+*** \`nptl' add-on.  Without that, the library will be
 *** incompatible with normal GNU/Linux systems.
 *** If you really mean to not use this add-on, run configure again
 *** using the extra parameter \`--disable-sanity-checks'."
     exit 1
   else
     echo "\
-*** WARNING: Are you sure you do not want to use the \`linuxthreads'
+*** WARNING: Are you sure you do not want to use the \`nptl'
 *** add-on?"
   fi
 fi
@@ -322,9 +307,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index e3fccb4c9b..43681f3251 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -75,10 +75,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -98,6 +94,10 @@ case "$machine" in
     arch_minimum_kernel=2.3.99
     libc_cv_gcc_unwind_find_fde=yes
     ;;
+  sparc/sparc64*)
+    libc_cv_gcc_unwind_find_fde=yes
+    arch_minimum_kernel=2.4.21
+    ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -159,10 +159,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -170,14 +172,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -192,38 +186,29 @@ case "$prefix" in
   ;;
 esac
 
-# Under Linux the LinuxThreads or NPTL add-on should be available.
+# Under Linux the NPTL add-on should be available.
 case $add_ons in
-  # Only one of the add-ons should be available.
-  *linuxthreads*nptl*|*nptl*linuxthreads*)
-    echo "\
-*** LinuxThreads and NPTL add-ons are both available.  Only one must be used."
-    exit 1
-    ;;
   # It is available.  Good.
-  *linuxthreads*)
-    linuxthreads_missing=
-    ;;
   *nptl*)
-    linuxthreads_missing=
+    nptl_missing=
     ;;
   *)
-    linuxthreads_missing=yes
+    nptl_missing=yes
     ;;
 esac
 
-if test "$linuxthreads_missing"; then
+if test "$nptl_missing"; then
   if test $enable_sanity = yes; then
     echo "\
 *** On GNU/Linux systems it is normal to compile GNU libc with the
-*** \`linuxthreads' add-on.  Without that, the library will be
+*** \`nptl' add-on.  Without that, the library will be
 *** incompatible with normal GNU/Linux systems.
 *** If you really mean to not use this add-on, run configure again
 *** using the extra parameter \`--disable-sanity-checks'."
     exit 1
   else
     echo "\
-*** WARNING: Are you sure you do not want to use the \`linuxthreads'
+*** WARNING: Are you sure you do not want to use the \`nptl'
 *** add-on?"
   fi
 fi
@@ -257,9 +242,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/device-nrs.h b/sysdeps/unix/sysv/linux/device-nrs.h
index 6b6578ec5f..b30c1dbede 100644
--- a/sysdeps/unix/sysv/linux/device-nrs.h
+++ b/sysdeps/unix/sysv/linux/device-nrs.h
@@ -1,5 +1,5 @@
 /* Device numbers of devices used in the implementation.  Linux version.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 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
@@ -26,6 +26,10 @@
 #define DEV_NULL_MAJOR	1
 #define DEV_NULL_MINOR	3
 
+/* /dev/full is (1,7).  */
+#define DEV_FULL_MAJOR	1
+#define DEV_FULL_MINOR	7
+
 /* Pseudo tty slaves.  For Linux we use the Unix98 ttys.  We could
    also include the old BSD-style tty buts they should not be used and
    the extra test would only slow down correctly set up systems.  If a
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c
index 6ef9679045..fcac5ae240 100644
--- a/sysdeps/unix/sysv/linux/dl-execstack.c
+++ b/sysdeps/unix/sysv/linux/dl-execstack.c
@@ -1,5 +1,5 @@
 /* Stack executability handling for GNU dynamic linker.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 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
@@ -24,8 +24,9 @@
 #include <stdbool.h>
 #include <stackinfo.h>
 #include <caller.h>
+#include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern int __stack_prot attribute_relro attribute_hidden;
@@ -38,6 +39,7 @@ _dl_make_stack_executable (void **stack_endp)
   /* This gives us the highest/lowest page that needs to be changed.  */
   uintptr_t page = ((uintptr_t) *stack_endp
 		    & -(intptr_t) GLRO(dl_pagesize));
+  int result = 0;
 
   /* Challenge the caller.  */
   if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
@@ -60,7 +62,10 @@ _dl_make_stack_executable (void **stack_endp)
 	no_growsupdown = true;
       else
 # endif
-	return errno;
+	{
+	  result = errno;
+	  goto out;
+	}
     }
 #endif
 
@@ -85,7 +90,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the top hole page and failed.
@@ -108,7 +116,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the lowest hole page and failed.
@@ -133,6 +144,11 @@ _dl_make_stack_executable (void **stack_endp)
   /* Remember that we changed the permission.  */
   GL(dl_stack_flags) |= PF_X;
 
-  return 0;
+ out:
+#ifdef check_consistency
+  check_consistency ();
+#endif
+
+  return result;
 }
 rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index abc67fcdcf..3c93218dfc 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -1,5 +1,5 @@
-/* Operating system specific code  for generic dynamic loader functions.
-   Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Operating system specific code for generic dynamic loader functions.  Linux.
+   Copyright (C) 2000,2001,2002,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
@@ -18,10 +18,14 @@
    02111-1307 USA.  */
 
 #include <string.h>
+#include <errno.h>
 #include <fcntl.h>
-#include <sys/sysctl.h>
 #include <sys/utsname.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
+#include <dl-sysdep.h>
+#include <stdint.h>
+#include <hp-timing.h>
+#include <endian.h>
 
 #ifndef MIN
 # define MIN(a,b) (((a)<(b))?(a):(b))
@@ -39,71 +43,167 @@ dl_fatal (const char *str)
 }
 #endif
 
+static inline int __attribute__ ((always_inline))
+_dl_discover_osversion (void)
+{
+#if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED
+  if (GLRO(dl_sysinfo_map) != NULL)
+    {
+      /* If the kernel-supplied DSO contains a note indicating the kernel's
+	 version, we don't need to call uname or parse any strings.  */
+
+      static const struct
+      {
+	ElfW(Word) vendorlen;
+	ElfW(Word) datalen;
+	ElfW(Word) type;
+	char vendor[8];
+      } expected_note = { sizeof "Linux", sizeof (ElfW(Word)), 0, "Linux" };
+      const ElfW(Phdr) *const phdr = GLRO(dl_sysinfo_map)->l_phdr;
+      const ElfW(Word) phnum = GLRO(dl_sysinfo_map)->l_phnum;
+      for (uint_fast16_t i = 0; i < phnum; ++i)
+	if (phdr[i].p_type == PT_NOTE)
+	  {
+	    const ElfW(Addr) start = (phdr[i].p_vaddr
+				      + GLRO(dl_sysinfo_map)->l_addr);
+	    const struct
+	    {
+	      ElfW(Word) vendorlen;
+	      ElfW(Word) datalen;
+	      ElfW(Word) type;
+	    } *note = (const void *) start;
+	    while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz)
+	      {
+		if (!memcmp (note, &expected_note, sizeof expected_note))
+		  return *(const ElfW(Word) *) ((const void *) note
+						+ sizeof expected_note);
+#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
+		note = ((const void *) (note + 1)
+			+ ROUND (note->vendorlen) + ROUND (note->datalen));
+	      }
+	  }
+    }
+#endif
+
+  char bufmem[64];
+  char *buf = bufmem;
+  unsigned int version;
+  int parts;
+  char *cp;
+  struct utsname uts;
+
+  /* Try the uname system call.  */
+  if (__uname (&uts))
+    {
+      /* This was not successful.  Now try reading the /proc filesystem.  */
+      int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);
+      if (fd < 0)
+	return -1;
+      ssize_t reslen = __read (fd, bufmem, sizeof (bufmem));
+      __close (fd);
+      if (reslen <= 0)
+	/* This also didn't work.  We give up since we cannot
+	   make sure the library can actually work.  */
+	return -1;
+      buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0';
+    }
+  else
+    buf = uts.release;
+
+  /* Now convert it into a number.  The string consists of at most
+     three parts.  */
+  version = 0;
+  parts = 0;
+  cp = buf;
+  while ((*cp >= '0') && (*cp <= '9'))
+    {
+      unsigned int here = *cp++ - '0';
+
+      while ((*cp >= '0') && (*cp <= '9'))
+	{
+	  here *= 10;
+	  here += *cp++ - '0';
+	}
 
-#define DL_SYSDEP_OSCHECK(FATAL) \
+      ++parts;
+      version <<= 8;
+      version |= here;
+
+      if (*cp++ != '.')
+	/* Another part following?  */
+	break;
+    }
+
+  if (parts < 3)
+    version <<= 8 * (3 - parts);
+
+  return version;
+}
+
+#define DL_SYSDEP_OSCHECK(FATAL)					      \
   do {									      \
-    /* Test whether the kernel is new enough.  This test is only	      \
-       performed if the library is not compiled to run on all		      \
-       kernels.  */							      \
-    if (__LINUX_KERNEL_VERSION > 0)					      \
-      {									      \
-	char bufmem[64];						      \
-	char *buf = bufmem;						      \
-	unsigned int version;						      \
-	int parts;							      \
-	char *cp;							      \
-	struct utsname uts;						      \
-									      \
-	/* Try the uname syscall */					      \
-	if (__uname (&uts))					      	      \
-	  {							      	      \
-	    /* This was not successful.  Now try reading the /proc	      \
-	       filesystem.  */						      \
-	    ssize_t reslen;						      \
-	    int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);	      \
-	    if (fd == -1						      \
-		|| (reslen = __read (fd, bufmem, sizeof (bufmem))) <= 0)      \
-  	      /* This also didn't work.  We give up since we cannot	      \
-		 make sure the library can actually work.  */		      \
-	      FATAL ("FATAL: cannot determine kernel version\n");	      \
-	    __close (fd);						      \
-	    buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0';	      \
-	  }								      \
-	else								      \
-          buf = uts.release;						      \
+    /* Test whether the kernel is new enough.  This test is only performed    \
+       if the library is not compiled to run on all kernels.  */	      \
 									      \
-	/* Now convert it into a number.  The string consists of at most      \
-	   three parts.  */						      \
-	version = 0;							      \
-	parts = 0;							      \
-	cp = buf;							      \
-	while ((*cp >= '0') && (*cp <= '9'))				      \
-	  {								      \
-	    unsigned int here = *cp++ - '0';				      \
-									      \
-	    while ((*cp >= '0') && (*cp <= '9'))			      \
-	      {								      \
-		here *= 10;						      \
-		here += *cp++ - '0';					      \
-	      }								      \
-									      \
-	    ++parts;							      \
-	    version <<= 8;						      \
-	    version |= here;						      \
-									      \
-	    if (*cp++ != '.')						      \
-	      /* Another part following?  */				      \
-	      break;							      \
-	  }								      \
-									      \
-	if (parts < 3)							      \
-	  version <<= 8 * (3 - parts);					      \
+    int version = _dl_discover_osversion ();				      \
+    if (__builtin_expect (version >= 0, 1))				      \
+      {									      \
+	if (__builtin_expect (GLRO(dl_osversion) == 0, 1)		      \
+	    || GLRO(dl_osversion) > version)				      \
+	  GLRO(dl_osversion) = version;					      \
 									      \
 	/* Now we can test with the required version.  */		      \
-	if (version < __LINUX_KERNEL_VERSION)				      \
+	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
 	  /* Not sufficent.  */						      \
 	  FATAL ("FATAL: kernel too old\n");				      \
-									      \
-	GLRO(dl_osversion) = version;					      \
       }									      \
+    else if (__LINUX_KERNEL_VERSION > 0)				      \
+      FATAL ("FATAL: cannot determine kernel version\n");		      \
   } while (0)
+
+static inline uintptr_t __attribute__ ((always_inline))
+_dl_setup_stack_chk_guard (void)
+{
+  uintptr_t ret;
+#ifdef ENABLE_STACKGUARD_RANDOMIZE
+  int fd = __open ("/dev/urandom", O_RDONLY);
+  if (fd >= 0)
+    {
+      ssize_t reslen = __read (fd, &ret, sizeof (ret));
+      __close (fd);
+      if (reslen == (ssize_t) sizeof (ret))
+	return ret;
+    }
+#endif
+  ret = 0;
+  unsigned char *p = (unsigned char *) &ret;
+  p[sizeof (ret) - 1] = 255;
+  p[sizeof (ret) - 2] = '\n';
+#ifdef HP_TIMING_NOW
+  hp_timing_t hpt;
+  HP_TIMING_NOW (hpt);
+  hpt = (hpt & 0xffff) << 8;
+  ret ^= hpt;
+#endif
+  uintptr_t stk;
+  /* Avoid GCC being too smart.  */
+  asm ("" : "=r" (stk) : "r" (p));
+  stk &= 0x7ffff0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+  stk <<= (__WORDSIZE - 23);
+#elif __WORDSIZE == 64
+  stk <<= 31;
+#endif
+  ret ^= stk;
+  /* Avoid GCC being too smart.  */
+  p = (unsigned char *) &errno;
+  asm ("" : "=r" (stk) : "r" (p));
+  stk &= 0x7fff00;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+  stk <<= (__WORDSIZE - 29);
+#else
+  stk >>= 8;
+#endif
+  ret ^= stk;
+  return ret;
+}
diff --git a/sysdeps/unix/sysv/linux/dl-sbrk.c b/sysdeps/unix/sysv/linux/dl-sbrk.c
index 4713a92694..1ce5cb188c 100644
--- a/sysdeps/unix/sysv/linux/dl-sbrk.c
+++ b/sysdeps/unix/sysv/linux/dl-sbrk.c
@@ -2,4 +2,4 @@
    from ld.so.  */
 extern void *__curbrk attribute_hidden;
 
-#include <sbrk.c>
+#include <misc/sbrk.c>
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 79f95df0a2..42aec77e82 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Dynamic linker system dependencies for Linux.
-   Copyright (C) 1995, 1997, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995,1997,2001,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
@@ -22,7 +22,7 @@
 
 #include <unistd.h>
 #include <ldsodefs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define DL_SYSDEP_INIT frob_brk ()
 
@@ -53,4 +53,4 @@ frob_brk (void)
 #endif
 }
 
-#include <sysdeps/generic/dl-sysdep.c>
+#include <elf/dl-sysdep.c>
diff --git a/sysdeps/unix/bsd/sun/m68k/brk.S b/sysdeps/unix/sysv/linux/dl-sysdep.h
index 07af96d23c..becfc8df3f 100644
--- a/sysdeps/unix/bsd/sun/m68k/brk.S
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+/* System-specific settings for dynamic linker code.  Linux 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
@@ -16,34 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+#include_next <dl-sysdep.h>
 
-#ifndef	SYS_brk
-#define	SYS_brk	17
-#endif
+/* On many architectures the kernel provides a virtual DSO and gives
+   AT_SYSINFO_EHDR to point us to it.  As this is introduced for new
+   machines, we should look at it for unwind information even if
+   we aren't making direct use of it.  So enable this across the board.  */
 
-#ifndef	HAVE_GNU_LD
-#define	__end	_end
-#endif
-
-.data
-.globl ___curbrk
-___curbrk:
-	.long __end
-
-.text
-ENTRY (__brk)
-	movel #__end, d0
-	cmpl sp@(4), d0
-	ble 0f
-	movel d0, sp@(4)
-0:	pea SYS_brk
-	trap #0
-	bcs 1f
-	movel sp@(4), ___curbrk
-	clrl d0
-	rts
-1:
-	jmp syscall_error
-
-weak_alias (__brk, brk)
+#define NEED_DL_SYSINFO_DSO	1
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
new file mode 100644
index 0000000000..10b903d076
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -0,0 +1,143 @@
+/* Test for access to file, relative to open directory.  Linux version.
+   Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+
+int
+faccessat (fd, file, mode, flag)
+     int fd;
+     const char *file;
+     int mode;
+     int flag;
+{
+  if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+#ifdef __NR_faccessat
+  if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure))
+# ifndef __ASSUME_ATFCTS
+      && __have_atfcts >= 0
+# endif
+      )
+    {
+      int result = INLINE_SYSCALL (faccessat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if ((!(flag & AT_EACCESS) || ! __libc_enable_secure)
+# ifndef __NR_laccess		/* Linux so far has no laccess syscall.  */
+      && !(flag & AT_SYMLINK_NOFOLLOW)
+# endif
+      )
+    {
+      /* If we are not set-uid or set-gid, access does the same.  */
+      char *buf = NULL;
+
+      if (fd != AT_FDCWD && file[0] != '/')
+	{
+	  size_t filelen = strlen (file);
+	  static const char procfd[] = "/proc/self/fd/%d/%s";
+	  /* Buffer for the path name we are going to use.  It consists of
+	     - the string /proc/self/fd/
+	     - the file descriptor number
+	     - the file name provided.
+	     The final NUL is included in the sizeof.   A bit of overhead
+	     due to the format elements compensates for possible negative
+	     numbers.  */
+	  size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+	  buf = alloca (buflen);
+
+	  __snprintf (buf, buflen, procfd, fd, file);
+	  file = buf;
+	}
+
+      int result;
+      INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_laccess
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (laccess, err, 2, file, mode);
+      else
+# endif
+	result = INTERNAL_SYSCALL (access, err, 2, file, mode);
+
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+	{
+	  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+	  result = -1;
+	}
+
+      return result;
+    }
+#endif
+
+  struct stat64 stats;
+  if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
+    return -1;
+
+  mode &= (X_OK | W_OK | R_OK);	/* Clear any bogus bits. */
+#if R_OK != S_IROTH || W_OK != S_IWOTH || X_OK != S_IXOTH
+# error Oops, portability assumptions incorrect.
+#endif
+
+  if (mode == F_OK)
+    return 0;			/* The file exists. */
+
+  uid_t uid = (flag & AT_EACCESS) ? __geteuid () : __getuid ();
+
+  /* The super-user can read and write any file, and execute any file
+     that anyone can execute. */
+  if (uid == 0 && ((mode & X_OK) == 0
+		   || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
+    return 0;
+
+  int granted = (uid == stats.st_uid
+		 ? (unsigned int) (stats.st_mode & (mode << 6)) >> 6
+		 : (stats.st_gid == ((flag & AT_EACCESS)
+				     ? __getegid () : __getgid ())
+		    || __group_member (stats.st_gid))
+		 ? (unsigned int) (stats.st_mode & (mode << 3)) >> 3
+		 : (stats.st_mode & mode));
+
+  if (granted == mode)
+    return 0;
+
+  __set_errno (EACCES);
+  return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
new file mode 100644
index 0000000000..8b420153f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -0,0 +1,106 @@
+/* Change the protections of file relative to open directory.  Linux version.
+   Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+int
+fchmodat (fd, file, mode, flag)
+     int fd;
+     const char *file;
+     mode_t mode;
+     int flag;
+{
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#ifndef __NR_lchmod		/* Linux so far has no lchmod syscall.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (ENOTSUP);
+      return -1;
+    }
+#endif
+
+  int result;
+
+#ifdef __NR_fchmodat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchmodat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_lchmod
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode);
+  else
+# endif
+    result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
new file mode 100644
index 0000000000..0f731775b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -0,0 +1,99 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+
+/* Change the owner and group of FILE.  */
+int
+fchownat (fd, file, owner, group, flag)
+     int fd;
+     const char *file;
+     uid_t owner;
+     gid_t group;
+     int flag;
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+  else
+    result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fstatvfs64.c b/sysdeps/unix/sysv/linux/fstatvfs64.c
index 18f2f6dc7b..24c0a8fedc 100644
--- a/sysdeps/unix/sysv/linux/fstatvfs64.c
+++ b/sysdeps/unix/sysv/linux/fstatvfs64.c
@@ -1,5 +1,6 @@
 /* Return information about the filesystem on which FD resides.
-   Copyright (C) 1996,1997,1998,2000,2001,2004 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,2000,2001,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
@@ -22,7 +23,7 @@
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern void __internal_statvfs64 (const char *name, struct statvfs64 *buf,
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index 26caee2f46..60e7ae0ac7 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,2003,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
@@ -24,7 +25,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -72,5 +73,5 @@ weak_alias (__ftruncate64, ftruncate64)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
+# include <misc/ftruncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c
index f43f568ec1..b307c3ff64 100644
--- a/sysdeps/unix/sysv/linux/futimes.c
+++ b/sysdeps/unix/sysv/linux/futimes.c
@@ -1,5 +1,5 @@
 /* futimes -- change access and modification times of open file.  Linux version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002,2003,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
@@ -23,8 +23,9 @@
 #include <utime.h>
 #include <sys/time.h>
 #include <stdio-common/_itoa.h>
+#include <fcntl.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* Change the access time of FILE to TVP[0] and
    the modification time of FILE to TVP[1], but do not follow symlinks.
@@ -40,31 +41,61 @@ __futimes (int fd, const struct timeval tvp[2])
   char *cp = _itoa_word ((unsigned int) fd, fname + sizeof (fname) - 1, 10, 0);
   cp = memcpy (cp - sizeof (selffd) + 1, selffd, sizeof (selffd) - 1);
 
+  int result;
 #ifdef __NR_utimes
-  int result = INLINE_SYSCALL (utimes, 2, cp, tvp);
+  result = INLINE_SYSCALL (utimes, 2, cp, tvp);
 # ifndef __ASSUME_UTIMES
-  if (result != -1 || errno != ENOSYS)
+  if (result == -1 && errno == ENOSYS)
 # endif
-    return result;
 #endif
-
-  /* The utimes() syscall does not exist or is not available in the
-     used kernel.  Use utime().  For this we have to convert to the
-     data format utime() expects.  */
+    {
+      /* The utimes() syscall does not exist or is not available in the
+	 used kernel.  Use utime().  For this we have to convert to the
+	 data format utime() expects.  */
 #ifndef __ASSUME_UTIMES
-  struct utimbuf buf;
-  struct utimbuf *times;
+      struct utimbuf buf;
+      struct utimbuf *times;
 
-  if (tvp != NULL)
-    {
-      times = &buf;
-      buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000;
-      buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000;
+      if (tvp != NULL)
+	{
+	  times = &buf;
+	  buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000;
+	  buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000;
+	}
+      else
+	times = NULL;
+
+      result = INLINE_SYSCALL (utime, 2, cp, times);
+#endif
     }
-  else
-    times = NULL;
 
-  return INLINE_SYSCALL (utime, 2, cp, times);
+  if (result == -1)
+    /* Check for errors that result from failing to find /proc.
+       This means we can't do futimes at all, so return ENOSYS
+       rather than some confusing error.  */
+    switch (errno)
+      {
+      case EACCES:
+	if (tvp == NULL)  /* Could be a path problem or a file problem.  */
+	  break;
+	/*FALLTHROUGH*/
+      case ELOOP:
+      case ENAMETOOLONG:
+      case ENOTDIR:
+	__set_errno (ENOSYS);
+	break;
+
+      case ENOENT:
+	/* Validate the file descriptor by letting fcntl set errno to
+	   EBADF if it's bogus.  Otherwise it's a /proc issue.  */
+#if !defined __NR_fcntl && defined __NR_fcntl64
+# define __NR_fcntl __NR_fcntl64
 #endif
+	if (INLINE_SYSCALL (fcntl, 3, fd, F_GETFD, 0) != -1)
+	  __set_errno (ENOSYS);
+	break;
+      }
+
+  return result;
 }
 weak_alias (__futimes, futimes)
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
new file mode 100644
index 0000000000..5f3a3f52f3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <utime.h>
+#include <sys/time.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+   the modification time of FILE to TVP[1].  */
+int
+futimesat (fd, file, tvp)
+     int fd;
+     const char *file;
+     const struct timeval tvp[2];
+{
+  int result;
+
+  if (file == NULL)
+    return __futimes (fd, tvp);
+
+#ifdef __NR_futimesat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_utimes
+  result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return result;
+
+#  ifndef __ASSUME_UTIMES
+  if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+    goto fail;
+#  endif
+# endif
+
+  /* The utimes() syscall does not exist or is not available in the
+     used kernel.  Use utime().  For this we have to convert to the
+     data format utime() expects.  */
+# ifndef __ASSUME_UTIMES
+  struct utimbuf tmp;
+  struct utimbuf *times;
+
+  if (tvp != NULL)
+    {
+      times = &tmp;
+      tmp.actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000;
+      tmp.modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000;
+    }
+  else
+    times = NULL;
+
+  result = INTERNAL_SYSCALL (utime, err, 2, file, times);
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return result;
+
+ fail:
+# endif
+
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index f443adf7da..6bc560152c 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -1,5 +1,5 @@
 /* fxstat64 using old-style Unix fstat system call.
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2002, 2003, 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
new file mode 100644
index 0000000000..c1c416abd7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -0,0 +1,141 @@
+/* Copyright (C) 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
+   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.  */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+   will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+#ifdef STAT_IS_KERNEL_STAT
+# define kst (*st)
+#else
+  struct kernel_stat kst;
+#endif
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  {
+#ifdef STAT_IS_KERNEL_STAT
+	    return 0;
+#else
+	    return __xstat_conv (vers, &kst, st);
+#endif
+	  }
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  if (vers == _STAT_VER_KERNEL)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      else
+	result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	return result;
+    }
+#ifdef STAT_IS_KERNEL_STAT
+  else
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#else
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+#endif
+
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+}
+libc_hidden_def (__fxstatat)
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_def (__fxstatat64)
+#endif
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
new file mode 100644
index 0000000000..cb932b8e59
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -0,0 +1,167 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#if __ASSUME_STAT64_SYSCALL == 0
+# include <xstatconv.h>
+#endif
+
+#ifdef __NR_stat64
+# if  __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls.
+   This is the definition.  */
+extern int __have_no_stat64;
+# endif
+#endif
+
+/* Get information about the file NAME in BUF.  */
+
+int
+__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
+{
+  if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+
+#ifdef __NR_fstatat64
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  return 0;
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_STAT64_SYSCALL > 0
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+			       CHECK_1 (st));
+  else
+    result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+			       CHECK_1 (st));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    {
+#  if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+      if (st->__st_ino != (__ino_t) st->st_ino)
+	st->st_ino = st->__st_ino;
+#  endif
+      return result;
+    }
+# else
+  struct kernel_stat kst;
+#  ifdef __NR_stat64
+  if (! __have_no_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+				   CHECK_1 (st));
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+				   CHECK_1 (st));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	{
+#   if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+	  if (st->__st_ino != (__ino_t) st->st_ino)
+	    st->st_ino = st->__st_ino;
+#   endif
+	  return result;
+	}
+      if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+	goto fail;
+
+      __have_no_stat64 = 1;
+    }
+#  endif
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat64_conv (vers, &kst, st);
+
+ fail:
+# endif
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+#endif
+}
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
index 3e67add0d7..0c6654a386 100644
--- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -52,5 +52,5 @@ __gai_sigqueue (sig, val, caller_pid)
 			 sig, __ptrvalue (&info));
 }
 #else
-# include <sysdeps/generic/gai_sigqueue.c>
+# include <resolv/gai_sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index 9695d8a035..911d85f43d 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -1,5 +1,6 @@
 /* Determine current working directory.  Linux version.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -28,7 +29,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* If we compile the file for use in ld.so we don't need the feature
@@ -86,7 +87,7 @@ __getcwd (char *buf, size_t size)
 	  return NULL;
 	}
 
-      alloc_size = PATH_MAX;
+      alloc_size = MAX (PATH_MAX, __getpagesize ());
     }
 
   if (buf == NULL)
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index d473486de8..836cbf3922 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-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
@@ -33,15 +33,15 @@
 
 #include <linux/posix_types.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getdents64
 # ifndef __ASSUME_GETDENTS64_SYSCALL
 #  ifndef __GETDENTS
 /* The variable is shared between all *getdents* calls.  */
-int __have_no_getdents64;
+int __have_no_getdents64 attribute_hidden;
 #  else
-extern int __have_no_getdents64;
+extern int __have_no_getdents64 attribute_hidden;
 #  endif
 #  define have_no_getdents64_defined 1
 # endif
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index f44a9afbf2..de98fb3d7b 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1998-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998-2001,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
@@ -24,7 +25,6 @@
 #include <not-cancel.h>
 
 #define HOSTIDFILE "/etc/hostid"
-#define OLD_HOSTIDFILE "/etc/hostid"
 
 #ifdef SET_PROCEDURE
 int
@@ -81,8 +81,6 @@ gethostid ()
 
   /* First try to get the ID from a former invocation of sethostid.  */
   fd = open_not_cancel (HOSTIDFILE, O_RDONLY|O_LARGEFILE, 0);
-  if (fd < 0)
-    fd = open_not_cancel (OLD_HOSTIDFILE, O_RDONLY|O_LARGEFILE, 0);
   if (fd >= 0)
     {
       ssize_t n = read_not_cancel (fd, &id, sizeof (id));
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c
index 6a521431ba..81a1c0dd52 100644
--- a/sysdeps/unix/sysv/linux/getloadavg.c
+++ b/sysdeps/unix/sysv/linux/getloadavg.c
@@ -1,5 +1,5 @@
 /* Get system load averages.  Linux (/proc/loadavg) version.
-   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 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
@@ -55,7 +55,7 @@ getloadavg (double loadavg[], int nelem)
       for (i = 0; i < nelem; ++i)
 	{
 	  char *endp;
-	  loadavg[i] = __strtod_l (p, &endp, &_nl_C_locobj);
+	  loadavg[i] = __strtod_l (p, &endp, _nl_C_locobj_ptr);
 	  if (endp == p)
 	    /* This should not happen.  The format of /proc/loadavg
 	       must have changed.  Don't return with what we have,
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.c b/sysdeps/unix/sysv/linux/getsourcefilter.c
index fdcf8d6130..a6f89a3cc9 100644
--- a/sysdeps/unix/sysv/linux/getsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.c
@@ -1,5 +1,5 @@
 /* Get source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -112,23 +112,27 @@ getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   gf->gf_numsrc = *numsrc;
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
-
-  /* If successful, copy the results to the places the caller wants
-     them in.  */
-  if (result == 0)
+  else
     {
-      *fmode = gf->gf_fmode;
-      memcpy (slist, gf->gf_slist,
-	      MIN (*numsrc, gf->gf_numsrc) * sizeof (struct sockaddr_storage));
-      *numsrc = gf->gf_numsrc;
+      result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
+
+      /* If successful, copy the results to the places the caller wants
+	 them in.  */
+      if (result == 0)
+	{
+	  *fmode = gf->gf_fmode;
+	  memcpy (slist, gf->gf_slist,
+		  MIN (*numsrc, gf->gf_numsrc)
+		  * sizeof (struct sockaddr_storage));
+	  *numsrc = gf->gf_numsrc;
+	}
     }
 
   if (! use_alloca)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 985a0860cb..d655ba3b27 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
 /* Determine various system internal values, Linux version.
-   Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -34,75 +34,6 @@
 #include <atomic.h>
 
 
-/* The default value for the /proc filesystem mount point.  */
-static const char path_proc[] = "/proc";
-
-/* Actual mount point of /proc filesystem.  */
-libc_freeres_ptr (static char *mount_proc);
-
-/* Determine the path to the /proc filesystem if available.  */
-static const char *
-internal_function
-get_proc_path (char *buffer, size_t bufsize)
-{
-  struct mntent mount_point;
-  struct mntent *entry;
-  char *result = NULL;
-  char *copy_result;
-  FILE *fp;
-
-  /* First find the mount point of the proc filesystem.  */
-  fp = __setmntent (_PATH_MOUNTED, "r");
-  if (fp == NULL)
-    fp = __setmntent (_PATH_MNTTAB, "r");
-  if (fp != NULL)
-    {
-      /* We don't need locking.  */
-      (void) __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-      while ((entry = __getmntent_r (fp, &mount_point, buffer, bufsize))
-	     != NULL)
-	if (strcmp (mount_point.mnt_type, "proc") == 0)
-	  {
-	    result = mount_point.mnt_dir;
-	    break;
-	  }
-      __endmntent (fp);
-    }
-
-  /* If we haven't found anything this is generally a bad sign but we
-     handle it gracefully.  We return what is hopefully the right
-     answer (/proc) but we don't remember this.  This will enable
-     programs which started before the system is fully running to
-     adjust themselves.  */
-  if (result == NULL)
-    return path_proc;
-
-  /* Make a copy we can keep around.  */
-  copy_result = __strdup (result);
-  if (copy_result == NULL)
-    return result;
-
-  /* Now store the copied value.  But do it atomically.  */
-  assert (sizeof (long int) == sizeof (void *__unbounded));
-  if (atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
-    /* Replacing the value failed.  This means another thread was
-       faster and we don't need the copy anymore.  */
-    free (copy_result);
-#if __BOUNDED_POINTERS__
-  else
-    {
-      /* compare_and_swap only copied the pointer value, so we must
-	 now copy the bounds as well.  */
-      __ptrlow (mount_proc) = __ptrlow (copy_result);
-      __ptrhigh (mount_proc) = __ptrhigh (copy_result);
-    }
-#endif
-
-  return mount_proc;
-}
-
-
 /* How we can determine the number of available processors depends on
    the configuration.  There is currently (as of version 2.0.21) no
    system call to determine the number.  It is planned for the 2.1.x
@@ -136,50 +67,35 @@ get_proc_path (char *buffer, size_t bufsize)
 int
 __get_nprocs ()
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   int result = 1;
 
   /* XXX Here will come a test for the new system call.  */
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
-  /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  /* The /proc/stat format is more uniform, use it by default.  */
+  FILE *fp = fopen ("/proc/stat", "rc");
+  if (fp != NULL)
     {
-      char *proc_fname = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
 
-      /* The /proc/stat format is more uniform, use it by default.  */
-      __stpcpy (__stpcpy (proc_fname, proc_path), "/stat");
+      result = 0;
+      while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
+	if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
+	  ++result;
 
-      fp = fopen (proc_fname, "rc");
+      fclose (fp);
+    }
+  else
+    {
+      fp = fopen ("/proc/cpuinfo", "rc");
       if (fp != NULL)
 	{
 	  /* No threads use this stream.  */
 	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-	  result = 0;
-	  while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
-	    if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
-	      ++result;
-
+	  GET_NPROCS_PARSER (fp, buffer, result);
 	  fclose (fp);
 	}
-      else
-	{
-	  __stpcpy (__stpcpy (proc_fname, proc_path), "/cpuinfo");
-
-	  fp = fopen (proc_fname, "rc");
-	  if (fp != NULL)
-	    {
-	      /* No threads use this stream.  */
-	      __fsetlocking (fp, FSETLOCKING_BYCALLER);
-	      GET_NPROCS_PARSER (fp, buffer, result);
-	      fclose (fp);
-	    }
-	}
     }
 
   return result;
@@ -193,30 +109,19 @@ weak_alias (__get_nprocs, get_nprocs)
 int
 __get_nprocs_conf ()
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   int result = 1;
 
   /* XXX Here will come a test for the new system call.  */
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
   /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  FILE *fp = fopen ("/proc/cpuinfo", "rc");
+  if (fp != NULL)
     {
-      char *proc_cpuinfo = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
-      __stpcpy (__stpcpy (proc_cpuinfo, proc_path), "/cpuinfo");
-
-      fp = fopen (proc_cpuinfo, "rc");
-      if (fp != NULL)
-	{
-	  /* No threads use this stream.  */
-	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-	  GET_NPROCS_CONF_PARSER (fp, buffer, result);
-	  fclose (fp);
-	}
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+      GET_NPROCS_CONF_PARSER (fp, buffer, result);
+      fclose (fp);
     }
 
   return result;
@@ -235,40 +140,29 @@ static long int
 internal_function
 phys_pages_info (const char *format)
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   long int result = -1;
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
   /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  FILE *fp = fopen ("/proc/meminfo", "rc");
+  if (fp != NULL)
     {
-      char *proc_meminfo = alloca (strlen (proc_path) + sizeof ("/meminfo"));
-      __stpcpy (__stpcpy (proc_meminfo, proc_path), "/meminfo");
-
-      fp = fopen (proc_meminfo, "rc");
-      if (fp != NULL)
-	{
-	  /* No threads use this stream.  */
-	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-	  result = 0;
-	  /* Read all lines and count the lines starting with the
-	     string "processor".  We don't have to fear extremely long
-	     lines since the kernel will not generate them.  8192
-	     bytes are really enough.  */
-	  while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
-	    if (sscanf (buffer, format, &result) == 1)
-	      {
-		result /= (__getpagesize () / 1024);
-		break;
-	      }
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+      result = 0;
+      /* Read all lines and count the lines starting with the
+	 string "processor".  We don't have to fear extremely long
+	 lines since the kernel will not generate them.  8192
+	 bytes are really enough.  */
+      while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
+	if (sscanf (buffer, format, &result) == 1)
+	  {
+	    result /= (__getpagesize () / 1024);
+	    break;
+	  }
 
-	  fclose (fp);
-	}
+      fclose (fp);
     }
 
   if (result == -1)
diff --git a/sysdeps/unix/sysv/linux/hppa/Dist b/sysdeps/unix/sysv/linux/hppa/Dist
deleted file mode 100644
index 2954d3c4bf..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Dist
+++ /dev/null
@@ -1,5 +0,0 @@
-umount.c
-kernel_stat.h
-kernel_sigaction.h
-clone.S
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/hppa/Makefile b/sysdeps/unix/sysv/linux/hppa/Makefile
deleted file mode 100644
index 1c93ec52d9..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# linux/hppa does not use -lmilli anymore
-gnulib := -lgcc
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
deleted file mode 100644
index e15c8225fb..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ /dev/null
@@ -1,25 +0,0 @@
-libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
-  GLIBC_2.1 {
-    #errlist-compat	253
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-  }
-  GLIBC_2.2 {
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64; setrlimit64;
-  }
-  GLIBC_2.3 {
-    #errlist-compat	254
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-  }
-}
-librt {
-  GLIBC_2.3 {
-    # AIO functions.
-    aio_cancel; aio_cancel64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/errno.h b/sysdeps/unix/sysv/linux/hppa/bits/errno.h
deleted file mode 100644
index 003d71f622..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/errno.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Error constants.  Linux/HPPA specific version.
-   Copyright (C) 1996,1997,1998,1999,2000,2002 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.  */
-
-#ifdef _ERRNO_H
-
-# undef EDOM
-# undef EILSEQ
-# undef ERANGE
-# include <linux/errno.h>
-
-/* Linux also has no ECANCELED error code.  Since it is not used here
-   we define it to an invalid value.  */
-# ifndef ECANCELED
-#  define ECANCELED	ECANCELLED
-# endif
-
-# ifndef __ASSEMBLER__
-/* Function to get address of global `errno' variable.  */
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-
-#  if !defined _LIBC || defined _LIBC_REENTRANT
-/* When using threads, errno is a per-thread value.  */
-#   define errno (*__errno_location ())
-#  endif
-# endif /* !__ASSEMBLER__ */
-#endif /* _ERRNO_H */
-
-#if !defined _ERRNO_H && defined __need_Emath
-/* This is ugly but the kernel header is not clean enough.  We must
-   define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
-   defined.  */
-# define EDOM	33	/* Math argument out of domain of function.  */
-# define EILSEQ	47	/* Illegal byte sequence.  */
-# define ERANGE	34	/* Math result not representable.  */
-#endif /* !_ERRNO_H && __need_Emath */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
deleted file mode 100644
index 9d967c6475..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux/HPPA.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-#include <sys/types.h>
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_RDONLY	00000000
-#define O_WRONLY	00000001
-#define O_RDWR		00000002
-#define O_ACCMODE	00000003
-#define O_APPEND	00000010
-#define O_BLKSEEK	00000100 /* HPUX only */
-#define O_CREAT		00000400 /* not fcntl */
-#define O_TRUNC		00001000 /* not fcntl */
-#define O_EXCL		00002000 /* not fcntl */
-#define O_ASYNC		00020000
-#define O_SYNC		00100000
-#define O_NONBLOCK	00200004 /* HPUX has separate NDELAY & NONBLOCK */
-#define O_NDELAY	O_NONBLOCK
-#define O_NOCTTY	00400000 /* not fcntl */
-
-
-#ifdef __USE_GNU
-# define O_DIRECT	00040000 /* direct disk access hint - currently ignored */
-# define O_DIRECTORY	00010000 /* must be a directory */
-# define O_NOFOLLOW	00000200 /* don't follow links */
-# define O_NOATIME	04000000 /* Do not set atime.  */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	00004000
-#endif
-
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC		01000000 /* HPUX only */
-# define O_RSYNC		02000000 /* HPUX only */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6    	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).  */
-#else
-# define F_GETLK	F_GETLK64 /* Get record locking info.  */
-# define F_SETLK	F_SETLK64 /* Set record locking info (non-blocking). */
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-
-#define F_GETLK64	8	/* Get record locking info.  */
-#define F_SETLK64	9	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	10	/* Set record locking info (blocking).  */
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN	11	/* Get owner of socket (receiver of SIGIO).  */
-# define F_SETOWN	12	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	13	/* Set number of signal to be sent.  */
-# define F_GETSIG	14	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE     1024    /* Set a lease.  */
-# define F_GETLEASE     1025    /* Enquire what lease is active.  */
-# define F_NOTIFY       1026    /* Request notfications on a directory.  */
-#endif
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		1	/* Read lock.  */
-#define F_WRLCK		2	/* Write lock.  */
-#define F_UNLCK		3	/* Remove lock.  */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS      0x00000001      /* File accessed.  */
-# define DN_MODIFY      0x00000002      /* File modified.  */
-# define DN_CREATE      0x00000004      /* File created.  */
-# define DN_DELETE      0x00000008      /* File removed.  */
-# define DN_RENAME      0x00000010      /* File renamed.  */
-# define DN_ATTRIB      0x00000020      /* File changed attibutes.  */
-# define DN_MULTISHOT   0x80000000      /* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h b/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h
deleted file mode 100644
index 6f4e05fcc8..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1996, 1997 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 _SYS_IOCTL_H
-# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-/* Use the definitions from the kernel header files.  */
-#include <asm/ioctls.h>
-
-/* Oh well, this is necessary since the kernel data structure is
-   different from the user-level version.  */
-#undef  TCGETS
-#undef  TCSETS
-#undef  TCSETSW
-#undef  TCSETSF
-#define TCGETS	_IOR ('T', 16, char[36])
-#define TCSETS	_IOW ('T', 17, char[36])
-#define TCSETSW	_IOW ('T', 18, char[36])
-#define TCSETSF	_IOW ('T', 19, char[36])
-
-#include <linux/sockios.h>
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/ipc.h b/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
deleted file mode 100644
index d80cf06993..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 1995-1999, 2000 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 _SYS_IPC_H
-# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* Create key if key does not exist. */
-#define IPC_EXCL	02000		/* Fail if key exists.  */
-#define IPC_NOWAIT	04000		/* Return error on wait.  */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* Remove identifier.  */
-#define IPC_SET		1		/* Set `ipc_perm' options.  */
-#define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#ifdef __USE_GNU
-# define IPC_INFO	3		/* See ipcs.  */
-#endif
-
-/* Special key values.  */
-#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
-
-
-/* Data structure used to pass permission information to IPC operations.  */
-struct ipc_perm
-  {
-    __key_t __key;			/* Key.  */
-    __uid_t uid;			/* Owner's user ID.  */
-    __gid_t gid;			/* Owner's group ID.  */
-    __uid_t cuid;			/* Creator's user ID.  */
-    __gid_t cgid;			/* Creator's group ID.  */
-#if __WORDSIZE == 32
-    unsigned short int __pad1;
-    unsigned short int mode;		/* Read/write permission.  */
-    unsigned short int __pad2;
-#else
-    __mode_t mode;			/* Read/write permission.  */
-    unsigned short int __pad2;
-#endif
-    unsigned short int __seq;		/* Sequence number.  */
-    unsigned int __pad3;
-    unsigned long long int __unused1;
-    unsigned long long int __unused2;
-  };
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
deleted file mode 100644
index 1eb1233814..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/mman.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/HPPA version.
-   Copyright (C) 1997, 1998, 2000, 2003 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* these are basically taken from the kernel definitions */
-
-#define PROT_READ	0x1		/* page can be read */
-#define PROT_WRITE	0x2		/* page can be written */
-#define PROT_EXEC	0x4		/* page can be executed */
-#define PROT_NONE	0x0		/* page can not be accessed */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_TYPE	0x03		/* Mask for type of mapping */
-#define MAP_FIXED	0x04		/* Interpret addr exactly */
-#define MAP_ANONYMOUS	0x10		/* don't use a file */
-
-#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
-#define MAP_LOCKED	0x2000		/* pages are locked */
-#define MAP_NORESERVE	0x4000		/* don't check for reservations */
-#define MAP_GROWSDOWN	0x8000		/* stack-like segment */
-#define MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
-#define MAP_NONBLOCK	0x20000		/* do not block on IO */
-
-#define MS_SYNC		1		/* synchronous memory sync */
-#define MS_ASYNC	2		/* sync memory asynchronously */
-#define MS_INVALIDATE	4		/* invalidate the caches */
-
-#define MCL_CURRENT	1		/* lock all current mappings */
-#define MCL_FUTURE	2		/* lock all future mappings */
-
-#define MADV_NORMAL     0               /* no further special treatment */
-#define MADV_RANDOM     1               /* expect random page references */
-#define MADV_SEQUENTIAL 2               /* expect sequential page references */
-#define MADV_WILLNEED   3               /* will need these pages */
-#define MADV_DONTNEED   4               /* dont need these pages */
-#define MADV_SPACEAVAIL 5               /* insure that resources are reserved */
-#define MADV_VPS_PURGE  6               /* Purge pages from VM page cache */
-#define MADV_VPS_INHERIT 7              /* Inherit parents page size */
-
-/* The range 12-64 is reserved for page size specification. */
-#define MADV_4K_PAGES   12              /* Use 4K pages  */
-#define MADV_16K_PAGES  14              /* Use 16K pages */
-#define MADV_64K_PAGES  16              /* Use 64K pages */
-#define MADV_256K_PAGES 18              /* Use 256K pages */
-#define MADV_1M_PAGES   20              /* Use 1 Megabyte pages */
-#define MADV_4M_PAGES   22              /* Use 4 Megabyte pages */
-#define MADV_16M_PAGES  24              /* Use 16 Megabyte pages */
-#define MADV_64M_PAGES  26              /* Use 64 Megabyte pages */
-
-/* compatibility flags */
-#define MAP_ANON	MAP_ANONYMOUS
-#define MAP_FILE	0
-#define MAP_VARIABLE	0
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/msq.h b/sysdeps/unix/sysv/linux/hppa/bits/msq.h
deleted file mode 100644
index 1268dc858c..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/msq.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 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 _SYS_MSG_H
-# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-#ifdef __USE_GNU
-# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
-#endif
-
-/* Types used in the structure definition.  */
-typedef unsigned long int msgqnum_t;
-typedef unsigned long int msglen_t;
-
-
-/* Structure of record for one message inside the kernel.
-   The type `struct msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-#if __WORDSIZE == 32
-  unsigned int __pad1;
-#endif
-  __time_t msg_stime;		/* time of last msgsnd command */
-#if __WORDSIZE == 32
-  unsigned int __pad2;
-#endif
-  __time_t msg_rtime;		/* time of last msgrcv command */
-#if __WORDSIZE == 32
-  unsigned int __pad3;
-#endif
-  __time_t msg_ctime;		/* time of last change */
-  unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-#ifdef __USE_MISC
-
-# define msg_cbytes	__msg_cbytes
-
-/* ipcs ctl commands */
-# define MSG_STAT 11
-# define MSG_INFO 12
-
-/* buffer for msgctl calls IPC_INFO, MSG_INFO */
-struct msginfo
-  {
-    int msgpool;
-    int msgmap;
-    int msgmax;
-    int msgmnb;
-    int msgmni;
-    int msgssz;
-    int msgtql;
-    unsigned short int msgseg;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/sem.h b/sysdeps/unix/sysv/linux/hppa/bits/sem.h
deleted file mode 100644
index 2880765108..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/sem.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000 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 _SYS_SEM_H
-# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
-#endif
-
-#include <sys/types.h>
-#include <bits/wordsize.h>
-
-/* Flags for `semop'.  */
-#define SEM_UNDO	0x1000		/* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID		11		/* get sempid */
-#define GETVAL		12		/* get semval */
-#define GETALL		13		/* get all semval's */
-#define GETNCNT		14		/* get semncnt */
-#define GETZCNT		15		/* get semzcnt */
-#define SETVAL		16		/* set semval */
-#define SETALL		17		/* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-#if __WORDSIZE == 32
-  unsigned int __pad1;
-#endif
-  __time_t sem_otime;			/* last semop() time */
-#if __WORDSIZE == 32
-  unsigned int __pad2;
-#endif
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned long int sem_nsems;		/* number of semaphores in set */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-/* The user should define a union like the following to use it for arguments
-   for `semctl'.
-
-   union semun
-   {
-     int val;				<= value for SETVAL
-     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
-     unsigned short int *array;		<= array for GETALL & SETALL
-     struct seminfo *__buf;		<= buffer for IPC_INFO
-   };
-
-   Previous versions of this file used to define this union but this is
-   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
-   one must define the union or not.  */
-#define _SEM_SEMUN_UNDEFINED	1
-
-#ifdef __USE_MISC
-
-/* ipcs ctl cmds */
-# define SEM_STAT 18
-# define SEM_INFO 19
-
-struct  seminfo
-{
-  int semmap;
-  int semmni;
-  int semmns;
-  int semmnu;
-  int semmsl;
-  int semopm;
-  int semume;
-  int semusz;
-  int semvmx;
-  int semaem;
-};
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/shm.h b/sysdeps/unix/sysv/linux/hppa/bits/shm.h
deleted file mode 100644
index 1c022fda83..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/shm.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000, 2002 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 _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Permission flag for shmget.  */
-#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
-#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
-
-/* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
-
-/* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
-
-/* Segment low boundary address multiple.  */
-#define SHMLBA 0x00400000		/* address needs to be 4 Mb aligned */
-
-/* Type to count number of attaches.  */
-typedef unsigned long int shmatt_t;
-
-/* Data structure describing a set of semaphores.  */
-struct shmid_ds
-  {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-#if __WORDSIZE == 32
-    unsigned int __pad1;
-#endif
-    __time_t shm_atime;			/* time of last shmat() */
-#if __WORDSIZE == 32
-    unsigned int __pad2;
-#endif
-    __time_t shm_dtime;			/* time of last shmdt() */
-#if __WORDSIZE == 32
-    unsigned int __pad3;
-#endif
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-#if __WORDSIZE == 32
-    unsigned int __pad4;
-#endif
-    size_t shm_segsz;			/* size of segment in bytes */
-    __pid_t shm_cpid;			/* pid of creator */
-    __pid_t shm_lpid;			/* pid of last shmop */
-    shmatt_t shm_nattch;		/* number of current attaches */
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-  };
-
-#ifdef __USE_MISC
-
-/* ipcs ctl commands */
-# define SHM_STAT 	13
-# define SHM_INFO 	14
-
-/* shm_mode upper byte flags */
-# define SHM_DEST	01000	/* segment will be destroyed on last detach */
-# define SHM_LOCKED	02000   /* segment will not be swapped */
-# define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
-
-struct	shminfo
-  {
-    unsigned long shmmax;
-    unsigned long shmmin;
-    unsigned long shmmni;
-    unsigned long shmseg;
-    unsigned long shmall;
-    unsigned long __unused1;
-    unsigned long __unused2;
-    unsigned long __unused3;
-    unsigned long __unused4;
-  };
-
-struct shm_info
-  {
-    int used_ids;
-    unsigned long int shm_tot;	/* total allocated shm */
-    unsigned long int shm_rss;	/* total resident shm */
-    unsigned long int shm_swp;	/* total swapped shm */
-    unsigned long int swap_attempts;
-    unsigned long int swap_successes;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h b/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
deleted file mode 100644
index 33f2b237b7..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Definitions for Linux/HPPA sigaction.
-   Copyright (C) 1996, 1997, 2000 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 _SIGNAL_H
-# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
-#endif
-
-/* Structure describing the action to be taken when a signal arrives.  */
-struct sigaction
-  {
-    /* Signal handler.  */
-#ifdef __USE_POSIX199309
-    union
-      {
-	/* Used if SA_SIGINFO is not set.  */
-	__sighandler_t sa_handler;
-	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) (int, siginfo_t *, void *);
-      }
-    __sigaction_handler;
-# define sa_handler	__sigaction_handler.sa_handler
-# define sa_sigaction	__sigaction_handler.sa_sigaction
-#else
-    __sighandler_t sa_handler;
-#endif
-
-    /* Special flags.  */
-    unsigned long int sa_flags;
-
-    /* Additional set of signals to be blocked.  */
-    __sigset_t sa_mask;
-  };
-
-/* Bits in `sa_flags'.  */
-
-#define SA_NOCLDSTOP  0x00000008  /* Don't send SIGCHLD when children stop.  */
-#define SA_NOCLDWAIT  0x00000080  /* Don't create zombie on child death.  */
-#define SA_SIGINFO    0x00000010  /* Invoke signal-catching function with
-				     three arguments instead of one.  */
-#if defined __USE_UNIX98 || defined __USE_MISC
-# define SA_ONSTACK   0x00000001 /* Use signal stack by using `sa_restorer'. */
-# define SA_RESETHAND 0x00000004 /* Reset to SIG_DFL on entry to handler.  */
-# define SA_NODEFER   0x00000020 /* Don't automatically block the signal
-				    when its handler is being executed.  */
-# define SA_RESTART   0x00000040 /* Restart syscall on signal return.  */
-#endif
-#ifdef __USE_MISC
-# define SA_INTERRUPT 0x20000000 /* Historic no-op.  */
-
-/* Some aliases for the SA_ constants.  */
-# define SA_NOMASK    SA_NODEFER
-# define SA_ONESHOT   SA_RESETHAND
-# define SA_STACK     SA_ONSTACK
-#endif
-
-/* Values for the HOW argument to `sigprocmask'.  */
-#define SIG_BLOCK          0	/* for blocking signals */
-#define SIG_UNBLOCK        1	/* for unblocking signals */
-#define SIG_SETMASK        2	/* for setting the signal mask */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
deleted file mode 100644
index bf46006c8d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Signal number definitions.  Linux/HPPA version.
-   Copyright (C) 1995,1996,1997,1998,1999,2003 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.  */
-
-#ifdef	_SIGNAL_H
-
-/* Fake signal functions.  */
-#define SIG_ERR	((__sighandler_t) -1)		/* Error return.  */
-#define SIG_DFL	((__sighandler_t) 0)		/* Default action.  */
-#define SIG_IGN	((__sighandler_t) 1)		/* Ignore signal.  */
-
-#ifdef __USE_UNIX98
-# define SIG_HOLD	((__sighandler_t) 2)	/* Add signal to hold mask.  */
-#endif
-
-
-/* Signals.  */
-#define	SIGHUP		1	/* Hangup (POSIX).  */
-#define	SIGINT		2	/* Interrupt (ANSI).  */
-#define	SIGQUIT		3	/* Quit (POSIX).  */
-#define	SIGILL		4	/* Illegal instruction (ANSI).  */
-#define	SIGTRAP		5	/* Trace trap (POSIX).  */
-#define	SIGABRT		6	/* Abort (ANSI).  */
-#define	SIGIOT		6	/* IOT trap (4.2 BSD).  */
-#define	SIGEMT		7
-#define	SIGFPE		8	/* Floating-point exception (ANSI).  */
-#define	SIGKILL		9	/* Kill, unblockable (POSIX).  */
-#define	SIGBUS		10	/* BUS error (4.2 BSD).  */
-#define	SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define SIGSYS		12	/* Bad system call.  */
-#define	SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define	SIGALRM		14	/* Alarm clock (POSIX).  */
-#define	SIGTERM		15	/* Termination (ANSI).  */
-#define	SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
-#define SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
-#define	SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define	SIGCHLD		18	/* Child status has changed (POSIX).  */
-#define	SIGPWR		19	/* Power failure restart (System V).  */
-#define	SIGVTALRM	20	/* Virtual alarm clock (4.2 BSD).  */
-#define	SIGPROF		21	/* Profiling alarm clock (4.2 BSD).  */
-#define	SIGPOLL		SIGIO	/* Pollable event occurred (System V).  */
-#define	SIGIO		22	/* I/O now possible (4.2 BSD).  */
-#define	SIGWINCH	23	/* Window size change (4.3 BSD, Sun).  */
-#define	SIGSTOP		24	/* Stop, unblockable (POSIX).  */
-#define	SIGTSTP		25	/* Keyboard stop (POSIX).  */
-#define	SIGCONT		26	/* Continue (POSIX).  */
-#define	SIGTTIN		27	/* Background read from tty (POSIX).  */
-#define	SIGTTOU		28	/* Background write to tty (POSIX).  */
-#define	SIGURG		29	/* Urgent condition on socket (4.2 BSD).  */
-#define SIGLOST		30	/* Operating System Has Lost (HP/UX). */
-#define SIGUNUSED	31
-#define	SIGXCPU		33	/* CPU limit exceeded (4.2 BSD).  */
-#define	SIGXFSZ		34	/* File size limit exceeded (4.2 BSD).  */
-#define	SIGSTKFLT	36	/* Stack fault.  */
-
-#define	_NSIG		65	/* Biggest signal number + 1
-				   (including real-time signals).  */
-
-#define SIGRTMIN        (__libc_current_sigrtmin ())
-#define SIGRTMAX        (__libc_current_sigrtmax ())
-
-/* These are the hard limits of the kernel.  These values should not be
-   used directly at user level.  */
-#define __SIGRTMIN	37
-#define __SIGRTMAX	(_NSIG - 1)
-
-#endif	/* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/brk.c b/sysdeps/unix/sysv/linux/hppa/brk.c
deleted file mode 100644
index a4b4df2831..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/brk.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* brk system call for Linux/HPPA.
-   Copyright (C) 1995, 1996, 2000, 2001 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
deleted file mode 100644
index 4f3bb9e206..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
-   Based on the Alpha version by Richard Henderson <rth@tamu.edu>, 1996.
-
-   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.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <asm/unistd.h>
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
-
-        .text
-ENTRY(__clone)
-	/* FIXME: I have no idea how profiling works on hppa. */
-
-	/* Sanity check arguments.  */
-	comib,=  0,%arg0,.Lerror        /* no NULL function pointers */
-	ldi     -EINVAL,%ret0
-	comib,=  0,%arg1,.Lerror        /* no NULL stack pointers */
-	nop
-
-	/* Save the fn ptr and arg on the new stack.  */
-	stwm    %arg0,64(%arg1)
-	stw	%arg3,-60(%arg1)
-
-	/* Save the PIC register. */
-#ifdef PIC
-	stw	%r19,-32(%sr0, %sp)	/* parent */
-#endif
-
-	/* Do the system call */
-	copy	%arg2,%arg0
-	ble     0x100(%sr2,%r0)
-	ldi	__NR_clone,%r20
-
-	ldi	-4096,%r1
-	comclr,>>= %r1,%ret0,%r0	/* Note: unsigned compare. */
-	b,n	.Lerror
-
-	comib,=,n 0,%ret0,thread_start
-
-	/* Successful return from the parent
-	   No need to restore the PIC register, 
-	   since we return immediately. */
-
-	bv	%r0(%rp)
-	nop
-
-	/* Something bad happened -- no child created */
-.Lerror:
-
-	/* Restore the PIC register on error */
-#ifdef PIC
-	ldw	-32(%sr0, %sp), %r19	/* parent */
-#endif
-
-	b	__syscall_error
-	sub     %r0,%ret0,%arg0
-
-thread_start:
-
-	/* Load up the arguments.  */
-	ldw	-60(%sr0, %sp),%arg0
-	ldw     -64(%sr0, %sp),%r22
-
-	/* $$dyncall fixes childs PIC register */
-
-	/* Call the user's function */
-	bl	$$dyncall,%r31
-	copy	%r31,%rp
-
-	bl	_exit,%rp
-	copy	%ret0,%arg0
-
-	/* Die horribly.  */
-	iitlbp	%r0,(%r0)
-
-PSEUDO_END(__clone)
-
-weak_alias(__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/hppa/fcntl.c b/sysdeps/unix/sysv/linux/hppa/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/getdents64.c b/sysdeps/unix/sysv/linux/hppa/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/getrlimit64.c b/sysdeps/unix/sysv/linux/hppa/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h b/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h
deleted file mode 100644
index af048cbe7d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* We have a separate header file here because we do not support
-   SA_RESTORER on hppa. */
-
-/* This is the sigaction struction from the Linux 2.1.20 kernel.  */
-/* Blah.  This is bogus.  We don't ever use it. */
-struct old_kernel_sigaction {
-	__sighandler_t k_sa_handler;
-	unsigned long sa_mask;
-	unsigned long sa_flags;
-};
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel.  */
-
-struct kernel_sigaction {
-	__sighandler_t k_sa_handler;
-	unsigned long sa_flags;
-	sigset_t sa_mask;
-};
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
deleted file mode 100644
index a85c5be464..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* definition of "struct stat" from the kernel */
-struct kernel_stat {
-	unsigned long	st_dev;		/* dev_t is 32 bits on parisc */
-	unsigned long	st_ino;		/* 32 bits */
-	unsigned short	st_mode;	/* 16 bits */
-	unsigned short	st_nlink;	/* 16 bits */
-	unsigned short	st_reserved1;	/* old st_uid */
-	unsigned short	st_reserved2;	/* old st_gid */
-	unsigned long	st_rdev;
-	unsigned long   st_size;
-	struct timespec st_atim;
-	struct timespec st_mtim;
-	struct timespec st_ctim;
-	long		st_blksize;
-	long		st_blocks;
-	unsigned long	__unused1;	/* ACL stuff */
-	unsigned long	__unused2;	/* network */
-	unsigned long	__unused3;	/* network */
-	unsigned long	__unused4;	/* cnodes */
-	unsigned short	__unused5;	/* netsite */
-	short		st_fstype;
-	unsigned long	st_realdev;
-	unsigned short	st_basemode;
-	unsigned short	st_spareshort;
-	unsigned long	st_uid;
-	unsigned long   st_gid;
-	unsigned long	st_spare4[3];
-};
-
-#define _HAVE_STAT_NSEC
-#define _HAVE_STAT64_NSEC
diff --git a/sysdeps/unix/sysv/linux/hppa/mmap.c b/sysdeps/unix/sysv/linux/hppa/mmap.c
deleted file mode 100644
index 6f4bfdce2a..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/mmap.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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 <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  From
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-#include <sysdep.h>
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-	
-	__ptr_t ret;
-
-	ret = INLINE_SYSCALL(mmap, 6, addr, len, prot, flags, fd, offset);
-
-	/* check if it's really a negative number */
-	if(((unsigned long)ret & 0xfffff000) == 0xfffff000)
-		return MAP_FAILED;
-
-	return ret;
-
-}
-
-strong_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/hppa/profil-counter.h b/sysdeps/unix/sysv/linux/hppa/profil-counter.h
deleted file mode 100644
index b108be8a36..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/profil-counter.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Machine-dependent SIGPROF signal handler.  PA-RISC version
-   Copyright (C) 1996, 1997, 2000 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.  */
-
-static void
-profil_counter (int signr, siginfo_t *si, struct ucontext *uctx)
-{
-  unsigned long ip = uctx->uc_mcontext.sc_iaoq[0] & ~0x3;
-  profil_count ((void *) ip);
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/socket.S b/sysdeps/unix/sysv/linux/hppa/socket.S
deleted file mode 100644
index dfbb721a82..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/socket.S
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-
-	.globl __socket
-PSEUDO(__socket, socket, 3)
-
-PSEUDO_END(__socket)
-
-#ifndef NO_WEAK_ALIAS
-weak_alias (__socket, socket)
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/procfs.h b/sysdeps/unix/sysv/linux/hppa/sys/procfs.h
deleted file mode 100644
index 2e6d10956d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sys/procfs.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 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 _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <sys/user.h>
-#include <asm/elf.h>
-
-__BEGIN_DECLS
-
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned int pr_uid;
-    unsigned int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
deleted file mode 100644
index 1431143849..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2001 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.  */
-
-/* Don't rely on this, the interface is currently messed up and may need to
-   be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-
-/* Type for general register.  */
-typedef unsigned long int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	80
-#define NFPREG	32
-
-/* Container for all general registers.  */
-typedef struct gregset
-  {
-    greg_t g_regs[32];
-    greg_t sr_regs[8];
-    greg_t cr_regs[24];
-    greg_t g_pad[16];
-  } gregset_t;
-
-/* Container for all FPU registers.  */
-typedef struct fpregset
-  {
-    double fp_dregs[32];
-  } fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct sigcontext mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.S b/sysdeps/unix/sysv/linux/hppa/syscall.S
deleted file mode 100644
index b333487c99..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscall.S
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 1995, 1996, 1998, 2001 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.  */
-
-/* HPPA implements syscall() in 'C'; see sysdep.c.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
deleted file mode 100644
index 0f7537c306..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ /dev/null
@@ -1,37 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# semaphore and shm system calls
-msgctl		-	msgctl		i:iip	__msgctl	msgctl
-msgget		-	msgget		i:ii	__msgget	msgget
-msgrcv		-	msgrcv		Ci:ibnii __msgrcv	msgrcv
-msgsnd		-	msgsnd		Ci:ibni	__msgsnd	msgsnd
-shmat		-	shmat		i:ipi	__shmat		shmat
-shmctl		-	shmctl		i:iip	__shmctl	shmctl
-shmdt		-	shmdt		i:s	__shmdt		shmdt
-shmget		-	shmget		i:iii	__shmget	shmget
-semop		-	semop		i:ipi	__semop		semop
-semtimedop      -       semtimedop      i:ipip  semtimedop
-semget		-	semget		i:iii	__semget	semget
-semctl		-	semctl		i:iiii	__semctl	semctl
-
-# proper socket implementations:
-accept		-	accept		Ci:iBN	__libc_accept	__accept accept
-bind		-	bind		i:ipi	__bind		bind
-connect		-	connect		Ci:ipi	__libc_connect	__connect_internal __connect connect 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
-listen		-	listen		i:ii	__listen	listen
-recv		-	recv		Ci:ibni	__libc_recv	__recv recv
-recvfrom	-	recvfrom	Ci:ibniBN	__libc_recvfrom	__recvfrom recvfrom
-recvmsg		-	recvmsg		Ci:ipi	__libc_recvmsg	__recvmsg recvmsg
-send		-	send		Ci:ibni	__libc_send	__send send
-sendmsg		-	sendmsg		Ci:ipi	__libc_sendmsg	__sendmsg sendmsg
-sendto		-	sendto		Ci:ibnibn	__libc_sendto	__sendto sendto
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
-socket		-	socket		i:iii	__socket	socket
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-
-setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit	
-getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit	
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.c b/sysdeps/unix/sysv/linux/hppa/sysdep.c
deleted file mode 100644
index 192efbaf75..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1997, 1998, 2001, 2003 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 <errno.h>
-
-extern int __syscall_error(int err_no);
-extern int syscall (int sysnum, int arg0, int arg1, int arg2,
-		    int arg3, int arg4, int arg5);
-
-/* This routine is jumped to by all the syscall handlers, to stash
-   an error number into errno.  */
-int
-__syscall_error (int err_no)
-{
-  __set_errno (err_no);
-  return -1;
-}
-
-
-/* HPPA implements syscall() in 'C'; the assembler version would
-   typically be in syscall.S. Also note that we have INLINE_SYSCALL,
-   INTERNAL_SYSCALL, and all the generated pure assembly syscall wrappers.
-   How often the function is used is unknown. */
-int
-syscall (int sysnum, int arg0, int arg1, int arg2, int arg3, int arg4,
-	 int arg5)
-{
-  /* FIXME: Keep this matching INLINE_SYSCALL for hppa */
-  long int __sys_res;
-  {
-    register unsigned long int __res asm("r28");
-    LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
-    asm volatile (STW_ASM_PIC
-		  "	ble  0x100(%%sr2, %%r0)	\n"
-		  "	copy %1, %%r20		\n"
-		  LDW_ASM_PIC
-		  : "=r" (__res)
-		  : "r" (sysnum) ASM_ARGS_6
-		  : CALL_CLOB_REGS CLOB_ARGS_6);
-    __sys_res = __res;
-  }
-  if ((unsigned long int) __sys_res >= (unsigned long int) -4095)
-    {
-      __set_errno (-__sys_res);
-      __sys_res = -1;
-    }
-  return __sys_res;
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
deleted file mode 100644
index 4cfe63c556..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
+++ /dev/null
@@ -1,419 +0,0 @@
-/* Assembler macros for PA-RISC.
-   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
-   Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.
-
-   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 <asm/unistd.h>
-#include <sysdeps/generic/sysdep.h>
-#include <sys/syscall.h>
-#include "config.h"
-
-#ifndef ASM_LINE_SEP
-# define ASM_LINE_SEP ;
-#endif
-
-#undef SYS_ify
-#define SYS_ify(syscall_name)	(__NR_##syscall_name)
-
-#ifdef PIC
-/* WARNING: CANNOT BE USED IN A NOP! */
-# define STW_PIC stw %r19, -32(%sr0, %sp) ASM_LINE_SEP
-# define LDW_PIC ldw -32(%sr0, %sp), %r19 ASM_LINE_SEP
-# define STW_ASM_PIC	"       copy %%r19, %%r4\n"
-# define LDW_ASM_PIC	"       copy %%r4, %%r19\n"
-# define USING_GR4	"%r4",
-#else
-# define STW_PIC ASM_LINE_SEP
-# define LDW_PIC ASM_LINE_SEP
-# define STW_ASM_PIC	" \n"
-# define LDW_ASM_PIC	" \n"
-# define USING_GR4
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* Syntactic details of assembler.  */
-
-#define ALIGNARG(log2) log2
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#define SYS_ify(syscall_name)	__NR_##syscall_name
-
-/* ELF-like local names start with `.L'.  */
-#undef L
-#define L(name)	.L##name
-
-/* Linux uses a negative return value to indicate syscall errors,
-   unlike most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be
-   negative even if the call succeeded.  E.g., the `lseek' system call
-   might return a large offset.  Therefore we must not anymore test
-   for < 0, but test for a real error by making sure the value in %eax
-   is a real error number.  Linus said he will make sure the no syscall
-   returns a value in -1 .. -4095 as a valid result so we can safely
-   test with -4095.  */
-
-/* We don't want the label for the error handle to be global when we define
-   it here.  */
-#ifdef PIC
-# define SYSCALL_ERROR_LABEL 0f
-#else
-# define SYSCALL_ERROR_LABEL syscall_error
-#endif
-
-/* Define an entry point visible from C.
-
-   There is currently a bug in gdb which prevents us from specifying
-   incomplete stabs information.  Fake some entries here which specify
-   the current source file.  */
-#define	ENTRY(name)						\
-	.text					ASM_LINE_SEP	\
-	.export C_SYMBOL_NAME(name)		ASM_LINE_SEP	\
-	.type	C_SYMBOL_NAME(name),@function	ASM_LINE_SEP	\
-	C_LABEL(name)				ASM_LINE_SEP	\
-	CALL_MCOUNT				ASM_LINE_SEP
-
-#undef	END
-#define END(name)							\
-1:							ASM_LINE_SEP	\
-.size	C_SYMBOL_NAME(name),1b-C_SYMBOL_NAME(name)	ASM_LINE_SEP
-
-/* If compiled for profiling, call `mcount' at the start of each function.  */
-/* No, don't bother.  gcc will put the call in for us.  */
-#define CALL_MCOUNT		/* Do nothing.  */
-
-/* syscall wrappers consist of
-	#include <sysdep.h>
-	PSEUDO(...)
-	ret
-	PSEUDO_END(...)
-
-   which means
-	ENTRY(name)
-	DO_CALL(...)
-	nop
-	bv 0(2)
-	nop
-*/
-
-#define	PSEUDO(name, syscall_name, args)			\
-  ENTRY (name)							\
-  DO_CALL(syscall_name, args)			ASM_LINE_SEP	\
-  nop						ASM_LINE_SEP
-
-#define ret \
-	/* Return value set by ERRNO code */	ASM_LINE_SEP	\
-	bv 0(2)					ASM_LINE_SEP	\
-	nop					ASM_LINE_SEP
-
-#undef	PSEUDO_END
-#define	PSEUDO_END(name)					\
-  END (name)
-
-/* We don't set the errno on the return from the syscall */
-#define	PSEUDO_NOERRNO(name, syscall_name, args)		\
-  ENTRY (name)							\
-  DO_CALL_NOERRNO(syscall_name, args)		ASM_LINE_SEP	\
-  nop						ASM_LINE_SEP
-
-#define ret_NOERRNO ret
-
-#undef	PSEUDO_END_NOERRNO
-#define	PSEUDO_END_NOERRNO(name)				\
-  END (name)
-
-/* This has to return the error value */
-#undef  PSEUDO_ERRVAL
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	ENTRY(name)						\
-	DO_CALL_ERRVAL(syscall_name, args)	ASM_LINE_SEP	\
-	nop					ASM_LINE_SEP
-
-#define ret_ERRVAL ret
-
-#undef	PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)					\
-	END(name)
-
-#undef JUMPTARGET
-#define JUMPTARGET(name)	name
-#define SYSCALL_PIC_SETUP	/* Nothing.  */
-
-
-/* All the syscall assembly macros rely on finding the approriate
-   SYSCALL_ERROR_LABEL or rather HANDLER. */
-
-/* int * __errno_location(void) so you have to store your value
-   into the return address! */
-#define DEFAULT_SYSCALL_ERROR_HANDLER 			\
-	.import __errno_location,code	ASM_LINE_SEP	\
-	/* branch to errno handler */	ASM_LINE_SEP	\
-	bl __errno_location,%rp		ASM_LINE_SEP
-
-/* Here are the myriad of configuration options that the above can
-   work for... what we've done is provide the framework for future
-   changes if required to each section */
-
-#ifdef PIC
-# if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# else /* !RTLD_PRIVATE_ERRNO */
-#  if defined _LIBC_REENTRANT
-#   define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-#  else /* !_LIBC_REENTRANT */
-#   define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-#  endif /* _LIBC_REENTRANT */
-# endif /* RTLD_PRIVATE_ERRNO */
-#else
-# ifndef _LIBC_REENTRANT
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# else
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# endif
-#endif
-
-
-/* Linux takes system call arguments in registers:
-	syscall number	gr20
-	arg 1		gr26
-	arg 2		gr25
-	arg 3		gr24
-	arg 4		gr23
-	arg 5		gr22
-	arg 6		gr21
-
-   The compiler calls us by the C convention:
-	syscall number	in the DO_CALL macro
-	arg 1		gr26
-	arg 2		gr25
-	arg 3		gr24
-	arg 4		gr23
-	arg 5		-52(gr30)
-	arg 6		-56(gr30)
-
-   gr22 and gr21 are caller-saves, so we can just load the arguments
-   there and generally be happy. */
-
-/* the cmpb...no_error code below inside DO_CALL
- * is intended to mimic the if (__sys_res...)
- * code inside INLINE_SYSCALL
- */
-
-#undef	DO_CALL
-#define DO_CALL(syscall_name, args)				\
-	DOARGS_##args				ASM_LINE_SEP	\
-	STW_PIC					ASM_LINE_SEP	\
-	/* Do syscall, delay loads # */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)			ASM_LINE_SEP	\
-	ldi SYS_ify (syscall_name), %r20	ASM_LINE_SEP	\
-	ldi -0x1000,%r1				ASM_LINE_SEP	\
-	cmpb,>>=,n %r1,%ret0,0f			ASM_LINE_SEP	\
-	/* save rp or we get lost */		ASM_LINE_SEP	\
-	stw %rp, -20(%sr0,%sp)			ASM_LINE_SEP	\
-	/* Restore r19 from frame */		ASM_LINE_SEP	\
-	LDW_PIC					ASM_LINE_SEP	\
-	stw %ret0, -24(%sr0,%sp)		ASM_LINE_SEP	\
-	SYSCALL_ERROR_HANDLER			ASM_LINE_SEP	\
-	/* create frame */			ASM_LINE_SEP	\
-	ldo 64(%sp), %sp			ASM_LINE_SEP	\
-	ldo -64(%sp), %sp			ASM_LINE_SEP	\
-	/* OPTIMIZE: Don't reload r19 */	ASM_LINE_SEP	\
-	/* do a -1*syscall_ret0 */		ASM_LINE_SEP	\
-	ldw -24(%sr0,%sp), %r26			ASM_LINE_SEP	\
-	sub %r0, %r26, %r26			ASM_LINE_SEP	\
-	/* Store into errno location */		ASM_LINE_SEP	\
-	stw %r26, 0(%sr0,%ret0)			ASM_LINE_SEP	\
-	/* return -1 as error */		ASM_LINE_SEP	\
-	ldo -1(%r0), %ret0			ASM_LINE_SEP	\
-	ldw -20(%sr0,%sp), %rp			ASM_LINE_SEP	\
-0:						ASM_LINE_SEP	\
-	UNDOARGS_##args				ASM_LINE_SEP
-
-/* We do nothing with the return, except hand it back to someone else */
-#undef  DO_CALL_NOERRNO
-#define DO_CALL_NOERRNO(syscall_name, args)			\
-	DOARGS_##args                                           \
-	/* No need to store r19 */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)                    ASM_LINE_SEP    \
-	ldi SYS_ify (syscall_name), %r20        ASM_LINE_SEP    \
-	/* Caller will restore r19 */		ASM_LINE_SEP	\
-	UNDOARGS_##args
-
-/* Here, we return the ERRVAL in assembly, note we don't call the
-   error handler function, but we do 'negate' the return _IF_
-   it's an error. Not sure if this is the right semantic. */
-
-#undef	DO_CALL_ERRVAL
-#define DO_CALL_ERRVAL(syscall_name, args)			\
-	DOARGS_##args				ASM_LINE_SEP	\
-	/* No need to store r19 */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)			ASM_LINE_SEP	\
-	ldi SYS_ify (syscall_name), %r20	ASM_LINE_SEP	\
-	/* Caller will restore r19 */		ASM_LINE_SEP	\
-	ldi -0x1000,%r1				ASM_LINE_SEP	\
-	cmpb,>>=,n %r1,%ret0,0f			ASM_LINE_SEP	\
-	sub %r0, %ret0, %ret0			ASM_LINE_SEP	\
-0:						ASM_LINE_SEP	\
-	UNDOARGS_##args				ASM_LINE_SEP
-
-#define DOARGS_0 /* nothing */
-#define DOARGS_1 /* nothing */
-#define DOARGS_2 /* nothing */
-#define DOARGS_3 /* nothing */
-#define DOARGS_4 /* nothing */
-#define DOARGS_5 ldw -52(%r30), %r22		ASM_LINE_SEP
-#define DOARGS_6 ldw -52(%r30), %r22		ASM_LINE_SEP	\
-		 ldw -56(%r30), %r21		ASM_LINE_SEP
-
-
-#define UNDOARGS_0 /* nothing */
-#define UNDOARGS_1 /* nothing */
-#define UNDOARGS_2 /* nothing */
-#define UNDOARGS_3 /* nothing */
-#define UNDOARGS_4 /* nothing */
-#define UNDOARGS_5 /* nothing */
-#define UNDOARGS_6 /* nothing */
-
-#else
-
-/* GCC has to be warned that a syscall may clobber all the ABI
-   registers listed as "caller-saves", see page 8, Table 2
-   in section 2.2.6 of the PA-RISC RUN-TIME architecture
-   document. However! r28 is the result and will conflict with
-   the clobber list so it is left out. Also the input arguments
-   registers r20 -> r26 will conflict with the list so they
-   are treated specially. Although r19 is clobbered by the syscall
-   we cannot say this because it would violate ABI, thus we say
-   r4 is clobbered and use that register to save/restore r19
-   across the syscall. */
-
-#define CALL_CLOB_REGS	"%r1", "%r2", USING_GR4 \
-		 	"%r20", "%r29", "%r31"
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)	({			\
-	long __sys_res;							\
-	{								\
-		register unsigned long __res asm("r28");		\
-		LOAD_ARGS_##nr(args)					\
-		/* FIXME: HACK stw/ldw r19 around syscall */		\
-		asm volatile(						\
-			STW_ASM_PIC					\
-			"	ble  0x100(%%sr2, %%r0)\n"		\
-			"	ldi %1, %%r20\n"			\
-			LDW_ASM_PIC					\
-			: "=r" (__res)					\
-			: "i" (SYS_ify(name)) ASM_ARGS_##nr		\
-			: CALL_CLOB_REGS CLOB_ARGS_##nr			\
-		);							\
-		__sys_res = (long)__res;				\
-	}								\
-	if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){	\
-		__set_errno(-__sys_res);				\
-		__sys_res = -1;						\
-	}								\
-	__sys_res;							\
-})
-
-/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static
-   value to use within the context of the syscall
-   INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise
-   You are allowed to use the syscall result (val) and the DECL error variable
-   to determine what went wrong.
-   INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number.
-   In our case we just flip the sign. */
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-/* Equivalent to  (val < 0)&&(val > -4095) which is what we want */
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
-	((unsigned long)val >= (unsigned long)-4095)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
-/* Similar to INLINE_SYSCALL but we don't set errno */
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) 		\
-({								\
-	long __sys_res;						\
-	{							\
-		register unsigned long __res asm("r28");	\
-		LOAD_ARGS_##nr(args)				\
-		/* FIXME: HACK stw/ldw r19 around syscall */	\
-		asm volatile(					\
-			STW_ASM_PIC				\
-			"	ble  0x100(%%sr2, %%r0)\n"	\
-			"	ldi %1, %%r20\n"		\
-			LDW_ASM_PIC				\
-			: "=r" (__res)				\
-			: "i" (SYS_ify(name)) ASM_ARGS_##nr	\
-			: CALL_CLOB_REGS CLOB_ARGS_##nr		\
-		);						\
-		__sys_res = (long)__res;			\
-	}							\
-	__sys_res;						\
- })
-
-#define LOAD_ARGS_0()
-#define LOAD_ARGS_1(r26)					\
-	register unsigned long __r26 __asm__("r26") = (unsigned long)(r26);   \
-	LOAD_ARGS_0()
-#define LOAD_ARGS_2(r26,r25)					\
-	register unsigned long __r25 __asm__("r25") = (unsigned long)(r25);   \
-	LOAD_ARGS_1(r26)
-#define LOAD_ARGS_3(r26,r25,r24)				\
-	register unsigned long __r24 __asm__("r24") = (unsigned long)(r24);   \
-	LOAD_ARGS_2(r26,r25)
-#define LOAD_ARGS_4(r26,r25,r24,r23)				\
-	register unsigned long __r23 __asm__("r23") = (unsigned long)(r23);   \
-	LOAD_ARGS_3(r26,r25,r24)
-#define LOAD_ARGS_5(r26,r25,r24,r23,r22)			\
-	register unsigned long __r22 __asm__("r22") = (unsigned long)(r22);   \
-	LOAD_ARGS_4(r26,r25,r24,r23)
-#define LOAD_ARGS_6(r26,r25,r24,r23,r22,r21)			\
-	register unsigned long __r21 __asm__("r21") = (unsigned long)(r21);   \
-	LOAD_ARGS_5(r26,r25,r24,r23,r22)
-
-/* Even with zero args we use r20 for the syscall number */
-#define ASM_ARGS_0
-#define ASM_ARGS_1 ASM_ARGS_0, "r" (__r26)
-#define ASM_ARGS_2 ASM_ARGS_1, "r" (__r25)
-#define ASM_ARGS_3 ASM_ARGS_2, "r" (__r24)
-#define ASM_ARGS_4 ASM_ARGS_3, "r" (__r23)
-#define ASM_ARGS_5 ASM_ARGS_4, "r" (__r22)
-#define ASM_ARGS_6 ASM_ARGS_5, "r" (__r21)
-
-/* The registers not listed as inputs but clobbered */
-#define CLOB_ARGS_6
-#define CLOB_ARGS_5 CLOB_ARGS_6, "%r21"
-#define CLOB_ARGS_4 CLOB_ARGS_5, "%r22"
-#define CLOB_ARGS_3 CLOB_ARGS_4, "%r23"
-#define CLOB_ARGS_2 CLOB_ARGS_3, "%r24"
-#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
-#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/i386/Dist b/sysdeps/unix/sysv/linux/i386/Dist
deleted file mode 100644
index 70253ac9e8..0000000000
--- a/sysdeps/unix/sysv/linux/i386/Dist
+++ /dev/null
@@ -1,17 +0,0 @@
-bp-thunks.h
-clone.S
-olddirent.h
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/debugreg.h
-sys/elf.h
-sys/io.h
-sys/perm.h
-sys/procfs.h
-sys/reg.h
-sys/user.h
-sys/vm86.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 1ae69407ff..9e84975635 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,5 +1,5 @@
 ifeq ($(subdir),misc)
-sysdep_routines += ioperm iopl vm86
+sysdep_routines += ioperm iopl vm86 call_pselect6
 sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
 endif
 
@@ -12,3 +12,7 @@ endif
 ifeq ($(subdir),resource)
 sysdep_routines += oldgetrlimit64
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 9065825b98..6de33302ee 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -96,7 +99,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -180,10 +183,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
index 1477aa54e2..00cb982395 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/i386 version.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 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
@@ -78,6 +78,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -87,6 +88,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/i386/call_pselect6.S b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
new file mode 100644
index 0000000000..a356f1dfa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
@@ -0,0 +1,65 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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>
+
+#ifdef __NR_pselect6
+	.text
+ENTRY(__call_pselect6)
+	.hidden __call_pselect6
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%esi
+	cfi_adjust_cfa_offset (4)
+	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebp, 0)
+	cfi_rel_offset (edi, 4)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebx, 12)
+
+	movl	$__NR_pselect6, %eax
+	movl	20(%esp), %ebx
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	movl	36(%esp), %edi
+	movl	40(%esp), %ebp
+
+	/* The syscall handling cannot handle 6 parameters.  Yet.  */
+	int	$0x80
+
+	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
+	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+
+	ret
+END(__call_pselect6)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c
index 31a6e0f08a..fc6a9c95a1 100644
--- a/sysdeps/unix/sysv/linux/i386/chown.c
+++ b/sysdeps/unix/sysv/linux/i386/chown.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998,1999,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2000,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 +26,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index c7d31f7a32..54524ec120 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,98,99,2000,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,02,03,04,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@tamu.edu)
 
@@ -83,12 +83,19 @@ ENTRY (BP_SYM (__clone))
 
 	/* Do the system call */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+
 	movl	TLS+12(%esp),%esi
+	cfi_rel_offset (esi, 4)
 	movl	PTID+12(%esp),%edx
 	movl	FLAGS+12(%esp),%ebx
+	cfi_rel_offset (ebx, 8)
 	movl	CTID+12(%esp),%edi
+	cfi_rel_offset (edi, 0)
 	movl	$SYS_ify(clone),%eax
 
 #ifdef RESET_PID
@@ -96,6 +103,10 @@ ENTRY (BP_SYM (__clone))
 	movl	%ebx, (%ecx)
 #endif
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	int	$0x80
 	popl	%edi
 	popl	%esi
@@ -125,7 +136,7 @@ L(here):
 #endif
 	movl	%eax, %ebx
 	movl	$SYS_ify(exit), %eax
-	int	$0x80
+	ENTER_KERNEL
 
 #ifdef RESET_PID
 	.subsection 2
@@ -142,6 +153,7 @@ L(nomoregetpid):
 	.previous
 #endif
 
+	cfi_startproc
 PSEUDO_END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/i386/dl-cache.h b/sysdeps/unix/sysv/linux/i386/dl-cache.h
new file mode 100644
index 0000000000..38a1c7dfb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/dl-cache.h
@@ -0,0 +1,59 @@
+/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+static inline int
+is_ia64 (void)
+{
+  unsigned int fl1, fl2;
+
+  /* See if we can use cpuid.  */
+  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
+           "pushl %0; popfl; pushfl; popl %0; popfl"
+           : "=&r" (fl1), "=&r" (fl2)
+           : "i" (0x00200000));
+  if (((fl1 ^ fl2) & 0x00200000) == 0)
+    return 0;
+
+  /* Host supports cpuid.  See if cpuid gives capabilities, try
+     CPUID(0).  Preserve %ebx and %ecx; cpuid insn clobbers these, we
+     don't need their CPUID values here, and %ebx may be the PIC
+     register.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+           : "=a" (fl1) : "0" (0) : "edx", "cc");
+  if (fl1 == 0)
+    return 0;
+
+  /* Invoke CPUID(1), return %edx; caller can examine bits to
+     determine what's supported.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+           : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
+  return (fl2 & (1 << 30)) != 0;
+}
+
+#define arch_startup(argc, argv) \
+  do {									\
+    /* On IA-64, try to execute 64-bit ldconfig if possible.		\
+       This is because the badly designed /emul/ia32-linux hack		\
+       will cause 32-bit ldconfig to do all sorts of weird things.  */	\
+    if (is_ia64 ())							\
+      execv ("/emul/ia32-linux/../../sbin/ldconfig",			\
+	     (char *const *) argv);					\
+  } while (0)
+
+#include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c
index 1f2e389844..30299c9609 100644
--- a/sysdeps/unix/sysv/linux/i386/fchown.c
+++ b/sysdeps/unix/sysv/linux/i386/fchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 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
@@ -23,7 +23,7 @@
 #include <sys/syscall.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_fchown32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
new file mode 100644
index 0000000000..34acf10c27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.c
@@ -0,0 +1,110 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <shlib-compat.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include <kernel-features.h>
+
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_32BITUIDS > 0
+  /* This implies __ASSUME_LCHOWN_SYSCALL.  */
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file), owner,
+			       group);
+  else
+    result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+			       group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      return -1;
+    }
+# else
+  /* Don't inline the rest to avoid unnecessary code duplication.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = __lchown (file, owner, group);
+  else
+    result = __chown (file, owner, group);
+  if (result < 0)
+    __atfct_seterrno (errno, fd, buf);
+# endif
+
+  return result;
+
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 210faba2a7..b27373d24b 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,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
@@ -23,7 +23,7 @@
 #include <stdarg.h>
 
 #include <sys/syscall.h>
-#include "../kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_FCNTL64 == 0
 /* This variable is shared with all files that check for fcntl64.  */
diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c
index 40787b99e7..281839f964 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstat.c
@@ -1,5 +1,6 @@
 /* fxstat using old-style Unix fstat system call.
-   Copyright (C) 1991,1995-1998,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-1998,2000,2002,2003,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
@@ -30,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
new file mode 100644
index 0000000000..94f6e81186
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -0,0 +1,176 @@
+/* Copyright (C) 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
+   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.  */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+   will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#include <xstatconv.h>
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls.  */
+extern int __have_no_stat64;
+# endif
+#endif
+
+
+/* Get information about the file NAME relative to FD in ST.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+  struct stat64 st64;
+
+#ifdef __NR_fstatat64
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  return __xstat32_conv (vers, &st64, st);
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (__builtin_expect (flag & ~AT_SYMLINK_NOFOLLOW, 0))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_STAT64_SYSCALL == 0
+  struct kernel_stat kst;
+# endif
+  if (vers == _STAT_VER_KERNEL)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      else
+	result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      goto out;
+    }
+
+# if __ASSUME_STAT64_SYSCALL > 0
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&st64));
+  else
+    result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&st64));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat32_conv (vers, &st64, st);
+# else
+#  if defined __NR_stat64
+  /* To support 32 bit UIDs, we have to use stat64.  The normal stat
+     call only returns 16 bit UIDs.  */
+  if (! __have_no_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+				   __ptrvalue (&st64));
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+				   __ptrvalue (&st64));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	result = __xstat32_conv (vers, &st64, st);
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+	goto out;
+
+      __have_no_stat64 = 1;
+    }
+#  endif
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+# endif  /* __ASSUME_STAT64_SYSCALL  */
+
+ out:
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
+libc_hidden_def (__fxstatat)
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_ver (__fxstatat, __fxstatat64)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S
index 68541d5d80..fe28f1e0e1 100644
--- a/sysdeps/unix/sysv/linux/i386/getcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   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.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -63,12 +63,16 @@ ENTRY(__getcontext)
 
 	/* Save the current signal mask.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 	leal	oSIGMASK(%eax), %edx
 	xorl	%ecx, %ecx
 	movl	$SIG_BLOCK, %ebx
 	movl	$__NR_sigprocmask, %eax
 	ENTER_KERNEL
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	cmpl	$-4095, %eax		/* Check %eax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
@@ -78,4 +82,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/getegid.c b/sysdeps/unix/sysv/linux/i386/getegid.c
index c54133b359..31c10cc32f 100644
--- a/sysdeps/unix/sysv/linux/i386/getegid.c
+++ b/sysdeps/unix/sysv/linux/i386/getegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 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
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getegid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/geteuid.c b/sysdeps/unix/sysv/linux/i386/geteuid.c
index 8d56f6c7f8..53f52687a4 100644
--- a/sysdeps/unix/sysv/linux/i386/geteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/geteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 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
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_geteuid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/getgid.c b/sysdeps/unix/sysv/linux/i386/getgid.c
index 0ff63580f6..7a7e38d9c0 100644
--- a/sysdeps/unix/sysv/linux/i386/getgid.c
+++ b/sysdeps/unix/sysv/linux/i386/getgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getgid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/getmsg.c b/sysdeps/unix/sysv/linux/i386/getmsg.c
index e6ca88d136..c0efd56369 100644
--- a/sysdeps/unix/sysv/linux/i386/getmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/getmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 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
@@ -34,5 +34,5 @@ getmsg (fildes, ctlptr, dataptr, flagsp)
   return INLINE_SYSCALL (getpmsg, 5, fildes, ctlptr, dataptr, NULL, flagsp);
 }
 #else
-# include <sysdeps/generic/getmsg.c>
+# include <streams/getmsg.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getresgid.c b/sysdeps/unix/sysv/linux/i386/getresgid.c
index 8028dec3f9..393195619f 100644
--- a/sysdeps/unix/sysv/linux/i386/getresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/getresgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getresgid
 
@@ -81,5 +81,5 @@ libc_hidden_def (__getresgid)
 weak_alias (__getresgid, getresgid)
 
 #else
-# include <sysdeps/generic/getresgid.c>
+# include <posix/getresgid.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getresuid.c b/sysdeps/unix/sysv/linux/i386/getresuid.c
index 6b94bbb66c..ddd25341b2 100644
--- a/sysdeps/unix/sysv/linux/i386/getresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/getresuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getresuid
 
@@ -80,5 +80,5 @@ libc_hidden_def (__getresuid)
 weak_alias (__getresuid, getresuid)
 
 #else
-# include <sysdeps/generic/getresuid.c>
+# include <posix/getresuid.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit.c b/sysdeps/unix/sysv/linux/i386/getrlimit.c
index 38b369bc4f..59951ac100 100644
--- a/sysdeps/unix/sysv/linux/i386/getrlimit.c
+++ b/sysdeps/unix/sysv/linux/i386/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003, 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
@@ -24,7 +24,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __new_getrlimit (enum __rlimit_resource resource,
 			    struct rlimit *__unbounded rlimits);
diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit64.c b/sysdeps/unix/sysv/linux/i386/getrlimit64.c
index d6ab86f3e4..2ff175393c 100644
--- a/sysdeps/unix/sysv/linux/i386/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/i386/getrlimit64.c
@@ -1,4 +1,4 @@
-/* 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
@@ -18,7 +18,7 @@
 
 #define getrlimit64 __new_getrlimit64
 
-#include <sysdeps/generic/getrlimit64.c>
+#include <resource/getrlimit64.c>
 
 #undef getrlimit64
 #include <shlib-compat.h>
diff --git a/sysdeps/unix/sysv/linux/i386/getuid.c b/sysdeps/unix/sysv/linux/i386/getuid.c
index 3e5c901ec5..d7be0c3cde 100644
--- a/sysdeps/unix/sysv/linux/i386/getuid.c
+++ b/sysdeps/unix/sysv/linux/i386/getuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getuid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/glob64.c b/sysdeps/unix/sysv/linux/i386/glob64.c
index d3d1212f05..18b7f21ae8 100644
--- a/sysdeps/unix/sysv/linux/i386/glob64.c
+++ b/sysdeps/unix/sysv/linux/i386/glob64.c
@@ -19,7 +19,7 @@
 
 #define COMPILE_GLOB64	1
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 #include "shlib-compat.h"
 
@@ -48,7 +48,7 @@ int __old_glob64 (__const char *__pattern, int __flags,
 
 #define GLOB_ONLY_P 1
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1);
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c
index 1b217a9451..fbba0bf1d1 100644
--- a/sysdeps/unix/sysv/linux/i386/lchown.c
+++ b/sysdeps/unix/sysv/linux/i386/lchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2003,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
@@ -24,7 +24,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_lchown
 # ifdef __NR_lchown32
@@ -70,5 +70,5 @@ __lchown (const char *file, uid_t owner, gid_t group)
 weak_alias (__lchown, lchown)
 
 #else
-# include <sysdeps/generic/lchown.c>
+# include <io/lchown.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/lockf64.c b/sysdeps/unix/sysv/linux/i386/lockf64.c
index e066cb26e1..8b568ff4a3 100644
--- a/sysdeps/unix/sysv/linux/i386/lockf64.c
+++ b/sysdeps/unix/sysv/linux/i386/lockf64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1994,1996,1997,1998,1999,2000,2003,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
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* lockf is a simplified interface to fcntl's locking facilities.  */
 
diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c
index 65ea0bbed0..5cc96127b5 100644
--- a/sysdeps/unix/sysv/linux/i386/lxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/lxstat.c
@@ -1,6 +1,6 @@
 /* lxstat using old-style Unix lstat system call.
-   Copyright (C) 1991, 1995, 1996, 1997, 1998, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1991,1995,1996,1997,1998,2000,2002,2003,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
@@ -31,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index ec49b74b9a..12ba4e2d67 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2001,02 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -68,7 +68,9 @@ ENTRY(__makecontext)
 	   below).  */
 #ifdef PIC
 	call	1f
+	cfi_adjust_cfa_offset (4)
 1:	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 	addl	$L(exitcode)-1b, %ecx
 	movl	%ecx, (%edx)
 #else
@@ -83,6 +85,7 @@ ENTRY(__makecontext)
 	   the context 'makecontext' manipulated at the time of the
 	   'makecontext' call.  If the pointer is NULL the process must
 	   terminate.  */
+	cfi_endproc
 L(exitcode):
 	/* This removes the parameters passed to the function given to
 	   'makecontext' from the stack.  EBX contains the number of
@@ -108,6 +111,7 @@ L(exitcode):
 	/* The 'exit' call should never return.  In case it does cause
 	   the process to terminate.  */
 	hlt
+	cfi_startproc
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
index ebb21f3d32..a1481feeb5 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,98,99,2000,2002,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
@@ -18,7 +19,7 @@
 
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 
@@ -26,22 +27,30 @@
 
 ENTRY (__mmap)
 
-/* I don't think it is worthwhile trzing to use mmap2 whenever it
+/* I don't think it is worthwhile trying to use mmap2 whenever it
    is available.  Only use it when we are sure the syscall exists.  */
 #ifdef __ASSUME_MMAP2_SYSCALL
 
 	/* Save registers.  */
 	pushl %ebp
+	cfi_adjust_cfa_offset (4)
 	pushl %ebx
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 
 	movl 20(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl 24(%esp), %ecx
 	movl 28(%esp), %edx
 	movl 32(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl 36(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl 40(%esp), %ebp
+	cfi_rel_offset (ebp, 12)
 	testl $0xfff, %ebp
 	movl $-EINVAL, %eax
 	jne L(skip)
@@ -54,14 +63,23 @@ ENTRY (__mmap)
 L(skip):
 	/* Restore registers.  */
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #else
 
 	/* Save registers.  */
 	movl %ebx, %edx
+	cfi_register (ebx, edx)
 
 	movl $SYS_ify(mmap), %eax	/* System call number in %eax.  */
 
@@ -72,6 +90,7 @@ L(skip):
 
 	/* Restore registers.  */
 	movl %edx, %ebx
+	cfi_restore (ebx)
 
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S
index 3a03335814..f53e6e8c68 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap64.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap64.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,98,99,2000,2002,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
@@ -20,7 +21,7 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 #define ENOSYS	38
@@ -42,9 +43,13 @@ ENTRY (BP_SYM (__mmap64))
 
 	/* Save registers.  */
 	pushl %ebp
+	cfi_adjust_cfa_offset (4)
 	pushl %ebx
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 
 	movl OFFLO(%esp), %edx
 	movl OFFHI(%esp), %ecx
@@ -54,12 +59,16 @@ ENTRY (BP_SYM (__mmap64))
 	shrl $12, %ecx
 	jne L(einval)
 	movl %edx, %ebp
+	cfi_rel_offset (ebp, 12)
 
 	movl ADDR(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl LEN(%esp), %ecx
 	movl PROT(%esp), %edx
 	movl FLAGS(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl FD(%esp), %edi
+	cfi_rel_offset (edi, 0)
 
 	movl $SYS_ify(mmap2), %eax	/* System call number in %eax.  */
 
@@ -69,9 +78,17 @@ L(do_syscall):
 
 	/* Restore registers.  */
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #ifndef __ASSUME_MMAP2_SYSCALL
 2:
@@ -87,12 +104,25 @@ L(do_syscall):
 L(pseudo_end):
 	ret
 
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (ebp, 12)
+	cfi_rel_offset (ebx, 8)
+	cfi_rel_offset (esi, 4)
+	cfi_rel_offset (edi, 0)
 	/* This means the offset value is too large.  */
 L(einval):
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	movl $-EINVAL, %eax
 	jmp SYSCALL_ERROR_LABEL
 #endif
@@ -101,6 +131,7 @@ L(einval):
 3:
 	/* Save registers.  */
 	movl %ebx, %edx
+	cfi_register (ebx, edx)
 
 	cmpl $0, OFFHI-SVRSP(%esp)
 	jne L(einval2)
@@ -114,6 +145,7 @@ L(einval):
 
 	/* Restore registers.  */
 	movl %edx, %ebx
+	cfi_restore (ebx)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	cmpl $-4096, %eax
@@ -125,8 +157,10 @@ L(pseudo_end):
 #endif
 	ret
 
+	cfi_register (ebx, edx)
 L(einval2):
 	movl %edx, %ebx
+	cfi_restore (ebx)
 	movl $-EINVAL, %eax
 	jmp SYSCALL_ERROR_LABEL
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c
index 108da8a987..afecc49dd7 100644
--- a/sysdeps/unix/sysv/linux/i386/msgctl.c
+++ b/sysdeps/unix/sysv/linux/i386/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_msqid_ds
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
index 99a3ea536d..092a3bfb97 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
+++ b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2000,2002,2003,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
@@ -20,7 +21,7 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 #define ENOSYS	38
@@ -42,25 +43,41 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 
 	/* Save registers.  */
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	FD(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl	OFFLO(%esp), %ecx
 	movl	OFFHI(%esp), %edx
 	movl	LENLO(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl	LENHI(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	FLAGS(%esp), %ebp
+	cfi_rel_offset (ebp, 12)
 
 	movl	$SYS_ify(fadvise64_64), %eax
 	ENTER_KERNEL
 
 	/* Restore registers.  */
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #ifndef __ASSUME_FADVISE64_64_SYSCALL
 	cmpl	$-ENOSYS, %eax
@@ -80,8 +97,11 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
     && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64)
 1:	/* Save registers.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	/* Overflow check.  */
 	cmpl	$0, LENHI(%esp)
@@ -89,10 +109,13 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 	jne	L(overflow)
 
 	movl	FD(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl	OFFLO(%esp), %ecx
 	movl	OFFHI(%esp), %edx
 	movl	LENLO(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl	FLAGS(%esp), %edi
+	cfi_rel_offset (edi, 0)
 
 	movl	$SYS_ify(fadvise64), %eax
 	ENTER_KERNEL
@@ -100,8 +123,14 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 	/* Restore registers.  */
 L(overflow):
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	negl	%eax
diff --git a/sysdeps/unix/sysv/linux/i386/pselect.c b/sysdeps/unix/sysv/linux/i386/pselect.c
new file mode 100644
index 0000000000..2646608786
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/pselect.c
@@ -0,0 +1,18 @@
+#include <sys/select.h>
+
+extern int __call_pselect6 (int nfds, fd_set *readfds, fd_set *writefds,
+			    fd_set *exceptfds, const struct timespec *timeout,
+			    void *data) attribute_hidden;
+
+
+#define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+  ({ int r = __call_pselect6 (nfds, readfds, writefds, exceptfds, timeout,    \
+			      data);					      \
+     if (r < 0 && r > -4096)						      \
+       {								      \
+	 __set_errno (-r);						      \
+	 r = -1;							      \
+       }								      \
+     r; })
+
+#include "../pselect.c"
diff --git a/sysdeps/unix/sysv/linux/i386/putmsg.c b/sysdeps/unix/sysv/linux/i386/putmsg.c
index e7b7a08b55..04fd159b7c 100644
--- a/sysdeps/unix/sysv/linux/i386/putmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/putmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 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
@@ -34,5 +34,5 @@ putmsg (fildes, ctlptr, dataptr, flags)
   return INLINE_SYSCALL (putpmsg, 5, fildes, ctlptr, dataptr, -1, flags);
 }
 #else
-# include <sysdeps/generic/putmsg.c>
+# include <streams/putmsg.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c
index 6852f2a9a9..a6374e61d2 100644
--- a/sysdeps/unix/sysv/linux/i386/readelflib.c
+++ b/sysdeps/unix/sysv/linux/i386/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 2000.
@@ -73,10 +73,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c
index 14bfac613c..1693cd47c4 100644
--- a/sysdeps/unix/sysv/linux/i386/semctl.c
+++ b/sysdeps/unix/sysv/linux/i386/semctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1997,1998,2000,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +27,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_semid_ds
diff --git a/sysdeps/unix/sysv/linux/i386/semtimedop.S b/sysdeps/unix/sysv/linux/i386/semtimedop.S
index 572641675f..0893c6a654 100644
--- a/sysdeps/unix/sysv/linux/i386/semtimedop.S
+++ b/sysdeps/unix/sysv/linux/i386/semtimedop.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -32,22 +32,34 @@
 ENTRY (BP_SYM (semtimedop))
 
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	$SYSOP_semtimedop, %ebx
+	cfi_rel_offset (ebx, 4)
 	movl	SEMID(%esp), %ecx
 	movl	NSOPS(%esp), %edx
 	movl	SOPS(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	TIMEOUT(%esp), %ebp
+	cfi_rel_offset (ebp, 8)
 	movl	$__NR_ipc, %eax
 
 	ENTER_KERNEL
 
 	/* Restore registers.  */
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	cmpl $-4096, %eax
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S
index ebed2ce572..bf2d7d2bad 100644
--- a/sysdeps/unix/sysv/linux/i386/setcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/setcontext.S
@@ -1,5 +1,5 @@
 /* Install given context.
-   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.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -31,12 +31,16 @@ ENTRY(__setcontext)
 	   the system call fails and we return from the function with an
 	   error.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	xorl	%edx, %edx
 	leal	oSIGMASK(%eax), %ecx
 	movl	$SIG_SETMASK, %ebx
+	cfi_rel_offset (ebx, 0)
 	movl	$__NR_sigprocmask, %eax
 	ENTER_KERNEL
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	cmpl	$-4095, %eax		/* Check %eax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
@@ -57,6 +61,13 @@ ENTRY(__setcontext)
 	movl	oEIP(%eax), %ecx
 
 	/* Load the new stack pointer.  */
+	cfi_def_cfa (eax, 0)
+	cfi_offset (edi, oEDI)
+	cfi_offset (esi, oESI)
+	cfi_offset (ebp, oEBP)
+	cfi_offset (ebx, oEBX)
+	cfi_offset (edx, oEDX)
+	cfi_offset (ecx, oECX)
 	movl	oESP(%eax), %esp
 
 	/* Push the return address on the new stack so we can return there.  */
@@ -72,6 +83,10 @@ ENTRY(__setcontext)
 	movl	oECX(%eax), %ecx
 	movl	oEAX(%eax), %eax
 
+	/* End FDE here, we fall into another context.  */
+	cfi_endproc
+	cfi_startproc
+
 	/* The following 'ret' will pop the address of the code and jump
 	   to it.  */
 
@@ -79,4 +94,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c
index b4bf33f18f..755bc360ad 100644
--- a/sysdeps/unix/sysv/linux/i386/setegid.c
+++ b/sysdeps/unix/sysv/linux/i386/setegid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000,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
@@ -19,7 +20,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setresgid
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c
index c139684d04..6de173521c 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/seteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setresuid
diff --git a/sysdeps/unix/sysv/linux/i386/setfsgid.c b/sysdeps/unix/sysv/linux/i386/setfsgid.c
index b98514d5be..7296d433ca 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003, 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
@@ -23,7 +23,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setfsgid
diff --git a/sysdeps/unix/sysv/linux/i386/setfsuid.c b/sysdeps/unix/sysv/linux/i386/setfsuid.c
index f7cf89bf14..65ed353480 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003, 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
@@ -24,7 +24,7 @@
 #include <sys/syscall.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_setfsuid
 
diff --git a/sysdeps/unix/sysv/linux/i386/setgid.c b/sysdeps/unix/sysv/linux/i386/setgid.c
index a7cdba582d..208ef25d0e 100644
--- a/sysdeps/unix/sysv/linux/i386/setgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setgid32
diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c
index a2c6fc8daa..10f5b7c91b 100644
--- a/sysdeps/unix/sysv/linux/i386/setgroups.c
+++ b/sysdeps/unix/sysv/linux/i386/setgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002,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
@@ -26,7 +26,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setgroups32
diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c
index f20a78175a..05e448c6c9 100644
--- a/sysdeps/unix/sysv/linux/i386/setregid.c
+++ b/sysdeps/unix/sysv/linux/i386/setregid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setregid32
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index d4093afb0f..d0750bb203 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,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
@@ -20,7 +21,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresgid || defined __NR_setresgid32
@@ -80,6 +81,6 @@ weak_alias (__setresgid, setresgid)
 
 #else
 
-#include <sysdeps/generic/setresgid.c>
+#include <posix/setresgid.c>
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c
index 540b954e08..0a676e53a9 100644
--- a/sysdeps/unix/sysv/linux/i386/setresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresuid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,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
@@ -20,7 +21,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresuid || defined __NR_setresuid32
@@ -80,6 +81,6 @@ weak_alias (__setresuid, setresuid)
 
 #else
 
-#include <sysdeps/generic/setresuid.c>
+#include <posix/setresuid.c>
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c
index 09717ec52a..1ea449616c 100644
--- a/sysdeps/unix/sysv/linux/i386/setreuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setreuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setreuid32
diff --git a/sysdeps/unix/sysv/linux/i386/setrlimit.c b/sysdeps/unix/sysv/linux/i386/setrlimit.c
index 4d23209f62..e7e517d914 100644
--- a/sysdeps/unix/sysv/linux/i386/setrlimit.c
+++ b/sysdeps/unix/sysv/linux/i386/setrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003, 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 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __new_setrlimit (enum __rlimit_resource resource,
 			    const struct rlimit *__unboundedrlimits);
diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c
index f809948f59..21c5bcd615 100644
--- a/sysdeps/unix/sysv/linux/i386/setuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setuid32
diff --git a/sysdeps/unix/sysv/linux/i386/shmctl.c b/sysdeps/unix/sysv/linux/i386/shmctl.c
index 394d3c01cf..2cc039996c 100644
--- a/sysdeps/unix/sysv/linux/i386/shmctl.c
+++ b/sysdeps/unix/sysv/linux/i386/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -27,7 +27,7 @@
 #include <bits/wordsize.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_shmid_ds
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/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index e403899cc6..7c8ac29b86 100644
--- a/sysdeps/unix/sysv/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,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
@@ -41,7 +41,6 @@
 #endif
 
 .globl __socket
-	cfi_startproc
 ENTRY (__socket)
 #if defined NEED_CANCELLATION && defined CENABLE
 	SINGLE_THREAD_P
@@ -118,7 +117,6 @@ L(pseudo_end):
 	/* Successful; return the syscall's value.  */
 	ret
 #endif
-	cfi_endproc
 PSEUDO_END (__socket)
 
 #ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S
index d909e659e4..27c16200b2 100644
--- a/sysdeps/unix/sysv/linux/i386/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S
@@ -109,4 +109,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/sync_file_range.S b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
new file mode 100644
index 0000000000..f39e8a00d7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
@@ -0,0 +1,72 @@
+/* Selective file content synch'ing.
+   Copyright (C) 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#define _ERRNO_H        1
+#include <bits/errno.h>
+
+
+	.text
+ENTRY (sync_file_range)
+#ifdef __NR_sync_file_range
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%esi
+	cfi_adjust_cfa_offset (4)
+	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+
+	movl	20(%esp), %ebx
+	cfi_rel_offset (ebx, 12)
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	cfi_rel_offset (esi, 8)
+	movl	36(%esp), %edi
+	cfi_rel_offset (edi, 4)
+	movl	40(%esp), %ebp
+	cfi_rel_offset (ebp, 0)
+
+	movl	$SYS_ify(sync_file_range), %eax
+	ENTER_KERNEL
+
+	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
+	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+
+	cmpl	$-4095, %eax
+	jae	SYSCALL_ERROR_LABEL
+L(pseudo_end):
+	ret
+#else
+	movl	$-ENOSYS, %eax
+	jmp	SYSCALL_ERROR_LABEL
+#endif
+PSEUDO_END (sync_file_range)
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 214397446d..3ff3a73aab 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -5,5 +5,4 @@ vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
-time		-	time		Ei:p	time
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c
index eae849b277..2ffbd5227b 100644
--- a/sysdeps/unix/sysv/linux/i386/sysconf.c
+++ b/sysdeps/unix/sysv/linux/i386/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -26,7 +26,7 @@
 static long int linux_sysconf (int name);
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_i486 (int name)
 {
   /* The processor only has a unified level 1 cache of 8k.  */
@@ -84,11 +84,24 @@ static const struct intel_02_cache_info
     { 0x29, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
     { 0x2c, _SC_LEVEL1_DCACHE_SIZE, 32768, 8, 64 },
     { 0x30, _SC_LEVEL1_ICACHE_SIZE, 32768, 8, 64 },
+    { 0x39, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 64 },
+    { 0x3a, _SC_LEVEL2_CACHE_SIZE, 196608, 6, 64 },
+    { 0x3b, _SC_LEVEL2_CACHE_SIZE, 131072, 2, 64 },
+    { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
+    { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
+    { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
     { 0x44, _SC_LEVEL2_CACHE_SIZE, 1048576, 4, 32 },
     { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
+    { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
+    { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
+    { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
+    { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
+    { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
+    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
+    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
     { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
     { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
     { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
@@ -99,6 +112,7 @@ static const struct intel_02_cache_info
     { 0x7b, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 64 },
     { 0x7c, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
     { 0x7d, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 64 },
+    { 0x7f, _SC_LEVEL2_CACHE_SIZE, 524288, 2, 64 },
     { 0x82, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 32 },
     { 0x83, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 32 },
     { 0x84, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 32 },
@@ -126,6 +140,7 @@ intel_02_known_compare (const void *p1, const void *p2)
 
 
 static long int
+__attribute__ ((noinline))
 intel_check_word (int name, unsigned int value, bool *has_level_2,
 		  bool *no_level_2_or_3)
 {
@@ -152,6 +167,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 	}
       else
 	{
+	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	    {
+	      /* Intel reused this value.  For family 15, model 6 it
+		 specifies the 3rd level cache.  Otherwise the 2nd
+		 level cache.  */
+	      unsigned int eax;
+	      unsigned int ebx;
+	      unsigned int ecx;
+	      unsigned int edx;
+	      asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+			    : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+			    : "0" (1));
+
+	      unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+	      unsigned int model = ((((eax >>16) & 0xf) << 4)
+				    + ((eax >> 4) & 0xf));
+	      if (family == 15 && model == 6)
+		{
+		  /* The level 3 cache is encoded for this model like
+		     the level 2 cache is for other models.  Pretend
+		     the caller asked for the level 2 cache.  */
+		  name = (_SC_LEVEL2_CACHE_SIZE
+			  + (name - _SC_LEVEL3_CACHE_SIZE));
+		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		}
+	    }
+
 	  struct intel_02_cache_info *found;
 	  struct intel_02_cache_info search;
 
@@ -188,7 +230,7 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 }
 
 
-static long int
+static long int  __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
   if (maxidx < 2)
@@ -250,7 +292,7 @@ handle_intel (int name, unsigned int maxidx)
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_amd (int name)
 {
   unsigned int eax;
@@ -345,17 +387,6 @@ i386_i486_test (void)
 long int
 __sysconf (int name)
 {
-  if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME)
-    {
-#if HP_TIMING_AVAIL
-      // XXX We can add  here test for machines which cannot support a
-      // XXX usable TSC.
-      return 200112L;
-#else
-      return -1;
-#endif
-    }
-
   /* All the remainder, except the cache information, is handled in
      the generic code.  */
   if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index af75d4c51a..5286676fc1 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995-2000,2002,2003,2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995-2000,2002-2005,2006
+   	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
 
@@ -109,27 +109,6 @@
 # define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
 #else
 
-# ifndef HAVE_HIDDEN
-#  define SETUP_PIC_REG(reg) \
-  call 1f;								      \
-  .subsection 1;							      \
-1:movl (%esp), %e##reg;							      \
-  ret;									      \
-  .previous
-# else
-#  define SETUP_PIC_REG(reg) \
-  .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits;	      \
-  .globl __i686.get_pc_thunk.reg;					      \
-  .hidden __i686.get_pc_thunk.reg;					      \
-  .type __i686.get_pc_thunk.reg,@function;				      \
-__i686.get_pc_thunk.reg:						      \
-  movl (%esp), %e##reg;							      \
-  ret;									      \
-  .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg;		      \
-  .previous;								      \
-  call __i686.get_pc_thunk.reg
-# endif
-
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER						      \
 0:SETUP_PIC_REG(cx);							      \
@@ -154,22 +133,36 @@ __i686.get_pc_thunk.reg:						      \
   movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx;			      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
-  movl %edx, %gs:0(%ecx);						      \
+  SYSCALL_ERROR_HANDLER_TLS_STORE (%edx, %ecx);				      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
+#   ifndef NO_TLS_DIRECT_SEG_REFS
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  movl src, %gs:(destoff)
+#   else
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  addl %gs:0, destoff;							      \
+  movl src, (destoff)
+#   endif
 #  else
 #   define SYSCALL_ERROR_HANDLER					      \
 0:pushl %ebx;								      \
+  cfi_adjust_cfa_offset (4);						      \
+  cfi_rel_offset (ebx, 0);						      \
   SETUP_PIC_REG (bx);							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
   pushl %edx;								      \
+  cfi_adjust_cfa_offset (4);						      \
   PUSH_ERRNO_LOCATION_RETURN;						      \
   call BP_SYM (__errno_location)@PLT;					      \
   POP_ERRNO_LOCATION_RETURN;						      \
   popl %ecx;								      \
+  cfi_adjust_cfa_offset (-4);						      \
   popl %ebx;								      \
+  cfi_adjust_cfa_offset (-4);						      \
+  cfi_restore (ebx);							      \
   movl %ecx, (%eax);							      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
@@ -265,9 +258,11 @@ __i686.get_pc_thunk.reg:						      \
 #define PUSHARGS_1	movl %ebx, %edx; L(SAVEBX1): PUSHARGS_0
 #define	DOARGS_1	_DOARGS_1 (4)
 #define	POPARGS_1	POPARGS_0; movl %edx, %ebx; L(RESTBX1):
-#define	_PUSHARGS_1	pushl %ebx; L(PUSHBX1): _PUSHARGS_0
+#define	_PUSHARGS_1	pushl %ebx; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebx, 0); L(PUSHBX1): _PUSHARGS_0
 #define _DOARGS_1(n)	movl n(%esp), %ebx; _DOARGS_0(n-4)
-#define	_POPARGS_1	_POPARGS_0; popl %ebx; L(POPBX1):
+#define	_POPARGS_1	_POPARGS_0; popl %ebx; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebx); L(POPBX1):
 
 #define PUSHARGS_2	PUSHARGS_1
 #define	DOARGS_2	_DOARGS_2 (8)
@@ -286,23 +281,29 @@ __i686.get_pc_thunk.reg:						      \
 #define PUSHARGS_4	_PUSHARGS_4
 #define DOARGS_4	_DOARGS_4 (24)
 #define POPARGS_4	_POPARGS_4
-#define _PUSHARGS_4	pushl %esi; L(PUSHSI1): _PUSHARGS_3
+#define _PUSHARGS_4	pushl %esi; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (esi, 0); L(PUSHSI1): _PUSHARGS_3
 #define _DOARGS_4(n)	movl n(%esp), %esi; _DOARGS_3 (n-4)
-#define _POPARGS_4	_POPARGS_3; popl %esi; L(POPSI1):
+#define _POPARGS_4	_POPARGS_3; popl %esi; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (esi); L(POPSI1):
 
 #define PUSHARGS_5	_PUSHARGS_5
 #define DOARGS_5	_DOARGS_5 (32)
 #define POPARGS_5	_POPARGS_5
-#define _PUSHARGS_5	pushl %edi; L(PUSHDI1): _PUSHARGS_4
+#define _PUSHARGS_5	pushl %edi; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (edi, 0); L(PUSHDI1): _PUSHARGS_4
 #define _DOARGS_5(n)	movl n(%esp), %edi; _DOARGS_4 (n-4)
-#define _POPARGS_5	_POPARGS_4; popl %edi; L(POPDI1):
+#define _POPARGS_5	_POPARGS_4; popl %edi; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (edi); L(POPDI1):
 
 #define PUSHARGS_6	_PUSHARGS_6
-#define DOARGS_6	_DOARGS_6 (36)
+#define DOARGS_6	_DOARGS_6 (40)
 #define POPARGS_6	_POPARGS_6
-#define _PUSHARGS_6	pushl %ebp; L(PUSHBP1): _PUSHARGS_5
+#define _PUSHARGS_6	pushl %ebp; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebp, 0); L(PUSHBP1): _PUSHARGS_5
 #define _DOARGS_6(n)	movl n(%esp), %ebp; _DOARGS_5 (n-4)
-#define _POPARGS_6	_POPARGS_5; popl %ebp; L(POPBP1):
+#define _POPARGS_6	_POPARGS_5; popl %ebp; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebp); L(POPBP1):
 
 #else	/* !__ASSEMBLER__ */
 
@@ -446,7 +447,7 @@ asm (".L__X'%ebx = 1\n\t"
 
 #define LOADARGS_0
 #ifdef __PIC__
-# if defined I386_USE_SYSENTER
+# if defined I386_USE_SYSENTER && defined SHARED
 #  define LOADARGS_1 \
     "bpushl .L__X'%k3, %k3\n\t"
 #  define LOADARGS_5 \
@@ -532,6 +533,49 @@ asm (".L__X'%ebx = 1\n\t"
 # define EXTRAVAR_5
 #endif
 
+/* Consistency check for position-independent code.  */
+#ifdef __PIC__
+# define check_consistency()						      \
+  ({ int __res;								      \
+     __asm__ __volatile__						      \
+       ("call __i686.get_pc_thunk.cx;"					      \
+	"addl $_GLOBAL_OFFSET_TABLE_, %%ecx;"				      \
+	"subl %%ebx, %%ecx;"						      \
+	"je 1f;"							      \
+	"ud2;"								      \
+	"1:\n"								      \
+	".section .gnu.linkonce.t.__i686.get_pc_thunk.cx,\"ax\",@progbits;"   \
+	".globl __i686.get_pc_thunk.cx;"				      \
+	".hidden __i686.get_pc_thunk.cx;"				      \
+	".type __i686.get_pc_thunk.cx,@function;"			      \
+	"__i686.get_pc_thunk.cx:"					      \
+	"movl (%%esp), %%ecx;"						      \
+	"ret;"								      \
+	".previous"							      \
+	: "=c" (__res));						      \
+     __res; })
+#endif
+
 #endif	/* __ASSEMBLER__ */
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  Using a global variable
+   is too complicated here since we have no PC-relative addressing mode.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorl %gs:POINTER_GUARD, reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(var)	asm ("xorl %%gs:%c2, %0"		      \
+				     : "=r" (var)			      \
+				     : "0" (var),			      \
+				       "i" (offsetof (tcbhead_t,	      \
+						      pointer_guard)))
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/i386/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.h b/sysdeps/unix/sysv/linux/i386/ucontext_i.h
deleted file mode 100644
index d6efca41b1..0000000000
--- a/sysdeps/unix/sysv/linux/i386/ucontext_i.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2001 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.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oLINK		4
-#define oSS_SP		8
-#define oSS_SIZE	16
-#define oGS		20
-#define oFS		24
-#define oEDI		36
-#define oESI		40
-#define oEBP		44
-#define oESP		48
-#define oEBX		52
-#define oEDX		56
-#define oECX		60
-#define oEAX		64
-#define oEIP		76
-#define oFPREGS		96
-#define oSIGMASK	108
-#define oFPREGSMEM	236
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
new file mode 100644
index 0000000000..b11a5509cd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
@@ -0,0 +1,30 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oGS		mreg (GS)
+oFS		mreg (FS)
+oEDI		mreg (EDI)
+oESI		mreg (ESI)
+oEBP		mreg (EBP)
+oESP		mreg (ESP)
+oEBX		mreg (EBX)
+oEDX		mreg (EDX)
+oECX		mreg (ECX)
+oEAX		mreg (EAX)
+oEIP		mreg (EIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
diff --git a/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S
index e660e6b70e..eefd4b49cb 100644
--- a/sysdeps/unix/sysv/linux/i386/vfork.S
+++ b/sysdeps/unix/sysv/linux/i386/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Schwab <schwab@gnu.org>.
 
@@ -33,6 +33,7 @@ ENTRY (__vfork)
 
 	/* Pop the return PC value into ECX.  */
 	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 
 #ifdef SAVE_PID
 	SAVE_PID
@@ -46,6 +47,7 @@ ENTRY (__vfork)
 	   disturbs the branch target cache.  Instead push the return
 	   address back on the stack.  */
 	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
 
 #ifdef RESTORE_PID
 	RESTORE_PID
diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c
index 7c41d8cefa..d27ecd3126 100644
--- a/sysdeps/unix/sysv/linux/i386/xstat.c
+++ b/sysdeps/unix/sysv/linux/i386/xstat.c
@@ -1,5 +1,6 @@
 /* xstat using old-style Unix stat system call.
-   Copyright (C) 1991,95,96,97,98,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,95,96,97,98,2000,2002,2003,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
@@ -30,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/ia64/Dist b/sysdeps/unix/sysv/linux/ia64/Dist
deleted file mode 100644
index b4118bdead..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/Dist
+++ /dev/null
@@ -1,13 +0,0 @@
-clone.S
-clone2.S
-dl-brk.S
-dl-static.c
-has_cpuclock.c
-ioperm.c
-ldd-rewrite.sed
-__start_context.S
-ucontext_i.h
-sys/procfs.h
-sys/io.h
-sys/rse.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/ia64/__longjmp.S b/sysdeps/unix/sysv/linux/ia64/__longjmp.S
index 7922e81bea..aa18fadf9c 100644
--- a/sysdeps/unix/sysv/linux/ia64/__longjmp.S
+++ b/sysdeps/unix/sysv/linux/ia64/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -101,6 +101,9 @@ LEAF(__longjmp)
 	ld8.nta r18=[r2],16		// b2
 	ld8.nta r19=[r3],16		// b3
 	;;
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (r16, r24)
+#endif
 	ld8.nta r20=[r2],16		// b4
 	ld8.nta r21=[r3],16		// b5
 	;;
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index d330954d48..ed8c2da9e2 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/IA64.
-   Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 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
@@ -23,6 +23,9 @@
 
 
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -40,9 +43,9 @@
 #define O_SYNC		010000
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000
-#define O_DIRECT	040000
 
 #ifdef __USE_GNU
+# define O_DIRECT	040000
 # define O_DIRECTORY	0200000	/* must be a directory */
 # define O_NOFOLLOW	0400000 /* don't follow links */
 # define O_NOATIME	01000000 /* Do not set atime.  */
@@ -92,7 +95,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -174,10 +177,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/mman.h b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
index 01db5be028..a27a30fc0c 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/ia64 version.
-   Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,2000,2003,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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
index 76625753d9..8bd675e4ec 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,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
@@ -32,9 +32,4 @@
 /* the __jmp_buf element type should be __float80 per ABI... */
 typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
 
-/* 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]))
-
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/shm.h b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
index 078345d7e6..7f38f2dd7b 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -38,6 +38,8 @@
 /* Segment low boundary address multiple.  */
 #define SHMLBA		(1024 * 1024)
 
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
 
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
@@ -49,7 +51,7 @@ struct shmid_ds
     __time_t shm_ctime;			/* time of last change by shmctl() */
     __pid_t shm_cpid;			/* pid of creator */
     __pid_t shm_lpid;			/* pid of last shmop */
-    unsigned long int shm_nattch;	/* number of current attaches */
+    shmatt_t shm_nattch;		/* number of current attaches */
     unsigned long int __unused1;
     unsigned long int __unused2;
   };
@@ -64,6 +66,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
index d2c45a560a..2f39851535 100644
--- a/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
+++ b/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* clock_getcpuclockid -- Get a clockid_t for process CPU time.  Linux/IA64
+   Copyright (C) 2000,2001,2003,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,22 +27,6 @@
 
 #include "has_cpuclock.c"
 
+#define HAS_CPUCLOCK (has_cpuclock () > 0)
 
-int
-clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
-{
-  /* We don't allow any process ID but our own.  */
-  if (pid != 0 && pid != getpid ())
-    return EPERM;
-
-  int retval = ENOENT;
-
-  if (has_cpuclock () > 0)
-    {
-      /* Store the number.  */
-      *clock_id = CLOCK_PROCESS_CPUTIME_ID;
-      retval = 0;
-    }
-
-  return retval;
-}
+#include <sysdeps/unix/sysv/linux/clock_getcpuclockid.c>
diff --git a/sysdeps/unix/sysv/linux/ia64/clone2.S b/sysdeps/unix/sysv/linux/ia64/clone2.S
index 69c9e05044..d38eb201ad 100644
--- a/sysdeps/unix/sysv/linux/ia64/clone2.S
+++ b/sysdeps/unix/sysv/linux/ia64/clone2.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 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
@@ -32,10 +32,12 @@ ENTRY(__clone2)
 	.prologue
 	alloc r2=ar.pfs,8,1,6,0
 	cmp.eq p6,p0=0,in0
+	cmp.eq p7,p0=0,in1
 	mov r8=EINVAL
 	mov out0=in3		/* Flags are first syscall argument.	*/
 	mov out1=in1		/* Stack address.			*/
-(p6)	br.cond.spnt.many __syscall_error
+(p6)	br.cond.spnt.many __syscall_error	/* no NULL function pointers */
+(p7)	br.cond.spnt.many __syscall_error	/* no NULL stack pointers */
 	;;
 	mov out2=in2		/* Stack size.				*/
 	mov out3=in5		/* Parent TID Pointer			*/
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-cache.h b/sysdeps/unix/sysv/linux/ia64/dl-cache.h
index b8e2790589..c2165706c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/ia64/dl-cache.h
@@ -22,4 +22,31 @@
 #define _dl_cache_check_flags(flags) \
   ((flags) == _DL_CACHE_DEFAULT_ID)
 
+#define EMUL_HACK "/emul/ia32-linux"
+
+#define arch_startup(argc, argv) unlink (EMUL_HACK LD_SO_CACHE)
+
+#define add_arch_dirs(config_file) \
+  do {							\
+    int save_verbose = opt_verbose;			\
+    opt_verbose = 0;					\
+							\
+    parse_conf (config_file, EMUL_HACK, true);		\
+							\
+    /* Always add the standard search paths.  */	\
+    add_system_dir (EMUL_HACK SLIBDIR);			\
+    if (strcmp (SLIBDIR, LIBDIR))			\
+      add_system_dir (EMUL_HACK LIBDIR);		\
+							\
+    char emul_config_file[strlen (config_file)		\
+			  + sizeof EMUL_HACK];		\
+    strcpy (mempcpy (emul_config_file, EMUL_HACK,	\
+		     strlen (EMUL_HACK)), config_file);	\
+							\
+    if (! access (emul_config_file, R_OK))		\
+      parse_conf (emul_config_file, EMUL_HACK, true);	\
+							\
+    opt_verbose = save_verbose;				\
+  } while (0)
+
 #include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c
new file mode 100644
index 0000000000..7e26fecb3a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c
@@ -0,0 +1,5 @@
+#ifdef IS_IN_ldconfig
+#include <sysdeps/i386/dl-procinfo.c>
+#else
+#include <sysdeps/generic/dl-procinfo.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h
new file mode 100644
index 0000000000..b360b4288a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h
@@ -0,0 +1,5 @@
+#ifdef IS_IN_ldconfig
+#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
+#else
+#include <sysdeps/generic/dl-procinfo.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/getcontext.S b/sysdeps/unix/sysv/linux/ia64/getcontext.S
index 0f9cc5db19..4e18bace2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/getcontext.S
@@ -155,4 +155,4 @@ ENTRY(__getcontext)
 	ret
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
index ee19161272..39511cd2c5 100644
--- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
+++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 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
@@ -21,7 +21,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <not-cancel.h>
 
 static int itc_usable;
 
@@ -31,18 +31,18 @@ has_cpuclock (void)
   if (__builtin_expect (itc_usable == 0, 0))
     {
       int newval = 1;
-      int fd = open ("/proc/sal/itc_drift", O_RDONLY);
+      int fd = open_not_cancel_2 ("/proc/sal/itc_drift", O_RDONLY);
       if (__builtin_expect (fd != -1, 1))
 	{
 	  char buf[16];
 	  /* We expect the file to contain a single digit followed by
 	     a newline.  If the format changes we better not rely on
 	     the file content.  */
-	  if (read (fd, buf, sizeof buf) != 2 || buf[0] != '0'
-	      || buf[1] != '\n')
+	  if (read_not_cancel (fd, buf, sizeof buf) != 2
+	      || buf[0] != '0' || buf[1] != '\n')
 	    newval = -1;
 
-	  close (fd);
+	  close_not_cancel_no_status (fd);
 	}
 
       itc_usable = newval;
diff --git a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
index 535d1671e3..1df27afd2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
@@ -1 +1 @@
-s_^\(RTLDLIST=\)\([^ 	]*\)-ia64\(\.so\.[0-9.]*\)[ 	]*$_\1"\2-ia64\3 \2\3"_
+s_^\(RTLDLIST=\)\([^ 	]*\)-ia64\(\.so\.[0-9.]*\)[ 	]*$_\1"\2-ia64\3 /emul/ia32-linux\2\3"_
diff --git a/sysdeps/unix/sysv/linux/ia64/readelflib.c b/sysdeps/unix/sysv/linux/ia64/readelflib.c
index 9b1a645d34..7a10d23c90 100644
--- a/sysdeps/unix/sysv/linux/ia64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/ia64/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 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
@@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/ia64/setcontext.S b/sysdeps/unix/sysv/linux/ia64/setcontext.S
index e18c40fa4c..ef0a93c0c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/setcontext.S
@@ -150,4 +150,4 @@ ENTRY(__setcontext)
 	ret
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/setjmp.S b/sysdeps/unix/sysv/linux/ia64/setjmp.S
index 9c987c7ef8..53f80d203e 100644
--- a/sysdeps/unix/sysv/linux/ia64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/ia64/setjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005
+   Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,7 +87,7 @@ libc_hidden_def (_setjmp)
 
 ENTRY(__sigsetjmp)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	alloc loc1=ar.pfs,2,3,2,0
+	alloc loc1=ar.pfs,2,5,2,0
 	.save ar.unat, loc2
 	mov loc2=ar.unat
 	;;
@@ -140,7 +141,13 @@ ENTRY(__sigsetjmp)
 	;;
 	stf.spill.nta [r8]=f28,32
 	stf.spill.nta [r9]=f29,32
+#ifdef PTR_MANGLE
+	mov loc3=loc0
 	;;
+	PTR_MANGLE (loc3, loc4)
+#else
+	;;
+#endif
 	stf.spill.nta [r8]=f30
 	stf.spill.nta [r9]=f31
 
@@ -151,7 +158,11 @@ ENTRY(__sigsetjmp)
 	mov r25=ar.unat
 	mov out0=in0
 
+#ifdef PTR_MANGLE
+	st8.nta [r2]=loc3,16		// b0
+#else
 	st8.nta [r2]=loc0,16		// b0
+#endif
 	st8.nta [r3]=r17,16		// b1
 	mov out1=in1
 	;;
@@ -169,7 +180,12 @@ ENTRY(__sigsetjmp)
 	;;
 	st8.nta [r2]=r25		// ar.unat
 	st8.nta [r3]=in0		// &__jmp_buf
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	;;
+#else
 	br.call.dpnt.few rp=__sigjmp_save
+#endif
 .ret0:					// force a new bundle ::q
 	mov.m ar.unat=loc2		// restore caller's unat
 	mov rp=loc0
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/ia64/sigsuspend.c b/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
deleted file mode 100644
index f8f9563494..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003
-   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 <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-/* Change the set of blocked signals to SET,
-   wait until a signal arrives, and restore the set of blocked signals.  */
-int
-__sigsuspend (set)
-     const sigset_t *set;
-{
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
index 986c4b2d33..ff77627a83 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux/ia64 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 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
@@ -75,14 +75,6 @@ enum __ptrace_request
   PTRACE_SINGLEBLOCK = 12,
 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
 
-  /* Get siginfo for process.  */
-  PTRACE_GETSIGINFO = 13,
-#define PT_GETSIGINFO PTRACE_GETSIGINFO
-
-  /* Set new siginfo for process.  */
-  PTRACE_SETSIGINFO = 14,
-#define PT_GETSIGINFO PTRACE_GETSIGINFO
-
   /* Attach to a process that is already running. */
   PTRACE_ATTACH = 16,
 #define PT_ATTACH PTRACE_ATTACH
@@ -100,8 +92,24 @@ enum __ptrace_request
 #define PT_SETREGS PTRACE_SETREGS
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* pt_all_user_regs is used for PTRACE_GETREGS/PTRACE_SETREGS.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 31c7718d8b..c55c70ef54 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -2,7 +2,6 @@
 
 umount2		-	umount		2	__umount2	umount2
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # semaphore and shm system calls
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index a4453ddcc7..dd7a5b1b1d 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
    Based on code originally written by David Mosberger-Tang
@@ -204,7 +205,7 @@
     register long _r8 __asm ("r8");					      \
     register long _r10 __asm ("r10");					      \
     register long _r15 __asm ("r15") = name;				      \
-    register void *_b7 __asm ("b7") = ((tcbhead_t *) __thread_self)->private; \
+    register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\
     long _retval;							      \
     LOAD_REGS_##nr							      \
     /*									      \
@@ -360,4 +361,24 @@
 
 #endif /* not __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+        add	tmpreg=-16,r13		\
+        ;;				\
+        ld8	tmpreg=[tmpreg]		\
+        ;;				\
+        xor	reg=reg, tmpreg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/ia64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 377ccf5199..66f0ac1317 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 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
@@ -188,12 +189,8 @@ if_nameindex_netlink (void)
 
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    goto exit_close;
-
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces.  Collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     goto exit_free;
 
   /* Count the interfaces.  */
@@ -290,7 +287,6 @@ if_nameindex_netlink (void)
 
  exit_free:
   __netlink_free_handle (&nh);
- exit_close:
   __netlink_close (&nh);
 
   return idx;
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 8a052e212d..02e6935538 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
 /* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
@@ -24,6 +25,7 @@
 #include <netinet/in.h>
 #include <netpacket/packet.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -84,13 +86,14 @@ __netlink_free_handle (struct netlink_handle *h)
 }
 
 
-int
+static int
 __netlink_sendreq (struct netlink_handle *h, int type)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    char pad[0];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -103,6 +106,8 @@ __netlink_sendreq (struct netlink_handle *h, int type)
   req.nlh.nlmsg_pid = 0;
   req.nlh.nlmsg_seq = h->seq;
   req.g.rtgen_family = AF_UNSPEC;
+  if (sizeof (req) != offsetof (struct req, pad))
+    memset (req.pad, '\0', sizeof (req) - offsetof (struct req, pad));
 
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
@@ -114,16 +119,40 @@ __netlink_sendreq (struct netlink_handle *h, int type)
 
 
 int
-__netlink_receive (struct netlink_handle *h)
+__netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
-  int read_len;
+  ssize_t read_len;
   bool done = false;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
+  if (__netlink_sendreq (h, type) < 0)
+    goto out_fail;
+
   while (! done)
     {
       struct msghdr msg =
@@ -136,33 +165,25 @@ __netlink_receive (struct netlink_handle *h)
 
       read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
-      if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+      if (nladdr.nl_pid != 0)
+	continue;
 
-      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
-						+ read_len);
-      if (nlm_next == NULL)
-	return -1;
-      nlm_next->next = NULL;
-      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
-      nlm_next->size = read_len;
-      nlm_next->seq = h->seq;
-      if (h->nlm_list == NULL)
-	h->nlm_list = nlm_next;
-      else
-	h->end_ptr->next = nlm_next;
-      h->end_ptr = nlm_next;
+      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+	goto out_fail;
 
+      size_t count = 0;
+      size_t remaining_len = read_len;
       for (nlmh = (struct nlmsghdr *) buf;
-	   NLMSG_OK (nlmh, (size_t) read_len);
-	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
+	   NLMSG_OK (nlmh, remaining_len);
+	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
 	{
-	  if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
+	  if ((pid_t) nlmh->nlmsg_pid != h->pid
 	      || nlmh->nlmsg_seq != h->seq)
 	    continue;
 
+	  ++count;
 	  if (nlmh->nlmsg_type == NLMSG_DONE)
 	    {
 	      /* We found the end, leave the loop.  */
@@ -176,11 +197,38 @@ __netlink_receive (struct netlink_handle *h)
 		errno = EIO;
 	      else
 		errno = -nlerr->error;
-	      return -1;
+	      goto out_fail;
 	    }
 	}
+
+      /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
+	 there is no point to record it.  */
+      if (count == 0)
+	continue;
+
+      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
+						+ read_len);
+      if (nlm_next == NULL)
+	goto out_fail;
+      nlm_next->next = NULL;
+      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
+      nlm_next->size = read_len;
+      nlm_next->seq = h->seq;
+      if (h->nlm_list == NULL)
+	h->nlm_list = nlm_next;
+      else
+	h->end_ptr->next = nlm_next;
+      h->end_ptr = nlm_next;
     }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -268,12 +316,11 @@ getifaddrs (struct ifaddrs **ifap)
   unsigned int i, newlink, newaddr, newaddr_idx;
   int *map_newlink_data;
   size_t ifa_data_size = 0;  /* Size to allocate for all ifa_data.  */
-  char *ifa_data_ptr;        /* Pointer to the unused part of memory for
+  char *ifa_data_ptr;	/* Pointer to the unused part of memory for
 				ifa_data.  */
   int result = 0;
 
-  if (ifap)
-    *ifap = NULL;
+  *ifap = NULL;
 
   if (! __no_netlink_support && __netlink_open (&nh) < 0)
     {
@@ -288,28 +335,20 @@ getifaddrs (struct ifaddrs **ifap)
 #endif
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    {
-      result = -1;
-      goto exit_close;
-    }
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces, collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     {
       result = -1;
       goto exit_free;
     }
 
-
   /* Now ask the kernel for all addresses which are assigned
-     to an interface.  Since we store the addresses after the
-     interfaces in the list, we will later always find the
-     interface before the corresponding addresses.  */
+     to an interface and collect all data for every interface.
+     Since we store the addresses after the interfaces in the
+     list, we will later always find the interface before the
+     corresponding addresses.  */
   ++nh.seq;
-  if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
-      /* Collect all data for every interface.  */
-      || __netlink_receive (&nh) < 0)
+  if (__netlink_request (&nh, RTM_GETADDR) < 0)
     {
       result = -1;
       goto exit_free;
@@ -327,7 +366,7 @@ getifaddrs (struct ifaddrs **ifap)
 	continue;
 
       /* Walk through all entries we got from the kernel and look, which
-         message type they contain.  */
+	 message type they contain.  */
       for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
 	{
 	  /* Check if the message is what we want.  */
@@ -423,7 +462,7 @@ getifaddrs (struct ifaddrs **ifap)
 	      /* Interfaces are stored in the first "newlink" entries
 		 of our list, starting in the order as we got from the
 		 kernel.  */
-              ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
+	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
 	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
 
@@ -762,13 +801,10 @@ getifaddrs (struct ifaddrs **ifap)
 	memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage));
     }
 
-  if (ifap != NULL)
-    *ifap = &ifas[0].ifa;
+  *ifap = &ifas[0].ifa;
 
  exit_free:
   __netlink_free_handle (&nh);
-
- exit_close:
   __netlink_close (&nh);
 
   return result;
diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c
index 098f11750f..d7e442c277 100644
--- a/sysdeps/unix/sysv/linux/ifreq.c
+++ b/sysdeps/unix/sysv/linux/ifreq.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include "ifreq.h"
+#include <kernel-features.h>
 
 /* Variable to signal whether SIOCGIFCONF is not available.  */
 #if __ASSUME_SIOCGIFNAME == 0 || 1
diff --git a/sysdeps/unix/sysv/linux/ifreq.h b/sysdeps/unix/sysv/linux/ifreq.h
deleted file mode 100644
index b92e0638e2..0000000000
--- a/sysdeps/unix/sysv/linux/ifreq.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>.
-
-   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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <net/if.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include "kernel-features.h"
-
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-  return ifr + 1;
-}
-
-static inline void
-__if_freereq (struct ifreq *ifreqs, int num_ifs)
-{
-  free (ifreqs);
-}
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index f00271255d..b061a848c6 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -1,5 +1,5 @@
 /* Initialization code run first thing by the ELF startup code.  Linux version.
-   Copyright (C) 1995-1999,2000,01,02,03,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-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
@@ -29,9 +29,6 @@
 
 #include <ldsodefs.h>
 
-/* The function is called from assembly stubs the compiler can't see.  */
-static void init (int, char **, char **) __attribute__ ((used));
-
 /* Set nonzero if we have to be prepared for more then one libc being
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs attribute_hidden = 1;
@@ -42,9 +39,18 @@ int __libc_argc attribute_hidden;
 char **__libc_argv attribute_hidden;
 
 
-static void
-init (int argc, char **argv, char **envp)
+void
+__libc_init_first (int argc, char **argv, char **envp)
+{
+#ifdef SHARED
+  /* For DSOs we do not need __libc_init_first but instead _init.  */
+}
+
+void
+attribute_hidden
+_init (int argc, char **argv, char **envp)
 {
+#endif
 #ifdef USE_NONOPTION_FLAGS
   extern void __getopt_clean_environment (char **);
 #endif
@@ -88,27 +94,6 @@ init (int argc, char **argv, char **envp)
 #endif
 }
 
-#ifdef SHARED
-
-strong_alias (init, _init);
-
-extern void __libc_init_first (void);
-
-void
-__libc_init_first (void)
-{
-}
-
-#else
-extern void __libc_init_first (int argc, char **argv, char **envp);
-
-void
-__libc_init_first (int argc, char **argv, char **envp)
-{
-  init (argc, argv, envp);
-}
-#endif
-
 
 /* This function is defined here so that if this file ever gets into
    ld.so we will get a link error.  Having this file silently included
diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c
index ea26729d55..73317ecafd 100644
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -71,6 +71,33 @@ __statvfs_getflags (const char *name, int fstype, struct stat64 *st)
     case NFS_SUPER_MAGIC:
       fsname = "nfs";
       break;
+    case SYSFS_MAGIC:
+      fsname = "sysfs";
+      break;
+    case REISERFS_SUPER_MAGIC:
+      fsname = "reiserfs";
+      break;
+    case XFS_SUPER_MAGIC:
+      fsname = "xfs";
+      break;
+    case JFS_SUPER_MAGIC:
+      fsname = "jfs";
+      break;
+    case HPFS_SUPER_MAGIC:
+      fsname = "hpfs";
+      break;
+    case DEVFS_SUPER_MAGIC:
+      fsname = "devfs";
+      break;
+    case ISOFS_SUPER_MAGIC:
+      fsname = "iso9660";
+      break;
+    case MSDOS_SUPER_MAGIC:
+      fsname = "msdos";
+      break;
+    case NTFS_SUPER_MAGIC:
+      fsname = "ntfs";
+      break;
     }
 
   FILE *mtab = __setmntent ("/proc/mounts", "r");
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index f499a712c4..e54f675dbe 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -1,6 +1,6 @@
 /* Set flags signalling availability of kernel features based on given
    kernel version number.
-   Copyright (C) 1999-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999-2003, 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
@@ -21,10 +21,6 @@
 /* This file must not contain any C code.  At least it must be protected
    to allow using the file also in assembler files.  */
 
-#if defined __mips__
-# include <sgidefs.h>
-#endif
-
 #ifndef __LINUX_KERNEL_VERSION
 /* We assume the worst; all kernels should be supported.  */
 # define __LINUX_KERNEL_VERSION	0
@@ -79,6 +75,22 @@
 # define __ASSUME_SIOCGIFNAME		1
 #endif
 
+/* MSG_NOSIGNAL was at least available with Linux 2.2.0.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_MSG_NOSIGNAL		1
+#endif
+
+/* The sendfile syscall was introduced in 2.2.0.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_SENDFILE		1
+#endif
+
+/* Only very old kernels had no real symlinks for terminal descriptors
+   in /proc/self/fd.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_PROC_SELF_FD_SYMLINK	1
+#endif
+
 /* On x86 another `getrlimit' syscall was added in 2.3.25.  */
 #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
 # define __ASSUME_NEW_GETRLIMIT_SYSCALL	1
@@ -99,9 +111,10 @@
 # define __ASSUME_STAT64_SYSCALL	1
 #endif
 
-/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
+/* On sparc the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
    syscalls were introduced in 2.3.35.  */
-#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__)
+#if __LINUX_KERNEL_VERSION >= 131875 \
+    && (defined __sparc__ && !defined __arch64__)
 # define __ASSUME_TRUNCATE64_SYSCALL	1
 # define __ASSUME_MMAP2_SYSCALL		1
 # define __ASSUME_STAT64_SYSCALL	1
@@ -122,7 +135,7 @@
 
 /* Linux 2.3.39 introduced 32bit UID/GIDs.  Some platforms had 32
    bit type all along.  */
-#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
+#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__
 # define __ASSUME_32BITUIDS		1
 #endif
 
@@ -140,11 +153,6 @@
 # define __ASSUME_IPC64		1
 #endif
 
-/* MIPS platforms had IPC64 all along.  */
-#if defined __mips__
-# define __ASSUME_IPC64		1
-#endif
-
 /* We can use the LDTs for threading with Linux 2.3.99 and newer.  */
 #if __LINUX_KERNEL_VERSION >= 131939
 # define __ASSUME_LDT_WORKS		1
@@ -189,7 +197,7 @@
    don't know when it got introduced).  But PowerPC64 does not support
    separate FCNTL64 call, FCNTL is already 64-bit */
 #if __LINUX_KERNEL_VERSION >= 132100 \
-    && (defined __arm__ || defined __powerpc__ || defined __sh__) \
+    && (defined __powerpc__ || defined __sh__) \
     && !defined __powerpc64__
 # define __ASSUME_FCNTL64		1
 #endif
@@ -258,65 +266,37 @@
 #endif
 
 /* The vfork syscall on x86 and arm was definitely available in 2.4.  */
-#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
+#if __LINUX_KERNEL_VERSION >= 132097 && defined __i386__
 # define __ASSUME_VFORK_SYSCALL		1
 #endif
 
-/* There are an infinite number of PA-RISC kernel versions numbered
-   2.4.0.  But they've not really been released as such.  We require
-   and expect the final version here.  */
-#ifdef __hppa__
-# define __ASSUME_32BITUIDS		1
-# define __ASSUME_TRUNCATE64_SYSCALL	1
-# define __ASSUME_MMAP2_SYSCALL		1
-# define __ASSUME_STAT64_SYSCALL	1
-# define __ASSUME_IPC64			1
-# define __ASSUME_ST_INO_64_BIT		1
-# define __ASSUME_FCNTL64		1
-# define __ASSUME_GETDENTS64_SYSCALL	1
-#endif
-
 /* Alpha switched to a 64-bit timeval sometime before 2.2.0.  */
 #if __LINUX_KERNEL_VERSION >= 131584 && defined __alpha__
 # define __ASSUME_TIMEVAL64		1
 #endif
 
-#if defined __mips__ && _MIPS_SIM == _ABIN32
-# define __ASSUME_FCNTL64		1
-#endif
-
 /* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
    their availability with one define.  The changes were made first
    for i386 and the have to be done separately for the other archs.
-   For i386 we pick 2.5.50 as the first version with support.  */
-#if __LINUX_KERNEL_VERSION >= 132402 && defined __i386__
+   For i386 we pick 2.5.50 as the first version with support.
+   For ia64, s390*, PPC, x86-64, and SH we pick 2.5.64 as the first
+   version with support.  */
+#if ((__LINUX_KERNEL_VERSION >= 132402 && defined __i386__)		\
+     || (__LINUX_KERNEL_VERSION >= 132416				\
+	 && (defined __ia64__ || defined __s390__			\
+	     || defined __powerpc__ || defined __x86_64__ || defined __sh__)))
 # define __ASSUME_CLONE_THREAD_FLAGS	1
 #endif
 
-/* These features were surely available with 2.4.12.  */
-#if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
-# define __ASSUME_MMAP2_SYSCALL		1
-# define __ASSUME_TRUNCATE64_SYSCALL	1
-# define __ASSUME_STAT64_SYSCALL	1
-# define __ASSUME_FCNTL64		1
-# define __ASSUME_VFORK_SYSCALL		1
-#endif
-
 /* Beginning with 2.5.63 support for realtime and monotonic clocks and
    timers based on them is available.  */
 #if __LINUX_KERNEL_VERSION >= 132415
 # define __ASSUME_POSIX_TIMERS		1
 #endif
 
-/* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
-   their availability with one define.  The changes were made first
-   for i386 and the have to be done separately for the other archs.
-   For ia64, s390*, PPC, x86-64 we pick 2.5.64 as the first version
-   with support.  */
-#if __LINUX_KERNEL_VERSION >= 132416 \
-    && (defined __ia64__ || defined __s390__ || defined __powerpc__ \
-	|| defined __x86_64__ || defined __sh__)
-# define __ASSUME_CLONE_THREAD_FLAGS	1
+/* Beginning with 2.6.12 the clock and timer supports CPU clocks.  */
+#if __LINUX_KERNEL_VERSION >= 0x2060c
+# define __ASSUME_POSIX_CPU_TIMERS	1
 #endif
 
 /* With kernel 2.4.17 we always have netlink support.  */
@@ -349,22 +329,24 @@
 
 /* The tgkill syscall was instroduced for i386 in 2.5.75.  For Alpha
    it was introduced in 2.6.0-test1 which unfortunately cannot be
-   distinguished from 2.6.0.  On x86-64 it was introduced in
-   2.6.0-test3. */
+   distinguished from 2.6.0.  On x86-64, ppc, and ppc64 it was
+   introduced in 2.6.0-test3. */
 #if (__LINUX_KERNEL_VERSION >= 132427 && defined __i386__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __alpha__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __x86_64__) \
+    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
 # define __ASSUME_TGKILL	1
 #endif
 
 /* The utimes syscall has been available for some architectures
-   forever.  For x86 it was introduced after 2.5.75, for x86-64 in
-   2.6.0-test3.  */
-#if defined __alpha__ || defined __ia64__ || defined __hppa__ \
+   forever.  For x86 it was introduced after 2.5.75, for x86-64,
+   ppc, and ppc64 it was introduced in 2.6.0-test3.  */
+#if defined __alpha__ || defined __ia64__ \
     || defined __sparc__ \
     || (__LINUX_KERNEL_VERSION > 132427 && defined __i386__) \
     || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \
+    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
 # define __ASSUME_UTIMES	1
 #endif
@@ -378,8 +360,11 @@
 #endif
 
 /* The fixed version of the posix_fadvise64 syscall appeared in
-   2.6.0-test3.  At least for x86.  */
-#if __LINUX_KERNEL_VERSION >= 132609 && defined __i386__
+   2.6.0-test3.  At least for x86.  Powerpc support appeared in
+   2.6.2, but for 32-bit userspace only.  */
+#if (__LINUX_KERNEL_VERSION >= 132609 && defined __i386__) \
+    || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \
+       && !defined __powerpc64__)
 # define __ASSUME_FADVISE64_64_SYSCALL	1
 #endif
 
@@ -403,8 +388,10 @@
 #endif
 
 /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
-   information as well.  */
-#if __LINUX_KERNEL_VERSION >= 132612
+   information as well and in between 2.6.5 and 2.6.8 most compat wrappers
+   were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
 # define __ASSUME_GETDENTS32_D_TYPE	1
 #endif
 
@@ -414,8 +401,12 @@
 # define __ASSUME_BRK_PAGE_ROUNDED	1
 #endif
 
-/* Starting with version 2.6.9, the waitid system call is available.  */
-#if __LINUX_KERNEL_VERSION >=  0x020609
+/* Starting with version 2.6.9, the waitid system call is available.
+   Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020609 \
+     && !defined __powerpc__ && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060c \
+	&& (defined __powerpc__ || defined __s390__))
 # define __ASSUME_WAITID_SYSCALL	1
 #endif
 
@@ -423,3 +414,47 @@
 #if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
 #define __ASSUME_IEEE_RAISE_EXCEPTION	1
 #endif
+
+/* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12.  */
+#if __LINUX_KERNEL_VERSION >= 0x02060c && defined __sparc__ \
+    && defined __arch64__
+# define __ASSUME_STAT64_SYSCALL	1
+#endif
+
+/* Early kernel used "shm" as the filesystem name for the filesystem used
+   for shm_open etc.  Later it is "tmpfs".  2.4.20 is a safe bet for the
+   cutover.  */
+#if __LINUX_KERNEL_VERSION >= 0x02041a
+# define __ASSUME_TMPFS_NAME	1
+#endif
+
+/* pselect was introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611 && !defined __x86_64__
+# define __ASSUME_PSELECT	1
+#endif
+
+/* ppoll was introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611 && !defined __x86_64__
+# define __ASSUME_PPOLL	1
+#endif
+
+/* The *at syscalls were introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611
+# define __ASSUME_ATFCTS	1
+#endif
+
+/* Support for inter-process robust mutexes was added in 2.6.17.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611
+# define __ASSUME_SET_ROBUST_LIST	1
+#endif
+
+/* Support for PI futexes was added in 2.6.18.  */
+#if __LINUX_KERNEL_VERSION >= 0x020612
+# define __ASSUME_FUTEX_LOCK_PI	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h
new file mode 100644
index 0000000000..164a90ddeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h
@@ -0,0 +1,18 @@
+/* Parameters for the Linux kernel ABI for CPU clocks.  */
+
+#define CPUCLOCK_PID(clock)		((pid_t) ~((clock) >> 3))
+#define CPUCLOCK_PERTHREAD(clock) \
+	(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
+#define CPUCLOCK_PID_MASK	7
+#define CPUCLOCK_PERTHREAD_MASK	4
+#define CPUCLOCK_WHICH(clock)	((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
+#define CPUCLOCK_CLOCK_MASK	3
+#define CPUCLOCK_PROF		0
+#define CPUCLOCK_VIRT		1
+#define CPUCLOCK_SCHED		2
+#define CPUCLOCK_MAX		3
+
+#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
+	((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
+#define MAKE_THREAD_CPUCLOCK(tid, clock) \
+	MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)
diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
index f7b208e7d8..7683ec2efd 100644
--- a/sysdeps/unix/sysv/linux/lddlibc4.c
+++ b/sysdeps/unix/sysv/linux/lddlibc4.c
@@ -1,5 +1,5 @@
 /* Stub for ldd script to print Linux libc4 dependencies.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -84,5 +84,5 @@ main (int argc, char *argv[])
   putenv (buf);
 
   /* Now we can execute the binary.  */
-  return execl (filename, NULL) ? 4 : 0;
+  return execv (filename, &argv[argc]) ? 4 : 0;
 }
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index c5fd854d70..0bdca3c3fd 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 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
@@ -19,7 +19,7 @@
 
 #ifndef	_LDSODEFS_H
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* Get the real definitions.  */
 #include_next <ldsodefs.h>
diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c
index a79cfbabb9..c7fac6ab51 100644
--- a/sysdeps/unix/sysv/linux/libc_fatal.c
+++ b/sysdeps/unix/sysv/linux/libc_fatal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993-1995,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
@@ -27,6 +27,7 @@
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/syslog.h>
+#include <execinfo.h>
 
 /* Abort with an error message.  */
 #include <not-cancel.h>
@@ -141,8 +142,33 @@ __libc_message (int do_abort, const char *fmt, ...)
   va_end (ap_copy);
 
   if (do_abort)
-    /* Terminate the process.  */
-    abort ();
+    {
+      if (do_abort > 1 && written)
+	{
+	  void *addrs[64];
+#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
+	  int n = __backtrace (addrs, naddrs);
+	  if (n > 2)
+	    {
+#define strnsize(str) str, strlen (str)
+#define writestr(str) write_not_cancel (fd, str)
+	      writestr (strnsize ("======= Backtrace: =========\n"));
+	      __backtrace_symbols_fd (addrs + 1, n - 1, fd);
+
+	      writestr (strnsize ("======= Memory map: ========\n"));
+	      int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY);
+	      char buf[1024];
+	      ssize_t n2;
+	      while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0)
+		if (write_not_cancel (fd, buf, n2) != n2)
+		  break;
+	      close_not_cancel_no_status (fd2);
+	    }
+	}
+
+      /* Terminate the process.  */
+      abort ();
+    }
 }
 
 
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
new file mode 100644
index 0000000000..cfd0e18223
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -0,0 +1,115 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Make a link to FROM named TO but relative paths in TO and FROM are
+   interpreted relative to FROMFD and TOFD respectively.  */
+int
+linkat (fromfd, from, tofd, to, flags)
+     int fromfd;
+     const char *from;
+     int tofd;
+     const char *to;
+     int flags;
+{
+  int result;
+
+#ifdef __NR_linkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (linkat, 5, fromfd, from, tofd, to, flags);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  /* Without kernel support we cannot handle AT_SYMLINK_FOLLOW.  */
+  if (flags != 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  static const char procfd[] = "/proc/self/fd/%d/%s";
+  char *buffrom = NULL;
+
+  if (fromfd != AT_FDCWD && from[0] != '/')
+    {
+      size_t filelen = strlen (from);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buffrom = alloca (buflen);
+
+      __snprintf (buffrom, buflen, procfd, fromfd, from);
+      from = buffrom;
+    }
+
+  char *bufto = NULL;
+
+  if (tofd != AT_FDCWD && to[0] != '/')
+    {
+      size_t filelen = strlen (to);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufto = alloca (buflen);
+
+      __snprintf (bufto, buflen, procfd, tofd, to);
+      to = bufto;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (link, err, 2, from,  to);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), tofd, bufto,
+			  fromfd, buffrom);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h b/sysdeps/unix/sysv/linux/linux_fsinfo.h
index 13c3856266..8c6591ada3 100644
--- a/sysdeps/unix/sysv/linux/linux_fsinfo.h
+++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h
@@ -1,5 +1,5 @@
 /* Constants from kernel header for various FSes.
-   Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1998,1999,2000,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
@@ -135,6 +135,9 @@
 /* Constants that identify the `vxfs' filesystem.  */
 #define VXFS_SUPER_MAGIC	0xa501fcf5
 
+/* Constants that identify the `sysfs´ filesystem.  */
+#define SYSFS_MAGIC		0x62656572
+
 /* Maximum link counts.  */
 #define COH_LINK_MAX		10000
 #define EXT2_LINK_MAX		32000
diff --git a/sysdeps/unix/sysv/linux/local-setxid.h b/sysdeps/unix/sysv/linux/local-setxid.h
new file mode 100644
index 0000000000..0579687982
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/local-setxid.h
@@ -0,0 +1,23 @@
+/* SETxID functions which only have to change the local thread and
+   none of the possible other threads.  */
+#include <kernel-features.h>
+#include <sysdep.h>
+
+/* If we can use the syscall directly, use it.  */
+#if __ASSUME_32BITUIDS > 0 && defined __NR_setresuid32
+# define local_seteuid(id) INLINE_SYSCALL (setresuid32, 3, -1, id, -1)
+#elif __ASSUME_SETRESUID_SYSCALL > 0
+# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1)
+#else
+# define local_seteuid(id) seteuid (id)
+#endif
+
+
+/* If we can use the syscall directly, use it.  */
+#if __ASSUME_32BITUIDS > 0 && defined __NR_setresgid32
+# define local_setegid(id) INLINE_SYSCALL (setresgid32, 3, -1, id, -1)
+#elif __ASSUME_SETRESGID_SYSCALL > 0
+# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1)
+#else
+# define local_setegid(id) setegid (id)
+#endif
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
index 4e80469572..7444dfe0d9 100644
--- a/sysdeps/unix/sysv/linux/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -1,5 +1,5 @@
 /* lxstat64 using old-style Unix lstat system call.
-   Copyright (C) 1997-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2002,2003,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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/Dist b/sysdeps/unix/sysv/linux/m68k/Dist
deleted file mode 100644
index 35fad7ff0e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-clone.S
-mremap.S
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/reg.h
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile
deleted file mode 100644
index 6bb4f6b816..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Linux/m68k uses Motorola asm syntax and the ELF format.
-
-m68k-syntax-flag = -DMOTOROLA_SYNTAX
-
-ifeq ($(subdir),misc)
-sysdep_routines += mremap
-sysdep_headers += sys/reg.h
-endif
-
-ifeq ($(subdir),elf)
-sysdep-others += lddlibc4
-install-bin += lddlibc4
-endif
-
-ifeq ($(subdir),resource)
-sysdep_routines += oldgetrlimit64
-endif
diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
deleted file mode 100644
index 0799bf310e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Versions
+++ /dev/null
@@ -1,32 +0,0 @@
-libc {
-  GLIBC_2.0 {
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-
-    # c*
-    cacheflush;
-  }
-  GLIBC_2.2 {
-    # functions used in other libraries
-    __xstat64; __fxstat64; __lxstat64;
-
-    # a*
-    alphasort64;
-
-    # g*
-    glob64;
-
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64;
-
-    # r*
-    readdir64; readdir64_r;
-
-    # s*
-    scandir64;
-
-    # v*
-    versionsort64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/m68k/alphasort64.c b/sysdeps/unix/sysv/linux/m68k/alphasort64.c
deleted file mode 100644
index 0b5ae47d2f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/alphasort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/a.out.h b/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
deleted file mode 100644
index 0fb52c3815..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifndef __A_OUT_GNU_H__
-# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
deleted file mode 100644
index 90c0a481e4..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define O_FSYNC		 O_SYNC
-#define O_ASYNC		 020000
-
-#ifdef __USE_GNU
-# define O_DIRECTORY	 040000	/* Must be a directory.	 */
-# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
-# define O_DIRECT	0200000	/* Direct disk access.	*/
-# define O_NOATIME	01000000 /* Do not set atime.  */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
-   We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.	*/
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0400000
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-#define F_GETLK64	12	/* Get record locking info.  */
-#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* For F_[GET|SET]FL.  */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* For old implementation of bsd flock().  */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation.	*/
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
deleted file mode 100644
index 815a3da88f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/mman.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/m68k version.
-   Copyright (C) 1997, 2003 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 _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0
-# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
deleted file mode 100644
index f7a7393154..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/poll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1997, 2001 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 _SYS_POLL_H
-# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
-#endif
-
-/* Event types that can be polled for.  These bits may be set in `events'
-   to indicate the interesting event types; they will appear in `revents'
-   to indicate the status of the file descriptor.  */
-#define POLLIN		0x001		/* There is data to read.  */
-#define POLLPRI		0x002		/* There is urgent data to read.  */
-#define POLLOUT		0x004		/* Writing now will not block.  */
-
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
-# define POLLRDNORM	0x040		/* Normal data may be read.  */
-# define POLLRDBAND	0x080		/* Priority data may be read.  */
-# define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
-# define POLLWRBAND	0x100		/* Priority data may be written.  */
-#endif
-
-/* Event types always implicitly polled for.  These bits need not be set in
-   `events', but they will appear in `revents' to indicate the status of
-   the file descriptor.  */
-#define POLLERR		0x008		/* Error condition.  */
-#define POLLHUP		0x010		/* Hung up.  */
-#define POLLNVAL	0x020		/* Invalid polling request.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
deleted file mode 100644
index dc06b13e2f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002
-     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 _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
-
-/* Versions of the `xmknod' interface.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
-#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
-
-
-struct stat
-  {
-    __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;			/* File serial number.	*/
-#else
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
-#endif
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned short int __pad2;
-#ifndef __USE_FILE_OFFSET64
-    __off_t st_size;			/* Size of file, in bytes.  */
-#else
-    __off64_t st_size;			/* Size of file, in bytes.  */
-#endif
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
-
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
-#else
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_MISC
-    /* Nanosecond resolution timestamps are stored in a format
-       equivalent to 'struct timespec'.  This is the type used
-       whenever possible but the Unix namespace rules do not allow the
-       identifier 'timespec' to appear in the <sys/stat.h> header.
-       Therefore we have to handle the use of this header in strictly
-       standard-compliant sources special.  */
-    struct timespec st_atim;		/* Time of last access.  */
-    struct timespec st_mtim;		/* Time of last modification.  */
-    struct timespec st_ctim;		/* Time of last status change.  */
-# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
-#ifndef __USE_FILE_OFFSET64
-    unsigned long int __unused4;
-    unsigned long int __unused5;
-#else
-    __ino64_t st_ino;			/* File serial number.	*/
-#endif
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned short int __pad2;
-    __off64_t st_size;			/* Size of file, in bytes.  */
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
-
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
-    /* Nanosecond resolution timestamps are stored in a format
-       equivalent to 'struct timespec'.  This is the type used
-       whenever possible but the Unix namespace rules do not allow the
-       identifier 'timespec' to appear in the <sys/stat.h> header.
-       Therefore we have to handle the use of this header in strictly
-       standard-compliant sources special.  */
-    struct timespec st_atim;		/* Time of last access.  */
-    struct timespec st_mtim;		/* Time of last modification.  */
-    struct timespec st_ctim;		/* Time of last status change.  */
-#else
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
-    __ino64_t st_ino;			/* File serial number.		*/
-  };
-#endif
-
-/* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported.  */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.  */
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-#define	__S_IFLNK	0120000	/* Symbolic link.  */
-#define	__S_IFSOCK	0140000	/* Socket.  */
-
-/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
-   they do it by enforcing the correct use of the macros.  */
-#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/chown.c b/sysdeps/unix/sysv/linux/m68k/chown.c
deleted file mode 100644
index 735fa5780a..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/chown.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 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 <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <linux/posix_types.h>
-#include "kernel-features.h"
-
-#ifdef __NR_chown32
-# if __ASSUME_32BITUIDS == 0
-/* This variable is shared with all files that need to check for 32bit
-   uids.  */
-extern int __libc_missing_32bit_uids;
-# endif
-#endif /* __NR_chown32 */
-
-int
-__chown (const char *file, uid_t owner, gid_t group)
-{
-#if __ASSUME_32BITUIDS > 0
-  return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
-#else
-# ifdef __NR_chown32
-  if (__libc_missing_32bit_uids <= 0)
-    {
-      int result;
-      int saved_errno = errno;
-
-      result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
-      if (result == 0 || errno != ENOSYS)
-	return result;
-
-      __set_errno (saved_errno);
-      __libc_missing_32bit_uids = 1;
-    }
-# endif /* __NR_chown32 */
-
-  if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
-      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
-#endif
-}
-libc_hidden_def (__chown)
-weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
deleted file mode 100644
index 6baf723d9b..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/clone.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
-
-   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.  */
-
-/* clone is even more special than fork as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-        .text
-ENTRY (__clone)
-
-	/* Sanity check arguments.  */
-	movel	#-EINVAL, %d0
-	movel	4(%sp), %a0		/* no NULL function pointers */
-	tstl	%a0
-	jeq	SYSCALL_ERROR_LABEL
-	movel	8(%sp), %a1		/* no NULL stack pointers */
-	tstl	%a1
-	jeq	SYSCALL_ERROR_LABEL
-
-	/* Allocate space and copy the argument onto the new stack.  */
-	movel	16(%sp), -(%a1)
-
-	/* Do the system call */
-	exg	%d2, %a1		/* save %d2 and get stack pointer */
-	movel	12(%sp), %d1		/* get flags */
-	movel	#SYS_ify (clone), %d0
-	trap	#0
-	exg	%d2, %a1		/* restore %d2 */
-
-	tstl	%d0
-	jmi	SYSCALL_ERROR_LABEL
-	jeq	thread_start
-
-	rts
-
-thread_start:
-	subl	%fp, %fp	/* terminate the stack frame */
-	jsr	(%a0)
-	movel	%d0, %d1
-	movel	#SYS_ify (exit), %d0
-	trap	#0
-
-PSEUDO_END (__clone)
-
-weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/m68k/dl-librecon.h b/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
deleted file mode 100644
index dbb4e75712..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/dl-librecon.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/fchown.c b/sysdeps/unix/sysv/linux/m68k/fchown.c
deleted file mode 100644
index 3a69ecc9e7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fcntl.c b/sysdeps/unix/sysv/linux/m68k/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fxstat.c b/sysdeps/unix/sysv/linux/m68k/fxstat.c
deleted file mode 100644
index 4f219f0b9d..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fxstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getdents64.c b/sysdeps/unix/sysv/linux/m68k/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getegid.c b/sysdeps/unix/sysv/linux/m68k/getegid.c
deleted file mode 100644
index 37b4b4a530..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/geteuid.c b/sysdeps/unix/sysv/linux/m68k/geteuid.c
deleted file mode 100644
index ebcb555b5e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/geteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgid.c b/sysdeps/unix/sysv/linux/m68k/getgid.c
deleted file mode 100644
index 0a4d6061f0..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgroups.c b/sysdeps/unix/sysv/linux/m68k/getgroups.c
deleted file mode 100644
index 102ea24e14..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getmsg.c b/sysdeps/unix/sysv/linux/m68k/getmsg.c
deleted file mode 100644
index 3a1fa08525..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
deleted file mode 100644
index f7ffdc5185..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>.
-
-   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 <unistd.h>
-#include <sys/param.h>
-#include <errno.h>
-
-#include <ldsodefs.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Return the system page size.  */
-int
-__getpagesize ()
-{
-#ifdef __NR_getpagesize
-  int result;
-#endif
-
-  if (GLRO(dl_pagesize) != 0)
-    return GLRO(dl_pagesize);
-
-#ifdef __NR_getpagesize
-  INTERNAL_SYSCALL_DECL (err);
-  result = INTERNAL_SYSCALL (getpagesize, err, 0);
-  /* The only possible error is ENOSYS.  */
-  if (!INTERNAL_SYSCALL_ERROR_P (result, err))
-    return result;
-#endif
-
-  return 4096;
-}
-libc_hidden_def (__getpagesize)
-weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/linux/m68k/getresgid.c b/sysdeps/unix/sysv/linux/m68k/getresgid.c
deleted file mode 100644
index b703a414cc..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getresuid.c b/sysdeps/unix/sysv/linux/m68k/getresuid.c
deleted file mode 100644
index 0b14cefe34..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit.c b/sysdeps/unix/sysv/linux/m68k/getrlimit.c
deleted file mode 100644
index fc06dbd641..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit64.c b/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getsysstats.c b/sysdeps/unix/sysv/linux/m68k/getsysstats.c
deleted file mode 100644
index 23207e9bcb..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getsysstats.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Determine various system internal values, Linux/m68k version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>
-
-   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.  */
-
-
-/* We need to define a special parser for /proc/cpuinfo.  */
-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)				  \
-  do									  \
-    {									  \
-      (RESULT) = 0;							  \
-      /* Read all lines and count the lines starting with the string	  \
-	 "CPU:".  We don't have to fear extremely long lines since	  \
-	 the kernel will not generate them.  8192 bytes are really	  \
-	 enough.  */							  \
-      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)	  \
-	if (strncmp (BUFFER, "CPU:", 4) == 0)	      	     		  \
-	  ++(RESULT);							  \
-    }									  \
-  while (0)
-
-#include <sysdeps/unix/sysv/linux/getsysstats.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getuid.c b/sysdeps/unix/sysv/linux/m68k/getuid.c
deleted file mode 100644
index d682c79a49..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/glob64.c b/sysdeps/unix/sysv/linux/m68k/glob64.c
deleted file mode 100644
index 82a9a296a7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lchown.c b/sysdeps/unix/sysv/linux/m68k/lchown.c
deleted file mode 100644
index c89de99ba2..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
deleted file mode 100644
index 953f192bcd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/ldconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/ldconfig.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/lockf64.c b/sysdeps/unix/sysv/linux/m68k/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lxstat.c b/sysdeps/unix/sysv/linux/m68k/lxstat.c
deleted file mode 100644
index 2371cd9719..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lxstat.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
-
diff --git a/sysdeps/unix/sysv/linux/m68k/mmap.S b/sysdeps/unix/sysv/linux/m68k/mmap.S
deleted file mode 100644
index 086212a42b..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/mmap.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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>
-
-	.text
-ENTRY (__mmap)
-
-	move.l #SYS_ify (mmap), %d0	/* System call number in %d0.  */
-
-	lea 4(%sp), %a0			/* Address of args is 1st arg.  */
-	move.l %a0, %d1
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Kludge: negative numbers are among the legal return values.
-	   If %d0 is between -4096 and 0 then there was an error.  */
-	cmp.l #-4096, %d0
-	jhi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  Copy it to %a0 because
-	   mmap is declared to return a pointer.  */
-	move.l %d0, %a0
-	rts
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/m68k/mremap.S b/sysdeps/unix/sysv/linux/m68k/mremap.S
deleted file mode 100644
index 68d961b553..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/mremap.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996 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>
-
-/* The mremap system call is special because it needs to return
-   its value in register %a0.  */
-
-	.text
-PSEUDO (__mremap, mremap, 4)
-	move.l %d0, %a0
-	rts
-PSEUDO_END (__mremap)
-weak_alias (__mremap, mremap)
diff --git a/sysdeps/unix/sysv/linux/m68k/msgctl.c b/sysdeps/unix/sysv/linux/m68k/msgctl.c
deleted file mode 100644
index 9f9b8431a3..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
deleted file mode 100644
index 4c27e957bf..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/putmsg.c b/sysdeps/unix/sysv/linux/m68k/putmsg.c
deleted file mode 100644
index ebc1680ca7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/putmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64.c b/sysdeps/unix/sysv/linux/m68k/readdir64.c
deleted file mode 100644
index 2ea26dd409..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/readdir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64_r.c b/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
deleted file mode 100644
index 9f54f897e3..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/register-dump.h b/sysdeps/unix/sysv/linux/m68k/register-dump.h
deleted file mode 100644
index a7ac3ca01c..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/register-dump.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Dump registers.
-   Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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 <stddef.h>
-#include <sys/uio.h>
-#include <stdio-common/_itoa.h>
-
-/* We will print the register dump in this format:
-
-  D0: XXXXXXXX   D1: XXXXXXXX   D2: XXXXXXXX   D3: XXXXXXXX
-  D4: XXXXXXXX   D5: XXXXXXXX   D6: XXXXXXXX   D7: XXXXXXXX
-  A0: XXXXXXXX   A1: XXXXXXXX   A2: XXXXXXXX   A3: XXXXXXXX
-  A4: XXXXXXXX   A5: XXXXXXXX   A6: XXXXXXXX   A7: XXXXXXXX
-  PC: XXXXXXXX   SR: XXXX
-
-  OldMask: XXXXXXXX  Vector: XXXX
-
-  FP0: XXXXXXXXXXXXXXXXXXXXXXXX   FP1: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP2: XXXXXXXXXXXXXXXXXXXXXXXX   FP3: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP4: XXXXXXXXXXXXXXXXXXXXXXXX   FP5: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP6: XXXXXXXXXXXXXXXXXXXXXXXX   FP7: XXXXXXXXXXXXXXXXXXXXXXXX
-  FPCR: XXXXXXXX   FPSR: XXXXXXXX   FPIAR: XXXXXXXX
-
-*/
-
-/* Linux saves only the call-clobbered registers in the sigcontext.  We
-   need to use a trampoline that saves the rest so that the C code can
-   access them.  We use the sc_fpstate field, since the handler is not
-   supposed to return anyway, thus it doesn't matter that it's clobbered.  */
-
-/* static */ void catch_segfault (int, int, struct sigcontext *);
-
-/* Dummy function so that we can use asm with arguments.  */
-static void __attribute_used__
-__dummy__ (void)
-{
-  asm ("\n\
-catch_segfault:\n\
-	move.l 12(%%sp),%%a0\n\
-	lea %c0(%%a0),%%a0\n\
-	/* Clear the first 4 bytes to make it a null fp state, just\n\
-	   in case the handler does return.  */\n\
-	clr.l (%%a0)+\n\
-	movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
-	fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
-	jra real_catch_segfault"
-       : : "n" (offsetof (struct sigcontext, sc_fpstate)));
-}
-#define catch_segfault(a,b) \
-  __attribute_used__ real_catch_segfault(a,b)
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, struct sigcontext *ctx)
-{
-  char regs[20][8];
-  char fpregs[11][24];
-  struct iovec iov[63], *next_iov = iov;
-  unsigned long *p = (unsigned long *) ctx->sc_fpstate + 1;
-
-#define ADD_STRING(str) \
-  next_iov->iov_base = (char *) (str); \
-  next_iov->iov_len = strlen (str); \
-  ++next_iov
-#define ADD_MEM(str, len) \
-  next_iov->iov_base = (str); \
-  next_iov->iov_len = (len); \
-  ++next_iov
-
-  /* Generate strings of register contents.  */
-  hexvalue (ctx->sc_d0, regs[0], 8);
-  hexvalue (ctx->sc_d1, regs[1], 8);
-  hexvalue (*p++, regs[2], 8);
-  hexvalue (*p++, regs[3], 8);
-  hexvalue (*p++, regs[4], 8);
-  hexvalue (*p++, regs[5], 8);
-  hexvalue (*p++, regs[6], 8);
-  hexvalue (*p++, regs[7], 8);
-  hexvalue (ctx->sc_a0, regs[8], 8);
-  hexvalue (ctx->sc_a1, regs[9], 8);
-  hexvalue (*p++, regs[10], 8);
-  hexvalue (*p++, regs[11], 8);
-  hexvalue (*p++, regs[12], 8);
-  hexvalue (*p++, regs[13], 8);
-  hexvalue (*p++, regs[14], 8);
-  hexvalue (ctx->sc_usp, regs[15], 8);
-  hexvalue (ctx->sc_pc, regs[16], 8);
-  hexvalue (ctx->sc_sr, regs[17], 4);
-  hexvalue (ctx->sc_mask, regs[18], 8);
-  hexvalue (ctx->sc_formatvec & 0xfff, regs[19], 4);
-  hexvalue (ctx->sc_fpregs[0], fpregs[0], 8);
-  hexvalue (ctx->sc_fpregs[1], fpregs[0] + 8, 8);
-  hexvalue (ctx->sc_fpregs[2], fpregs[0] + 16, 8);
-  hexvalue (ctx->sc_fpregs[3], fpregs[1], 8);
-  hexvalue (ctx->sc_fpregs[4], fpregs[1] + 8, 8);
-  hexvalue (ctx->sc_fpregs[5], fpregs[1] + 16, 8);
-  hexvalue (*p++, fpregs[2], 8);
-  hexvalue (*p++, fpregs[2] + 8, 8);
-  hexvalue (*p++, fpregs[2] + 16, 8);
-  hexvalue (*p++, fpregs[3], 8);
-  hexvalue (*p++, fpregs[3] + 8, 8);
-  hexvalue (*p++, fpregs[3] + 16, 8);
-  hexvalue (*p++, fpregs[4], 8);
-  hexvalue (*p++, fpregs[4] + 8, 8);
-  hexvalue (*p++, fpregs[4] + 16, 8);
-  hexvalue (*p++, fpregs[5], 8);
-  hexvalue (*p++, fpregs[5] + 8, 8);
-  hexvalue (*p++, fpregs[5] + 16, 8);
-  hexvalue (*p++, fpregs[6], 8);
-  hexvalue (*p++, fpregs[6] + 8, 8);
-  hexvalue (*p++, fpregs[6] + 16, 8);
-  hexvalue (*p++, fpregs[7], 8);
-  hexvalue (*p++, fpregs[7] + 8, 8);
-  hexvalue (*p++, fpregs[7] + 16, 8);
-  hexvalue (ctx->sc_fpcntl[0], fpregs[8], 8);
-  hexvalue (ctx->sc_fpcntl[1], fpregs[9], 8);
-  hexvalue (ctx->sc_fpcntl[2], fpregs[10], 8);
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n  D0: ");
-  ADD_MEM (regs[0], 8);
-  ADD_STRING ("  D1: ");
-  ADD_MEM (regs[1], 8);
-  ADD_STRING ("  D2: ");
-  ADD_MEM (regs[2], 8);
-  ADD_STRING ("  D3: ");
-  ADD_MEM (regs[3], 8);
-  ADD_STRING ("\n  D4: ");
-  ADD_MEM (regs[4], 8);
-  ADD_STRING ("  D5: ");
-  ADD_MEM (regs[5], 8);
-  ADD_STRING ("  D6: ");
-  ADD_MEM (regs[6], 8);
-  ADD_STRING ("  D7: ");
-  ADD_MEM (regs[7], 8);
-  ADD_STRING ("\n  A0: ");
-  ADD_MEM (regs[8], 8);
-  ADD_STRING ("  A1: ");
-  ADD_MEM (regs[9], 8);
-  ADD_STRING ("  A2: ");
-  ADD_MEM (regs[10], 8);
-  ADD_STRING ("  A3: ");
-  ADD_MEM (regs[11], 8);
-  ADD_STRING ("\n  A4: ");
-  ADD_MEM (regs[12], 8);
-  ADD_STRING ("  A5: ");
-  ADD_MEM (regs[13], 8);
-  ADD_STRING ("  A6: ");
-  ADD_MEM (regs[14], 8);
-  ADD_STRING ("  A7: ");
-  ADD_MEM (regs[15], 8);
-  ADD_STRING ("\n  PC: ");
-  ADD_MEM (regs[16], 8);
-  ADD_STRING ("  SR: ");
-  ADD_MEM (regs[17], 4);
-
-  ADD_STRING ("\n\n  OldMask: ");
-  ADD_MEM (regs[18], 8);
-  ADD_STRING ("  Vector: ");
-  ADD_MEM (regs[19], 4);
-
-  ADD_STRING ("\n\n  FP0: ");
-  ADD_MEM (fpregs[0], 24);
-  ADD_STRING ("  FP1: ");
-  ADD_MEM (fpregs[1], 24);
-  ADD_STRING ("\n  FP2: ");
-  ADD_MEM (fpregs[2], 24);
-  ADD_STRING ("  FP3: ");
-  ADD_MEM (fpregs[3], 24);
-  ADD_STRING ("\n  FP4: ");
-  ADD_MEM (fpregs[4], 24);
-  ADD_STRING ("  FP5: ");
-  ADD_MEM (fpregs[5], 24);
-  ADD_STRING ("\n  FP6: ");
-  ADD_MEM (fpregs[6], 24);
-  ADD_STRING ("  FP7: ");
-  ADD_MEM (fpregs[7], 24);
-  ADD_STRING ("\n  FPCR: ");
-  ADD_MEM (fpregs[8], 8);
-  ADD_STRING ("  FPSR: ");
-  ADD_MEM (fpregs[9], 8);
-  ADD_STRING ("  FPIAR: ");
-  ADD_MEM (fpregs[10], 8);
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, next_iov - iov);
-}
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/m68k/scandir64.c b/sysdeps/unix/sysv/linux/m68k/scandir64.c
deleted file mode 100644
index 506fd8877c..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/scandir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semctl.c b/sysdeps/unix/sysv/linux/m68k/semctl.c
deleted file mode 100644
index e9b1a483c9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
deleted file mode 100644
index 2775c124c6..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/semtimedop.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP	8		/* saved register space */
-#define PARMS	4+SVRSP		/* space for 3 saved regs */
-#define SEMID	PARMS
-#define SOPS	SEMID+4
-#define NSOPS	SOPS+4
-#define TIMEOUT	NSOPS+4
-
-	.text
-ENTRY (semtimedop)
-
-	/* Save registers.  */
-	move.l	%d2, %a1
-	move.l	%d3, -(%sp)
-	move.l	%d5, -(%sp)
-
-	move.l	#SYSOP_semtimedop, %d1
-	move.l	SEMID(%sp), %d2
-	move.l	NSOPS(%sp), %d3
-	move.l	SOPS(%sp), %d5
-	move.l	TIMEOUT(%sp), %a0
-	move.l	#SYS_ify (ipc), %d0
-
-	trap	#0
-
-	/* Restore registers.  */
-	move.l	(%sp)+, %d5
-	move.l	(%sp)+, %d3
-	move.l	%a1, %d2
-
-	/* Check for error.  */
-	tst.l	%d0
-	jmi	SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	ret
-
-PSEUDO_END (semtimedop)
diff --git a/sysdeps/unix/sysv/linux/m68k/setegid.c b/sysdeps/unix/sysv/linux/m68k/setegid.c
deleted file mode 100644
index 2e3a54c893..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/seteuid.c b/sysdeps/unix/sysv/linux/m68k/seteuid.c
deleted file mode 100644
index 18e41d08c1..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/seteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsgid.c b/sysdeps/unix/sysv/linux/m68k/setfsgid.c
deleted file mode 100644
index 0886712569..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setfsgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsuid.c b/sysdeps/unix/sysv/linux/m68k/setfsuid.c
deleted file mode 100644
index a9f22eb8ab..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setfsuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgid.c b/sysdeps/unix/sysv/linux/m68k/setgid.c
deleted file mode 100644
index 377021d9ec..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgroups.c b/sysdeps/unix/sysv/linux/m68k/setgroups.c
deleted file mode 100644
index 0e7086278f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setregid.c b/sysdeps/unix/sysv/linux/m68k/setregid.c
deleted file mode 100644
index 99c57ad20f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setregid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresgid.c b/sysdeps/unix/sysv/linux/m68k/setresgid.c
deleted file mode 100644
index daca1a4833..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresuid.c b/sysdeps/unix/sysv/linux/m68k/setresuid.c
deleted file mode 100644
index 3aeabe9ad7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setreuid.c b/sysdeps/unix/sysv/linux/m68k/setreuid.c
deleted file mode 100644
index 8ad61226e9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setreuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setrlimit.c b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
deleted file mode 100644
index bfaef74c38..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setuid.c b/sysdeps/unix/sysv/linux/m68k/setuid.c
deleted file mode 100644
index de394379be..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/shmctl.c b/sysdeps/unix/sysv/linux/m68k/shmctl.c
deleted file mode 100644
index 7eac6380dd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
deleted file mode 100644
index b7e08cfc95..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 1998.
-
-   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.  */
-
-#define SIGCONTEXT int _code, struct sigcontext *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) (ctx)->sc_pc)
-#define GET_FRAME(ctx)	((void *) __builtin_frame_address (1))
-#define GET_STACK(ctx)	((void *) (ctx)->sc_usp)
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/m68k/socket.S b/sysdeps/unix/sysv/linux/m68k/socket.S
deleted file mode 100644
index 1d10f33e17..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/socket.S
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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-cancel.h>
-#include <socketcall.h>
-
-#define P(a, b) P2(a, b)
-#define P2(a, b) a##b
-
-	.text
-/* The socket-oriented system calls are handled unusally in Linux.
-   They are all gated through the single `socketcall' system call number.
-   `socketcall' takes two arguments: the first is the subcode, specifying
-   which socket function is being called; and the second is a pointer to
-   the arguments to the specific function.
-
-   The .S files for the other calls just #define socket and #include this.  */
-
-#ifndef __socket
-#ifndef NO_WEAK_ALIAS
-#define __socket P(__,socket)
-#else
-#define __socket socket
-#endif
-#endif
-
-.globl __socket
-ENTRY (__socket)
-#if defined NEED_CANCELLATION && defined CENABLE
-	SINGLE_THREAD_P
-	jne 1f
-#endif
-
-	/* Save registers.  */
-	move.l %d2, %a0
-
-	move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
-
-	/* Use ## so `socket' is a separate token that might be #define'd.  */
-	move.l #P (SOCKOP_,socket), %d1	/* Subcode is first arg to syscall.  */
-	lea 4(%sp), %a1			/* Address of args is 2nd arg.  */
-	move.l %a1, %d2
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Restore registers.  */
-	move.l %a0, %d2
-
-	/* %d0 is < 0 if there was an error.  */
-	tst.l %d0
-	jmi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	rts
-
-#if defined NEED_CANCELLATION && defined CENABLE
-1:	/* Enable asynchronous cancellation.  */
-	CENABLE
-
-	/* Save registers.  */
-	move.l %d2, -(%sp)
-	move.l %d0, -(%sp)
-
-	move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
-
-	/* Use ## so `socket' is a separate token that might be #define'd.  */
-	move.l #P (SOCKOP_,socket), %d1	/* Subcode is first arg to syscall.  */
-	lea 4+8(%sp), %a1		/* Address of args is 2nd arg.  */
-	move.l %a1, %d2
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Restore cancellation.  */
-	move.l %d0, %d2
-	CDISABLE
-	addq.l #4, %sp
-	move.l %d2, %d0
-
-	/* Restore registers.  */
-	move.l (%sp)+, %d2
-
-	/* %d0 is < 0 if there was an error.  */
-	tst.l %d0
-	jmi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	rts
-#endif
-	
-PSEUDO_END (__socket)
-
-#ifndef NO_WEAK_ALIAS
-weak_alias (__socket, socket)
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/procfs.h b/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
deleted file mode 100644
index 27abf8ef52..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2001 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 _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-
-__BEGIN_DECLS
-
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We could have used `struct
-   user_regs_struct' directly in the typedef, but tradition says that
-   the register set is an array, which does have some peculiar
-   semantics, so leave it that way.  */
-#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/* Register set for the floating-point registers.  */
-typedef struct user_m68kfp_struct elf_fpregset_t;
-
-
-/* Signal info.  */
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/reg.h b/sysdeps/unix/sysv/linux/m68k/sys/reg.h
deleted file mode 100644
index 418f8323f1..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/reg.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 1998 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 _SYS_REG_H
-#define _SYS_REG_H	1
-
-/* Index into an array of 4 byte integers returned from ptrace for
-   location of the users' stored general purpose registers. */
-
-enum
-{
-  PT_D1 = 0,
-#define PT_D1 PT_D1
-  PT_D2 = 1,
-#define PT_D2 PT_D2
-  PT_D3 = 2,
-#define PT_D3 PT_D3
-  PT_D4 = 3,
-#define PT_D4 PT_D4
-  PT_D5 = 4,
-#define PT_D5 PT_D5
-  PT_D6 = 5,
-#define PT_D6 PT_D6
-  PT_D7 = 6,
-#define PT_D7 PT_D7
-  PT_A0 = 7,
-#define PT_A0 PT_A0
-  PT_A1 = 8,
-#define PT_A1 PT_A1
-  PT_A2 = 9,
-#define PT_A2 PT_A2
-  PT_A3 = 10,
-#define PT_A3 PT_A3
-  PT_A4 = 11,
-#define PT_A4 PT_A4
-  PT_A5 = 12,
-#define PT_A5 PT_A5
-  PT_A6 = 13,
-#define PT_A6 PT_A6
-  PT_D0 = 14,
-#define PT_D0 PT_D0
-  PT_USP = 15,
-#define PT_USP PT_USP
-  PT_ORIG_D0 = 16,
-#define PT_ORIG_D0 PT_ORIG_D0
-  PT_SR = 17,
-#define PT_SR PT_SR
-  PT_PC = 18,
-#define PT_PC PT_PC
-  PT_FP0 = 21,
-#define PT_FP0 PT_FP0
-  PT_FP1 = 24,
-#define PT_FP1 PT_FP1
-  PT_FP2 = 27,
-#define PT_FP2 PT_FP2
-  PT_FP3 = 30,
-#define PT_FP3 PT_FP3
-  PT_FP4 = 33,
-#define PT_FP4 PT_FP4
-  PT_FP5 = 36,
-#define PT_FP5 PT_FP5
-  PT_FP6 = 39,
-#define PT_FP6 PT_FP6
-  PT_FP7 = 42,
-#define PT_FP7 PT_FP7
-  PT_FPCR = 45,
-#define PT_FPCR PT_FPCR
-  PT_FPSR = 46,
-#define PT_FPSR PT_FPSR
-  PT_FPIAR = 47
-#define PT_FPIAR PT_FPIAR
-};
-
-#endif	/* _SYS_REG_H */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
deleted file mode 100644
index 3c441dc5ce..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1999, 2001 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.  */
-
-/* System V/m68k ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* Type for general register.  */
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	18
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R_D0 = 0,
-#define R_D0	R_D0
-  R_D1 = 1,
-#define R_D1	R_D1
-  R_D2 = 2,
-#define R_D2	R_D2
-  R_D3 = 3,
-#define R_D3	R_D3
-  R_D4 = 4,
-#define R_D4	R_D4
-  R_D5 = 5,
-#define R_D5	R_D5
-  R_D6 = 6,
-#define R_D6	R_D6
-  R_D7 = 7,
-#define R_D7	R_D7
-  R_A0 = 8,
-#define R_A0	R_A0
-  R_A1 = 9,
-#define R_A1	R_A1
-  R_A2 = 10,
-#define R_A2	R_A2
-  R_A3 = 11,
-#define R_A3	R_A3
-  R_A4 = 12,
-#define R_A4	R_A4
-  R_A5 = 13,
-#define R_A5	R_A5
-  R_A6 = 14,
-#define R_A6	R_A6
-  R_A7 = 15,
-#define R_A7	R_A7
-  R_SP = 15,
-#define R_SP	R_SP
-  R_PC = 16,
-#define R_PC	R_PC
-  R_PS = 17
-#define R_PS	R_PS
-};
-
-/* Structure to describe FPU registers.  */
-typedef struct fpregset
-{
-  int f_fpregs[8][3];
-  int f_pcr;
-  int f_psr;
-  int f_fpiaddr;
-} fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-{
-  int version;
-  gregset_t gregs;
-  fpregset_t fpregs;
-} mcontext_t;
-
-#define MCONTEXT_VERSION 2
-
-/* Userlevel context.  */
-typedef struct ucontext
-{
-  unsigned long int uc_flags;
-  struct ucontext *uc_link;
-  __sigset_t uc_sigmask;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  long int uc_filler[174];
-} ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/syscall.S b/sysdeps/unix/sysv/linux/m68k/syscall.S
deleted file mode 100644
index 4f2c747c27..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/syscall.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1998 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>
-
-/* Please consult the file sysdeps/unix/sysv/linux/m68k/sysdep.h for
-   more information about the value -4095 used below.*/
-
-	.text
-ENTRY (syscall)
-	move.l 4(%sp), %d0	/* Load syscall number.  */
-	_DOARGS_5 (24)		/* Frob arguments.  */
-	trap &0			/* Do the system call.  */
-	UNDOARGS_5		/* Unfrob arguments.  */
-	cmp.l &-4095, %d0	/* Check %d0 for error.  */
-	jcc SYSCALL_ERROR_LABEL	/* Jump to error handler if negative.  */
-	rts			/* Return to caller.  */
-PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
deleted file mode 100644
index 98d30667bd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
-oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
-oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.S b/sysdeps/unix/sysv/linux/m68k/sysdep.S
deleted file mode 100644
index e4ec92d836..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1996, 2002 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>
-
-
-/* The following code is only used in the shared library when we
-   compile the reentrant version.  Otherwise each system call defines
-   each own version.  */
-
-#ifndef	PIC
-
-/* The syscall stubs jump here when they detect an error.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %d0.  */
-
-	.text
-ENTRY (__syscall_error)
-	neg.l %d0
-#ifndef _LIBC_REENTRANT
-	move.l %d0, errno
-#else
-	move.l %d0, -(%sp)
-	jbsr __errno_location
-	move.l (%sp)+, (%a0)
-#endif
-	move.l #-1, %d0
-	/* Copy return value to %a0 for syscalls that are declared to
-	   return a pointer.  */
-	move.l %d0, %a0
-	rts
-END (__syscall_error)
-#endif /* PIC */
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
deleted file mode 100644
index 091dfc9c7d..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
-   December 1995.
-
-   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 <sysdeps/unix/sysdep.h>
-#include <sysdeps/m68k/sysdep.h>
-
-/* Defines RTLD_PRIVATE_ERRNO.  */
-#include <dl-sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* Linux uses a negative return value to indicate syscall errors, unlike
-   most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be negative
-   even if the call succeeded.  E.g., the `lseek' system call might return
-   a large offset.  Therefore we must not anymore test for < 0, but test
-   for a real error by making sure the value in %d0 is a real error
-   number.  Linus said he will make sure the no syscall returns a value
-   in -1 .. -4095 as a valid result so we can savely test with -4095.  */
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef PIC
-#define SYSCALL_ERROR_LABEL .Lsyscall_error
-#else
-#define SYSCALL_ERROR_LABEL __syscall_error
-#endif
-
-#undef PSEUDO
-#define	PSEUDO(name, syscall_name, args)				      \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    cmp.l &-4095, %d0;							      \
-    jcc SYSCALL_ERROR_LABEL
-
-#undef PSEUDO_END
-#define PSEUDO_END(name)						      \
-  SYSCALL_ERROR_HANDLER;						      \
-  END (name)
-
-#undef PSEUDO_NOERRNO
-#define	PSEUDO_NOERRNO(name, syscall_name, args)			      \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args)
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					      \
-  END (name)
-
-#define ret_NOERRNO rts
-
-/* The function has to return the error code.  */
-#undef	PSEUDO_ERRVAL
-#define	PSEUDO_ERRVAL(name, syscall_name, args) \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    negl %d0
-
-#undef	PSEUDO_END_ERRVAL
-#define	PSEUDO_END_ERRVAL(name) \
-  END (name)
-
-#define ret_ERRVAL rts
-
-#ifdef PIC
-# if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER						      \
-SYSCALL_ERROR_LABEL:							      \
-    lea (rtld_errno, %pc), %a0;					      	      \
-    neg.l %d0;								      \
-    move.l %d0, (%a0);							      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-# else /* !RTLD_PRIVATE_ERRNO */
-/* Store (- %d0) into errno through the GOT.  */
-#  if defined _LIBC_REENTRANT
-#   define SYSCALL_ERROR_HANDLER					      \
-SYSCALL_ERROR_LABEL:							      \
-    neg.l %d0;								      \
-    move.l %d0, -(%sp);							      \
-    jbsr __errno_location@PLTPC;					      \
-    move.l (%sp)+, (%a0);						      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-#  else /* !_LIBC_REENTRANT */
-#   define SYSCALL_ERROR_HANDLER					      \
-SYSCALL_ERROR_LABEL:							      \
-    move.l (errno@GOTPC, %pc), %a0;					      \
-    neg.l %d0;								      \
-    move.l %d0, (%a0);							      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-#  endif /* _LIBC_REENTRANT */
-# endif /* RTLD_PRIVATE_ERRNO */
-#else
-# define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
-#endif /* PIC */
-
-/* Linux takes system call arguments in registers:
-
-	syscall number	%d0	     call-clobbered
-	arg 1		%d1	     call-clobbered
-	arg 2		%d2	     call-saved
-	arg 3		%d3	     call-saved
-	arg 4		%d4	     call-saved
-	arg 5		%d5	     call-saved
-
-   The stack layout upon entering the function is:
-
-	20(%sp)		Arg# 5
-	16(%sp)		Arg# 4
-	12(%sp)		Arg# 3
-	 8(%sp)		Arg# 2
-	 4(%sp)		Arg# 1
-	  (%sp)		Return address
-
-   (Of course a function with say 3 arguments does not have entries for
-   arguments 4 and 5.)
-
-   Separate move's are faster than movem, but need more space.  Since
-   speed is more important, we don't use movem.  Since %a0 and %a1 are
-   scratch registers, we can use them for saving as well.  */
-
-#define DO_CALL(syscall_name, args)			      		      \
-    move.l &SYS_ify(syscall_name), %d0;					      \
-    DOARGS_##args							      \
-    trap &0;								      \
-    UNDOARGS_##args
-
-#define	DOARGS_0	/* No arguments to frob.  */
-#define	UNDOARGS_0	/* No arguments to unfrob.  */
-#define	_DOARGS_0(n)	/* No arguments to frob.  */
-
-#define	DOARGS_1	_DOARGS_1 (4)
-#define	_DOARGS_1(n)	move.l n(%sp), %d1; _DOARGS_0 (n)
-#define	UNDOARGS_1	UNDOARGS_0
-
-#define	DOARGS_2	_DOARGS_2 (8)
-#define	_DOARGS_2(n)	move.l %d2, %a0; move.l n(%sp), %d2; _DOARGS_1 (n-4)
-#define	UNDOARGS_2	UNDOARGS_1; move.l %a0, %d2
-
-#define DOARGS_3	_DOARGS_3 (12)
-#define _DOARGS_3(n)	move.l %d3, %a1; move.l n(%sp), %d3; _DOARGS_2 (n-4)
-#define UNDOARGS_3	UNDOARGS_2; move.l %a1, %d3
-
-#define DOARGS_4	_DOARGS_4 (16)
-#define _DOARGS_4(n)	move.l %d4, -(%sp); move.l n+4(%sp), %d4; _DOARGS_3 (n)
-#define UNDOARGS_4	UNDOARGS_3; move.l (%sp)+, %d4
-
-#define DOARGS_5	_DOARGS_5 (20)
-#define _DOARGS_5(n)	move.l %d5, -(%sp); move.l n+4(%sp), %d5; _DOARGS_4 (n)
-#define UNDOARGS_5	UNDOARGS_4; move.l (%sp)+, %d5
-
-
-#define	ret	rts
-#if 0 /* Not used by Linux */
-#define	r0	%d0
-#define	r1	%d1
-#define	MOVE(x,y)	movel x , y
-#endif
-
-#else /* not __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				\
-  ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
-       {								\
-	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
-	 _sys_result = (unsigned int) -1;				\
-       }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-/* 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.  */
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)	\
-  ({ unsigned int _sys_result;				\
-     {							\
-       /* Load argument values in temporary variables
-	  to perform side effects like function calls
-	  before the call used registers are set.  */	\
-       LOAD_ARGS_##nr (args)				\
-       LOAD_REGS_##nr					\
-       register int _d0 asm ("%d0") = __NR_##name;	\
-       asm volatile ("trap #0"				\
-		     : "=d" (_d0)			\
-		     : "0" (_d0) ASM_ARGS_##nr		\
-		     : "memory");			\
-       _sys_result = _d0;				\
-     }							\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)		\
-  ((unsigned int) (val) >= -4095U)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define LOAD_ARGS_0()
-#define LOAD_REGS_0
-#define ASM_ARGS_0
-#define LOAD_ARGS_1(a1)				\
-  LOAD_ARGS_0 ()				\
-  int __arg1 = (int) (a1);
-#define LOAD_REGS_1				\
-  register int _d1 asm ("d1") = __arg1;		\
-  LOAD_REGS_0
-#define ASM_ARGS_1	ASM_ARGS_0, "d" (_d1)
-#define LOAD_ARGS_2(a1, a2)			\
-  LOAD_ARGS_1 (a1)				\
-  int __arg2 = (int) (a2);
-#define LOAD_REGS_2				\
-  register int _d2 asm ("d2") = __arg2;		\
-  LOAD_REGS_1
-#define ASM_ARGS_2	ASM_ARGS_1, "d" (_d2)
-#define LOAD_ARGS_3(a1, a2, a3)			\
-  LOAD_ARGS_2 (a1, a2)				\
-  int __arg3 = (int) (a3);
-#define LOAD_REGS_3				\
-  register int _d3 asm ("d3") = __arg3;		\
-  LOAD_REGS_2
-#define ASM_ARGS_3	ASM_ARGS_2, "d" (_d3)
-#define LOAD_ARGS_4(a1, a2, a3, a4)		\
-  LOAD_ARGS_3 (a1, a2, a3)			\
-  int __arg4 = (int) (a4);
-#define LOAD_REGS_4				\
-  register int _d4 asm ("d4") = __arg4;		\
-  LOAD_REGS_3
-#define ASM_ARGS_4	ASM_ARGS_3, "d" (_d4)
-#define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  LOAD_ARGS_4 (a1, a2, a3, a4)			\
-  int __arg5 = (int) (a5);
-#define LOAD_REGS_5				\
-  register int _d5 asm ("d5") = __arg5;		\
-  LOAD_REGS_4
-#define ASM_ARGS_5	ASM_ARGS_4, "d" (_d5)
-#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)	\
-  LOAD_ARGS_5 (a1, a2, a3, a4, a5)		\
-  int __arg6 = (int) (a6);
-#define LOAD_REGS_6				\
-  register int _a0 asm ("a0") = __arg6;		\
-  LOAD_REGS_5
-#define ASM_ARGS_6	ASM_ARGS_5, "a" (_a0)
-
-#endif /* not __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/m68k/versionsort64.c b/sysdeps/unix/sysv/linux/m68k/versionsort64.c
deleted file mode 100644
index 144b691e56..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/versionsort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/vfork.S b/sysdeps/unix/sysv/linux/m68k/vfork.S
deleted file mode 100644
index 8027b2f801..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/vfork.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-
-#ifdef __NR_vfork
-
-	/* Pop the return PC value into A0.  */
-	movel	%sp@+, %a0
-
-	/* Stuff the syscall number in D0 and trap into the kernel.  */
-	movel	#SYS_ify (vfork), %d0
-	trap	#0
-	tstl	%d0
-	jmi	.Lerror		/* Branch forward if it failed.  */
-
-	/* Jump to the return PC.  */
-	jmp	%a0@
-
-.Lerror:
-	/* Push back the return PC.  */
-	movel	%a0,%sp@-
-
-# ifdef __ASSUME_VFORK_SYSCALL
-#  ifndef PIC
-	jbra	SYSCALL_ERROR_LABEL
-#  endif
-# else
-	/* Check if vfork syscall is known at all.  */
-	movel	#-ENOSYS,%d1
-	cmpl	%d0,%d1
-	jne	SYSCALL_ERROR_LABEL
-
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	movel	#SYS_ify (fork), %d0
-	trap	#0
-	tstl	%d0
-	jmi	SYSCALL_ERROR_LABEL
-	rts
-#endif
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/m68k/xstat.c b/sysdeps/unix/sysv/linux/m68k/xstat.c
deleted file mode 100644
index e9869f5508..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/xstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist
deleted file mode 100644
index 1d74119a6d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Dist
+++ /dev/null
@@ -1,13 +0,0 @@
-_test_and_set.c
-clone.S
-entry.h
-ipc_priv.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-sys/cachectl.h
-sys/procfs.h
-sys/sysmips.h
-sys/tas.h
-sys/user.h
-xstatconv.c
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
deleted file mode 100644
index d5e4f6b72d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-ifeq ($(subdir),signal)
-#sysdep_routines += sigsuspend
-endif
-
-ifeq ($(subdir),misc)
-sysdep_routines += cachectl cacheflush sysmips _test_and_set
-
-sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
-
-no_syscall_list_h = 1
-
-# Generate the list of SYS_* macros for the system calls (__NR_* macros).
-# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
-# it exists, but also define SYS_<abi>_<syscall> for all ABIs.
-$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
-	$(make-target-directory)
-	{ \
-	 echo '/* Generated at libc build time from kernel syscall list.  */';\
-	 echo ''; \
-	 echo '#ifndef _SYSCALL_H'; \
-	 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
-	 echo '#endif'; \
-	 echo ''; \
-	 echo '#include <sgidefs.h>'; \
-	 rm -f $(@:.d=.h).newt; \
-	 $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
-	       -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
-	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
-	     > $(@:.d=.h).newt; \
-	 if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
-	   echo '#if _MIPS_SIM == _ABIN32'; \
-	   sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#elif _MIPS_SIM == _ABI64'; \
-	   sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#else'; \
-	   sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#endif'; \
-	   sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort +1.8; \
-	 else \
-	   cat $(@:.d=.h).newt; \
-	 fi; \
-	 rm $(@:.d=.h).newt; \
-	} > $(@:.d=.h).new
-	mv -f $(@:.d=.h).new $(@:.d=.h)
-ifneq (,$(objpfx))
-	sed $(sed-remove-objpfx) $(@:.h=.d)-t > $(@:.h=.d)-t2
-	rm -f $(@:.h=.d)-t
-	mv -f $(@:.h=.d)-t2 $(@:.h=.d)
-else
-	mv -f $(@:.h=.d)-t $(@:.h=.d)
-endif
-endif
diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
deleted file mode 100644
index 50bfac5599..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Versions
+++ /dev/null
@@ -1,31 +0,0 @@
-libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
-  GLIBC_2.0 {
-    #errlist-compat	123
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-
-    # Needed by gcc:
-    _flush_cache;
-
-    # c*
-    cachectl; cacheflush;
-
-    # s*
-    sysmips;
-  }
-  GLIBC_2.2 {
-    #errlist-compat	1134
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-
-    # _*
-    _test_and_set;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/mips/_test_and_set.c b/sysdeps/unix/sysv/linux/mips/_test_and_set.c
deleted file mode 100644
index 9fd48f753e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/_test_and_set.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
-
-   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.  */
-
-/* Define the real-function versions of all inline functions
-   defined in sys/tas.h  */
-
-#include <features.h>
-
-#define _EXTERN_INLINE
-#ifndef __USE_EXTERN_INLINES
-# define __USE_EXTERN_INLINES 1
-#endif
-
-#include "sys/tas.h"
diff --git a/sysdeps/unix/sysv/linux/mips/bits/endian.h b/sysdeps/unix/sysv/linux/mips/bits/endian.h
deleted file mode 100644
index 0a3d2fabe3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/endian.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* The MIPS architecture has selectable endianness.
-   Linux/MIPS exists in two both little and big endian flavours and we
-   want to be able to share the installed headerfiles between both,
-   so we define __BYTE_ORDER based on GCC's predefines.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#ifdef __MIPSEB__
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# ifdef __MIPSEL__
-#  define __BYTE_ORDER __LITTLE_ENDIAN
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/errno.h b/sysdeps/unix/sysv/linux/mips/bits/errno.h
deleted file mode 100644
index 8220c2e513..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/errno.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Error constants.  MIPS/Linux specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 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.  */
-
-#ifdef _ERRNO_H
-
-# undef EDOM
-# undef EILSEQ
-# undef ERANGE
-# include <linux/errno.h>
-
-/* Linux has no ENOTSUP error code.  */
-# define ENOTSUP EOPNOTSUPP
-
-# ifndef __ASSEMBLER__
-/* Function to get address of global `errno' variable.  */
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-
-#  if !defined _LIBC || defined _LIBC_REENTRANT
-/* When using threads, errno is a per-thread value.  */
-#   define errno (*__errno_location ())
-#  endif
-# endif /* !__ASSEMBLER__ */
-#endif /* _ERRNO_H */
-
-#if !defined _ERRNO_H && defined __need_Emath
-/* This is ugly but the kernel header is not clean enough.  We must
-   define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
-   defined.  */
-# define EDOM	33	/* Math argument out of domain of function.  */
-# define EILSEQ	88	/* Illegal byte sequence.  */
-# define ERANGE	34	/* Math result not representable.  */
-#endif /* !_ERRNO_H && __need_Emath */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
deleted file mode 100644
index aa039b4c0e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-#include <sgidefs.h>
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	0x0003
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_APPEND	0x0008
-#define O_SYNC		0x0010
-#define O_NONBLOCK	0x0080
-#define O_CREAT		0x0100	/* not fcntl */
-#define O_TRUNC		0x0200	/* not fcntl */
-#define O_EXCL		0x0400	/* not fcntl */
-#define O_NOCTTY	0x0800	/* not fcntl */
-#define O_FSYNC		O_SYNC
-#define O_ASYNC		0x1000
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0x2000	/* Allow large file opens.  */
-#endif
-
-#ifdef __USE_GNU
-# define O_NOFOLLOW	0x20000	/* Do not follow links.	 */
-# define O_DIRECT	0x8000	/* Direct disk access hint.  */
-# define O_DIRECTORY	0x10000	/* Must be a directory.	 */
-# define O_NOATIME	0x40000	/* Do not set atime.  */
-#endif
-
-#define O_NDELAY	O_NONBLOCK
-
-/* For now Linux has no synchronisity options for data and read
-   operations.	We define the symbols here but let them do the same as
-   O_SYNC since this is a superset.  */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	14	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-
-#define F_GETLK64	33	/* Get record locking info.  */
-#define F_SETLK64	34	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	35	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	24	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	23	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-typedef struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#if _MIPS_SIM != _ABI64
-    /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
-       fcntls in o32 and n32, never has this field.  */
-    long int l_sysid;
-#endif
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-#if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64
-    /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
-       flock in o32 and n32, never has this field.  */
-    long int pad[4];
-#endif
-} flock_t;
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
deleted file mode 100644
index a8dcf242d3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Structure types for pre-termios terminal ioctls.  Linux/MIPS version.
-   Copyright (C) 1997, 1999, 2000, 2001 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 _SYS_IOCTL_H
-# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-/* Get definition of constants for use with `ioctl'.  */
-#include <asm/ioctls.h>
-
-struct winsize
-  {
-    unsigned short int ws_row;
-    unsigned short int ws_col;
-    unsigned short int ws_xpixel;
-    unsigned short int ws_ypixel;
-  };
-
-#define NCC	8
-struct termio
-  {
-    unsigned short int c_iflag;		/* input mode flags */
-    unsigned short int c_oflag;		/* output mode flags */
-    unsigned short int c_cflag;		/* control mode flags */
-    unsigned short int c_lflag;		/* local mode flags */
-    char c_line;			/* line discipline */
-    /* Yes, this is really NCCS.  */
-    unsigned char c_cc[32 /* NCCS */]; /* control characters */
-  };
-
-/* modem lines */
-#define TIOCM_LE	0x001		/* line enable */
-#define TIOCM_DTR	0x002		/* data terminal ready */
-#define TIOCM_RTS	0x004		/* request to send */
-#define TIOCM_ST	0x010		/* secondary transmit */
-#define TIOCM_SR	0x020		/* secondary receive */
-#define TIOCM_CTS	0x040		/* clear to send */
-#define TIOCM_CAR	0x100		/* carrier detect */
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RNG	0x200		/* ring */
-#define TIOCM_RI	TIOCM_RNG
-#define TIOCM_DSR	0x400		/* data set ready */
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async  */
-#define N_6PACK		7
-#define N_MASC		8	/* Mobitex module  */
-#define N_R3964		9	/* Simatic R3964 module  */
-#define N_PROFIBUS_FDL	10	/* Profibus  */
-#define N_IRDA		11	/* Linux IR  */
-#define N_SMSBLOCK	12	/* SMS block mode  */
-#define N_HDLC		13	/* synchronous HDLC  */
-#define N_SYNC_PPP	14	/* synchronous PPP  */
-#define	N_HCI		15	/* Bluetooth HCI UART  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
deleted file mode 100644
index 1f629ce665..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/ipc.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 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 _SYS_IPC_H
-# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* Create key if key does not exist. */
-#define IPC_EXCL	02000		/* Fail if key exists.	*/
-#define IPC_NOWAIT	04000		/* Return error on wait.  */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* Remove identifier.  */
-#define IPC_SET		1		/* Set `ipc_perm' options.  */
-#define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#ifdef __USE_GNU
-# define IPC_INFO	3		/* See ipcs.  */
-#endif
-
-/* Special key values.	*/
-#define IPC_PRIVATE	((__key_t) 0)	/* Private key.	 */
-
-
-/* Data structure used to pass permission information to IPC operations.  */
-struct ipc_perm
-  {
-    __key_t __key;			/* Key.  */
-    unsigned int uid;			/* Owner's user ID.  */
-    unsigned int gid;			/* Owner's group ID.  */
-    unsigned int cuid;			/* Creator's user ID.  */
-    unsigned int cgid;			/* Creator's group ID.	*/
-    unsigned int mode;			/* Read/write permission.  */
-    unsigned short int __seq;		/* Sequence number.  */
-    unsigned short int __pad1;
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-};
diff --git a/sysdeps/unix/sysv/linux/mips/bits/mman.h b/sysdeps/unix/sysv/linux/mips/bits/mman.h
deleted file mode 100644
index 154501fba2..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/mman.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/MIPS version.
-   Copyright (C) 1997, 2000, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0x00
-# define MAP_ANONYMOUS	0x0800		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-# define MAP_RENAME	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_NORESERVE	0x0400		/* don't check for reservations */
-# define MAP_ANONYMOUS	0x0800		/* don't use a file */
-# define MAP_GROWSDOWN	0x1000		/* stack-like segment */
-# define MAP_DENYWRITE	0x2000		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x4000		/* mark it as an executable */
-# define MAP_LOCKED	0x8000		/* pages are locked */
-# define MAP_POPULATE   0x10000         /* populate (prefault) pagetables */
-# define MAP_NONBLOCK   0x20000         /* do not block on IO */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-#define MADV_NORMAL	0		/* default page-in behavior */
-#define MADV_RANDOM	1		/* page-in minimum required */
-#define MADV_SEQUENTIAL	2		/* read-ahead aggressively */
-#define MADV_WILLNEED	3		/* pre-fault pages */
-#define MADV_DONTNEED	4		/* discard these pages */
-#endif
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/msq.h b/sysdeps/unix/sysv/linux/mips/bits/msq.h
deleted file mode 100644
index c2c1dd2e85..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/msq.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2002 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 _SYS_MSG_H
-# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-#ifdef __USE_GNU
-# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
-#endif
-
-/* Types used in the structure definition.  */
-typedef unsigned long int msgqnum_t;
-typedef unsigned long int msglen_t;
-
-
-/* Structure of record for one message inside the kernel.
-   The type `struct msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-  __time_t msg_stime;		/* time of last msgsnd command */
-  __time_t msg_rtime;		/* time of last msgrcv command */
-  __time_t msg_ctime;		/* time of last change */
-  unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-#ifdef __USE_MISC
-
-# define msg_cbytes	__msg_cbytes
-
-/* ipcs ctl commands */
-# define MSG_STAT 11
-# define MSG_INFO 12
-
-/* buffer for msgctl calls IPC_INFO, MSG_INFO */
-struct msginfo
-  {
-    int msgpool;
-    int msgmap;
-    int msgmax;
-    int msgmnb;
-    int msgmni;
-    int msgssz;
-    int msgtql;
-    unsigned short int msgseg;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/poll.h b/sysdeps/unix/sysv/linux/mips/bits/poll.h
deleted file mode 100644
index f62b9c3948..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/poll.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1997, 2001 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 _SYS_POLL_H
-# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
-#endif
-
-/* Event types that can be polled for.  These bits may be set in `events'
-   to indicate the interesting event types; they will appear in `revents'
-   to indicate the status of the file descriptor.  */
-#define POLLIN		0x001		/* There is data to read.  */
-#define POLLPRI		0x002		/* There is urgent data to read.  */
-#define POLLOUT		0x004		/* Writing now will not block.  */
-
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
-# define POLLRDNORM	0x040		/* Normal data may be read.  */
-# define POLLRDBAND	0x080		/* Priority data may be read.  */
-# define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
-# define POLLWRBAND	0x100		/* Priority data may be written.  */
-#endif
-
-#ifdef __USE_GNU
-/* This is an extension for Linux.  */
-# define POLLMSG	0x400
-#endif
-
-/* Event types always implicitly polled for.  These bits need not be set in
-   `events', but they will appear in `revents' to indicate the status of
-   the file descriptor.  */
-#define POLLERR		0x008		/* Error condition.  */
-#define POLLHUP		0x010		/* Hung up.  */
-#define POLLNVAL	0x020		/* Invalid polling request.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
deleted file mode 100644
index 2b6c887fd0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Bit values & structures for resource limits.  Linux/MIPS version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Transmute defines to enumerations.  The macro re-definitions are
-   necessary because some programs want to test for operating system
-   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
-   definition is a no-op.  */
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-{
-  /* Per-process CPU limit, in seconds.  */
-  RLIMIT_CPU = 0,
-#define RLIMIT_CPU RLIMIT_CPU
-
-  /* Largest file that can be created, in bytes.  */
-  RLIMIT_FSIZE = 1,
-#define	RLIMIT_FSIZE RLIMIT_FSIZE
-
-  /* Maximum size of data segment, in bytes.  */
-  RLIMIT_DATA = 2,
-#define	RLIMIT_DATA RLIMIT_DATA
-
-  /* Maximum size of stack segment, in bytes.  */
-  RLIMIT_STACK = 3,
-#define	RLIMIT_STACK RLIMIT_STACK
-
-  /* Largest core file that can be created, in bytes.  */
-  RLIMIT_CORE = 4,
-#define	RLIMIT_CORE RLIMIT_CORE
-
-  /* Largest resident set size, in bytes.
-     This affects swapping; processes that are exceeding their
-     resident set size will be more likely to have physical memory
-     taken from them.  */
-  __RLIMIT_RSS = 7,
-#define	RLIMIT_RSS __RLIMIT_RSS
-
-  /* Number of open files.  */
-  RLIMIT_NOFILE = 5,
-  __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
-#define RLIMIT_NOFILE RLIMIT_NOFILE
-#define RLIMIT_OFILE __RLIMIT_OFILE
-
-  /* Address space limit (?) */
-  RLIMIT_AS = 6,
-#define RLIMIT_AS RLIMIT_AS
-
-  /* Number of processes.  */
-  __RLIMIT_NPROC = 8,
-#define RLIMIT_NPROC __RLIMIT_NPROC
-
-  /* Locked-in-memory address space.  */
-  __RLIMIT_MEMLOCK = 9,
-#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK
-
-  /* Maximum number of file locks.  */
-  __RLIMIT_LOCKS = 10,
-#define RLIMIT_LOCKS __RLIMIT_LOCKS
-
-  /* Maximum number of pending signals.  */
-  __RLIMIT_SIGPENDING = 11,
-#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING
-
-  /* Maximum bytes in POSIX message queues.  */
-  __RLIMIT_MSGQUEUE = 12,
-#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
-
-  __RLIMIT_NLIMITS = 13,
-  __RLIM_NLIMITS = __RLIMIT_NLIMITS
-#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
-#define RLIM_NLIMITS __RLIM_NLIMITS
-};
-
-/* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-/* We can represent all limits.  */
-#define RLIM_SAVED_MAX	RLIM_INFINITY
-#define RLIM_SAVED_CUR	RLIM_INFINITY
-
-
-/* Type for resource quantity measurement.  */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-#endif
-
-struct rlimit
-  {
-    /* The current (soft) limit.  */
-    rlim_t rlim_cur;
-    /* The hard limit.  */
-    rlim_t rlim_max;
-  };
-
-#ifdef __USE_LARGEFILE64
-struct rlimit64
-  {
-    /* The current (soft) limit.  */
-    rlim64_t rlim_cur;
-    /* The hard limit.  */
-    rlim64_t rlim_max;
- };
-#endif
-
-/* Whose usage statistics do you want?  */
-enum __rusage_who
-{
-  /* The calling process.  */
-  RUSAGE_SELF = 0,
-#define RUSAGE_SELF RUSAGE_SELF
-
-  /* All of its terminated child processes.  */
-  RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-};
-
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
-
-/* Structure which says how much of each resource has been used.  */
-struct rusage
-  {
-    /* Total amount of user time used.  */
-    struct timeval ru_utime;
-    /* Total amount of system time used.  */
-    struct timeval ru_stime;
-    /* Maximum resident set size (in kilobytes).  */
-    long int ru_maxrss;
-    /* Amount of sharing of text segment memory
-       with other processes (kilobyte-seconds).  */
-    long int ru_ixrss;
-    /* Amount of data segment memory used (kilobyte-seconds).  */
-    long int ru_idrss;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
-#define PRIO_MAX	20	/* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-{
-  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
-#define PRIO_PROCESS PRIO_PROCESS
-  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
-#define PRIO_PGRP PRIO_PGRP
-  PRIO_USER = 2			/* WHO is a user ID.  */
-#define PRIO_USER PRIO_USER
-};
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sem.h b/sysdeps/unix/sysv/linux/mips/bits/sem.h
deleted file mode 100644
index 6282de9cc8..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sem.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 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 _SYS_SEM_H
-# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
-#endif
-
-#include <sys/types.h>
-
-/* Flags for `semop'.  */
-#define SEM_UNDO	0x1000		/* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID		11		/* get sempid */
-#define GETVAL		12		/* get semval */
-#define GETALL		13		/* get all semval's */
-#define GETNCNT		14		/* get semncnt */
-#define GETZCNT		15		/* get semzcnt */
-#define SETVAL		16		/* set semval */
-#define SETALL		17		/* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-  __time_t sem_otime;			/* last semop() time */
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned long int sem_nsems;		/* number of semaphores in set */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-/* The user should define a union like the following to use it for arguments
-   for `semctl'.
-
-   union semun
-   {
-     int val;				<= value for SETVAL
-     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
-     unsigned short int *array;		<= array for GETALL & SETALL
-     struct seminfo *__buf;		<= buffer for IPC_INFO
-   };
-
-   Previous versions of this file used to define this union but this is
-   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
-   one must define the union or not.  */
-#define _SEM_SEMUN_UNDEFINED	1
-
-#ifdef __USE_MISC
-
-/* ipcs ctl cmds */
-# define SEM_STAT 18
-# define SEM_INFO 19
-
-struct  seminfo
-{
-  int semmap;
-  int semmni;
-  int semmns;
-  int semmnu;
-  int semmsl;
-  int semopm;
-  int semume;
-  int semusz;
-  int semvmx;
-  int semaem;
-};
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/shm.h b/sysdeps/unix/sysv/linux/mips/bits/shm.h
deleted file mode 100644
index b3083346dd..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/shm.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (C) 1995,1996,1997,2000,2001,2002,2003 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 _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Permission flag for shmget.  */
-#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
-#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
-
-/* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
-
-/* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
-
-/* Segment low boundary address multiple.  */
-#define SHMLBA		0x40000
-
-
-/* Type to count number of attaches.  */
-typedef unsigned long int shmatt_t;
-
-/* Data structure describing a set of semaphores.  */
-struct shmid_ds
-  {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-    size_t shm_segsz;			/* size of segment in bytes */
-    __time_t shm_atime;			/* time of last shmat() */
-    __time_t shm_dtime;			/* time of last shmdt() */
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-    __pid_t shm_cpid;			/* pid of creator */
-    __pid_t shm_lpid;			/* pid of last shmop */
-    shmatt_t shm_nattch;		/* number of current attaches */
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-  };
-
-#ifdef __USE_MISC
-
-/* ipcs ctl commands */
-# define SHM_STAT	13
-# define SHM_INFO	14
-
-/* shm_mode upper byte flags */
-# define SHM_DEST	01000	/* segment will be destroyed on last detach */
-# define SHM_LOCKED	02000   /* segment will not be swapped */
-# define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
-
-struct shminfo
-  {
-    unsigned long int shmmax;
-    unsigned long int shmmin;
-    unsigned long int shmmni;
-    unsigned long int shmseg;
-    unsigned long int shmall;
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-    unsigned long int __unused3;
-    unsigned long int __unused4;
-  };
-
-struct shm_info
-  {
-    int used_ids;
-    unsigned long int shm_tot;  /* total allocated shm */
-    unsigned long int shm_rss;  /* total resident shm */
-    unsigned long int shm_swp;  /* total swapped shm */
-    unsigned long int swap_attempts;
-    unsigned long int swap_successes;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
deleted file mode 100644
index d04e25f76f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* The proper definitions for Linux/MIPS's sigaction.
-   Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2003
-	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 _SIGNAL_H
-# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
-#endif
-
-/* Structure describing the action to be taken when a signal arrives.  */
-struct sigaction
-  {
-    /* Special flags.  */
-    unsigned int sa_flags;
-
-    /* Signal handler.  */
-#ifdef __USE_POSIX199309
-    union
-      {
-	/* Used if SA_SIGINFO is not set.  */
-	__sighandler_t sa_handler;
-	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) (int, siginfo_t *, void *);
-      }
-    __sigaction_handler;
-# define sa_handler    __sigaction_handler.sa_handler
-# define sa_sigaction  __sigaction_handler.sa_sigaction
-#else
-    __sighandler_t sa_handler;
-#endif
-    /* Additional set of signals to be blocked.  */
-    __sigset_t sa_mask;
-
-    /* The ABI says here are two unused ints following. */
-    /* Restore handler.  */
-    void (*sa_restorer) (void);
-
-#if _MIPS_SZPTR < 64
-    int sa_resv[1];
-#endif
-  };
-
-/* Bits in `sa_flags'.  */
-/* Please note that some Linux kernels versions use different values for these
-   flags which is a bug in those kernel versions.  */
-#define SA_NOCLDSTOP  0x00000001 /* Don't send SIGCHLD when children stop.  */
-#define SA_NOCLDWAIT  0x00010000 /* Don't create zombie on child death.  */
-#define SA_SIGINFO    0x00000008 /* Invoke signal-catching function with
-				    three arguments instead of one.  */
-#if defined __USE_UNIX98 || defined __USE_MISC
-# define SA_ONSTACK   0x08000000 /* Use signal stack by using `sa_restorer'. */
-# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler.  */
-# define SA_RESTART   0x10000000 /* Restart syscall on signal return.  */
-# define SA_NODEFER   0x40000000 /* Don't automatically block the signal when
-				    its handler is being executed.  */
-#endif
-#ifdef __USE_MISC
-# define SA_INTERRUPT 0x20000000 /* Historical no-op.  */
-
-/* Some aliases for the SA_ constants.  */
-# define SA_NOMASK    SA_NODEFER
-# define SA_ONESHOT   SA_RESETHAND
-# define SA_STACK     SA_ONSTACK
-#endif
-
-/* Values for the HOW argument to `sigprocmask'.  */
-#define SIG_NOP	      0		/* 0 is unused to catch errors */
-#define	SIG_BLOCK     1		/* Block signals.  */
-#define	SIG_UNBLOCK   2		/* Unblock signals.  */
-#define	SIG_SETMASK   3		/* Set the set of blocked signals.  */
-#ifdef __USE_MISC
-# define SIG_SETMASK32 256	/* Goodie from SGI for BSD compatibility:
-				   set only the low 32 bit of the sigset.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h b/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
deleted file mode 100644
index 079964ed46..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-#include <sgidefs.h>
-
-#ifndef sigcontext_struct
-/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
-   we need sigcontext.  */
-# define sigcontext_struct sigcontext
-
-/* # include <asm/sigcontext.h> */
-/* Instead of including the kernel header, that will vary depending on
-   whether the 32- or the 64-bit kernel is installed, we paste the
-   contents here.  In case you're wondering about the different
-   licenses, the fact that the file is pasted, instead of included,
-   doesn't really make any difference for the program that includes
-   this header.  */
-#if _MIPS_SIM == _ABIO32
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 2000 by Ralf Baechle
- */
-#ifndef _ASM_SIGCONTEXT_H
-#define _ASM_SIGCONTEXT_H
-
-/*
- * Keep this struct definition in sync with the sigcontext fragment
- * in arch/mips/tools/offset.c
- */
-struct sigcontext {
-	unsigned int       sc_regmask;		/* Unused */
-	unsigned int       sc_status;
-	unsigned long long sc_pc;
-	unsigned long long sc_regs[32];
-	unsigned long long sc_fpregs[32];
-	unsigned int       sc_ownedfp;		/* Unused */
-	unsigned int       sc_fpc_csr;
-	unsigned int       sc_fpc_eir;		/* Unused */
-	unsigned int       sc_used_math;
-	unsigned int       sc_ssflags;		/* Unused */
-	unsigned long long sc_mdhi;
-	unsigned long long sc_mdlo;
-
-	unsigned int       sc_cause;		/* Unused */
-	unsigned int       sc_badvaddr;		/* Unused */
-
-	unsigned long      sc_sigset[4];	/* kernel's sigset_t */
-};
-
-#endif /* _ASM_SIGCONTEXT_H */
-#else /* _MIPS_SIM != _ABIO32 */
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
- * Copyright (C) 1999 Silicon Graphics, Inc.
- */
-#ifndef _ASM_SIGCONTEXT_H
-#define _ASM_SIGCONTEXT_H
-
-/*
- * Keep this struct definition in sync with the sigcontext fragment
- * in arch/mips/tools/offset.c
- */
-struct sigcontext {
-	unsigned long long sc_regs[32];
-	unsigned long long sc_fpregs[32];
-	unsigned long long sc_mdhi;
-	unsigned long long sc_mdlo;
-	unsigned long long sc_pc;
-	unsigned int       sc_status;
-	unsigned int       sc_fpc_csr;
-	unsigned int       sc_fpc_eir;
-	unsigned int       sc_used_math;
-	unsigned int       sc_cause;
-	unsigned int       sc_badvaddr;
-};
-
-#endif /* _ASM_SIGCONTEXT_H */
-#endif /* _MIPS_SIM != _ABIO32 */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h b/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
deleted file mode 100644
index 54eba41d6e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* siginfo_t, sigevent and constants.  Linux/MIPS version.
-   Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined __need_siginfo_t \
-    && !defined __need_sigevent_t
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-#include <bits/wordsize.h>
-
-#if (!defined __have_sigval_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t \
-	 || defined __need_sigevent_t))
-# define __have_sigval_t	1
-
-/* Type for data associated with a signal.  */
-typedef union sigval
-  {
-    int sival_int;
-    void *sival_ptr;
-  } sigval_t;
-#endif
-
-#if (!defined __have_siginfo_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t))
-# define __have_siginfo_t	1
-
-# define __SI_MAX_SIZE		128
-# if __WORDSIZE == 64
-#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 4)
-# else
-#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 3)
-# endif
-
-
-typedef struct siginfo
-  {
-    int si_signo;		/* Signal number.  */
-    int si_code;		/* Signal code.  */
-    int si_errno;		/* If non-zero, an errno value associated with
-				   this signal, as defined in <errno.h>.  */
-    int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3];
-				/* Explicit padding.  */
-
-    union
-      {
-	int _pad[__SI_PAD_SIZE];
-
-	 /* kill().  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Sending process ID.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	  } _kill;
-
-	/* SIGCHLD.  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Which child.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	    int si_status;	/* Exit value or signal.  */
-	    __clock_t si_utime;
-	    __clock_t si_stime;
-	  } _sigchld;
-
-	/* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
-	struct
-	  {
-	    void *si_addr;	/* Faulting insn/memory ref.  */
-	  } _sigfault;
-
-	/* SIGPOLL.  */
-	struct
-	  {
-	    int si_band;	/* Band event for SIGPOLL.  */
-	    int si_fd;
-	  } _sigpoll;
-
-	/* POSIX.1b timers.  */
-	struct
-	  {
-	    unsigned int _timer1;
-	    unsigned int _timer2;
-	  } _timer;
-
-	/* POSIX.1b signals.  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Sending process ID.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	    sigval_t si_sigval;	/* Signal value.  */
-	  } _rt;
-      } _sifields;
-  } siginfo_t;
-
-
-/* X/Open requires some more fields with fixed names.  */
-# define si_pid		_sifields._kill.si_pid
-# define si_uid		_sifields._kill.si_uid
-# define si_status	_sifields._sigchld.si_status
-# define si_utime	_sifields._sigchld.si_utime
-# define si_stime	_sifields._sigchld.si_stime
-# define si_value	_sifields._rt.si_sigval
-# define si_int		_sifields._rt.si_sigval.sival_int
-# define si_ptr		_sifields._rt.si_sigval.sival_ptr
-# define si_addr	_sifields._sigfault.si_addr
-# define si_band	_sifields._sigpoll.si_band
-# define si_fd		_sifields._sigpoll.si_fd
-
-
-/* Values for `si_code'.  Positive values are reserved for kernel-generated
-   signals.  */
-enum
-{
-  SI_ASYNCNL = -60,		/* Sent by asynch name lookup completion.  */
-# define SI_ASYNCNL	SI_ASYNCNL
-  SI_TKILL = -6,		/* Sent by tkill.  */
-# define SI_TKILL	SI_TKILL
-  SI_SIGIO,			/* Sent by queued SIGIO.  */
-# define SI_SIGIO	SI_SIGIO
-  SI_MESGQ,			/* Sent by real time mesq state change.  */
-# define SI_MESGQ	SI_MESGQ
-  SI_TIMER,			/* Sent by real time mesq state change.  */
-# define SI_TIMER	SI_TIMER
-  SI_ASYNCIO,			/* Sent by AIO completion.  */
-# define SI_ASYNCIO	SI_ASYNCIO
-  SI_QUEUE,			/* Sent by sigqueue.  */
-# define SI_QUEUE	SI_QUEUE
-  SI_USER,			/* Sent by kill, sigsend, raise.  */
-# define SI_USER	SI_USER
-  SI_KERNEL = 0x80		/* Send by kernel.  */
-#define SI_KERNEL	SI_KERNEL
-};
-
-
-/* `si_code' values for SIGILL signal.  */
-enum
-{
-  ILL_ILLOPC = 1,		/* Illegal opcode.  */
-# define ILL_ILLOPC	ILL_ILLOPC
-  ILL_ILLOPN,			/* Illegal operand.  */
-# define ILL_ILLOPN	ILL_ILLOPN
-  ILL_ILLADR,			/* Illegal addressing mode.  */
-# define ILL_ILLADR	ILL_ILLADR
-  ILL_ILLTRP,			/* Illegal trap.  */
-# define ILL_ILLTRP	ILL_ILLTRP
-  ILL_PRVOPC,			/* Privileged opcode.  */
-# define ILL_PRVOPC	ILL_PRVOPC
-  ILL_PRVREG,			/* Privileged register.  */
-# define ILL_PRVREG	ILL_PRVREG
-  ILL_COPROC,			/* Coprocessor error.  */
-# define ILL_COPROC	ILL_COPROC
-  ILL_BADSTK			/* Internal stack error.  */
-# define ILL_BADSTK	ILL_BADSTK
-};
-
-/* `si_code' values for SIGFPE signal.  */
-enum
-{
-  FPE_INTDIV = 1,		/* Integer divide by zero.  */
-# define FPE_INTDIV	FPE_INTDIV
-  FPE_INTOVF,			/* Integer overflow.  */
-# define FPE_INTOVF	FPE_INTOVF
-  FPE_FLTDIV,			/* Floating point divide by zero.  */
-# define FPE_FLTDIV	FPE_FLTDIV
-  FPE_FLTOVF,			/* Floating point overflow.  */
-# define FPE_FLTOVF	FPE_FLTOVF
-  FPE_FLTUND,			/* Floating point underflow.  */
-# define FPE_FLTUND	FPE_FLTUND
-  FPE_FLTRES,			/* Floating point inexact result.  */
-# define FPE_FLTRES	FPE_FLTRES
-  FPE_FLTINV,			/* Floating point invalid operation.  */
-# define FPE_FLTINV	FPE_FLTINV
-  FPE_FLTSUB			/* Subscript out of range.  */
-# define FPE_FLTSUB	FPE_FLTSUB
-};
-
-/* `si_code' values for SIGSEGV signal.  */
-enum
-{
-  SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-# define SEGV_MAPERR	SEGV_MAPERR
-  SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-# define SEGV_ACCERR	SEGV_ACCERR
-};
-
-/* `si_code' values for SIGBUS signal.  */
-enum
-{
-  BUS_ADRALN = 1,		/* Invalid address alignment.  */
-# define BUS_ADRALN	BUS_ADRALN
-  BUS_ADRERR,			/* Non-existant physical address.  */
-# define BUS_ADRERR	BUS_ADRERR
-  BUS_OBJERR			/* Object specific hardware error.  */
-# define BUS_OBJERR	BUS_OBJERR
-};
-
-/* `si_code' values for SIGTRAP signal.  */
-enum
-{
-  TRAP_BRKPT = 1,		/* Process breakpoint.  */
-# define TRAP_BRKPT	TRAP_BRKPT
-  TRAP_TRACE			/* Process trace trap.  */
-# define TRAP_TRACE	TRAP_TRACE
-};
-
-/* `si_code' values for SIGCHLD signal.  */
-enum
-{
-  CLD_EXITED = 1,		/* Child has exited.  */
-# define CLD_EXITED	CLD_EXITED
-  CLD_KILLED,			/* Child was killed.  */
-# define CLD_KILLED	CLD_KILLED
-  CLD_DUMPED,			/* Child terminated abnormally.  */
-# define CLD_DUMPED	CLD_DUMPED
-  CLD_TRAPPED,			/* Traced child has trapped.  */
-# define CLD_TRAPPED	CLD_TRAPPED
-  CLD_STOPPED,			/* Child has stopped.  */
-# define CLD_STOPPED	CLD_STOPPED
-  CLD_CONTINUED			/* Stopped child has continued.  */
-# define CLD_CONTINUED	CLD_CONTINUED
-};
-
-/* `si_code' values for SIGPOLL signal.  */
-enum
-{
-  POLL_IN = 1,			/* Data input available.  */
-# define POLL_IN	POLL_IN
-  POLL_OUT,			/* Output buffers available.  */
-# define POLL_OUT	POLL_OUT
-  POLL_MSG,			/* Input message available.   */
-# define POLL_MSG	POLL_MSG
-  POLL_ERR,			/* I/O error.  */
-# define POLL_ERR	POLL_ERR
-  POLL_PRI,			/* High priority input available.  */
-# define POLL_PRI	POLL_PRI
-  POLL_HUP			/* Device disconnected.  */
-# define POLL_HUP	POLL_HUP
-};
-
-# undef __need_siginfo_t
-#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
-
-
-#if (defined _SIGNAL_H || defined __need_sigevent_t) \
-    && !defined __have_sigevent_t
-# define __have_sigevent_t	1
-
-/* Structure to transport application-defined values with signals.  */
-# define __SIGEV_MAX_SIZE	64
-# define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
-
-/* Forward declaration of the `pthread_attr_t' type.  */
-struct __pthread_attr_s;
-
-/* XXX This one might need to change!!!  */
-typedef struct sigevent
-  {
-    sigval_t sigev_value;
-    int sigev_signo;
-    int sigev_notify;
-
-    union
-      {
-	int _pad[__SIGEV_PAD_SIZE];
-
-	struct
-	  {
-	    void (*_function) (sigval_t);	/* Function to start.  */
-	    void *_attribute;			/* Really pthread_attr_t.  */
-	  } _sigev_thread;
-      } _sigev_un;
-  } sigevent_t;
-
-/* POSIX names to access some of the members.  */
-# define sigev_notify_function   _sigev_un._sigev_thread._function
-# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
-
-/* `sigev_notify' values.  */
-enum
-{
-  SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-# define SIGEV_SIGNAL	SIGEV_SIGNAL
-  SIGEV_NONE,			/* Other notification: meaningless.  */
-# define SIGEV_NONE	SIGEV_NONE
-  SIGEV_CALLBACK,		/* Deliver via thread creation.  */
-# define SIGEV_CALLBACK	SIGEV_CALLBACK
-  SIGEV_THREAD			/* Deliver via thread creation.  */
-# define SIGEV_THREAD	SIGEV_THREAD
-};
-
-#endif	/* have _SIGNAL_H.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
deleted file mode 100644
index a9b6848346..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/signum.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Signal number definitions.  Linux version.
-   Copyright (C) 1995, 1997, 1998 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.  */
-
-#ifdef	_SIGNAL_H
-
-/* Fake signal functions.  */
-#define SIG_ERR ((__sighandler_t) -1)		/* Error return.  */
-#define SIG_DFL ((__sighandler_t) 0)		/* Default action.  */
-#define SIG_IGN ((__sighandler_t) 1)		/* Ignore signal.  */
-
-#ifdef __USE_UNIX98
-# define SIG_HOLD	((__sighandler_t) 2)	/* Add signal to hold mask.  */
-#endif
-
-
-#define SIGHUP		 1	/* Hangup (POSIX).  */
-#define SIGINT		 2	/* Interrupt (ANSI).  */
-#define SIGQUIT		 3	/* Quit (POSIX).  */
-#define SIGILL		 4	/* Illegal instruction (ANSI).  */
-#define SIGTRAP		 5	/* Trace trap (POSIX).  */
-#define SIGIOT		 6	/* IOT trap (4.2 BSD).  */
-#define SIGABRT		 SIGIOT	/* Abort (ANSI).  */
-#define SIGEMT		 7
-#define SIGFPE		 8	/* Floating-point exception (ANSI).  */
-#define SIGKILL		 9	/* Kill, unblockable (POSIX).  */
-#define SIGBUS		10	/* BUS error (4.2 BSD).  */
-#define SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define SIGSYS		12
-#define SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define SIGALRM		14	/* Alarm clock (POSIX).  */
-#define SIGTERM		15	/* Termination (ANSI).  */
-#define SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
-#define SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
-#define SIGCHLD		18	/* Child status has changed (POSIX).  */
-#define SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define SIGPWR		19	/* Power failure restart (System V).  */
-#define SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
-#define SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
-#define SIGIO		22	/* I/O now possible (4.2 BSD).  */
-#define SIGPOLL		SIGIO	/* Pollable event occurred (System V).  */
-#define SIGSTOP		23	/* Stop, unblockable (POSIX).  */
-#define SIGTSTP		24	/* Keyboard stop (POSIX).  */
-#define SIGCONT		25	/* Continue (POSIX).  */
-#define SIGTTIN		26	/* Background read from tty (POSIX).  */
-#define SIGTTOU		27	/* Background write to tty (POSIX).  */
-#define SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
-#define SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
-#define SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
-#define SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
-
-
-#define _NSIG		128	/* Biggest signal number + 1
-				   (including real-time signals).  */
-
-#define SIGRTMIN	(__libc_current_sigrtmin ())
-#define SIGRTMAX	(__libc_current_sigrtmax ())
-
-/* These are the hard limits of the kernel.  These values should not be
-   used directly at user level.  */
-#define __SIGRTMIN	32
-#define __SIGRTMAX	(_NSIG - 1)
-
-#endif	/* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h b/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
deleted file mode 100644
index d2c8552209..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* sigstack, sigaltstack definitions.
-   Copyright (C) 1998, 1999, 2000 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 _SIGNAL_H
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-
-/* Structure describing a signal stack (obsolete).  */
-struct sigstack
-  {
-    void *ss_sp;		/* Signal stack pointer.  */
-    int ss_onstack;		/* Nonzero if executing on this stack.  */
-  };
-
-
-/* Possible values for `ss_flags.'.  */
-enum
-{
-  SS_ONSTACK = 1,
-#define SS_ONSTACK	SS_ONSTACK
-  SS_DISABLE
-#define SS_DISABLE	SS_DISABLE
-};
-
-/* Minimum stack size for a signal handler.  */
-#define MINSIGSTKSZ	2048
-
-/* System default stack size.  */
-#define SIGSTKSZ	8192
-
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    size_t ss_size;
-    int ss_flags;
-  } stack_t;
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
deleted file mode 100644
index 1dd82eb866..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* System-specific socket constants and types.  Linux/MIPS version.
-   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 __BITS_SOCKET_H
-#define __BITS_SOCKET_H
-
-#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
-# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
-#endif
-
-#define	__need_size_t
-#define __need_NULL
-#include <stddef.h>
-
-#include <limits.h>
-#include <sys/types.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
-
-/* Types of sockets.  */
-enum __socket_type
-{
-  SOCK_DGRAM = 1,		/* Connectionless, unreliable datagrams
-				   of fixed maximum length.  */
-#define SOCK_DGRAM SOCK_DGRAM
-  SOCK_STREAM = 2,		/* Sequenced, reliable, connection-based
-				   byte streams.  */
-#define SOCK_STREAM SOCK_STREAM
-  SOCK_RAW = 3,			/* Raw protocol interface.  */
-#define SOCK_RAW SOCK_RAW
-  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
-#define SOCK_RDM SOCK_RDM
-  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
-				   datagrams of fixed maximum length.  */
-#define SOCK_SEQPACKET SOCK_SEQPACKET
-  SOCK_PACKET = 10		/* Linux specific way of getting packets
-				   at the dev level.  For writing rarp and
-				   other similar things on the user level. */
-#define SOCK_PACKET SOCK_PACKET
-};
-
-/* Protocol families.  */
-#define	PF_UNSPEC	0	/* Unspecified.  */
-#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
-#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
-#define	PF_FILE		PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
-#define	PF_INET		2	/* IP protocol family.  */
-#define	PF_AX25		3	/* Amateur Radio AX.25.  */
-#define	PF_IPX		4	/* Novell Internet Protocol.  */
-#define	PF_APPLETALK	5	/* Appletalk DDP.  */
-#define	PF_NETROM	6	/* Amateur radio NetROM.  */
-#define	PF_BRIDGE	7	/* Multiprotocol bridge.  */
-#define	PF_ATMPVC	8	/* ATM PVCs.  */
-#define	PF_X25		9	/* Reserved for X.25 project.  */
-#define	PF_INET6	10	/* IP version 6.  */
-#define	PF_ROSE		11	/* Amateur Radio X.25 PLP.  */
-#define	PF_DECnet	12	/* Reserved for DECnet project.  */
-#define	PF_NETBEUI	13	/* Reserved for 802.2LLC project.  */
-#define	PF_SECURITY	14	/* Security callback pseudo AF.  */
-#define	PF_KEY		15	/* PF_KEY key management API.  */
-#define	PF_NETLINK	16
-#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD.  */
-#define	PF_PACKET	17	/* Packet family.  */
-#define	PF_ASH		18	/* Ash.  */
-#define	PF_ECONET	19	/* Acorn Econet.  */
-#define	PF_ATMSVC	20	/* ATM SVCs.  */
-#define	PF_SNA		22	/* Linux SNA Project */
-#define	PF_IRDA		23	/* IRDA sockets.  */
-#define	PF_PPPOX	24	/* PPPoX sockets.  */
-#define	PF_WANPIPE	25	/* Wanpipe API sockets.  */
-#define	PF_BLUETOOTH	31	/* Bluetooth sockets.  */
-#define	PF_MAX		32	/* For now..  */
-
-/* Address families.  */
-#define	AF_UNSPEC	PF_UNSPEC
-#define	AF_LOCAL	PF_LOCAL
-#define	AF_UNIX		PF_UNIX
-#define	AF_FILE		PF_FILE
-#define	AF_INET		PF_INET
-#define	AF_AX25		PF_AX25
-#define	AF_IPX		PF_IPX
-#define	AF_APPLETALK	PF_APPLETALK
-#define	AF_NETROM	PF_NETROM
-#define	AF_BRIDGE	PF_BRIDGE
-#define	AF_ATMPVC	PF_ATMPVC
-#define	AF_X25		PF_X25
-#define	AF_INET6	PF_INET6
-#define	AF_ROSE		PF_ROSE
-#define	AF_DECnet	PF_DECnet
-#define	AF_NETBEUI	PF_NETBEUI
-#define	AF_SECURITY	PF_SECURITY
-#define	AF_KEY		PF_KEY
-#define	AF_NETLINK	PF_NETLINK
-#define	AF_ROUTE	PF_ROUTE
-#define	AF_PACKET	PF_PACKET
-#define	AF_ASH		PF_ASH
-#define	AF_ECONET	PF_ECONET
-#define	AF_ATMSVC	PF_ATMSVC
-#define	AF_SNA		PF_SNA
-#define	AF_IRDA		PF_IRDA
-#define	AF_PPPOX	PF_PPPOX
-#define	AF_WANPIPE	PF_WANPIPE
-#define	AF_BLUETOOTH	PF_BLUETOOTH
-#define	AF_MAX		PF_MAX
-
-/* Socket level values.  Others are defined in the appropriate headers.
-
-   XXX These definitions also should go into the appropriate headers as
-   far as they are available.  */
-#define SOL_RAW		255
-#define SOL_DECNET      261
-#define SOL_X25         262
-#define SOL_PACKET	263
-#define SOL_ATM		264	/* ATM layer (cell level).  */
-#define SOL_AAL		265	/* ATM Adaption Layer (packet level).  */
-#define SOL_IRDA	266
-
-/* Maximum queue length specifiable by listen.  */
-#define SOMAXCONN	128
-
-/* Get the definition of the macro to define the common sockaddr members.  */
-#include <bits/sockaddr.h>
-
-/* Structure describing a generic socket address.  */
-struct sockaddr
-  {
-    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
-    char sa_data[14];		/* Address data.  */
-  };
-
-
-/* Structure large enough to hold any socket address (with the historical
-   exception of AF_UNIX).  We reserve 128 bytes.  */
-#if ULONG_MAX > 0xffffffff
-# define __ss_aligntype	__uint64_t
-#else
-# define __ss_aligntype	__uint32_t
-#endif
-#define _SS_SIZE	128
-#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
-
-struct sockaddr_storage
-  {
-    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
-    __ss_aligntype __ss_align;	/* Force desired alignment.  */
-    char __ss_padding[_SS_PADSIZE];
-  };
-
-
-/* Bits in the FLAGS argument to `send', `recv', et al.  */
-enum
-  {
-    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
-#define MSG_OOB		MSG_OOB
-    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
-#define MSG_PEEK	MSG_PEEK
-    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
-#define MSG_DONTROUTE	MSG_DONTROUTE
-#ifdef __USE_GNU
-    /* DECnet uses a different name.  */
-    MSG_TRYHARD		= MSG_DONTROUTE,
-# define MSG_TRYHARD	MSG_DONTROUTE
-#endif
-    MSG_CTRUNC		= 0x08,	/* Control data lost before delivery.  */
-#define MSG_CTRUNC	MSG_CTRUNC
-    MSG_PROXY		= 0x10,	/* Supply or ask second address.  */
-#define MSG_PROXY	MSG_PROXY
-    MSG_TRUNC		= 0x20,
-#define	MSG_TRUNC	MSG_TRUNC
-    MSG_DONTWAIT	= 0x40, /* Nonblocking IO.  */
-#define	MSG_DONTWAIT	MSG_DONTWAIT
-    MSG_EOR		= 0x80, /* End of record.  */
-#define	MSG_EOR		MSG_EOR
-    MSG_WAITALL		= 0x100, /* Wait for a full request.  */
-#define	MSG_WAITALL	MSG_WAITALL
-    MSG_FIN		= 0x200,
-#define	MSG_FIN		MSG_FIN
-    MSG_SYN		= 0x400,
-#define	MSG_SYN		MSG_SYN
-    MSG_CONFIRM		= 0x800, /* Confirm path validity.  */
-#define	MSG_CONFIRM	MSG_CONFIRM
-    MSG_RST		= 0x1000,
-#define	MSG_RST		MSG_RST
-    MSG_ERRQUEUE	= 0x2000, /* Fetch message from error queue.  */
-#define	MSG_ERRQUEUE	MSG_ERRQUEUE
-    MSG_NOSIGNAL	= 0x4000, /* Do not generate SIGPIPE.  */
-#define	MSG_NOSIGNAL	MSG_NOSIGNAL
-    MSG_MORE		= 0x8000  /* Sender will send more.  */
-#define	MSG_MORE	MSG_MORE
-  };
-
-
-/* Structure describing messages sent by
-   `sendmsg' and received by `recvmsg'.  */
-struct msghdr
-  {
-    void *msg_name;		/* Address to send to/receive from.  */
-    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.  */
-
-    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
-
-    int msg_flags;		/* Flags on received message.  */
-  };
-
-/* Structure used for storage of ancillary data object information.  */
-struct cmsghdr
-  {
-    size_t cmsg_len;		/* Length of data in cmsg_data plus length
-				   of cmsghdr structure.  */
-    int cmsg_level;		/* Originating protocol.  */
-    int cmsg_type;		/* Protocol specific type.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
-    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
-#endif
-  };
-
-/* Ancillary data object manipulation macros.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
-# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
-#else
-# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
-#endif
-#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
-#define CMSG_FIRSTHDR(mhdr) \
-  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
-   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
-#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
-			 & (size_t) ~(sizeof (size_t) - 1))
-#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
-			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
-#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
-
-extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
-				      struct cmsghdr *__cmsg) __THROW;
-#ifdef __USE_EXTERN_INLINES
-# ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
-# endif
-_EXTERN_INLINE struct cmsghdr *
-__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
-{
-  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
-    /* The kernel header does this so there may be a reason.  */
-    return 0;
-
-  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
-			       + CMSG_ALIGN (__cmsg->cmsg_len));
-  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
-					 + __mhdr->msg_controllen)
-      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
-	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
-    /* No more entries.  */
-    return 0;
-  return __cmsg;
-}
-#endif	/* Use `extern inline'.  */
-
-/* Socket level message types.  This must match the definitions in
-   <linux/socket.h>.  */
-enum
-  {
-    SCM_RIGHTS = 0x01,		/* Transfer file descriptors.  */
-#define SCM_RIGHTS SCM_RIGHTS
-#ifdef __USE_BSD
-    SCM_CREDENTIALS = 0x02,     /* Credentials passing.  */
-# define SCM_CREDENTIALS SCM_CREDENTIALS
-#endif
-    __SCM_CONNECT = 0x03	/* Data array is `struct scm_connect'.  */
-  };
-
-/* User visible structure for SCM_CREDENTIALS message */
-
-struct ucred
-{
-  pid_t pid;			/* PID of sending process.  */
-  uid_t uid;			/* UID of sending process.  */
-  gid_t gid;			/* GID of sending process.  */
-};
-
-/* Get socket manipulation related informations from kernel headers.  */
-#include <asm/socket.h>
-
-
-/* Structure used to manipulate the SO_LINGER option.  */
-struct linger
-  {
-    int l_onoff;		/* Nonzero to linger on close.  */
-    int l_linger;		/* Time to linger.  */
-  };
-
-#endif	/* bits/socket.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
deleted file mode 100644
index 9ae38cd8d0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#include <sgidefs.h>
-
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX /* The one defined below.  */
-
-/* Versions of the `xmknod' interface.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
-#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
-
-
-#if _MIPS_SIM == _ABIO32
-/* Structure describing file characteristics.  */
-struct stat
-  {
-    unsigned long int st_dev;
-    long int st_pad1[3];
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;		/* File serial number.		*/
-#else
-    __ino64_t st_ino;		/* File serial number.		*/
-#endif
-    __mode_t st_mode;		/* File mode.  */
-    __nlink_t st_nlink;		/* Link count.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    unsigned long int st_rdev;	/* Device number, if device.  */
-#ifndef __USE_FILE_OFFSET64
-    long int st_pad2[2];
-    __off_t st_size;		/* Size of file, in bytes.  */
-    /* SVR4 added this extra long to allow for expansion of off_t.  */
-    long int st_pad3;
-#else
-    long int st_pad2[3];
-    __off64_t st_size;		/* Size of file, in bytes.  */
-#endif
-    /*
-     * Actually this should be timestruc_t st_atime, st_mtime and
-     * st_ctime but we don't have it under Linux.
-     */
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
-    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-#else
-    long int st_pad4;
-    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-#endif
-    long int st_pad5[14];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    unsigned long int st_dev;
-    long int st_pad1[3];
-    __ino64_t st_ino;		/* File serial number.		*/
-    __mode_t st_mode;		/* File mode.  */
-    __nlink_t st_nlink;		/* Link count.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    unsigned long int st_rdev;	/* Device number, if device.  */
-    long int st_pad2[3];
-    __off64_t st_size;		/* Size of file, in bytes.  */
-    /*
-     * Actually this should be timestruc_t st_atime, st_mtime and
-     * st_ctime but we don't have it under Linux.
-     */
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
-    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
-    long int st_pad3;
-    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-    long int st_pad4[14];
-  };
-#endif
-#else
-struct stat
-  {
-    __dev_t st_dev;
-    int	st_pad1[3];		/* Reserved for st_dev expansion  */
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;
-#else
-    __ino64_t st_ino;
-#endif
-    __mode_t st_mode;
-    __nlink_t st_nlink;
-    __uid_t st_uid;
-    __gid_t st_gid;
-    __dev_t st_rdev;
-#if !defined __USE_FILE_OFFSET64
-    unsigned int st_pad2[2];	/* Reserved for st_rdev expansion  */
-    __off_t st_size;
-    int st_pad3;
-#else
-    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
-    __off64_t st_size;
-#endif
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
-    __blksize_t st_blksize;
-    unsigned int st_pad4;
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;
-#else
-    __blkcnt64_t st_blocks;
-#endif
-    int st_pad5[14];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    __dev_t st_dev;
-    unsigned int st_pad1[3];	/* Reserved for st_dev expansion  */
-    __ino64_t st_ino;
-    __mode_t st_mode;
-    __nlink_t st_nlink;
-    __uid_t st_uid;
-    __gid_t st_gid;
-    __dev_t st_rdev;
-    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
-    __off64_t st_size;
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
-    __blksize_t st_blksize;
-    unsigned int st_pad3;
-    __blkcnt64_t st_blocks;
-    int st_pad4[14];
-};
-#endif
-#endif
-
-/* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
-#define	_STATBUF_ST_RDEV
-
-/* Encoding of the file mode.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.  */
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-#define	__S_IFLNK	0120000	/* Symbolic link.  */
-#define	__S_IFSOCK	0140000	/* Socket.  */
-
-/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
-   they do it by enforcing the correct use of the macros.  */
-#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
deleted file mode 100644
index 2f9bd54edc..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1997, 2000 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 _SYS_STATFS_H
-# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
-#endif
-
-#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
-
-struct statfs
-  {
-    long int f_type;
-#define f_fstyp f_type
-    long int f_bsize;
-    long int f_frsize;	/* Fragment size - unsupported */
-#ifndef __USE_FILE_OFFSET64
-    __fsblkcnt_t f_blocks;
-    __fsblkcnt_t f_bfree;
-    __fsblkcnt_t f_files;
-    __fsblkcnt_t f_ffree;
-    __fsblkcnt_t f_bavail;
-#else
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-    __fsblkcnt64_t f_bavail;
-#endif
-
-	/* Linux specials */
-    __fsid_t f_fsid;
-    long int f_namelen;
-    long int f_spare[6];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct statfs64
-  {
-    long int f_type;
-#define f_fstyp f_type
-    long int f_bsize;
-    long int f_frsize;	/* Fragment size - unsupported */
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-    __fsblkcnt64_t f_bavail;
-
-	/* Linux specials */
-    __fsid_t f_fsid;
-    long int f_namelen;
-    long int f_spare[6];
-  };
-#endif
-
-/* Tell code we have these members.  */
-#define _STATFS_F_NAMELEN
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
deleted file mode 100644
index 4ff6e37ad6..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* termios type and macro definitions.  Linux/MIPS version.
-   Copyright (C) 1993, 94, 95, 96, 97, 99 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 _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char	cc_t;
-typedef unsigned int	speed_t;
-typedef unsigned int	tcflag_t;
-
-#define NCCS 32
-struct termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;		/* line discipline */
-    cc_t c_cc[NCCS];		/* control characters */
-  };
-
-/* c_cc characters */
-#define VINTR		0	/* Interrupt character [ISIG].  */
-#define VQUIT		1	/* Quit character [ISIG].  */
-#define VERASE		2	/* Erase character [ICANON].  */
-#define VKILL		3	/* Kill-line character [ICANON].  */
-#define VMIN		4	/* Minimum number of bytes read at once [!ICANON].  */
-#define VTIME		5	/* Time-out value (tenths of a second) [!ICANON].  */
-#define VEOL2		6	/* Second EOL character [ICANON].  */
-#define VSWTC		7
-#define VSWTCH		VSWTC
-#define VSTART		8	/* Start (X-ON) character [IXON, IXOFF].  */
-#define VSTOP		9	/* Stop (X-OFF) character [IXON, IXOFF].  */
-#define VSUSP		10	/* Suspend character [ISIG].  */
-				/* VDSUSP is not supported on Linux. */
-/* #define VDSUSP	11	/ * Delayed suspend character [ISIG].  */
-#define VREPRINT	12	/* Reprint-line character [ICANON].  */
-#define VDISCARD	13	/* Discard character [IEXTEN].  */
-#define VWERASE		14	/* Word-erase character [ICANON].  */
-#define VLNEXT		15	/* Literal-next character [IEXTEN].  */
-#define VEOF		16	/* End-of-file character [ICANON].  */
-#define VEOL		17	/* End-of-line character [ICANON].  */
-
-/* c_iflag bits */
-#define IGNBRK	0000001		/* Ignore break condition.  */
-#define BRKINT	0000002		/* Signal interrupt on break.  */
-#define IGNPAR	0000004		/* Ignore characters with parity errors.  */
-#define PARMRK	0000010		/* Mark parity and framing errors.  */
-#define INPCK	0000020		/* Enable input parity check.  */
-#define ISTRIP	0000040		/* Strip 8th bit off characters.  */
-#define INLCR	0000100		/* Map NL to CR on input.  */
-#define IGNCR	0000200		/* Ignore CR.  */
-#define ICRNL	0000400		/* Map CR to NL on input.  */
-#define IUCLC	0001000		/* Map upper case to lower case on input.  */
-#define IXON	0002000		/* Enable start/stop output control.  */
-#define IXANY	0004000		/* Any character will restart after stop.  */
-#define IXOFF	0010000		/* Enable start/stop input control.  */
-#define IMAXBEL 0020000		/* Ring bell when input queue is full.  */
-#define IUTF8	0040000		/* Input is UTF8.  */
-
-/* c_oflag bits */
-#define OPOST	0000001		/* Perform output processing.  */
-#define OLCUC	0000002		/* Map lower case to upper case on output.  */
-#define ONLCR	0000004		/* Map NL to CR-NL on output.  */
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-#define OFILL	0000100
-#define OFDEL	0000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY	0000400
-# define   NL0	0000000
-# define   NL1	0000400
-# define CRDLY	0003000
-# define   CR0	0000000
-# define   CR1	0001000
-# define   CR2	0002000
-# define   CR3	0003000
-# define TABDLY	0014000
-# define   TAB0	0000000
-# define   TAB1	0004000
-# define   TAB2	0010000
-# define   TAB3	0014000
-# define BSDLY	0020000
-# define   BS0	0000000
-# define   BS1	0020000
-# define FFDLY	0100000
-# define   FF0	0000000
-# define   FF1	0100000
-#endif
-
-#define VTDLY	0040000
-#define   VT0	0000000
-#define   VT1	0040000
-
-#ifdef __USE_MISC
-# define XTABS  0014000
-#endif
-
-/* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD	0010017
-#endif
-#define  B0	0000000		/* hang up */
-#define  B50	0000001
-#define  B75	0000002
-#define  B110	0000003
-#define  B134	0000004
-#define  B150	0000005
-#define  B200	0000006
-#define  B300	0000007
-#define  B600	0000010
-#define  B1200	0000011
-#define  B1800	0000012
-#define  B2400	0000013
-#define  B4800	0000014
-#define  B9600	0000015
-#define  B19200	0000016
-#define  B38400	0000017
-#ifdef __USE_MISC
-# define EXTA B19200
-# define EXTB B38400
-#endif
-#define CSIZE	0000060		/* Number of bits per byte (mask).  */
-#define   CS5	0000000		/* 5 bits per byte.  */
-#define   CS6	0000020		/* 6 bits per byte.  */
-#define   CS7	0000040		/* 7 bits per byte.  */
-#define   CS8	0000060		/* 8 bits per byte.  */
-#define CSTOPB	0000100		/* Two stop bits instead of one.  */
-#define CREAD	0000200		/* Enable receiver.  */
-#define PARENB	0000400		/* Parity enable.  */
-#define PARODD	0001000		/* Odd parity instead of even.  */
-#define HUPCL	0002000		/* Hang up on last close.  */
-#define CLOCAL	0004000		/* Ignore modem status lines.  */
-#ifdef __USE_MISC
-# define CBAUDEX   0010000
-#endif
-#define  B57600   0010001
-#define  B115200  0010002
-#define  B230400  0010003
-#define  B460800  0010004
-#define  B500000  0010005
-#define  B576000  0010006
-#define  B921600  0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define __MAX_BAUD B4000000
-#ifdef __USE_MISC
-# define CIBAUD	  002003600000	/* input baud rate (not used) */
-# define CRTSCTS  020000000000		/* flow control */
-#endif
-
-/* c_lflag bits */
-#define ISIG	0000001		/* Enable signals.  */
-#define ICANON	0000002		/* Do erase and kill processing.  */
-#if defined __USE_MISC || defined __USE_XOPEN
-# define XCASE	0000004
-#endif
-#define ECHO	0000010		/* Enable echo.  */
-#define ECHOE	0000020		/* Visual erase for ERASE.  */
-#define ECHOK	0000040		/* Echo NL after KILL.  */
-#define ECHONL	0000100		/* Echo NL even if ECHO is off.  */
-#define NOFLSH	0000200		/* Disable flush after interrupt.  */
-#define IEXTEN	0000400		/* Enable DISCARD and LNEXT.  */
-#ifdef __USE_MISC
-# define ECHOCTL 0001000	/* Echo control characters as ^X.  */
-# define ECHOPRT 0002000	/* Hardcopy visual erase.  */
-# define ECHOKE	 0004000	/* Visual erase for KILL.  */
-# define FLUSHO	0020000
-# define PENDIN	0040000		/* Retype pending input (state).  */
-#endif
-#define TOSTOP	0100000		/* Send SIGTTOU for background output.  */
-#define ITOSTOP	TOSTOP
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-/* tcflow() and TCXONC use these */
-#define	TCOOFF		0	/* Suspend output.  */
-#define	TCOON		1	/* Restart suspended output.  */
-#define	TCIOFF		2	/* Send a STOP character.  */
-#define	TCION		3	/* Send a START character.  */
-
-/* tcflush() and TCFLSH use these */
-#define	TCIFLUSH	0	/* Discard data received but not yet read.  */
-#define	TCOFLUSH	1	/* Discard data written but not yet sent.  */
-#define	TCIOFLUSH	2	/* Discard all pending data.  */
-
-/* tcsetattr uses these */
-#define	TCSANOW		0x540e	/* Same as TCSETS; change immediately.  */
-#define	TCSADRAIN	0x540f	/* Same as TCSETSW; change when pending output is written.  */
-#define	TCSAFLUSH	0x5410	/* Same as TCSETSF; flush pending input before changing.  */
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
deleted file mode 100644
index 4be88a9c5f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* brk system call for Linux/MIPS.
-   Copyright (C) 2000 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 <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  {
-    register long int res __asm__ ("$2");
-
-    asm ("move\t$4,%2\n\t"
-	 "syscall"		/* Perform the system call.  */
-	 : "=r" (res)
-	 : "0" (SYS_ify (brk)), "r" (addr)
-	 : "$4", "$7");
-    newbrk = (void *) res;
-  }
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
deleted file mode 100644
index 043f5921cb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/clone.S
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@linux-mips.org>, 1996.
-
-   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.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sys/asm.h>
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
-
-	.text
-LOCALSZ= 1
-FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
-GPOFF= FRAMESZ-(1*SZREG)
-NESTED(__clone,4*SZREG,sp)
-#ifdef __PIC__
-	SETUP_GP
-#endif
-	PTR_SUBU sp, FRAMESZ
-	SETUP_GP64 (GPOFF, __clone)
-#ifdef __PIC__
-	SAVE_GP (GPOFF)
-#endif
-#ifdef PROF
-	.set		noat
-	move		$1,ra
-	jal		_mcount
-	.set		at
-#endif
-
-
-	/* Sanity check arguments.  */
-	li		v0,EINVAL
-	beqz		a0,L(error)	/* No NULL function pointers.  */
-	beqz		a1,L(error)	/* No NULL stack pointers.  */
-
-	PTR_SUBU	a1,32		/* Reserve argument save space.  */
-	PTR_S		a0,0(a1)	/* Save function pointer.  */
-	PTR_S		a3,PTRSIZE(a1)	/* Save argument pointer.  */
-
-
-	/* Do the system call */
-	move		a0,a2
-	li		v0,__NR_clone
-	syscall
-
-	bnez		a3,L(error)
-	beqz		v0,L(thread_start)
-
-	/* Successful return from the parent */
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	ret
-
-	/* Something bad happened -- no child created */
-L(error):
-#ifdef __PIC__
-	PTR_LA		t9,__syscall_error
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	jr		t9
-#else
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	j		__syscall_error
-#endif
-	END(__clone)
-
-/* Load up the arguments to the function.  Put this block of code in
-   its own function so that we can terminate the stack trace with our
-   debug info.  */
-
-ENTRY(__thread_start)
-L(thread_start):
-	/* cp is already loaded.  */
-	SAVE_GP (GPOFF)
-	/* The stackframe has been created on entry of clone().  */
-	/* Restore the arg for user's function.  */
-	PTR_L		t9,0(sp)	/* Function pointer.  */
-	PTR_L		a0,PTRSIZE(sp)	/* Argument pointer.  */
-
-	/* Call the user's function.  */
-	jal		t9
-
-	/* Call _exit rather than doing it inline for breakpoint purposes.  */
-	move		a0,v0
-#ifdef __PIC__
-	PTR_LA		t9,_exit
-	jalr		t9
-#else
-	jal		_exit
-#endif
-	END(__thread_start)
-
-weak_alias(__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
deleted file mode 100755
index c081795aa1..0000000000
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ /dev/null
@@ -1,76 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
- # Local configure fragment for sysdeps/unix/sysv/linux/mips.
-
-case $machine in
-mips*64*)
-  rm -f asm-unistd.h
-  asm_unistd_h=$sysheaders/asm/unistd.h
-  if test ! -f $asm_unistd_h; then
-    # Try to find asm/unistd.h in compiler header search path.
-    try_asm_unistd_h=`echo '#include <asm/unistd.h>' | $CPP - |
-			sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'`
-    if test -n "$try_asm_unistd_h" &&
-       test -f "$try_asm_unistd_h"; then
-      asm_unistd_h=$try_asm_unistd_h
-    fi
-  fi
-  if test ! -f "$asm_unistd_h"; then
-    { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5
-echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
-    echo '#include <asm/unistd.h>' > asm-unistd.h
-  else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
-    cat "$asm_unistd_h" |
-    sed -e 's,__NR_,__NR_N64_,g' \
-        -e 's,__NR_N64_##,__NR_##,g' \
-	-e 's,__NR_N64_O32_,__NR_O32_,g' \
-	-e 's,__NR_N64_N32_,__NR_N32_,g' \
-	-e 's,__NR_N64_N64_,__NR_N64_,g' \
-    | awk > asm-unistd.h '
-BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
-	print "#define __NR__exit __NR_exit";
-	print "#define __NR_O32__exit __NR_O32_exit";
-	print "#define __NR_N32__exit __NR_N32_exit";
-	print; next;
-}
-/^#define __NR_O32_/ {
-	name = $2;
-	sub (/_O32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIO32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N32_/ {
-	name = $2;
-	sub (/_N32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIN32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N64_/ {
-	name = $2;
-	sub (/_N64_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABI64";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-{
-	print;
-}'
-  fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
-esac
diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in
deleted file mode 100644
index 67d965dfda..0000000000
--- a/sysdeps/unix/sysv/linux/mips/configure.in
+++ /dev/null
@@ -1,76 +0,0 @@
-sinclude(./aclocal.m4)dnl Autoconf lossage
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-# Local configure fragment for sysdeps/unix/sysv/linux/mips.
-
-case $machine in
-mips*64*)
-  rm -f asm-unistd.h
-  asm_unistd_h=$sysheaders/asm/unistd.h
-  if test ! -f $asm_unistd_h; then
-    # Try to find asm/unistd.h in compiler header search path.
-    try_asm_unistd_h=`echo '#include <asm/unistd.h>' | $CPP - |
-			sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'`
-    if test -n "$try_asm_unistd_h" &&
-       test -f "$try_asm_unistd_h"; then
-      asm_unistd_h=$try_asm_unistd_h
-    fi
-  fi
-  if test ! -f "$asm_unistd_h"; then
-    AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
-    echo '#include <asm/unistd.h>' > asm-unistd.h
-  else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
-    cat "$asm_unistd_h" |
-    sed -e 's,__NR_,__NR_N64_,g' \
-        -e 's,__NR_N64_##,__NR_##,g' \
-	-e 's,__NR_N64_O32_,__NR_O32_,g' \
-	-e 's,__NR_N64_N32_,__NR_N32_,g' \
-	-e 's,__NR_N64_N64_,__NR_N64_,g' \
-    | awk > asm-unistd.h '
-BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
-	print "#define __NR__exit __NR_exit";
-	print "#define __NR_O32__exit __NR_O32_exit";
-	print "#define __NR_N32__exit __NR_N32_exit";
-	print; next;
-}
-/^#define __NR_O32_/ {
-	name = $2;
-	sub (/_O32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIO32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N32_/ {
-	name = $2;
-	sub (/_N32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIN32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N64_/ {
-	name = $2;
-	sub (/_N64_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABI64";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-{
-	print;
-}'
-  fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
-esac
diff --git a/sysdeps/unix/sysv/linux/mips/dl-cache.h b/sysdeps/unix/sysv/linux/mips/dl-cache.h
deleted file mode 100644
index 4fa5d3ad22..0000000000
--- a/sysdeps/unix/sysv/linux/mips/dl-cache.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
-   Copyright (C) 2003 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.  */
-
-#define add_system_dir(dir) \
-  do								\
-    {								\
-      size_t len = strlen (dir);				\
-      char path[len + 3];					\
-      memcpy (path, dir, len + 1);				\
-      if (len >= 6						\
-	  && (! memcmp (path + len - 6, "/lib64", 6)		\
-	      || ! memcmp (path + len - 6, "/lib32", 6)))	\
-	{							\
-	  len -= 2;						\
-	  path[len] = '\0';					\
-	}							\
-      add_dir (path);						\
-      if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))	\
-	{							\
-	  memcpy (path + len, "32", 3);				\
-	  add_dir (path);					\
-	  memcpy (path + len, "64", 3);				\
-	  add_dir (path);					\
-	}							\
-    } while (0)
-
-#include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/mips/entry.h b/sysdeps/unix/sysv/linux/mips/entry.h
deleted file mode 100644
index 04d05d2b0a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/entry.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef __ASSEMBLY__
-extern void __start (void);
-#endif
-
-#define ENTRY_POINT __start
diff --git a/sysdeps/unix/sysv/linux/mips/fcntl.c b/sysdeps/unix/sysv/linux/mips/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c
deleted file mode 100644
index cdb2d56840..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   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 <sys/types.h>
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include "kernel-features.h"
-
-#ifdef __NR_ftruncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-__ftruncate64 (int fd, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! __have_no_truncate64)
-#endif
-    {
-      unsigned int low = length & 0xffffffff;
-      unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      int saved_errno = errno;
-#endif
-      int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
-				   __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      if (result != -1 || errno != ENOSYS)
-#endif
-	return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      __set_errno (saved_errno);
-      __have_no_truncate64 = 1;
-#endif
-    }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return __ftruncate (fd, (off_t) length);
-#endif
-}
-weak_alias (__ftruncate64, ftruncate64)
-
-#else
-/* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/getmsg.c b/sysdeps/unix/sysv/linux/mips/getmsg.c
deleted file mode 100644
index 3a1fa08525..0000000000
--- a/sysdeps/unix/sysv/linux/mips/getmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/mips/getsysstats.c b/sysdeps/unix/sysv/linux/mips/getsysstats.c
deleted file mode 100644
index 9b521ac76a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/getsysstats.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Determine various system internal values, Linux/MIPS version.
-   Copyright (C) 2001 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.  */
-
-
-/* We need to define a special parser for /proc/cpuinfo.  */
-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)				  \
-  do									  \
-    {									  \
-      (RESULT) = 0;							  \
-      /* Read all lines and count the lines starting with the string	  \
-	 "cpu model".  We don't have to fear extremely long lines since	  \
-	 the kernel will not generate them.  8192 bytes are really	  \
-	 enough.  */							  \
-      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)	  \
-	if (strncmp (BUFFER, "cpu model", 9) == 0)			  \
-	  ++(RESULT);							  \
-    }									  \
-  while (0)
-
-#include <sysdeps/unix/sysv/linux/getsysstats.c>
diff --git a/sysdeps/unix/sysv/linux/mips/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/ipc_priv.h
deleted file mode 100644
index 9b85386a7c..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ipc_priv.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/alpha/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
deleted file mode 100644
index b6f52cc9c9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This is the sigaction structure from the Linux 2.1.24 kernel.  */
-
-#include <sgidefs.h>
-
-#define HAVE_SA_RESTORER
-
-struct old_kernel_sigaction {
-	unsigned int	sa_flags;
-	__sighandler_t	k_sa_handler;
-	unsigned long	sa_mask;
-	unsigned int    __pad0[3]; /* reserved, keep size constant */
-
-	/* Abi says here follows reserved int[2] */
-	void		(*sa_restorer)(void);
-#if (_MIPS_SZPTR < 64)
-	/*
-	 * For 32 bit code we have to pad struct sigaction to get
-	 * constant size for the ABI
-	 */
-	int		pad1[1]; /* reserved */
-#endif
-};
-
-
-#define _KERNEL_NSIG	       128
-#define _KERNEL_NSIG_BPW       _MIPS_SZLONG
-#define _KERNEL_NSIG_WORDS     (_KERNEL_NSIG / _KERNEL_NSIG_BPW)
-
-typedef struct {
-	unsigned long sig[_KERNEL_NSIG_WORDS];
-} kernel_sigset_t;
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel.  */
-struct kernel_sigaction {
-	unsigned int	sa_flags;
-	__sighandler_t	k_sa_handler;
-	kernel_sigset_t	sa_mask;
-	void		(*sa_restorer)(void);
-	int		s_resv[1]; /* reserved */
-};
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
deleted file mode 100644
index cab1e7110e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <sgidefs.h>
-/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the
-   userland data structures are not identical, because of different
-   padding.  */
-/* Definition of `struct stat' used in the kernel.  */
-#if _MIPS_SIM != _ABIO32
-struct kernel_stat
-  {
-    unsigned int st_dev;
-    unsigned int __pad1[3];
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    int st_uid;
-    int st_gid;
-    unsigned int st_rdev;
-    unsigned int __pad2[3];
-    long long st_size;
-    unsigned int st_atime;
-    unsigned int __unused1;
-    unsigned int st_mtime;
-    unsigned int __unused2;
-    unsigned int st_ctime;
-    unsigned int __unused3;
-    unsigned int st_blksize;
-    unsigned int __pad3;
-    unsigned long long st_blocks;
-  };
-#else
-struct kernel_stat
-  {
-    unsigned long int st_dev;
-    long int __pad1[3];			/* Reserved for network id */
-    unsigned long int st_ino;
-    unsigned long int st_mode;
-    unsigned long int st_nlink;
-    long int st_uid;
-    long int st_gid;
-    unsigned long int st_rdev;
-    long int __pad2[2];
-    long int st_size;
-    long int __pad3;
-    long int st_atime;
-    long int __unused1;
-    long int st_mtime;
-    long int __unused2;
-    long int st_ctime;
-    long int __unused3;
-    long int st_blksize;
-    long int st_blocks;
-    char st_fstype[16];			/* Filesystem type name, unsupported */
-    long st_pad4[8];
-    /* Linux specific fields */
-    unsigned int st_flags;
-    unsigned int st_gen;
-  };
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
deleted file mode 100644
index 9b622f4d1f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997 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 _KERNEL_TERMIOS_H
-#define _KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.1.24 kernel.  */
-
-#define __KERNEL_NCCS 23
-
-struct __kernel_termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;		/* line discipline */
-    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
-  };
-
-#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/lockf64.c b/sysdeps/unix/sysv/linux/mips/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
deleted file mode 100644
index b0316b657b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003 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 _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_O32_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_O32_/**/syscall_name
-#endif
-
-#endif /* linux/mips/mips32/kern64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
deleted file mode 100644
index 5eaf7a276b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_MIPS32_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5) 						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"lw\t$8, %7\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"sw\t$8, 20($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5), "m" ((long)arg6)				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall7(name, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"lw\t$8, %7\n\t" 						\
-	"lw\t$9, %8\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"sw\t$8, 20($29)\n\t" 						\
-	"sw\t$9, 24($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5), "m" ((long)arg6), "m" ((long)arg7)		\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/mips32/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/Dist b/sysdeps/unix/sysv/linux/mips/mips64/Dist
deleted file mode 100644
index b8fa28f0a4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/Dist
+++ /dev/null
@@ -1 +0,0 @@
-ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
deleted file mode 100644
index d490fb95e2..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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 <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
deleted file mode 100644
index 2c327327e0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
+++ /dev/null
@@ -1 +0,0 @@
-s_^\(RTLDLIST=\)\(.*lib\)\(\|32\|64\)\(/[^/]*\.so\.[0-9.]*\)[ 	]*$_\1"\232\4 \264\4 \2\4"_
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/llseek.c b/sysdeps/unix/sysv/linux/mips/mips64/llseek.c
deleted file mode 100644
index 24013a8224..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/llseek.c
+++ /dev/null
@@ -1 +0,0 @@
-/* lseek() is 64-bit capable already.  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
deleted file mode 100644
index 42efcba315..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2003 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 <sys/types.h>
-
-#include <sysdep.h>
-
-extern int ftruncate (int fd, off64_t length);
-
-int __ftruncate64 (int fd, off64_t length) {
-  return ftruncate (fd, length);
-}
-weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
deleted file mode 100644
index be343aabca..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips64/n32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_N32_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_N32_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	register long long __a4 asm("$8") = (long long) arg5; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4) 							\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	register long long __a4 asm("$8") = (long long) arg5; 		\
-	register long long __a5 asm("$9") = (long long) arg6; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4), "r" (__a5)					\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c
deleted file mode 100644
index 33918ea6a5..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* glob64 is in glob.c */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
deleted file mode 100644
index 7b14089bcb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright 2003 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 <sys/asm.h>
-
-/* Sign-extend the ioctl number, since the kernel wants it as a
-   sign-extended 32-bit value, but our prototype is that of a long.  */
-
-	.text
-ENTRY (__ioctl)
-	li v0, __NR_ioctl
-	sll a1,a1,0
-	syscall			/* Do the system call.  */
-	bne a3, zero, L(error)
-	ret
-
-L(error):
-	.cpsetup t9, a0, __ioctl
-	PTR_LA t9,__syscall_error
-	.cprestore
-	jr t9
-
-PSEUDO_END (__ioctl)
-
-weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
deleted file mode 100644
index f30a465081..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips64/n64/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_N64_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_N64_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	register long __a4 asm("$8") = (long) arg5; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4) 							\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	register long __a4 asm("$8") = (long) arg5; 			\
-	register long __a5 asm("$9") = (long) arg6; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4), "r" (__a5)					\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/recv.c b/sysdeps/unix/sysv/linux/mips/mips64/recv.c
deleted file mode 100644
index b910525c92..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/recv.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/recv.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/send.c b/sysdeps/unix/sysv/linux/mips/mips64/send.c
deleted file mode 100644
index d2c2996a21..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/send.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/send.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
deleted file mode 100644
index ea5bf491d6..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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 <sys/asm.h>
-
-/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for
-   more information about the value -4095 used below.  */
-
-/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5)
-   We need to do some arg shifting, the syscall_number will be in
-   rax.  */
-
-
-	.text
-ENTRY (syscall)
-	move v0, a0		/* Syscall number -> v0 */
-	move a0, a1		/* shift arg1 - arg7.  */
-	move a1, a2
-	move a2, a3
-	move a3, a4
-	move a4, a5
-	move a5, a6
-	move a6, a7
-
-	syscall			/* Do the system call.  */
-	bne a3, zero, L(error)
-
-	ret
-
-L(error):
-	.cpsetup t9, a0, syscall
-	PTR_LA t9,__syscall_error
-	.cprestore
-	jr t9
-
-PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
deleted file mode 100644
index b0d79ff6a4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ /dev/null
@@ -1,21 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-lseek		-	lseek		i:iii	__libc_lseek	__lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
-
-# proper socket implementations:
-recvfrom	-	recvfrom	i:ibniBN __libc_recvfrom __recvfrom recvfrom
-sendto		-	sendto		i:ibnibn __libc_sendto	__sendto sendto
-
-# semaphore and shm system calls
-msgctl		-	msgctl		i:iip	__msgctl	msgctl
-msgget		-	msgget		i:ii	__msgget	msgget
-msgrcv		-	msgrcv		i:ibnii	__msgrcv	msgrcv
-msgsnd		-	msgsnd		i:ibni	__msgsnd	msgsnd
-shmat		-	shmat		i:ipi	__shmat		shmat
-shmctl		-	shmctl		i:iip	__shmctl	shmctl
-shmdt		-	shmdt		i:s	__shmdt		shmdt
-shmget		-	shmget		i:iii	__shmget	shmget
-semop		-	semop		i:ipi	__semop		semop
-semtimedop	-	semtimedop	i:ipip	semtimedop
-semget		-	semget		i:iii	__semget	semget
-semctl		-	semctl		i:iiii	__semctl	semctl
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/umount.c b/sysdeps/unix/sysv/linux/mips/mips64/umount.c
deleted file mode 100644
index 9a91ba5b2f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/umount.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
diff --git a/sysdeps/unix/sysv/linux/mips/pipe.S b/sysdeps/unix/sysv/linux/mips/pipe.S
deleted file mode 100644
index 1708888da4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/mips/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
deleted file mode 100644
index eff7d473d0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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 <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
-
-# if __ASSUME_PREAD_SYSCALL == 0
-static ssize_t __emulate_pread (int fd, void *buf, size_t count,
-				off_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pread (fd, buf, count, offset)
-     int fd;
-     void *buf;
-     size_t count;
-     off_t offset;
-{
-  ssize_t result;
-
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-  if (SINGLE_THREAD_P)
-    {
-      /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-      result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-      if (result == -1 && errno == ENOSYS)
-        /* No system call available.  Use the emulation.  */
-        result = __emulate_pread (fd, buf, count, offset);
-# endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pread (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
-
-# define __libc_pread(fd, buf, count, offset) \
-     static internal_function __emulate_pread (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PREAD_SYSCALL == 0
-# include <sysdeps/posix/pread.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
deleted file mode 100644
index d8763acabb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
-
-# if __ASSUME_PREAD_SYSCALL == 0
-static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
-				  off64_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pread64 (fd, buf, count, offset)
-     int fd;
-     void *buf;
-     size_t count;
-     off64_t offset;
-{
-  ssize_t result;
-
-
-  if (SINGLE_THREAD_P)
-    {
-     /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-     result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			      (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-     if (result == -1 && errno == ENOSYS)
-     /* No system call available.  Use the emulation.  */
-     result = __emulate_pread64 (fd, buf, count, offset);
-# endif
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pread64 (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
-
-# define __libc_pread64(fd, buf, count, offset) \
-     static internal_function __emulate_pread64 (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PREAD_SYSCALL == 0
-# include <sysdeps/posix/pread64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/profil-counter.h b/sysdeps/unix/sysv/linux/mips/profil-counter.h
deleted file mode 100644
index 8a6a0bcf3d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/profil-counter.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We can use the ix86 version.  */
-#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>
diff --git a/sysdeps/unix/sysv/linux/mips/ptrace.c b/sysdeps/unix/sysv/linux/mips/ptrace.c
deleted file mode 100644
index 19d7c2d927..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ptrace.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sgidefs.h>
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <stdarg.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-#include <sgidefs.h>
-
-#if _MIPS_SIM == _ABIN32
-__extension__ typedef long long int reg_type;
-#else
-typedef long int reg_type;
-#endif
-
-reg_type
-ptrace (enum __ptrace_request request, ...)
-{
-  reg_type res, ret;
-  va_list ap;
-  pid_t pid;
-  void *addr;
-  reg_type data;
-
-  va_start (ap, request);
-  pid = va_arg (ap, pid_t);
-  addr = va_arg (ap, void *);
-  data = va_arg (ap, reg_type);
-  va_end (ap);
-
-  if (request > 0 && request < 4)
-    data = &ret;
-
-#if __BOUNDED_POINTERS__
-  switch (request)
-    {
-    case PTRACE_PEEKTEXT:
-    case PTRACE_PEEKDATA:
-    case PTRACE_PEEKUSER:
-    case PTRACE_POKETEXT:
-    case PTRACE_POKEDATA:
-    case PTRACE_POKEUSER:
-      (void) CHECK_1 ((int *) addr);
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETREGS:
-    case PTRACE_SETREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETFPREGS:
-    case PTRACE_SETFPREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETFPXREGS:
-    case PTRACE_SETFPXREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_TRACEME:
-    case PTRACE_CONT:
-    case PTRACE_KILL:
-    case PTRACE_SINGLESTEP:
-    case PTRACE_ATTACH:
-    case PTRACE_DETACH:
-    case PTRACE_SYSCALL:
-      /* Neither `data' nor `addr' needs any checks.  */
-      break;
-    };
-#endif
-
-  res = INLINE_SYSCALL (ptrace, 4, request, pid,
-			__ptrvalue (addr), __ptrvalue (data));
-  if (res >= 0 && request > 0 && request < 4)
-    {
-      __set_errno (0);
-      return ret;
-    }
-
-  return res;
-}
diff --git a/sysdeps/unix/sysv/linux/mips/putmsg.c b/sysdeps/unix/sysv/linux/mips/putmsg.c
deleted file mode 100644
index ebc1680ca7..0000000000
--- a/sysdeps/unix/sysv/linux/mips/putmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
deleted file mode 100644
index 4378ebc859..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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 <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
-
-# if __ASSUME_PWRITE_SYSCALL == 0
-static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
-				 off_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pwrite (fd, buf, count, offset)
-     int fd;
-     const void *buf;
-     size_t count;
-     off_t offset;
-{
-  ssize_t result;
-
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-  if (SINGLE_THREAD_P)
-    {
-      /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-      result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-      if (result == -1 && errno == ENOSYS)
-        /* No system call available.  Use the emulation.  */
-        result = __emulate_pwrite (fd, buf, count, offset);
-# endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pwrite (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
-
-# define __libc_pwrite(fd, buf, count, offset) \
-     static internal_function __emulate_pwrite (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PWRITE_SYSCALL == 0
-# include <sysdeps/posix/pwrite.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
deleted file mode 100644
index e5853e432e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
-
-   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>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
-
-# if __ASSUME_PWRITE_SYSCALL == 0
-static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
-				   off64_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pwrite64 (fd, buf, count, offset)
-     int fd;
-     const void *buf;
-     size_t count;
-     off64_t offset;
-{
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-     /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-     result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-     if (result == -1 && errno == ENOSYS)
-     /* No system call available.  Use the emulation.  */
-     result = __emulate_pwrite64 (fd, buf, count, offset);
-# endif
-
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pwrite64 (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
-
-# define __libc_pwrite64(fd, buf, count, offset) \
-     static internal_function __emulate_pwrite64 (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PWRITE_SYSCALL == 0
-# include <sysdeps/posix/pwrite64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/readelflib.c b/sysdeps/unix/sysv/linux/mips/readelflib.c
deleted file mode 100644
index 73fd43f46f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/readelflib.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>
-   Based on work ../x86_64/readelflib.c,
-   contributed by Andreas Jaeger <aj@suse.de>, 1999 and
-		  Jakub Jelinek <jakub@redhat.com>, 1999.
-
-   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.  */
-
-
-int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-
-/* Returns 0 if everything is ok, != 0 in case of error.  */
-int
-process_elf_file (const char *file_name, const char *lib, int *flag,
-		  unsigned int *osversion, char **soname, void *file_contents,
-		  size_t file_length)
-{
-  ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
-  int ret;
-
-  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    {
-      ret = process_elf32_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-
-      /* n32 libraries are always libc.so.6+.  */
-      if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
-	*flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
-    }
-  else
-    {
-      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* n64 libraries are always libc.so.6+.  */
-      if (!ret)
-	*flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
-    }
-
-  return ret;
-}
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf32_file
-#define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf64_file
-#define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/mips/register-dump.h b/sysdeps/unix/sysv/linux/mips/register-dump.h
deleted file mode 100644
index f5bd3a2735..0000000000
--- a/sysdeps/unix/sysv/linux/mips/register-dump.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Dump registers.
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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 <sys/uio.h>
-#include <stdio-common/_itoa.h>
-
-/* We will print the register dump in this format:
-
- R0   XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R8   XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R16  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R24  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
-           pc    cause  status   badvaddr       lo       hi
-      XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- The FPU registers will not be printed.
-*/
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, struct sigcontext *ctx)
-{
-  char regs[38][8];
-  struct iovec iov[38 * 2 + 10];
-  size_t nr = 0;
-  int i;
-
-#define ADD_STRING(str) \
-  iov[nr].iov_base = (char *) str;					      \
-  iov[nr].iov_len = strlen (str);					      \
-  ++nr
-#define ADD_MEM(str, len) \
-  iov[nr].iov_base = str;						      \
-  iov[nr].iov_len = len;						      \
-  ++nr
-
-  /* Generate strings of register contents.  */
-  for (i = 0; i < 32; i++)
-    hexvalue (ctx->sc_regs[i], regs[i], 8);
-  hexvalue (ctx->sc_pc, regs[32], 8);
-  hexvalue (ctx->sc_cause, regs[33], 8);
-  hexvalue (ctx->sc_status, regs[34], 8);
-  hexvalue (ctx->sc_badvaddr, regs[35], 8);
-  hexvalue (ctx->sc_mdhi, regs[36], 8);
-  hexvalue (ctx->sc_mdlo, regs[37], 8);
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n R0   ");
-  for (i = 0; i < 8; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R8   ");
-  for (i = 8; i < 16; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R16  ");
-  for (i = 16; i < 24; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R24  ");
-  for (i = 24; i < 32; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n           pc    cause  status   badvaddr       lo       hi\n      ");
-  for (i = 32; i < 38; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, nr);
-}
-
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/mips/sigaction.c b/sysdeps/unix/sysv/linux/mips/sigaction.c
deleted file mode 100644
index 09fbe79316..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sigaction.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 <sgidefs.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <sgidefs.h>
-
-#include "kernel-features.h"
-
-/* The difference here is that the sigaction structure used in the
-   kernel is not the same as we use in the libc.  Therefore we must
-   translate it here.  */
-#include <kernel_sigaction.h>
-
-#if __ASSUME_REALTIME_SIGNALS == 0
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.	 This is the definition.  */
-int __libc_missing_rt_sigs;
-
-#endif
-
-#if _MIPS_SIM != _ABIO32
-
-# ifdef __NR_rt_sigreturn
-static void restore_rt (void) asm ("__restore_rt");
-# endif
-# ifdef __NR_sigreturn
-static void restore (void) asm ("__restore");
-# endif
-#endif
-
-/* If ACT is not NULL, change the action for SIG to *ACT.
-   If OACT is not NULL, put the old action for SIG in *OACT.  */
-int
-__libc_sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-#if __ASSUME_REALTIME_SIGNALS == 0
-  struct old_kernel_sigaction k_sigact, k_osigact;
-#endif
-  int result;
-
-#if defined __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0
-  /* First try the RT signals.	*/
-# if __ASSUME_REALTIME_SIGNALS == 0
-  if (!__libc_missing_rt_sigs)
-# endif
-    {
-      struct kernel_sigaction kact, koact;
-      /* Save the current error value for later.  We need not do this
-	 if we are guaranteed to have realtime signals.	 */
-# if __ASSUME_REALTIME_SIGNALS == 0
-      int saved_errno = errno;
-# endif
-
-      if (act)
-	{
-	  kact.k_sa_handler = act->sa_handler;
-	  memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kernel_sigset_t));
-	  kact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _ABIO32
-	  kact.sa_restorer = act->sa_restorer;
-#  else
-	  kact.sa_restorer = &restore_rt;
-#  endif
-# endif
-	}
-
-      /* XXX The size argument hopefully will have to be changed to the
-	 real size of the user-level sigset_t.	*/
-      result = INLINE_SYSCALL (rt_sigaction, 4, sig,
-			       act ? __ptrvalue (&kact) : NULL,
-			       oact ? __ptrvalue (&koact) : NULL,
-			       sizeof (kernel_sigset_t));
-
-# if __ASSUME_REALTIME_SIGNALS == 0
-      if (result >= 0 || errno != ENOSYS)
-# endif
-	{
-	  if (oact && result >= 0)
-	    {
-	      oact->sa_handler = koact.k_sa_handler;
-	      memcpy (&oact->sa_mask, &koact.sa_mask,
-				sizeof (kernel_sigset_t));
-	      oact->sa_flags = koact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-	      oact->sa_restorer = koact.sa_restorer;
-# endif
-	    }
-	  return result;
-	}
-
-# if __ASSUME_REALTIME_SIGNALS == 0
-      __set_errno (saved_errno);
-      __libc_missing_rt_sigs = 1;
-# endif
-    }
-#endif
-
-#if __ASSUME_REALTIME_SIGNALS == 0
-  if (act)
-    {
-      k_sigact.k_sa_handler = act->sa_handler;
-      k_sigact.sa_mask = act->sa_mask.__val[0];
-      k_sigact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-      k_sigact.sa_restorer = act->sa_restorer;
-# endif
-    }
-  result = INLINE_SYSCALL (sigaction, 3, sig,
-			   act ? __ptrvalue (&k_sigact) : NULL,
-			   oact ? __ptrvalue (&k_osigact) : NULL);
-  if (oact && result >= 0)
-    {
-      oact->sa_handler = k_osigact.k_sa_handler;
-      oact->sa_mask.__val[0] = k_osigact.sa_mask;
-      oact->sa_flags = k_osigact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _ABIO32
-      oact->sa_restorer = k_osigact.sa_restorer;
-#  else
-      oact->sa_restorer = &restore;
-#  endif
-# endif
-    }
-  return result;
-#endif
-}
-libc_hidden_def (__libc_sigaction)
-
-#ifndef LIBC_SIGACTION
-weak_alias (__libc_sigaction, __sigaction)
-libc_hidden_weak (__sigaction)
-weak_alias (__libc_sigaction, sigaction)
-#endif
-
-/* NOTE: Please think twice before making any changes to the bits of
-   code below.  GDB needs some intimate knowledge about it to
-   recognize them as signal trampolines, and make backtraces through
-   signal handlers work right.  Important are both the names
-   (__restore_rt) and the exact instruction sequence.
-   If you ever feel the need to make any changes, please notify the
-   appropriate GDB maintainer.  */
-
-#define RESTORE(name, syscall) RESTORE2 (name, syscall)
-#define RESTORE2(name, syscall) \
-asm						\
-  (						\
-   ".align 4\n"					\
-   "__" #name ":\n"				\
-   "	li $2, " #syscall "\n"			\
-   "	syscall\n"				\
-   );
-
-/* The return code for realtime-signals.  */
-#if _MIPS_SIM != _ABIO32
-# ifdef __NR_rt_sigreturn
-RESTORE (restore_rt, __NR_rt_sigreturn)
-# endif
-# ifdef __NR_sigreturn
-RESTORE (restore, __NR_sigreturn)
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h b/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
deleted file mode 100644
index f453c8d9b5..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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 <sgidefs.h>
-
-#if _MIPS_SIM == _ABIO32
-
-#define SIGCONTEXT unsigned long _code, struct sigcontext *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) ctx->sc_pc)
-#define GET_FRAME(ctx)	((void *) ctx->sc_regs[30])
-#define GET_STACK(ctx)	((void *) ctx->sc_regs[29])
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
-
-#else
-
-#define SIGCONTEXT unsigned long _code, ucontext_t *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) ctx->uc_mcontext.pc)
-#define GET_FRAME(ctx)	((void *) ctx->uc_mcontext.gregs[30])
-#define GET_STACK(ctx)	((void *) ctx->uc_mcontext.gregs[29])
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sys/cachectl.h b/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
deleted file mode 100644
index a93e1fb6d1..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 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 _SYS_CACHECTL_H
-#define _SYS_CACHECTL_H 1
-
-#include <features.h>
-
-/*
- * Get the kernel definition for the op bits.
- */
-#include <asm/cachectl.h>
-
-__BEGIN_DECLS
-
-#ifdef __USE_MISC
-extern int cachectl (void *addr, __const int nbytes, __const int op) __THROW;
-#endif
-extern int __cachectl (void *addr, __const int nbytes, __const int op) __THROW;
-#ifdef __USE_MISC
-extern int cacheflush (void *addr, __const int nbytes, __const int op) __THROW;
-#endif
-extern int _flush_cache (char *addr, __const int nbytes, __const int op) __THROW;
-
-__END_DECLS
-
-#endif /* sys/cachectl.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/procfs.h b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
deleted file mode 100644
index 2bf07be3e9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/procfs.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somehow modelled after the file of the same name on SysVr4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  */
-
-#include <features.h>
-#include <sgidefs.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-#include <sgidefs.h>
-
-/* ELF register definitions */
-#define ELF_NGREG	45
-#define ELF_NFPREG	33
-
-#if _MIPS_SIM == _ABIN32
-__extension__ typedef unsigned long long elf_greg_t;
-#else
-typedef unsigned long elf_greg_t;
-#endif
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef double elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
-
-__BEGIN_DECLS
-
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   gdb doesn't really use excluded.  Fields present but not used are
-   marked with "XXX".  */
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-#if _MIPS_SIM == _ABIN32
-    __extension__ unsigned long long int pr_sigpend;
-    __extension__ unsigned long long int pr_sighold;
-#else
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-#endif
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-#if _MIPS_SIM == _ABIN32
-    __extension__ unsigned long long int pr_flag;
-#else
-    unsigned long int pr_flag;		/* Flags.  */
-#endif
-    long pr_uid;
-    long pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore habe only ine PID type.  */
-typedef __pid_t lwpid_t;
-
-
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h b/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
deleted file mode 100644
index d05853da77..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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 _SYS_PTRACE_H
-#define _SYS_PTRACE_H	1
-
-#include <features.h>
-#include <sgidefs.h>
-
-__BEGIN_DECLS
-
-/* Type of the REQUEST argument to `ptrace.'  */
-enum __ptrace_request
-{
-  /* Indicate that the process making this request should be traced.
-     All signals received by this process can be intercepted by its
-     parent, and its parent can use the other `ptrace' requests.  */
-  PTRACE_TRACEME = 0,
-#define PT_TRACE_ME PTRACE_TRACEME
-
-  /* Return the word in the process's text space at address ADDR.  */
-  PTRACE_PEEKTEXT = 1,
-#define PT_READ_I PTRACE_PEEKTEXT
-
-  /* Return the word in the process's data space at address ADDR.  */
-  PTRACE_PEEKDATA = 2,
-#define PT_READ_D PTRACE_PEEKDATA
-
-  /* Return the word in the process's user area at offset ADDR.  */
-  PTRACE_PEEKUSER = 3,
-#define PT_READ_U PTRACE_PEEKUSER
-
-  /* Write the word DATA into the process's text space at address ADDR.  */
-  PTRACE_POKETEXT = 4,
-#define PT_WRITE_I PTRACE_POKETEXT
-
-  /* Write the word DATA into the process's data space at address ADDR.  */
-  PTRACE_POKEDATA = 5,
-#define PT_WRITE_D PTRACE_POKEDATA
-
-  /* Write the word DATA into the process's user area at offset ADDR.  */
-  PTRACE_POKEUSER = 6,
-#define PT_WRITE_U PTRACE_POKEUSER
-
-  /* Continue the process.  */
-  PTRACE_CONT = 7,
-#define PT_CONTINUE PTRACE_CONT
-
-  /* Kill the process.  */
-  PTRACE_KILL = 8,
-#define PT_KILL PTRACE_KILL
-
-  /* Single step the process.
-     This is not supported on all machines.  */
-  PTRACE_SINGLESTEP = 9,
-#define PT_STEP PTRACE_SINGLESTEP
-
-  /* Get all general purpose registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETREGS = 12,
-#define PT_GETREGS PTRACE_GETREGS
-
-  /* Set all general purpose registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETREGS = 13,
-#define PT_SETREGS PTRACE_SETREGS
-
-  /* Get all floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETFPREGS = 14,
-#define PT_GETFPREGS PTRACE_GETFPREGS
-
-  /* Set all floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETFPREGS = 15,
-#define PT_SETFPREGS PTRACE_SETFPREGS
-
-  /* Attach to a process that is already running. */
-  PTRACE_ATTACH = 16,
-#define PT_ATTACH PTRACE_ATTACH
-
-  /* Detach from a process attached to with PTRACE_ATTACH.  */
-  PTRACE_DETACH = 17,
-#define PT_DETACH PTRACE_DETACH
-
-  /* Get all extended floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETFPXREGS = 18,
-#define PT_GETFPXREGS PTRACE_GETFPXREGS
-
-  /* Set all extended floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETFPXREGS = 19,
-#define PT_SETFPXREGS PTRACE_SETFPXREGS
-
-  /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
-#define PT_SYSCALL PTRACE_SYSCALL
-};
-
-/* Perform process tracing functions.  REQUEST is one of the values
-   above, and determines the action to be taken.
-   For all requests except PTRACE_TRACEME, PID specifies the process to be
-   traced.
-
-   PID and the other arguments described above for the various requests should
-   appear (those that are used for the particular request) as:
-     pid_t PID, void *ADDR, int DATA, void *ADDR2
-   after REQUEST.  */
-#if _MIPS_SIM == _ABIN32
-__extension__ extern long long int ptrace
-  (enum __ptrace_request __request, ...) __THROW;
-#else
-extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
-#endif
-
-__END_DECLS
-
-#endif /* _SYS_PTRACE_H */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/syscall.h b/sysdeps/unix/sysv/linux/mips/sys/syscall.h
deleted file mode 100644
index f6458cd316..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/syscall.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2003 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 _SYSCALL_H
-#define _SYSCALL_H	1
-
-/* This file should list the numbers of the system the system knows.
-   But instead of duplicating this we use the information available
-   from the kernel sources.  */
-#ifdef _LIBC
-/* Since the kernel doesn't define macro names in a way usable for
-   glibc, we preprocess this header, and use it during the glibc build
-   process.  */
-# include <asm-unistd.h>
-#else
-# include <asm/unistd.h>
-#endif
-
-#ifndef _LIBC
-/* The Linux kernel header file defines macros `__NR_<name>', but some
-   programs expect the traditional form `SYS_<name>'.  So in building libc
-   we scan the kernel's list and produce <bits/syscall.h> with macros for
-   all the `SYS_' names.  */
-# include <bits/syscall.h>
-#endif
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sys/sysmips.h b/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
deleted file mode 100644
index 0677cafaa4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1995, 1997, 2000, 2001 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 _SYS_SYSMIPS_H
-#define _SYS_SYSMIPS_H 1
-
-#include <features.h>
-
-/*
- * Commands for the sysmips(2) call
- *
- * sysmips(2) is deprecated - though some existing software uses it.
- * We only support the following commands.  Sysmips exists for compatibility
- * purposes only so new software should avoid it.
- */
-#define SETNAME                   1	/* set hostname                  */
-#define FLUSH_CACHE		   3	/* writeback and invalidate caches */
-#define MIPS_FIXADE               7	/* control address error fixing  */
-#define MIPS_RDNVRAM              10	/* read NVRAM			 */
-#define MIPS_ATOMIC_SET		2001	/* atomically set variable       */
-
-__BEGIN_DECLS
-
-extern int sysmips (__const int cmd, ...) __THROW;
-
-__END_DECLS
-
-#endif /* sys/sysmips.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/tas.h b/sysdeps/unix/sysv/linux/mips/sys/tas.h
deleted file mode 100644
index 1183b867b8..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/tas.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
-
-   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 _SYS_TAS_H
-#define _SYS_TAS_H 1
-
-#include <features.h>
-#include <sgidefs.h>
-
-__BEGIN_DECLS
-
-extern int _test_and_set (int *p, int v) __THROW;
-
-#ifdef __USE_EXTERN_INLINES
-
-# ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
-# endif
-
-_EXTERN_INLINE int
-__NTH (_test_and_set (int *p, int v))
-{
-  int r, t;
-
-  __asm__ __volatile__
-    ("/* Inline test and set */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%3\n\t"
-     "move	%1,%4\n\t"
-     "beq	%0,%4,2f\n\t"
-     "sc	%1,%2\n\t"
-     ".set	pop\n\t"
-     "beqz	%1,1b\n"
-     "2:\n\t"
-     "/* End test and set */"
-     : "=&r" (r), "=&r" (t), "=m" (*p)
-     : "m" (*p), "r" (v)
-     : "memory");
-
-  return r;
-}
-
-#endif /* __USE_EXTERN_INLINES */
-
-__END_DECLS
-
-#endif /* sys/tas.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
deleted file mode 100644
index ddb499f20c..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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.  */
-
-/* Don't rely on this, the interface is currently messed up and may need to
-   be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <sgidefs.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-/* Type for general register.  Even in o32 we assume 64-bit registers,
-   like the kernel.  */
-__extension__ typedef unsigned long long int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	32
-#define NFPREG	32
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Container for all FPU registers.  */
-typedef struct fpregset {
-	union {
-		double	fp_dregs[NFPREG];
-		struct {
-			float		_fp_fregs;
-			unsigned int	_fp_pad;
-		} fp_fregs[NFPREG];
-	} fp_r;
-} fpregset_t;
-
-
-/* Context to describe whole processor state.  */
-#if _MIPS_SIM == _ABIO32
-/* Earlier versions of glibc for mips had an entirely different
-   definition of mcontext_t, that didn't even resemble the
-   corresponding kernel data structure.  Since all legitimate uses of
-   ucontext_t in glibc mustn't have accessed anything beyond
-   uc_mcontext and, even then, taking a pointer to it, casting it to
-   sigcontext_t, and accessing it as such, which is what it has always
-   been, this can still be rectified.  Fortunately, makecontext,
-   [gs]etcontext et all have never been implemented.  */
-typedef struct
-  {
-    unsigned int regmask;
-    unsigned int status;
-    greg_t pc;
-    gregset_t gregs;
-    fpregset_t fpregs;
-    unsigned int fp_owned;
-    unsigned int fpc_csr;
-    unsigned int fpc_eir;
-    unsigned int used_math;
-    unsigned int ssflags;
-    greg_t mdhi;
-    greg_t mdlo;
-    unsigned int cause;
-    unsigned int badvaddr;
-  } mcontext_t;
-#else
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-    greg_t mdhi;
-    greg_t mdlo;
-    greg_t pc;
-    unsigned int status;
-    unsigned int fpc_csr;
-    unsigned int fpc_eir;
-    unsigned int used_math;
-    unsigned int cause;
-    unsigned int badvaddr;
-  } mcontext_t;
-#endif
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/user.h b/sysdeps/unix/sysv/linux/mips/sys/user.h
deleted file mode 100644
index d5b3b0508b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/user.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_USER_H
-#define _SYS_USER_H	1
-
-#include <sgidefs.h>
-
-/* The whole purpose of this file is for GDB and GDB only.  Don't read
-   too much into it.  Don't use it for anything other than GDB unless
-   you know what you are doing.  */
-
-/* #include <asm/reg.h> */
-/* Instead of including the kernel header, that will vary depending on
-   whether the 32- or the 64-bit kernel is installed, we paste its
-   contents here.  Note that the fact that the file is inline here,
-   instead of included separately, doesn't change in any way the
-   licensing status of a program that includes user.h.  Since this is
-   for gdb alone, and gdb is GPLed, no surprises here.  */
-#if _MIPS_SIM == _ABIO32
-/*
- * Various register offset definitions for debuggers, core file
- * examiners and whatnot.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1999 by Ralf Baechle
- */
-#ifndef __ASM_MIPS_REG_H
-#define __ASM_MIPS_REG_H
-
-/*
- * This defines/structures correspond to the register layout on stack -
- * if the order here is changed, it needs to be updated in
- * include/asm-mips/stackframe.h
- */
-#define EF_REG0			6
-#define EF_REG1			7
-#define EF_REG2			8
-#define EF_REG3			9
-#define EF_REG4			10
-#define EF_REG5			11
-#define EF_REG6			12
-#define EF_REG7			13
-#define EF_REG8			14
-#define EF_REG9			15
-#define EF_REG10		16
-#define EF_REG11		17
-#define EF_REG12		18
-#define EF_REG13		19
-#define EF_REG14		20
-#define EF_REG15		21
-#define EF_REG16		22
-#define EF_REG17		23
-#define EF_REG18		24
-#define EF_REG19		25
-#define EF_REG20		26
-#define EF_REG21		27
-#define EF_REG22		28
-#define EF_REG23		29
-#define EF_REG24		30
-#define EF_REG25		31
-/*
- * k0/k1 unsaved
- */
-#define EF_REG28		34
-#define EF_REG29		35
-#define EF_REG30		36
-#define EF_REG31		37
-
-/*
- * Saved special registers
- */
-#define EF_LO			38
-#define EF_HI			39
-
-#define EF_CP0_EPC		40
-#define EF_CP0_BADVADDR		41
-#define EF_CP0_STATUS		42
-#define EF_CP0_CAUSE		43
-
-#define EF_SIZE			180	/* size in bytes */
-
-#endif /* __ASM_MIPS_REG_H */
-
-#else /* _MIPS_SIM != _ABIO32 */
-
-/*
- * Various register offset definitions for debuggers, core file
- * examiners and whatnot.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1999 Ralf Baechle
- * Copyright (C) 1995, 1999 Silicon Graphics
- */
-#ifndef _ASM_REG_H
-#define _ASM_REG_H
-
-/*
- * This defines/structures correspond to the register layout on stack -
- * if the order here is changed, it needs to be updated in
- * include/asm-mips/stackframe.h
- */
-#define EF_REG0			 0
-#define EF_REG1			 1
-#define EF_REG2			 2
-#define EF_REG3			 3
-#define EF_REG4			 4
-#define EF_REG5			 5
-#define EF_REG6			 6
-#define EF_REG7			 7
-#define EF_REG8			 8
-#define EF_REG9			 9
-#define EF_REG10		10
-#define EF_REG11		11
-#define EF_REG12		12
-#define EF_REG13		13
-#define EF_REG14		14
-#define EF_REG15		15
-#define EF_REG16		16
-#define EF_REG17		17
-#define EF_REG18		18
-#define EF_REG19		19
-#define EF_REG20		20
-#define EF_REG21		21
-#define EF_REG22		22
-#define EF_REG23		23
-#define EF_REG24		24
-#define EF_REG25		25
-/*
- * k0/k1 unsaved
- */
-#define EF_REG28		28
-#define EF_REG29		29
-#define EF_REG30		30
-#define EF_REG31		31
-
-/*
- * Saved special registers
- */
-#define EF_LO			32
-#define EF_HI			33
-
-#define EF_CP0_EPC		34
-#define EF_CP0_BADVADDR		35
-#define EF_CP0_STATUS		36
-#define EF_CP0_CAUSE		37
-
-#define EF_SIZE			304	/* size in bytes */
-
-#endif /* _ASM_REG_H */
-
-#endif /* _MIPS_SIM != _ABIO32 */
-
-#if _MIPS_SIM == _ABIO32
-
-struct user
-{
-  unsigned long	regs[EF_SIZE/4+64];	/* integer and fp regs */
-  size_t	u_tsize;		/* text size (pages) */
-  size_t	u_dsize;		/* data size (pages) */
-  size_t	u_ssize;		/* stack size (pages) */
-  unsigned long	start_code;		/* text starting address */
-  unsigned long	start_data;		/* data starting address */
-  unsigned long	start_stack;		/* stack starting address */
-  long int	signal;			/* signal causing core dump */
-  void*		u_ar0;			/* help gdb find registers */
-  unsigned long	magic;			/* identifies a core file */
-  char		u_comm[32];		/* user command name */
-};
-
-#else
-
-struct user {
-  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
-  __extension__ unsigned long	u_tsize;	/* text size (pages) */
-  __extension__ unsigned long	u_dsize;	/* data size (pages) */
-  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
-  __extension__ unsigned long long start_code;	/* text starting address */
-  __extension__ unsigned long long start_data;	/* data starting address */
-  __extension__ unsigned long long start_stack;	/* stack starting address */
-  __extension__ long long	signal;		/* signal causing core dump */
-  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
-  __extension__ unsigned long long magic;	/* identifies a core file */
-  char		u_comm[32];		/* user command name */
-};
-
-#endif
-
-#define PAGE_SHIFT		12
-#define PAGE_SIZE		(1UL << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
-#define NBPG			PAGE_SIZE
-#define UPAGES			1
-#define HOST_TEXT_START_ADDR	(u.start_code)
-#define HOST_DATA_START_ADDR	(u.start_data)
-#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
-
-#endif	/* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
deleted file mode 100644
index 518f2a2522..0000000000
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ /dev/null
@@ -1,31 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-#
-# Calls for compatibility with existing MIPS OS implementations and
-# compilers.
-#
-cachectl	-	cachectl	i:pii	__cachectl	cachectl
-cacheflush	-	cacheflush	i:pii	_flush_cache	cacheflush
-sysmips		-	sysmips		i:iiii	__sysmips	sysmips
-
-#
-# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
-# it's provided for compatibility, though.
-#
-accept		-	accept		Ci:iBN	__libc_accept	__accept accept
-bind		-	bind		i:ipi	__bind		bind
-connect		-	connect		Ci:ipi	__libc_connect	__connect_internal __connect connect
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
-listen		-	listen		i:ii	__listen	listen
-recv		-	recv		Ci:ibni	__libc_recv	__recv recv
-recvfrom	-	recvfrom	Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
-recvmsg		-	recvmsg		Ci:ipi	__libc_recvmsg	__recvmsg recvmsg
-send		-	send		Ci:ibni	__libc_send	__send send
-sendmsg		-	sendmsg		Ci:ipi	__libc_sendmsg	__sendmsg sendmsg
-sendto		-	sendto		Ci:ibnibn __libc_sendto	__sendto sendto
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
-socket		-	socket		i:iii	__socket	socket
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/mips/truncate64.c b/sysdeps/unix/sysv/linux/mips/truncate64.c
deleted file mode 100644
index e955f18ea3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/truncate64.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   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 <sys/types.h>
-#include <endian.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include "kernel-features.h"
-
-#ifdef __NR_truncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls.  */
-int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-truncate64 (const char *path, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! __have_no_truncate64)
-#endif
-    {
-      unsigned int low = length & 0xffffffff;
-      unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      int saved_errno = errno;
-#endif
-      int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
-				   __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      if (result != -1 || errno != ENOSYS)
-#endif
-	return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      __set_errno (saved_errno);
-      __have_no_truncate64 = 1;
-#endif
-    }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return truncate (path, (off_t) length);
-#endif
-}
-
-#else
-/* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/xmknod.c b/sysdeps/unix/sysv/linux/mips/xmknod.c
deleted file mode 100644
index 2d09752405..0000000000
--- a/sysdeps/unix/sysv/linux/mips/xmknod.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* xmknod call using old-style Unix mknod system call.
-   Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2003
-   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 <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-/* Create a device file named PATH, with permission and special bits MODE
-   and device number DEV (which can be constructed from major and minor
-   device numbers with the `makedev' macro above).  */
-int
-__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
-{
-  unsigned long k_dev;
-
-  if (vers != _MKNOD_VER)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* We must convert the value to dev_t type used by the kernel.  */
-  k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
-
-  return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
-}
-
-weak_alias (__xmknod, _xmknod)
-libc_hidden_def (__xmknod)
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
new file mode 100644
index 0000000000..3c190085ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+/* Create a new directory with permission bits MODE.  But interpret
+   relative PATH names relative to the directory associated with FD.  */
+int
+mkdirat (fd, file, mode)
+     int fd;
+     const char *file;
+     mode_t mode;
+{
+  int res;
+
+#ifdef __NR_mkdirat
+#  ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && res == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+  res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c
index 7e9e9498cb..d3c68cd106 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,01,02 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001,2002,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_mmap2
 
diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index 65522d5adc..008e8eeb95 100644
--- a/sysdeps/unix/sysv/linux/mq_close.c
+++ b/sysdeps/unix/sysv/linux/mq_close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -31,5 +31,5 @@ mq_close (mqd_t mqdes)
 }
 
 #else
-# include <sysdeps/generic/mq_close.c>
+# include <rt/mq_close.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c
index a61722e237..d25df7bcfd 100644
--- a/sysdeps/unix/sysv/linux/mq_getattr.c
+++ b/sysdeps/unix/sysv/linux/mq_getattr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -31,5 +31,5 @@ mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
 }
 
 #else
-# include <sysdeps/generic/mq_getattr.c>
+# include <rt/mq_getattr.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index 14db27da70..4eba28a301 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -40,5 +40,5 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
 }
 
 #else
-# include <sysdeps/generic/mq_notify.c>
+# include <rt/mq_notify.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index d8926a73a7..eac6e01238 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -56,5 +56,5 @@ mq_open (const char *name, int oflag, ...)
 }
 
 #else
-# include <sysdeps/generic/mq_open.c>
+# include <rt/mq_open.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c
index 891663c66a..2186508029 100644
--- a/sysdeps/unix/sysv/linux/mq_receive.c
+++ b/sysdeps/unix/sysv/linux/mq_receive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -33,5 +33,5 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
 }
 
 #else
-# include <sysdeps/generic/mq_receive.c>
+# include <rt/mq_receive.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c
index cb9cbc2a69..83b9f8df4a 100644
--- a/sysdeps/unix/sysv/linux/mq_send.c
+++ b/sysdeps/unix/sysv/linux/mq_send.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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,5 +32,5 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
 }
 
 #else
-# include <sysdeps/generic/mq_send.c>
+# include <rt/mq_send.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index 8d87ffadf4..bef39a4ae2 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -50,5 +50,5 @@ mq_unlink (const char *name)
 }
 
 #else
-# include <sysdeps/generic/mq_unlink.c>
+# include <rt/mq_unlink.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 700591b2d3..86fd34cf8c 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2002, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2002,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_msqid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index 7d8a8e7859..71e7c7aea5 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2002,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -35,7 +35,7 @@ struct ipc_kludge
   };
 
 
-int
+ssize_t
 __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
      int msqid;
      void *msgp;
@@ -56,8 +56,8 @@ __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
 
   int oldtype = LIBC_CANCEL_ASYNC ();
 
-  int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
-			       __ptrvalue (&tmp));
+  ssize_t result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
+				   __ptrvalue (&tmp));
 
    LIBC_CANCEL_RESET (oldtype);
 
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index 46f035bef6..9608652ee4 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -1,5 +1,5 @@
 /* Definitions for Address Resolution Protocol.
-   Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2001,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -96,7 +96,7 @@ struct arphdr
 #define ARPHRD_ADAPT	264
 #define ARPHRD_ROSE	270
 #define ARPHRD_X25	271		/* CCITT X.25.  */
-#define ARPHDR_HWX25	272		/* Boards with X.25 in firmware.  */
+#define ARPHRD_HWX25	272		/* Boards with X.25 in firmware.  */
 #define ARPHRD_PPP	512
 #define ARPHRD_CISCO	513		/* Cisco HDLC.  */
 #define ARPHRD_HDLC	ARPHRD_CISCO
@@ -126,6 +126,12 @@ struct arphdr
 #define ARPHRD_FCFABRIC 787		/* Fibrechanel fabric.  */
 #define ARPHRD_IEEE802_TR 800		/* Magic type ident for TR.  */
 #define ARPHRD_IEEE80211 801		/* IEEE 802.11.  */
+#define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header.  */
+#define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header.  */
+
+#define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known.  */
+#define ARPHRD_NONE	  0xFFFE	/* Zero header length.  */
+
 
 /* ARP ioctl request.  */
 struct arpreq
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index 1a7bc68c98..45c39115f3 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 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
@@ -21,13 +21,83 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
-#include <asm/types.h>
 
-#include <linux/if_tr.h>
+/* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
+   and FCS/CRC (frame check sequence). */
+#define TR_ALEN		6		/* Octets in one token-ring addr */
+#define TR_HLEN 	(sizeof (struct trh_hdr) + sizeof (struct trllc))
+#define AC		0x10
+#define LLC_FRAME 	0x40
+
+/* LLC and SNAP constants */
+#define EXTENDED_SAP 	0xAA
+#define UI_CMD       	0x03
+
+/* This is an Token-Ring frame header. */
+struct trh_hdr
+{
+  u_int8_t  ac;			/* access control field */
+  u_int8_t  fc;			/* frame control field */
+  u_int8_t  daddr[TR_ALEN];	/* destination address */
+  u_int8_t  saddr[TR_ALEN];	/* source address */
+  u_int16_t rcf;		/* route control field */
+  u_int16_t rseg[8];		/* routing registers */
+};
+
+/* This is an Token-Ring LLC structure */
+struct trllc
+{
+  u_int8_t  dsap;		/* destination SAP */
+  u_int8_t  ssap;		/* source SAP */
+  u_int8_t  llc;		/* LLC control field */
+  u_int8_t  protid[3];		/* protocol id */
+  u_int16_t ethertype;		/* ether type field */
+};
+
+/* Token-Ring statistics collection data. */
+struct tr_statistics
+{
+  unsigned long rx_packets;     /* total packets received	*/
+  unsigned long tx_packets;	/* total packets transmitted	*/
+  unsigned long rx_bytes;	/* total bytes received   	*/
+  unsigned long tx_bytes;	/* total bytes transmitted	*/
+  unsigned long rx_errors;	/* bad packets received		*/
+  unsigned long tx_errors;	/* packet transmit problems	*/
+  unsigned long rx_dropped;	/* no space in linux buffers	*/
+  unsigned long tx_dropped;	/* no space available in linux	*/
+  unsigned long multicast;	/* multicast packets received	*/
+  unsigned long transmit_collision;
+
+  /* detailed Token-Ring errors. See IBM Token-Ring Network
+     Architecture for more info */
+
+  unsigned long line_errors;
+  unsigned long internal_errors;
+  unsigned long burst_errors;
+  unsigned long A_C_errors;
+  unsigned long abort_delimiters;
+  unsigned long lost_frames;
+  unsigned long recv_congest_count;
+  unsigned long frame_copied_errors;
+  unsigned long frequency_errors;
+  unsigned long token_errors;
+  unsigned long dummy1;
+};
+
+/* source routing stuff */
+#define TR_RII 			0x80
+#define TR_RCF_DIR_BIT 		0x80
+#define TR_RCF_LEN_MASK 	0x1f00
+#define TR_RCF_BROADCAST 	0x8000	/* all-routes broadcast */
+#define TR_RCF_LIMITED_BROADCAST 0xC000	/* single-route broadcast */
+#define TR_RCF_FRAME2K 		0x20
+#define TR_RCF_BROADCAST_MASK 	0xC000
+#define TR_MAXRIFLEN 		18
 
 #ifdef __USE_BSD
 
-struct trn_hdr {
+struct trn_hdr
+{
   u_int8_t trn_ac;                /* access control field */
   u_int8_t trn_fc;                /* field control field */
   u_int8_t trn_dhost[TR_ALEN];    /* destination host */
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 6672e714ff..92310b77df 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -23,7 +23,7 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 struct netlink_res
@@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
 extern int __netlink_open (struct netlink_handle *h);
 extern void __netlink_close (struct netlink_handle *h);
 extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_sendreq (struct netlink_handle *h, int type);
-extern int __netlink_receive (struct netlink_handle *h);
+extern int __netlink_request (struct netlink_handle *h, int type);
 
 
 #endif /* netlinkaccess.h */
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 9418417b45..80d33be29c 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -1,5 +1,5 @@
 /* Uncancelable versions of cancelable interfaces.  Linux version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <sys/types.h>
 #include <sysdep.h>
 
 /* Uncancelable open.  */
@@ -26,6 +27,28 @@
 #define open_not_cancel_2(name, flags) \
    INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
 
+/* Uncancelable openat.  */
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+extern int __openat_nocancel (int fd, const char *fname, int oflag,
+			      mode_t mode) attribute_hidden;
+extern int __openat64_nocancel (int fd, const char *fname, int oflag,
+				mode_t mode) attribute_hidden;
+#else
+# define __openat_nocancel(fd, fname, oflag, mode) \
+  openat (fd, fname, oflag, mode)
+# define __openat64_nocancel(fd, fname, oflag, mode) \
+  openat64 (fd, fname, oflag, mode)
+#endif
+
+#define openat_not_cancel(fd, fname, oflag, mode) \
+  __openat_nocancel (fd, fname, oflag, mode)
+#define openat_not_cancel_3(fd, fname, oflag) \
+  __openat_nocancel (fd, fname, oflag, 0)
+#define openat64_not_cancel(fd, fname, oflag, mode) \
+  __openat64_nocancel (fd, fname, oflag, mode)
+#define openat64_not_cancel_3(fd, fname, oflag) \
+  __openat64_nocancel (fd, fname, oflag, 0)
+
 /* Uncancelable close.  */
 #define close_not_cancel(fd) \
   INLINE_SYSCALL (close, 1, fd)
@@ -58,3 +81,25 @@
 # define waitpid_not_cancel(pid, stat_loc, options) \
   INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
 #endif
+
+/* Uncancelable pause.  */
+#ifdef __NR_pause
+# define pause_not_cancel() \
+  INLINE_SYSCALL (pause, 0)
+#else
+# define pause_not_cancel() \
+  __pause_nocancel ()
+#endif
+
+/* Uncancelable nanosleep.  */
+#ifdef __NR_nanosleep
+# define nanosleep_not_cancel(requested_time, remaining) \
+  INLINE_SYSCALL (nanosleep, 2, requested_time, remaining)
+#else
+# define nanosleep_not_cancel(requested_time, remaining) \
+  __nanosleep_nocancel (requested_time, remaining)
+#endif
+
+/* Uncancelable sigsuspend.  */
+#define sigsuspend_not_cancel(set) \
+  __sigsuspend_nocancel (set)
diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
index 7d1bfd8dd1..1589c24ea9 100644
--- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c
+++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
@@ -1,22 +1,20 @@
 /* Setup of nscd worker threads.  Linux verison.
-   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.
 
-   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.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU 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.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include <string.h>
 #include <unistd.h>
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
new file mode 100644
index 0000000000..df53b6cf2c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
+
+
+#ifndef OPENAT
+# define OPENAT openat
+
+# ifndef __ASSUME_ATFCTS
+/* Set errno after a failed call.  If BUF is not null,
+   it is a /proc/self/fd/ path name we just tried to use.  */
+void
+attribute_hidden
+__atfct_seterrno (int errval, int fd, const char *buf)
+{
+  if (buf != NULL)
+    {
+      struct stat64 st;
+
+      if (errval == ENOTDIR || errval == ENOENT)
+	{
+	  /* This can mean either the file descriptor is invalid or
+	     /proc is not mounted.  */
+	  if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+	    /* errno is already set correctly.  */
+	    return;
+
+	  /* If /proc is not mounted there is nothing we can do.  */
+	  if ((errval != ENOTDIR || S_ISDIR (st.st_mode))
+	      && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		  || !S_ISDIR (st.st_mode)))
+	    errval = ENOSYS;
+	}
+    }
+
+  __set_errno (errval);
+}
+
+int __have_atfcts;
+# endif
+#endif
+
+
+#define OPENAT_NOT_CANCEL CONCAT (OPENAT)
+#define CONCAT(name) CONCAT2 (name)
+#define CONCAT2(name) __##name##_nocancel
+
+
+int
+OPENAT_NOT_CANCEL (fd, file, oflag, mode)
+     int fd;
+     const char *file;
+     int oflag;
+     mode_t mode;
+{
+
+  /* We have to add the O_LARGEFILE flag for openat64.  */
+#ifdef MORE_OFLAGS
+  oflag |= MORE_OFLAGS;
+#endif
+
+  INTERNAL_SYSCALL_DECL (err);
+  int res;
+
+#ifdef __NR_openat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      /* Note: snprintf cannot be canceled.  */
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
+
+#define UNDERIZE(name) UNDERIZE_1 (name)
+#define UNDERIZE_1(name) __##name
+#define __OPENAT UNDERIZE (OPENAT)
+
+
+/* Open FILE with access OFLAG.  Interpret relative paths relative to
+   the directory associated with FD.  If OFLAG includes O_CREAT, a
+   third argument is the file protection.  */
+int
+__OPENAT (fd, file, oflag)
+     int fd;
+     const char *file;
+     int oflag;
+{
+  mode_t mode = 0;
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, mode_t);
+      va_end (arg);
+    }
+
+  if (SINGLE_THREAD_P)
+    return OPENAT_NOT_CANCEL (fd, file, oflag, mode);
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  int res = OPENAT_NOT_CANCEL (fd, file, oflag, mode);
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return res;
+}
+libc_hidden_def (__OPENAT)
+weak_alias (__OPENAT, OPENAT)
diff --git a/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c
new file mode 100644
index 0000000000..9e7a2b3737
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/openat64.c
@@ -0,0 +1,4 @@
+#define OPENAT openat64
+#define MORE_OFLAGS O_LARGEFILE
+
+#include "openat.c"
diff --git a/sysdeps/unix/sysv/linux/opendir.c b/sysdeps/unix/sysv/linux/opendir.c
index 26acae814a..c7671dc170 100644
--- a/sysdeps/unix/sysv/linux/opendir.c
+++ b/sysdeps/unix/sysv/linux/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 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
@@ -16,7 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __ASSUME_O_DIRECTORY
diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
index fb2c77e99b..a87831e74a 100644
--- a/sysdeps/unix/sysv/linux/paths.h
+++ b/sysdeps/unix/sysv/linux/paths.h
@@ -61,7 +61,7 @@
 #define	_PATH_TTY	"/dev/tty"
 #define	_PATH_UNIX	"/boot/vmlinux"
 #define _PATH_UTMP	"/var/run/utmp"
-#define	_PATH_VI	"/usr/bin/vi"
+#define	_PATH_VI	"/bin/vi"
 #define _PATH_WTMP	"/var/log/wtmp"
 
 /* Provide trailing slash, since mostly used for building pathnames. */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 4c4868645b..a745fbcbc0 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -1,5 +1,6 @@
 /* Poll system call, with emulation if it is not available.
-   Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2002,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
@@ -24,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_poll || __ASSUME_POLL_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/posix_madvise.c
index 6b2c92852d..880b17ef31 100644
--- a/sysdeps/unix/sysv/linux/m68k/brk.c
+++ b/sysdeps/unix/sysv/linux/posix_madvise.c
@@ -1,5 +1,4 @@
-/* brk system call for Linux/m68k.
-   Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,32 +16,23 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
-#include <unistd.h>
 #include <sysdep.h>
+#include <sys/mman.h>
 
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
 
 int
-__brk (void *addr)
+posix_madvise (void *addr, size_t len, int advice)
 {
-  void *newbrk;
+  /* We have one problem: the kernel's MADV_DONTNEED does not
+     correspond to POSIX's POSIX_MADV_DONTNEED.  The former simply
+     discards changes made to the memory without writing it back to
+     disk, if this would be necessary.  The POSIX behavior does not
+     allow this.  There is no functionality mapping the POSIX behavior
+     so far so we ignore that advice for now.  */
+  if (advice == POSIX_MADV_DONTNEED)
+    return 0;
 
   INTERNAL_SYSCALL_DECL (err);
-  newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
+  int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
+  return INTERNAL_SYSCALL_ERRNO (result, err);
 }
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/powerpc/Dist b/sysdeps/unix/sysv/linux/powerpc/Dist
deleted file mode 100644
index f36d3685f6..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-dl-brk.S
-ipc_priv.h
-kernel_termios.h
-ldd-rewrite.sed
-oldgetrlimit64.c
-sys/procfs.h
-sys/ptrace.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/Implies b/sysdeps/unix/sysv/linux/powerpc/Implies
new file mode 100644
index 0000000000..ff27cdb568
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Implies
@@ -0,0 +1,4 @@
+# Make sure these routines come before ldbl-opt.
+ieee754/ldbl-128ibm
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 671370ede0..ecd8057951 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -2,3 +2,11 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 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/aix/Dist b/sysdeps/unix/sysv/linux/powerpc/aix/Dist
deleted file mode 100644
index 64de6ace3e..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/aix/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-aix-dirent.h
-aix-errno.h
-aix-stat.h
-aix-termios.h
-direntconv.c
-errnoconv.c
-statconv.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 19649c01c7..c4964e0fd8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/PowerPC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -96,7 +99,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -180,10 +183,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/bsd/sun/sigreturn.S b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
index a3ea8e3fae..f20a5a175c 100644
--- a/sysdeps/unix/bsd/sun/sigreturn.S
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,13 +17,20 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
 
-#ifndef SYS_sigreturn
-#define SYS_sigreturn 139
-#endif
+#ifndef _LIBC_VDSO_H
+#define _LIBC_VDSO_H
+
+#ifdef SHARED
+
+extern void *__vdso_gettimeofday;
+
+extern void *__vdso_clock_gettime;
 
-SYSCALL__ (sigreturn, 1)
-	/* Does not return.  */
+extern void *__vdso_clock_getres;
+
+extern void *__vdso_get_tbfreq;
+
+#endif
 
-weak_alias (__sigreturn, sigreturn)
+#endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
index 8dbaf5d7b8..e03ab7ff80 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/PowerPC version.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/shm.h b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
index 7705fb64d4..62560c0caf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
@@ -80,9 +80,10 @@ struct shmid_ds
 # define SHM_INFO      14
 
 /* shm_mode upper byte flags */
-# define SHM_DEST      01000   /* segment will be destroyed on last detach */
-# define SHM_LOCKED    02000   /* segment will not be swapped */
+# define SHM_DEST      01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED    02000	/* segment will not be swapped */
 # define SHM_HUGETLB   04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE 010000	/* don't check for reservations */
 
 struct shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 8a420cb69c..7aac02dc55 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1999,2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2001,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
@@ -92,34 +92,41 @@ struct termios {
 
 #define OFILL	00000100
 #define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define XTABS	00006000	/* Required by POSIX to be == TAB3.  */
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	00001400
+# define   NL0	00000000
+# define   NL1	00000400
+# define   NL2	00001000
+# define   NL3	00001400
+# define TABDLY	00006000
+# define   TAB0	00000000
+# define   TAB1	00002000
+# define   TAB2	00004000
+# define   TAB3	00006000
+# define CRDLY	00030000
+# define   CR0	00000000
+# define   CR1	00010000
+# define   CR2	00020000
+# define   CR3	00030000
+# define FFDLY	00040000
+# define   FF0	00000000
+# define   FF1	00040000
+# define BSDLY	00100000
+# define   BS0	00000000
+# define   BS1	00100000
+#endif
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
 
+#ifdef __USE_MISC
+# define XTABS	00006000
+#endif
+
 /* c_cflag bit meaning */
-#define CBAUD	0000377
+#ifdef __USE_MISC
+# define CBAUD	0000377
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -136,9 +143,11 @@ struct termios {
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CBAUDEX 0000020
+#ifdef __USE_MISC
+# define EXTA B19200
+# define EXTB B38400
+# define CBAUDEX 0000020
+#endif
 #define  B57600   00020
 #define  B115200  00021
 #define  B230400  00022
@@ -169,23 +178,30 @@ struct termios {
 #define HUPCL	00040000
 
 #define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
+#ifdef __USE_MISC
+# define CMSPAR   010000000000		/* mark or space (stick) parity */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000080
 #define ICANON	0x00000100
-#define XCASE	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00004000
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000002
 #define ECHOK	0x00000004
 #define ECHONL	0x00000010
 #define NOFLSH	0x80000000
 #define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000040
+# define ECHOPRT	0x00000020
+# define ECHOKE	0x00000001
+# define FLUSHO	0x00800000
+# define PENDIN	0x20000000
+#endif
 #define IEXTEN	0x00000400
 
 /* Values for the ACTION argument to `tcflow'.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
new file mode 100644
index 0000000000..cf934234f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Determine the wordsize from the preprocessor defines.  */
+
+#if defined __powerpc64__
+# define __WORDSIZE	64
+# define __WORDSIZE_COMPAT32	1
+#else
+# define __WORDSIZE	32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal the glibc ABI didn't used to have a `long double'.
+   The changes all the `long double' function variants to be redirects
+   to the double functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/chown.c b/sysdeps/unix/sysv/linux/powerpc/chown.c
index 4b283e720c..fdcbd3683a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/chown.c
+++ b/sysdeps/unix/sysv/linux/powerpc/chown.c
@@ -1,5 +1,5 @@
 /* chown() compatibility.
-   Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 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
@@ -24,6 +24,8 @@
 #include <sysdep.h>
 #include <stdlib.h>
 
+#include <kernel-features.h>
+
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
   was introduced.  The new chown now follows symlinks - the old chown and the
@@ -34,58 +36,61 @@
 int
 __chown (const char *file, uid_t owner, gid_t group)
 {
-   int err;
-   int old_errno;
-   char link[PATH_MAX+2];
-   char path[2*PATH_MAX+4];
-   int loopct;
-   size_t filelen;
-   static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
-
-   if (libc_old_chown == 1)
-     return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
-
-   old_errno = errno;
-
-#ifdef __NR_lchown
-   if (libc_old_chown == 0)
-     {
-       err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
-       if (err != -1 || errno != ENOSYS)
-	 {
-	   libc_old_chown = 1;
-	   return err;
-	 }
-       libc_old_chown = -1;
-     }
-#endif
-
-   err = __readlink (file, link, PATH_MAX+1);
-   if (err == -1)
-     {
-       errno = old_errno;
-       return __lchown(file, owner, group);
-     }
-
-   filelen = strlen (file) + 1;
-   if (filelen > sizeof(path))
-     {
-       errno = ENAMETOOLONG;
-       return -1;
-     }
-   memcpy (path, file, filelen);
-
-   /* 'The system has an arbitrary limit...'  In practise, we'll hit
-      ENAMETOOLONG before this, usually.  */
-   for (loopct = 0; loopct < 128; loopct++)
-   {
-     size_t linklen;
-
-     if (err >= PATH_MAX+1)
-       {
-	 errno = ENAMETOOLONG;
-	 return -1;
-       }
+#if __ASSUME_LCHOWN_SYSCALL
+  return INLINE_SYSCALL (chown, 3, file, owner, group);
+#else
+  int err;
+  int old_errno;
+  char link[PATH_MAX + 2];
+  char path[2 * PATH_MAX + 4];
+  int loopct;
+  size_t filelen;
+  static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
+
+  if (libc_old_chown == 1)
+    return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+
+  old_errno = errno;
+
+# ifdef __NR_lchown
+  if (libc_old_chown == 0)
+    {
+      err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+      if (err != -1 || errno != ENOSYS)
+	{
+	  libc_old_chown = 1;
+	  return err;
+	}
+      libc_old_chown = -1;
+    }
+# endif
+
+  err = __readlink (file, link, PATH_MAX + 1);
+  if (err == -1)
+    {
+      __set_errno (old_errno);
+      return __lchown (file, owner, group);
+    }
+
+  filelen = strlen (file) + 1;
+  if (filelen > sizeof (path))
+    {
+      __set_errno (ENAMETOOLONG);
+      return -1;
+    }
+  memcpy (path, file, filelen);
+
+  /* 'The system has an arbitrary limit...'  In practise, we'll hit
+     ENAMETOOLONG before this, usually.  */
+  for (loopct = 0; loopct < 128; ++loopct)
+    {
+      size_t linklen;
+
+      if (err >= PATH_MAX + 1)
+	{
+	  __set_errno (ENAMETOOLONG);
+	  return -1;
+	}
 
       link[err] = 0;  /* Null-terminate string, just-in-case.  */
 
@@ -97,28 +102,29 @@ __chown (const char *file, uid_t owner, gid_t group)
 	{
 	  filelen = strlen (path);
 
-	  while (filelen > 1 && path[filelen-1] == '/')
-	    filelen--;
-	  while (filelen > 0 && path[filelen-1] != '/')
-	    filelen--;
-	  if (filelen + linklen > sizeof(path))
+	  while (filelen > 1 && path[filelen - 1] == '/')
+	    --filelen;
+	  while (filelen > 0 && path[filelen - 1] != '/')
+	    --filelen;
+	  if (filelen + linklen > sizeof (path))
 	    {
 	      errno = ENAMETOOLONG;
 	      return -1;
 	    }
-	  memcpy (path+filelen, link, linklen);
+	  memcpy (path + filelen, link, linklen);
 	}
 
-      err = __readlink(path, link, PATH_MAX+1);
+      err = __readlink (path, link, PATH_MAX + 1);
 
       if (err == -1)
-      {
-	errno = old_errno;
-	return __lchown(path, owner, group);
-      }
-   }
-   errno = ELOOP;
-   return -1;
+	{
+	  __set_errno (old_errno);
+	  return __lchown (path, owner, group);
+	}
+    }
+  __set_errno (ELOOP);
+  return -1;
+#endif
 }
 libc_hidden_def (__chown)
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure
new file mode 100644
index 0000000000..070bf5caeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure
@@ -0,0 +1,135 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128ibm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_mlong_double_128ibm=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128ibm=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128ibm" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128ibm" >&6
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+  echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... $ECHO_C" >&6
+if test "${libc_cv_mabi_ibmlongdouble+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_mabi_ibmlongdouble=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mabi_ibmlongdouble=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mabi_ibmlongdouble" >&5
+echo "${ECHO_T}$libc_cv_mabi_ibmlongdouble" >&6
+
+  if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+    CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+  else
+    { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 IBM extended format support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 IBM extended format support" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.in b/sysdeps/unix/sysv/linux/powerpc/configure.in
new file mode 100644
index 0000000000..1768ab1f99
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure.in
@@ -0,0 +1,37 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
+	       libc_cv_mlong_double_128ibm, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+	       libc_cv_mlong_double_128ibm=yes,
+	       libc_cv_mlong_double_128ibm=no)
+CFLAGS="$save_CFLAGS"])
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+  AC_CACHE_CHECK(whether $CC $CFLAGS supports -mabi=ibmlongdouble,
+		 libc_cv_mabi_ibmlongdouble, [dnl
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+  AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+		 libc_cv_mabi_ibmlongdouble=yes,
+		 libc_cv_mabi_ibmlongdouble=no)
+  CFLAGS="$save_CFLAGS"])
+
+  if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+    CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+  else
+    AC_MSG_ERROR([this configuration requires -mlong-double-128 IBM extended format support])
+  fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
index a548a96325..7c02c68985 100644
--- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Linux/PPC version.
-   Copyright (C) 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2001, 2003, 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
@@ -17,9 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-
-#include "config.h"
-#include "kernel-features.h"
+#include <config.h>
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 extern int __cache_line_size;
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/bsd/m68k/wait.S b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
index 9fb4fd93bd..a7dcb2e5ff 100644
--- a/sysdeps/unix/bsd/m68k/wait.S
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,20 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+#ifndef _DL_VDSO_H
+#define _DL_VDSO_H	1
 
-SYSCALL__ (wait, 1)
-#ifdef __motorola__
-	tst.l 4(sp)
-	beq 1f
-	movea.l 4(sp), a0
-	move.l d1, (a0)
-#else
-	tstl sp@(4)
-	beq 1f
-	moveal sp@(4), a0
-	movel d1, a0@
-#endif
-1:	rts
+/* Functions for resolving symbols in the VDSO link map.  */
+extern void *_dl_vdso_vsym (const char *name, const char *version)
+     internal_function attribute_hidden;
 
-weak_alias (__wait, wait)
+#endif /* dl-vdso.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
new file mode 100644
index 0000000000..67c570648a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
@@ -0,0 +1,110 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sysdep.h>
+#include <stdlib.h>
+
+#include <kernel-features.h>
+
+/*
+  In Linux 2.1.x the chown functions have been changed.  A new function lchown
+  was introduced.  The new chown now follows symlinks - the old chown and the
+  new lchown do not follow symlinks.
+  This file emulates chown() under the old kernels.
+*/
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_LCHOWN_SYSCALL
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+  else
+    result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      return -1;
+    }
+# else
+  /* Don't inline the rest to avoid unnecessary code duplication.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = __lchown (file, owner, group);
+  else
+    result = __chown (file, owner, group);
+  if (result < 0)
+    __atfct_seterrno (errno, fd, buf);
+# endif
+
+  return result;
+
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
new file mode 100644
index 0000000000..6d2e766aa4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -0,0 +1,117 @@
+/* Get frequency of the system processor.  powerpc/Linux version.
+   Copyright (C) 2000, 2001, 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 <ctype.h>
+#include <fcntl.h>
+#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
+     We search for this line and convert the number into an integer.  */
+  static hp_timing_t timebase_freq;
+  hp_timing_t result = 0L;
+
+  /* If this function was called before, we know the result.  */
+  if (timebase_freq != 0)
+    return timebase_freq;
+
+  /* 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
+    {
+      int fd = open ("/proc/cpuinfo", O_RDONLY);
+
+      if (__builtin_expect (fd != -1, 1))
+	{
+	  /* 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))
+	    {
+	      /* 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 (__builtin_expect (n, 1) > 0)
+	    {
+	      char *mhz = memmem (buf, n, "timebase", 7);
+
+	      if (__builtin_expect (mhz != NULL, 1))
+		{
+		  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')
+		    {
+		      if (*mhz >= '0' && *mhz <= '9')
+			{
+			  result *= 10;
+			  result += *mhz - '0';
+			}
+
+		      ++mhz;
+		    }
+		}
+	      timebase_freq = result;
+	    }
+	  close (fd);
+	}
+    }
+
+  return timebase_freq;
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
index 339023f14f..b381baa285 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* 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
@@ -16,15 +16,27 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sys/types.h>
-
 #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>
 
-extern int truncate (const char *__unbounded path, int dummy,
-		     off64_t length);
+/* 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 truncate64 (const char *__unbounded path, int dummy,
-		off64_t length) {
-  return truncate (path, dummy, length);
+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/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
new file mode 100644
index 0000000000..a8005c1163
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -0,0 +1,130 @@
+/* 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
+   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 <stdlib.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <bp-start.h>
+#include <bp-sym.h>
+
+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);
+  };
+
+
+#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)
+{
+#if __BOUNDED_POINTERS__
+  char **argv;
+#else
+# define argv ubp_av
+#endif
+
+  /* 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...  */
+  if (*stack_on_entry != NULL)
+    {
+      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.  */
+      /* 32/64-bit agnostic load from stack */
+      argc = *(long int *__unbounded) stack_on_entry;
+      ubp_av = stack_on_entry + 1;
+      ubp_ev = ubp_av + argc + 1;
+#ifdef HAVE_AUX_VECTOR
+      temp = ubp_ev;
+      while (*temp != NULL)
+	++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)
+    switch (av->a_type)
+      {
+      case AT_DCACHEBSIZE:
+	{
+	  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/nldbl-abi.h b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist
deleted file mode 100644
index 297e031620..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-clone.S
-kernel_stat.h
-fe_nomask.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index 8ecbb548a2..e945834945 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -1,5 +1,5 @@
 /* brk system call for Linux/ppc.
-   Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995-97, 1999, 2000, 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
@@ -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>
 #define _ERRNO_H	1
@@ -27,28 +27,38 @@
 	.section ".text"
 ENTRY (BP_SYM (__brk))
 	DISCARD_BOUNDS (r3)	/* the bounds are meaningless, so toss 'em */
-
+	mflr	r0
 	stwu    r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
 	stw	r3,8(r1)
+	stw	r0,20(r1)
+	cfi_offset (lr, 4)
 	DO_CALL(SYS_ify(brk))
 	lwz     r6,8(r1)
 #ifdef PIC
-	mflr    r4
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,__curbrk-1b@ha
+	stw	r3,__curbrk-1b@l(r5)
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
 	lwz     r5,__curbrk@got(r5)
-	mtlr    r4
 	stw     r3,0(r5)
+# endif
 #else
 	lis     r4,__curbrk@ha
 	stw     r3,__curbrk@l(r4)
 #endif
+	lwz	r0,20(r1)
 	cmplw   r6,r3
 	addi    r1,r1,16
+	mtlr	r0
 	li	r3,0
 	blelr+
 	li      r3,ENOMEM
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (BP_SYM (__brk))
 
 weak_alias (BP_SYM (__brk), BP_SYM (brk))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index f232284747..37b777799c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -1,5 +1,5 @@
 /* Wrapper around clone system call.
-   Copyright (C) 1997,98,99,2000,02,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,02,04,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
@@ -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>
 #define _ERRNO_H	1
@@ -49,6 +49,7 @@ ENTRY (BP_SYM (__clone))
 
 	/* Set up stack frame for parent.  */
 	stwu	r1,-32(r1)
+	cfi_adjust_cfa_offset (32)
 #ifdef RESET_PID
 	stmw	r28,16(r1)
 #else
@@ -83,6 +84,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -132,11 +137,13 @@ L(parent):
 #endif
 	addi	r1,r1,32
 	bnslr+
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 
 L(badargs):
 	li	r3,EINVAL
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
index 2c85a3a9e9..8d3b9ad1f4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
@@ -1,5 +1,5 @@
 /* Procedure definition for FE_NOMASK_ENV for Linux/ppc.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 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
@@ -23,11 +23,11 @@
 #include <unistd.h>
 #include <sysdep.h>
 #include <sys/prctl.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_NEW_PRCTL_SYSCALL == 0
 /* This is rather fiddly under Linux.  We don't have direct access,
-   and there is no system call, but we can change the bits 
+   and there is no system call, but we can change the bits
    in a signal handler's context...  */
 
 static struct sigaction oact;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
new file mode 100644
index 0000000000..9f70f795bc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc32 specific routines.
+powerpc/powerpc32/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
index e79d74cb75..e83f7f04b7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002,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
@@ -23,12 +23,12 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
 #endif
 
 
@@ -39,7 +39,7 @@ __ftruncate64 (fd, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -57,7 +57,7 @@ __ftruncate64 (fd, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
@@ -74,5 +74,5 @@ weak_alias (__ftruncate64, ftruncate64)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
+# include <misc/ftruncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
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..c28c34664c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -0,0 +1,286 @@
+/* Save current context, powerpc32 common.
+   Copyright (C) 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
+   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)
+	cfi_adjust_cfa_offset (16)
+/* 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)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	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 4c75354a5f..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,362 +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
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# 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	JUMPTARGET(__sigprocmask)
-
-	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	JUMPTARGET(__sigprocmask)
+# 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)
@@ -378,13 +69,13 @@ 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)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__getcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
index 5615718e11..9451f9eb36 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
@@ -1,5 +1,5 @@
 /* Set up a context to call a function.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -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 <shlib-compat.h>
@@ -26,9 +26,7 @@
 
 ENTRY(__makecontext)
 	/* Set up the first 7 args to the function in its registers */
-	addi	r11,r3,_UC_REG_SPACE+12
-	clrrwi  r11,r11,4
-	stw	r11,_UC_REGS_PTR(r3)
+	lwz	r11,_UC_REGS_PTR(r3)
 	stw	r6,_UC_GREGS+(PT_R3*4)(r11)
 	stw	r7,_UC_GREGS+(PT_R4*4)(r11)
 	stw	r8,_UC_GREGS+(PT_R5*4)(r11)
@@ -49,10 +47,12 @@ ENTRY(__makecontext)
 	/* Set the function's LR to point to the exitcode below. */
 #ifdef PIC
 	mflr	r0
+	cfi_register(lr,r0)
 	bl	1f
 1:	mflr	r6
 	addi	r6,r6,L(exitcode)-1b
 	mtlr	r0
+	cfi_same_value (lr)
 #else
 	lis	r6,L(exitcode)@ha
 	addi	r6,r6,L(exitcode)@l
@@ -101,7 +101,7 @@ ENTRY(__makecontext)
 L(exitcode):
 	mr.	r3,r31
 	beq	4f
-	bl	JUMPTARGET(__setcontext)
+	bl	__setcontext@local
 4:	bl	HIDDEN_JUMPTARGET(exit)
 	b	4b
 
@@ -136,10 +136,12 @@ ENTRY(__novec_makecontext)
 	/* Set the function's LR to point to the exitcode below. */
 #ifdef PIC
 	mflr	r0
+	cfi_register(lr,r0)
 	bl	1f
 1:	mflr	r6
 	addi	r6,r6,L(novec_exitcode)-1b
 	mtlr	r0
+	cfi_same_value (lr)
 #else
 	lis	r6,L(novec_exitcode)@ha
 	addi	r6,r6,L(novec_exitcode)@l
@@ -188,7 +190,7 @@ ENTRY(__novec_makecontext)
 L(novec_exitcode):
 	mr.	r3,r31
 	beq	4f
-	bl	JUMPTARGET(__novec_setcontext)
+	bl	__novec_setcontext@local
 4:	bl	HIDDEN_JUMPTARGET(exit)
 	b	4b
 
@@ -206,7 +208,7 @@ compat_symbol (libc, __novec_makecontext, makecontext, GLIBC_2_3_3)
 	compat_text_section
 ENTRY (__makecontext_stub)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__makecontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
index 495c98ab97..4d9fa263c4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
@@ -58,7 +58,7 @@ __libc_pread (fd, buf, count, offset)
 
       return result;
     }
-  
+
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
index d4fe1eea2d..9527554e9b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
index 3727fa7a42..32383f4301 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
index 080c88cf29..acc250a88f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
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..40a7a24f19
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -0,0 +1,293 @@
+/* Jump to a new context powerpc32 common.
+   Copyright (C) 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
+   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)
+	cfi_adjust_cfa_offset (16)
+	stw	r0,20(r1)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	stw	r31,12(r1)
+	cfi_offset(r31,-4)
+	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 2d4fa9910e..1f2e250057 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, 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
@@ -14,383 +14,55 @@
 
    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(__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	JUMPTARGET(__sigprocmask)
-	cmpwi	r3,0
-	bne	L(error_exit)
-
-#ifdef PIC
-	mflr    r8
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# 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	JUMPTARGET(__sigprocmask)
-	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)
@@ -399,13 +71,13 @@ 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)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__setcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
index c52ad9babf..0bb5bef78b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,99, 2003, 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
@@ -13,8 +13,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-cancel.h>
 #include <socketcall.h>
@@ -39,15 +39,20 @@
 #define NARGS 3
 #endif
 
+/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used
+   for temp saves.  44(r1) is used to save r30.  */
 #define stackblock 20
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
 	.text
 ENTRY(__socket)
-	cfi_startproc
 	stwu r1,-48(r1)
 	cfi_adjust_cfa_offset(48)
 #if NARGS >= 1
@@ -69,12 +74,6 @@ ENTRY(__socket)
 	stw  r8,20+stackblock(r1)
 #endif
 #if NARGS >= 7
-	stw  r9,24+stackblock(r1)
-#endif
-#if NARGS >= 8
-	stw  r10,28+stackblock(r1)
-#endif
-#if NARGS >= 9
 #error too many arguments!
 #endif
 
@@ -94,6 +93,7 @@ ENTRY(__socket)
 	mflr	r9
 	stw	r9,52(r1)
 	cfi_offset (lr, 4)
+	CGOTSETUP
 	CENABLE
 	stw	r3,16(r1)
 	li	r3,P(SOCKOP_,socket)
@@ -107,13 +107,15 @@ ENTRY(__socket)
 	lwz	r4,52(r1)
 	lwz	r0,12(r1)
 	lwz	r3,8(r1)
+	CGOTRESTORE
 	mtlr	r4
 	mtcr	r0
 	addi	r1,r1,48
 	PSEUDO_RET
 #endif
-	cfi_endproc
 
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
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..0c7b945ed2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -0,0 +1,517 @@
+/* Save current context and jump to a new context.
+   Copyright (C) 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
+   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)
+	cfi_adjust_cfa_offset (16)
+/* 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)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	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
+	mtlr    r8
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	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	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	r1,_UC_GREGS+(PT_R1*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 c4f0faddc3..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,684 +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
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# 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	JUMPTARGET(__sigprocmask)
-	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
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# 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	JUMPTARGET(__sigprocmask)
-	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)
@@ -700,13 +69,13 @@ 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)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__swapcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 2ee3e60229..c42efbabdd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1997-2003,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
@@ -20,6 +20,7 @@
 #define _LINUX_POWERPC_SYSDEP_H 1
 
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
 
 /* Some systen calls got renamed over time, but retained the same semantics.
    Handle them here so they can be catched by both C and assembler stubs in
@@ -54,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...)				\
   ({									\
@@ -92,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"							\
@@ -109,16 +213,16 @@
 
 # undef INTERNAL_SYSCALL_ERROR_P
 # define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  (__builtin_expect (err & (1 << 28), 0))
+  ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
 
 # 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 (); \
@@ -170,4 +274,28 @@
 #endif /* __ASSEMBLER__ */
 
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  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_MANGLE3(destreg, reg, tmpreg) \
+	lwz	tmpreg,POINTER_GUARD(r2); \
+	xor	destreg,tmpreg,reg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+#  define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/powerpc/powerpc32/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
index ce8ebc2a97..f107e84373 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,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
@@ -24,12 +25,12 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-int have_no_truncate64;
+int __have_no_truncate64;
 #endif
 
 
@@ -40,7 +41,7 @@ truncate64 (path, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -58,7 +59,7 @@ truncate64 (path, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
@@ -68,11 +69,11 @@ truncate64 (path, length)
       __set_errno (EINVAL);
       return -1;
     }
-  return truncate (path, (off_t) length);
+  return __truncate (path, (off_t) length);
 #endif
 }
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
+# include <misc/truncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
deleted file mode 100644
index e47b24a09e..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-#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
-
-#define _UC_LINK	4
-#define _UC_STACK_SP	8
-#define _UC_STACK_SIZE	16
-#define _UC_REGS_PTR	48
-#define _UC_SIGMASK	52
-#define _UC_REG_SPACE	180
-
-/* offsets within mcontext_t */
-#define _UC_GREGS	0
-#define _UC_FREGS	192
-#define _UC_VREGS	464
-#define _UC_VSCR	976
-#define _UC_VRSAVE	980
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
new file mode 100644
index 0000000000..293761f260
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
@@ -0,0 +1,26 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+-- Offsets in ucontext_t.
+#define ucontext(member)	offsetof (ucontext_t, member)
+_UC_LINK		ucontext (uc_link)
+_UC_STACK_SP		ucontext (uc_stack.ss_sp)
+_UC_STACK_SIZE		ucontext (uc_stack.ss_size)
+_UC_REGS_PTR		ucontext (uc_mcontext.uc_regs)
+_UC_SIGMASK		ucontext (uc_sigmask)
+_UC_REG_SPACE		ucontext (uc_reg_space)
+
+-- Offsets in mcontext_t.
+#define mcontext(member)	offsetof (mcontext_t, member)
+_UC_GREGS		mcontext (gregs)
+_UC_FREGS		mcontext (fpregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VSCR		mcontext (vrregs.vscr)
+_UC_VRSAVE		mcontext (vrregs.vrsave)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
index 5fb7868c31..66a149f10b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
@@ -50,7 +50,7 @@ ENTRY (__vfork)
 	bnslr+
 
 .Lsyscall_error:
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 #endif
 
 PSEUDO_END (__vfork)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist
deleted file mode 100644
index 6085928f34..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-clone.S
-fe_nomask.c
-kernel_stat.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
index 3f74f55271..f2ac00d4c7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
@@ -1,5 +1,5 @@
 /* brk system call for Linux.  PowerPC64 version.
-   Copyright (C) 1995,96,97,99, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,99, 2000,02, 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
@@ -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>
 #define _ERRNO_H	1
@@ -33,6 +33,7 @@ ENTRY (BP_SYM (__brk))
 	DISCARD_BOUNDS (r3)	/* the bounds are meaningless, so toss 'em.  */
 
 	stdu    r1,-64(r1)
+	cfi_adjust_cfa_offset (64)
 	std	r3,48(r1)
 	DO_CALL(SYS_ify(brk))
 	ld     r6,48(r1)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 287597c480..f1a55e64db 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -1,5 +1,5 @@
 /* Wrapper around clone system call.  PowerPC64 version.
-   Copyright (C) 1997,98,99,2000,02, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,02,04, 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
@@ -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>
 #define _ERRNO_H	1
@@ -48,11 +48,16 @@ ENTRY (BP_SYM (__clone))
 
 	/* Set up stack frame for parent.  */
 	stdu	r1,-80(r1)
+	cfi_adjust_cfa_offset (80)
 	std	r29,56(r1)
 	std	r30,64(r1)
 	std	r31,72(r1)
+	cfi_offset(r29,-56)
+	cfi_offset(r30,-64)
+	cfi_offset(r31,-72)
 #ifdef RESET_PID
 	std	r28,48(r1)
+	cfi_offset(r28,-48)
 #endif
 
 	/* Set up stack frame for child.  */
@@ -76,6 +81,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -127,6 +136,8 @@ L(parent):
 L(badargs):
 	li	r3,EINVAL
 	b	JUMPTARGET(__syscall_error)
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
index 7571f28780..62f735514a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
@@ -1,5 +1,5 @@
 /* Procedure definition for FE_NOMASK_ENV for Linux/ppc64.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 #include <sys/prctl.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 const fenv_t *
 __fe_nomask_env (void)
@@ -36,7 +36,7 @@ __fe_nomask_env (void)
       && INTERNAL_SYSCALL_ERRNO (result, err) == EINVAL)
     __set_errno (ENOSYS);
 # endif
-#else  
+#else
   __set_errno (ENOSYS);
 #endif
   return FE_ENABLED_ENV;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
new file mode 100644
index 0000000000..6243d2ef27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc64 specific routines.
+powerpc/powerpc64/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
index 61e0f8ed11..8d7c959ff9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -14,13 +14,13 @@
 
    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"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -37,9 +37,11 @@ ENTRY(__novec_getcontext)
   mflr  r0
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -140,7 +142,9 @@ ENTRY(__novec_getcontext)
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -175,9 +179,11 @@ ENTRY(__getcontext)
   mflr  r0
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -387,7 +393,9 @@ L(has_no_vec):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
new file mode 100644
index 0000000000..ac4a0d5aa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
@@ -0,0 +1,77 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.
+   Copyright (C) 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
+   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	_LDSODEFS_H
+
+/* Get the real definitions.  */
+#include_next <ldsodefs.h>
+
+/* Now define our stuff.  */
+
+static __always_inline bool
+_dl_ppc64_is_opd_sym (const struct link_map *l, const ElfW(Sym) *sym)
+{
+  return (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
+	  && l->l_addr + sym->st_value >= (ElfW(Addr)) l->l_ld
+	  && l->l_addr + sym->st_value < l->l_map_end
+	  && sym->st_size != 0);
+}
+
+static __always_inline bool
+_dl_ppc64_addr_sym_match (const struct link_map *l, const ElfW(Sym) *sym,
+			  const ElfW(Sym) *matchsym, ElfW(Addr) addr)
+{
+  ElfW(Addr) value = l->l_addr + sym->st_value;
+  if (_dl_ppc64_is_opd_sym (l, sym))
+    {
+      if (addr < value || addr >= value + 24)
+	{
+	  value = *(ElfW(Addr) *) value;
+	  if (addr < value || addr >= value + sym->st_size)
+	    return false;
+	}
+    }
+  else if (sym->st_shndx == SHN_UNDEF || sym->st_size == 0)
+    {
+      if (addr != value)
+	return false;
+    }
+  else if (addr < value || addr >= value + sym->st_size)
+    return false;
+
+  if (matchsym == NULL)
+    return true;
+
+  ElfW(Addr) matchvalue = l->l_addr + matchsym->st_value;
+  if (_dl_ppc64_is_opd_sym (l, matchsym)
+      && (addr < matchvalue || addr > matchvalue + 24))
+    matchvalue = *(ElfW(Addr) *) matchvalue;
+
+  return matchvalue < value;
+}
+
+/* If this is a function symbol defined past the end of our dynamic
+   section, then it must be a function descriptor.  Allow these symbols
+   to match their associated function code range as well as the
+   descriptor addresses.  */
+#undef DL_ADDR_SYM_MATCH
+#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
+  _dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR)
+
+#endif /* ldsodefs.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 8034559200..4a82802d96 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -14,11 +14,11 @@
 
    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 "kernel-features.h"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -41,7 +41,9 @@ ENTRY(__makecontext)
   /* Get the address of the target functions first parameter.  */
   addi  r6,r1,FRAME_PARM4_SAVE
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
 
   /* Get the ucontexts stack pointer and size.  Compute the top of stack
      and round down to a quadword boundary.  Then stack a dummy frame
@@ -168,7 +170,9 @@ L(gotexitcodeaddr):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -180,4 +184,4 @@ L(gotexitcodeaddr):
 #endif
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
index d5b77e0b57..315d1195e8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
@@ -57,7 +57,7 @@ __libc_pread (fd, buf, count, offset)
 
       return result;
     }
-  
+
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
index 9bbe389420..f775e1f1eb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
index 96b72e18a5..0f509154e2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
index 9e68acdf08..22224324a1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
index 6514f442a6..48e9af363d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
@@ -1,5 +1,5 @@
 /* Switch to context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -14,13 +14,13 @@
 
    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"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -33,8 +33,11 @@ ENTRY(__novec_setcontext)
 #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
 /*
@@ -47,7 +50,7 @@ ENTRY(__novec_setcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(nv_do_sigret)
 
@@ -104,7 +107,7 @@ ENTRY(__novec_setcontext)
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
+  mtcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
@@ -167,7 +170,9 @@ L(nv_do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset(lr,FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -199,8 +204,11 @@ ENTRY(__setcontext)
 #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
 /*
@@ -213,7 +221,7 @@ ENTRY(__setcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(do_sigret)
 
@@ -380,11 +388,11 @@ L(has_no_vec):
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
   ld   r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31)
+  mtcr r0
   ld   r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31)
   ld   r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31)
   ld   r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31)
@@ -443,7 +451,9 @@ L(do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
index ec3ab5d9e6..15d8e84c1f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,99, 2003, 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
@@ -13,8 +13,8 @@
 
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   write to the Free Software Foundation, Inc., 51 Franklin Street, 
+   Fifth Floor, Boston MA 02110-1301, USA.  */
 
 #include <sysdep-cancel.h>
 #include <socketcall.h>
@@ -41,18 +41,17 @@
 
 #define stackblock 80 /* offset to socket parm area.  */
 
-#ifndef socket
-/* If this is just socket.S leave it alone! */
-#else
 #ifndef __socket
-#define __socket P(__,socket)
-#endif
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
 	.text
 ENTRY(__socket)
 	CALL_MCOUNT NARGS
-	cfi_startproc
 	stdu r1,-144(r1)
 	cfi_adjust_cfa_offset(144)
 #if NARGS >= 1
@@ -117,7 +116,8 @@ ENTRY(__socket)
 	addi	r1,r1,144
 	PSEUDO_RET
 #endif
-	cfi_endproc
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index f99df951a2..936d641b6b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and install the given one.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -14,13 +14,13 @@
 
    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"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -35,11 +35,14 @@ ENTRY(__novec_swapcontext)
   std  r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -150,7 +153,7 @@ ENTRY(__novec_swapcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(nv_do_sigret)
 
@@ -199,7 +202,7 @@ ENTRY(__novec_swapcontext)
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
+  mtcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
@@ -262,6 +265,7 @@ L(nv_do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset(lr,FRAME_LR_SAVE)
   stdu r1,-128(r1)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
@@ -296,11 +300,14 @@ ENTRY(__swapcontext)
   std  r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -521,7 +528,7 @@ L(has_no_vec):
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(do_sigret)
 
@@ -681,11 +688,11 @@ L(has_no_vec2):
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
   ld   r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31)
+  mtcr r0
   ld   r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31)
   ld   r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31)
   ld   r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31)
@@ -744,7 +751,9 @@ L(do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 38a376fa90..aab4b721c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,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
@@ -23,6 +23,7 @@
 #define _LINUX_POWERPC_SYSDEP_H 1
 
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
 
 /* Define __set_errno() for INLINE_SYSCALL macro below.  */
 #ifndef __ASSEMBLER__
@@ -61,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
 
@@ -100,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"							\
@@ -115,14 +222,14 @@
     (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
 
 #undef INTERNAL_SYSCALL_ERROR_P
 #define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  (__builtin_expect (err & (1 << 28), 0))
+  ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
 
 #undef INTERNAL_SYSCALL_ERRNO
 #define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
@@ -180,4 +287,29 @@
 #define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
 #define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  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_MANGLE3(destreg, reg, tmpreg) \
+	ld	tmpreg,POINTER_GUARD(r13); \
+	xor	destreg,tmpreg,reg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+#  define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/powerpc/powerpc64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
deleted file mode 100644
index 45f1bfdae9..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the powerpc64 ABI stack frame.  */
-
-#define FRAME_BACKCHAIN 0
-#define FRAME_CR_SAVE 8
-#define FRAME_LR_SAVE 16
-#define FRAME_COMPILER_DW 24
-#define FRAME_LINKER_DW 32
-#define FRAME_TOC_SAVE 40
-#define FRAME_PARM_SAVE 48
-#define FRAME_PARM1_SAVE 48
-#define FRAME_PARM2_SAVE 56
-#define FRAME_PARM3_SAVE 64
-#define FRAME_PARM4_SAVE 72
-#define FRAME_PARM5_SAVE 80
-#define FRAME_PARM6_SAVE 88
-#define FRAME_PARM7_SAVE 96
-#define FRAME_PARM8_SAVE 104
-#define FRAME_PARM9_SAVE 112
-
-
-/* Offsets of the fields in the ucontext_t structure.  */
-
-#define UCONTEXT_LINK 8
-#define UCONTEXT_STACK 16
-#define UCONTEXT_STACK_SP 16
-#define UCONTEXT_STACK_FLAGS 24
-#define UCONTEXT_STACK_SIZE 32
-#define UCONTEXT_SIGMASK 40
-#define UCONTEXT_MCONTEXT 168
-#define SIGCONTEXT_SIGNAL 200
-#define SIGCONTEXT_HANDLER 208
-#define SIGCONTEXT_OLDMASK 216
-#define SIGCONTEXT_PT_REGS 224
-#define SIGCONTEXT_GP_REGS 232
-#define SIGCONTEXT_FP_REGS 616
-#define SIGCONTEXT_V_REGS_PTR 880
-#define SIGCONTEXT_V_RESERVE 888
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
new file mode 100644
index 0000000000..a35418d9d4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
@@ -0,0 +1,50 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+
+-- Offsets of the fields in the powerpc64 ABI stack frame.
+-- XXX Do these correspond to some struct?
+
+FRAME_BACKCHAIN		0
+FRAME_CR_SAVE		8
+FRAME_LR_SAVE		16
+FRAME_COMPILER_DW	24
+FRAME_LINKER_DW		32
+FRAME_TOC_SAVE		40
+FRAME_PARM_SAVE		48
+FRAME_PARM1_SAVE	48
+FRAME_PARM2_SAVE	56
+FRAME_PARM3_SAVE	64
+FRAME_PARM4_SAVE	72
+FRAME_PARM5_SAVE	80
+FRAME_PARM6_SAVE	88
+FRAME_PARM7_SAVE	96
+FRAME_PARM8_SAVE	104
+FRAME_PARM9_SAVE	112
+
+
+-- Offsets of the fields in the ucontext_t structure.
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+UCONTEXT_LINK			ucontext (uc_link)
+UCONTEXT_STACK			ucontext (uc_stack)
+UCONTEXT_STACK_SP		ucontext (uc_stack.ss_sp)
+UCONTEXT_STACK_FLAGS		ucontext (uc_stack.ss_flags)
+UCONTEXT_STACK_SIZE		ucontext (uc_stack.ss_size)
+UCONTEXT_SIGMASK		ucontext (uc_sigmask)
+UCONTEXT_MCONTEXT		ucontext (uc_mcontext)
+SIGCONTEXT_SIGNAL		mcontext (signal)
+SIGCONTEXT_HANDLER		mcontext (handler)
+SIGCONTEXT_OLDMASK		mcontext (oldmask)
+SIGCONTEXT_PT_REGS		mcontext (regs)
+SIGCONTEXT_GP_REGS		mcontext (gp_regs)
+SIGCONTEXT_FP_REGS		mcontext (fp_regs)
+SIGCONTEXT_V_REGS_PTR		mcontext (v_regs)
+SIGCONTEXT_V_RESERVE		mcontext (vmx_reserve)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
index 9a91ba5b2f..e10b40f96c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
@@ -1 +1 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
+#include <sysdeps/unix/sysv/linux/x86_64/umount.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/readelflib.c b/sysdeps/unix/sysv/linux/powerpc/readelflib.c
index b4a449cdff..3c6b2daf81 100644
--- a/sysdeps/unix/sysv/linux/powerpc/readelflib.c
+++ b/sysdeps/unix/sysv/linux/powerpc/readelflib.c
@@ -1,5 +1,5 @@
 /* Special checks on libraries for ldconfig.  Linux/PowerPC version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -52,10 +52,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index 8e694c2ad3..577689f18d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2002, 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
@@ -35,10 +35,14 @@ __BEGIN_DECLS
 /* These definitions are normally provided by ucontext.h via 
    asm/sigcontext.h, asm/ptrace.h, and asm/elf.h.  Otherwise we define 
    them here.  */ 
-#ifndef __PPC64_ELF_H
+#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
 #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */
 #define ELF_NFPREG      33      /* includes fpscr */
-#define ELF_NVRREG      33      /* includes vscr */
+#if __WORDSIZE == 32
+# define ELF_NVRREG      33      /* includes vscr */
+#else
+# define ELF_NVRREG      34      /* includes vscr */
+#endif
 
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
@@ -46,15 +50,10 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 typedef double elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
-/* gcc 3.1 and newer support __uint128_t.  */
-#if !__GNUC_PREREQ(3,1)
-typedef struct {
-  unsigned long u[4];
-} __attribute((aligned(16))) __uint128_t;
-#endif
-
 /* Altivec registers */
-typedef __uint128_t elf_vrreg_t;
+typedef struct {
+  unsigned int u[4];
+} __attribute__ ((aligned (16))) elf_vrreg_t;
 typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
index 91a87307f3..5d055f67fe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 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
@@ -79,8 +79,24 @@ enum __ptrace_request
 #define PT_DETACH PTRACE_DETACH
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
index a499a80ef9..9eb50aa96b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 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
@@ -70,8 +70,6 @@ typedef struct
  * can be refernced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC
  * is set in AT_HWCAP.  */
     
-# include <asm/types.h>
-
 /* Number of general registers.  */
 # define NGREG	48	/* includes r0-r31, nip, msr, lr, etc.   */
 # define NFPREG	33	/* includes fp0-fp31 &fpscr.  */
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
new file mode 100644
index 0000000000..cfc86ba806
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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 <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_ppoll
+static int __generic_ppoll (struct pollfd *fds, nfds_t nfds,
+			    const struct timespec *timeout,
+			    const sigset_t *sigmask);
+
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
+       const sigset_t *sigmask)
+{
+  /* The Linux kernel can in some situations update the timeout value.
+     We do not want that so use a local variable.  */
+  struct timespec tval;
+  if (timeout != NULL)
+    {
+      tval = *timeout;
+      timeout = &tval;
+    }
+
+  int result;
+
+  if (SINGLE_THREAD_P)
+    result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
+
+      result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask,
+			       _NSIG / 8);
+
+      LIBC_CANCEL_RESET (oldtype);
+    }
+
+# ifndef __ASSUME_PPOLL
+  if (result == -1 && errno == ENOSYS)
+    result = __generic_ppoll (fds, nfds, timeout, sigmask);
+# endif
+
+  return result;
+}
+
+# ifndef __ASSUME_PPOLL
+#  define ppoll static __generic_ppoll
+# endif
+#endif
+
+#ifndef __ASSUME_PPOLL
+# include <io/ppoll.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 90057f3f40..d459e98f2c 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pread
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index 44ea68fa9f..07d8b68acc 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pread
diff --git a/sysdeps/unix/sysv/linux/prof-freq.c b/sysdeps/unix/sysv/linux/prof-freq.c
index 621a4c4d25..49ec257e70 100644
--- a/sysdeps/unix/sysv/linux/prof-freq.c
+++ b/sysdeps/unix/sysv/linux/prof-freq.c
@@ -1,5 +1,5 @@
 /* Determine realtime clock frequency.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -19,7 +19,7 @@
 
 #include <sys/time.h>
 #include <libc-internal.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
new file mode 100644
index 0000000000..0dd744f527
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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 <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_pselect6
+static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+			      fd_set *exceptfds,
+			      const struct timespec *timeout,
+			      const sigset_t *sigmask);
+
+
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+	   const struct timespec *timeout, const sigset_t *sigmask)
+{
+  /* The Linux kernel can in some situations update the timeout value.
+     We do not want that so use a local variable.  */
+  struct timespec tval;
+  if (timeout != NULL)
+    {
+      tval = *timeout;
+      timeout = &tval;
+    }
+
+  /* Note: the system call expects 7 values but on most architectures
+     we can only pass in 6 directly.  If there is an architecture with
+     support for more parameters a new version of this file needs to
+     be created.  */
+  struct
+  {
+    const sigset_t *ss;
+    size_t ss_len;
+  } data;
+
+  data.ss = sigmask;
+  data.ss_len = _NSIG / 8;
+
+  int result;
+
+#ifndef CALL_PSELECT6
+# define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+  INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds,	      \
+		  timeout, data)
+#endif
+
+  if (SINGLE_THREAD_P)
+    result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+			    &data);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
+
+      result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+			      &data);
+
+      LIBC_CANCEL_RESET (oldtype);
+    }
+
+# ifndef __ASSUME_PSELECT
+  if (result == -1 && errno == ENOSYS)
+    result = __generic_pselect (nfds, readfds, writefds, exceptfds, timeout,
+				sigmask);
+# endif
+
+  return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+
+# ifndef __ASSUME_PSELECT
+#  define __pselect static __generic_pselect
+# endif
+#endif
+
+#ifndef __ASSUME_PSELECT
+# include <misc/pselect.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ptrace.c b/sysdeps/unix/sysv/linux/ptrace.c
index e33eee0ee8..e149d80477 100644
--- a/sysdeps/unix/sysv/linux/ptrace.c
+++ b/sysdeps/unix/sysv/linux/ptrace.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000,2003,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
@@ -21,6 +21,7 @@
 #include <sys/ptrace.h>
 #include <sys/user.h>
 #include <stdarg.h>
+#include <signal.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -89,6 +90,19 @@ ptrace (enum __ptrace_request request, ...)
 #endif
       break;
 
+    case PTRACE_GETSIGINFO:
+    case PTRACE_SETSIGINFO:
+      (void) CHECK_1 ((siginfo_t *) data);
+      break;
+
+    case PTRACE_GETEVENTMSG:
+      (void) CHECK_1 ((unsigned long *) data);
+      break;
+
+    case PTRACE_SETOPTIONS:
+      (void) CHECK_1 ((long *) data);
+      break;
+
     case PTRACE_TRACEME:
     case PTRACE_CONT:
     case PTRACE_KILL:
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index f4eb2f5544..7afb814518 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pwrite
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index ae63ed0794..a0a6a08311 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pwrite
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index fa815e9581..e2c5002390 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir.c>
 
-weak_alias(__readdir64, readdir64)
+weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index d63680bf9a..bce56124ef 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir_r.c>
 
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
new file mode 100644
index 0000000000..1361596503
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Read the contents of the symbolic link PATH relative to FD into no
+   more than LEN bytes of BUF.  */
+ssize_t
+readlinkat (fd, path, buf, len)
+     int fd;
+     const char *path;
+     char *buf;
+     size_t len;
+{
+  int result;
+
+#ifdef __NR_readlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *pathbuf = NULL;
+
+  if (fd != AT_FDCWD && path[0] != '/')
+    {
+      size_t pathlen = strlen (path);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + pathlen;
+      pathbuf = __alloca (buflen);
+
+      __snprintf (pathbuf, buflen, procfd, fd, path);
+      path = pathbuf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
+libc_hidden_def (readlinkat)
diff --git a/sysdeps/unix/sysv/linux/readonly-area.c b/sysdeps/unix/sysv/linux/readonly-area.c
index ce5321bcef..69e926a7a1 100644
--- a/sysdeps/unix/sysv/linux/readonly-area.c
+++ b/sysdeps/unix/sysv/linux/readonly-area.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -16,6 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -33,7 +34,19 @@ __readonly_area (const char *ptr, size_t size)
 
   FILE *fp = fopen ("/proc/self/maps", "rc");
   if (fp == NULL)
-    return -1;
+    {
+      /* It is the system administrator's choice to not have /proc
+	 available to this process (e.g., because it runs in a chroot
+	 environment.  Don't fail in this case.  */
+      if (errno == ENOENT
+	  /* The kernel has a bug in that a process is denied access
+	     to the /proc filesystem if it is set[ug]id.  There has
+	     been no willingness to change this in the kernel so
+	     far.  */
+	  || errno == EACCES)
+	return 1;
+      return -1;
+    }
 
   /* We need no locking.  */
   __fsetlocking (fp, FSETLOCKING_BYCALLER);
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
new file mode 100644
index 0000000000..86bb75a7b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -0,0 +1,184 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+
+#ifndef __ASSUME_ATFCTS
+void
+attribute_hidden
+__atfct_seterrno_2 (int errval, int fd1, const char *buf1, int fd2,
+		    const char *buf2)
+{
+  if (buf1 != NULL || buf2 != NULL)
+    {
+      struct stat64 st;
+
+      if (errval == ENOTDIR)
+	{
+	  /* This can mean either the file descriptor is invalid or
+	     /proc is not mounted.  */
+	  if (buf1 != NULL)
+	    {
+	      if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
+		/* errno is already set correctly.  */
+		return;
+
+	      /* If /proc is not mounted there is nothing we can do.  */
+	      if (S_ISDIR (st.st_mode)
+		  && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		      || !S_ISDIR (st.st_mode)))
+		{
+		  errval = ENOSYS;
+		  goto out;
+		}
+	    }
+
+	  if (buf2 != NULL)
+	    {
+	      if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
+		/* errno is already set correctly.  */
+		return;
+
+	      /* If /proc is not mounted there is nothing we can do.  */
+	      if (S_ISDIR (st.st_mode)
+		  && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		      || !S_ISDIR (st.st_mode)))
+		errval = ENOSYS;
+	    }
+	}
+      else if (errval == ENOENT)
+	{
+	  /* This could mean the file descriptor is not valid.  We
+	     reuse BUF for the stat call.  Find the slash after the
+	     file descriptor number.  */
+	  if (buf1 != NULL)
+	    {
+	      *(char *) strchr (buf1 + sizeof "/proc/self/fd", '/') = '\0';
+
+	      int e = __lxstat64 (_STAT_VER, buf1, &st);
+	      if ((e == -1 && errno == ENOENT)
+		  ||(e == 0 && !S_ISLNK (st.st_mode)))
+		{
+		  errval = EBADF;
+		  goto out;
+		}
+	    }
+
+	  if (buf2 != NULL)
+	    {
+	      *(char *) strchr (buf2 + sizeof "/proc/self/fd", '/') = '\0';
+
+	      int e = __lxstat64 (_STAT_VER, buf2, &st);
+	      if ((e == -1 && errno == ENOENT)
+		  ||(e == 0 && !S_ISLNK (st.st_mode)))
+		errval = EBADF;
+	    }
+	}
+    }
+
+ out:
+  __set_errno (errval);
+}
+#endif
+
+
+/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD.  */
+int
+renameat (oldfd, old, newfd, new)
+     int oldfd;
+     const char *old;
+     int newfd;
+     const char *new;
+{
+  int result;
+
+#ifdef __NR_renameat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  static const char procfd[] = "/proc/self/fd/%d/%s";
+  char *bufold = NULL;
+
+  if (oldfd != AT_FDCWD && old[0] != '/')
+    {
+      size_t filelen = strlen (old);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufold = alloca (buflen);
+
+      __snprintf (bufold, buflen, procfd, oldfd, old);
+      old = bufold;
+    }
+
+  char *bufnew = NULL;
+
+  if (newfd != AT_FDCWD && new[0] != '/')
+    {
+      size_t filelen = strlen (new);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufnew = alloca (buflen);
+
+      __snprintf (bufnew, buflen, procfd, newfd, new);
+      new = bufnew;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (rename, err, 2, old,  new);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), newfd, bufnew,
+			  oldfd, bufold);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/s390/Dist b/sysdeps/unix/sysv/linux/s390/Dist
deleted file mode 100644
index 4af39f72c9..0000000000
--- a/sysdeps/unix/sysv/linux/s390/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-ldd-rewrite.sed
-sys/elf.h
-sys/procfs.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/s390/Implies b/sysdeps/unix/sysv/linux/s390/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile
index 8d8df743ac..5c5381871b 100644
--- a/sysdeps/unix/sysv/linux/s390/Makefile
+++ b/sysdeps/unix/sysv/linux/s390/Makefile
@@ -2,3 +2,7 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index 8c47077580..c611028f29 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 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
@@ -23,6 +23,10 @@
 
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -110,7 +114,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -199,10 +203,55 @@ struct flock64
 # endif
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
index ac94bb20b2..d25531c282 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/s390 version.
-   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000,2001,2002,2003,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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/s390/bits/shm.h b/sysdeps/unix/sysv/linux/s390/bits/shm.h
index b7c2ad0514..d88ed36efa 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/shm.h
@@ -80,6 +80,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000	/* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/s390/fpu/Implies b/sysdeps/unix/sysv/linux/s390/fpu/Implies
new file mode 100644
index 0000000000..3a8e225986
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with s390 specific routines.
+s390/fpu
diff --git a/sysdeps/unix/sysv/linux/s390/nldbl-abi.h b/sysdeps/unix/sysv/linux/s390/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/s390/readelflib.c b/sysdeps/unix/sysv/linux/s390/readelflib.c
index c8efcbf7ac..2782bc1e01 100644
--- a/sysdeps/unix/sysv/linux/s390/readelflib.c
+++ b/sysdeps/unix/sysv/linux/s390/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 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
@@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Dist b/sysdeps/unix/sysv/linux/s390/s390-32/Dist
deleted file mode 100644
index c0a7dc8c93..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-clone.S
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
index 0656b396f8..5909ba8a43 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,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 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
index 2578b3ddc0..3b38d19488 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
index ccdb67b15c..1e64a0ef75 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 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
@@ -24,7 +24,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 # ifdef __NR_lchown32
 #  if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
index 29c8640e92..94760e0c2b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
@@ -37,8 +37,6 @@
                +-----------------------+
              n | overflow parameters   | 96
                +-----------------------+
-             8 | trampoline            | 96+n
-               +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -55,18 +53,16 @@
 void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
+  extern void __makecontext_ret (void);
   unsigned long *sp;
   va_list ap;
   int i;
 
-  sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
-  /* Setup the trampoline.  */
-  *--sp = 0x07f90000;
-  *--sp = 0x0de71828;
+  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+			   + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) sp;
+  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
@@ -98,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
   ucp->uc_mcontext.gregs[15] = (long) sp;
 }
 
+asm(".text\n"
+    ".type __makecontext_ret,@function\n"
+    "__makecontext_ret:\n"
+    "      basr  %r14,%r7\n"
+    "      lr    %r2,%r8\n"
+    "      br    %r9\n"
+    ".size __makecontext_ret, .-__makecontext_ret");
+
 weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 7ad360a3a0..cce8d29735 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
index d9abb62c0b..bf70f11cc7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
index d1ce925ac3..b7e1736891 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -48,13 +48,14 @@ ENTRY (syscall)
 	lr     %r4,%r5             /* third parameter  */
 	lr     %r5,%r6             /* fourth parameter */
 	l      %r6,192(%r15)       /* fifth parameter  */
+	l      %r7,196(%r15)       /* sixth parameter  */
 
-	basr   %r7,0
-0:	cl     %r1,4f-0b(%r7)      /* svc number < 256? */
+	basr   %r8,0
+0:	cl     %r1,4f-0b(%r8)      /* svc number < 256? */
 	jl     2f
 1:	svc    0
 	j      3f
-2:	ex     %r1,1b-0b(%r7)      /* lsb of R1 is subsituted as SVC number */
+2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
 3:	l      %r15,0(%r15)        /* load back chain */
 	cfi_adjust_cfa_offset (-96)
 	lm     %r6,15,24(%r15)     /* load registers */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 43b1b951d5..b86072bd30 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000,01,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -23,6 +24,7 @@
 #include <sysdeps/s390/s390-32/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -111,8 +113,8 @@
 0:  lcr   %r0,%r2;							      \
     basr  %r1,0;							      \
 1:  al    %r1,2f-1b(%r1);						      \
-    l     %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1)			      \
-    ear   %r2,%a0							      \
+    l     %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1);			      \
+    ear   %r2,%a0;							      \
     st    %r0,0(%r1,%r2);						      \
     lhi   %r2,-1;							      \
     br    %r14;								      \
@@ -147,19 +149,28 @@
 	arg 3		4	     call-clobbered
 	arg 4		5	     call-clobbered
 	arg 5		6	     call-saved
+	arg 6		7	     call-saved
 
    (Of course a function with say 3 arguments does not have entries for
    arguments 4 and 5.)
-   S390 does not need to do ANY stack operations to get its parameters
-   right.
+   For system calls with 6 parameters a stack operation is required
+   to load the 6th parameter to register 7. Call saved register 7 is
+   moved to register 0 and back to avoid an additional stack frame.
  */
 
 #define DO_CALL(syscall, args)						      \
+  .if args > 5;								      \
+    lr %r0,%r7;								      \
+    l %r7,96(%r15);							      \
+  .endif;								      \
   .if SYS_ify (syscall) < 256;						      \
     svc SYS_ify (syscall);						      \
   .else;								      \
     lhi %r1,SYS_ify (syscall);						      \
     svc 0;								      \
+  .endif;								      \
+  .if args > 5;								      \
+    lr %r7,%r0;								      \
   .endif
 
 #define ret                                                                   \
@@ -253,6 +264,9 @@
 #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
 	DECLARGS_4(arg1, arg2, arg3, arg4) \
 	register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
+#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	register unsigned long gpr7 asm ("7") = (unsigned long)(arg6);
 
 #define ASMFMT_0
 #define ASMFMT_1 , "0" (gpr2)
@@ -260,5 +274,28 @@
 #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
 #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
 #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+/* For the time being just use stack_guard rather than a separate
+   pointer_guard.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+  ear     tmpreg,%a0;			\
+  x       reg,STACK_GUARD(tmpreg)
+#  define PTR_MANGLE2(reg, tmpreg) \
+  x       reg,STACK_GUARD(tmpreg)
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
 
 #endif /* _LINUX_S390_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
deleted file mode 100644
index 2e51f04e65..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x004
-#define SC_STCK 0x008
-#define SC_PSW  0x018
-#define SC_GPRS 0x020
-#define SC_ACRS 0x060
-#define SC_FPC  0x0A0
-#define SC_FPRS 0x0A8
-#define SC_MASK 0x128
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Dist b/sysdeps/unix/sysv/linux/s390/s390-64/Dist
deleted file mode 100644
index bfd4edc372..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-clone.S
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 5a0d7eca5d..8889b5359e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
index cdff9a4f21..b08f1b4047 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
@@ -37,8 +37,6 @@
                +-----------------------+
              n | overflow parameters   | 160
                +-----------------------+
-             8 | trampoline            | 160+n
-               +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -55,17 +53,16 @@
 void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
+  extern void __makecontext_ret (void);
   unsigned long *sp;
   va_list ap;
   int i;
 
-  sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
-  /* Setup the trampoline.  */
-  *--sp = 0x0de7b904002807f9;
+  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+			   + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) sp;
+  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
@@ -97,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
   ucp->uc_mcontext.gregs[15] = (long) sp;
 }
 
+asm(".text\n"
+    ".type __makecontext_ret,@function\n"
+    "__makecontext_ret:\n"
+    "      basr  %r14,%r7\n"
+    "      lgr   %r2,%r8\n"
+    "      br    %r9\n"
+    ".size __makecontext_ret, .-__makecontext_ret");
+
 weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index 268f36e713..7beca847c2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
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/s390/s390-64/sigsuspend.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
deleted file mode 100644
index 452f8354d0..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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 <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* Change the set of blocked signals to SET,
-   wait until a signal arrives, and restore the set of blocked signals.  */
-int
-__sigsuspend (set)
-     const sigset_t *set;
-{
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
index c98a97449b..d4c3a1c4e1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
@@ -128,6 +128,7 @@ L(socket_cancel):
 	j	4b
 #endif
 
+	SYSCALL_ERROR_HANDLER
 END (__socket)
 
 #ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ef2a862c55..cb96fd3b6a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index 4caeaeaf50..31b55d73f2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -48,13 +48,14 @@ ENTRY (syscall)
 	lgr    %r4,%r5		   /* Third parameter.	*/
 	lgr    %r5,%r6		   /* Fourth parameter.	 */
 	lg     %r6,320(%r15)	   /* Fifth parameter.	*/
+	lg     %r7,328(%r15)	   /* Sixth parameter.	*/
 
-	basr   %r7,0
-0:	clg    %r1,4f-0b(%r7)      /* svc number < 256? */
+	basr   %r8,0
+0:	clg    %r1,4f-0b(%r8)      /* svc number < 256? */
 	jl     2f
 1:	svc    0
 	j      3f
-2:	ex     %r1,1b-0b(%r7)      /* lsb of R1 is subsituted as SVC number */
+2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
 3:	lg     %r15,0(%r15)        /* load back chain */
 	cfi_adjust_cfa_offset (-160)
 	lmg	%r6,15,48(%r15)	   /* Load registers.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 477f8a9f09..791ab9ba52 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 vfork		-	vfork		0	__vfork		vfork
 
 # semaphore and shm system calls
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 154bc06803..9ddec8e041 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -1,5 +1,6 @@
 /* Assembler macros for 64 bit S/390.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -24,6 +25,7 @@
 #include <sysdeps/s390/s390-64/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -149,19 +151,28 @@
 	arg 3		4	     call-clobbered
 	arg 4		5	     call-clobbered
 	arg 5		6	     call-saved
+	arg 6		7	     call-saved
 
    (Of course a function with say 3 arguments does not have entries for
    arguments 4 and 5.)
-   S390 does not need to do ANY stack operations to get its parameters
-   right.
+   For system calls with 6 parameters a stack operation is required
+   to load the 6th parameter to register 7. Call saved register 7 is
+   moved to register 0 and back to avoid an additional stack frame.
  */
 
 #define DO_CALL(syscall, args)						      \
+  .if args > 5;								      \
+    lgr %r0,%r7;							      \
+    lg %r7,160(%r15);							      \
+  .endif;								      \
   .if SYS_ify (syscall) < 256;						      \
     svc SYS_ify (syscall);						      \
   .else;								      \
     lghi %r1,SYS_ify (syscall);						      \
     svc 0;								      \
+  .endif;								      \
+  .if args > 5;								      \
+    lgr %r7,%r0;							      \
   .endif
 
 #define ret								      \
@@ -255,6 +266,9 @@
 #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
 	DECLARGS_4(arg1, arg2, arg3, arg4) \
 	register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
+#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	register unsigned long gpr7 asm ("7") = (unsigned long)(arg6);
 
 #define ASMFMT_0
 #define ASMFMT_1 , "0" (gpr2)
@@ -262,5 +276,29 @@
 #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
 #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
 #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+/* For the time being just use stack_guard rather than a separate
+   pointer_guard.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+  ear     tmpreg,%a0;			\
+  sllg    tmpreg,tmpreg,32;		\
+  ear     tmpreg,%a1;			\
+  xg      reg,STACK_GUARD(tmpreg)
+#  define PTR_MANGLE2(reg, tmpreg) \
+  xg      reg,STACK_GUARD(tmpreg)
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
 
 #endif /* _LINUX_S390_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
deleted file mode 100644
index 6d223a08a6..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-     Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x008
-#define SC_STCK 0x010
-#define SC_PSW  0x028
-#define SC_GPRS 0x038
-#define SC_ACRS 0x0B8
-#define SC_FPC  0x0F8
-#define SC_FPRS 0x100
-#define SC_MASK 0x180
-
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
index d26cf114ef..70eb4f8222 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006 Free Software Foundation, Inc.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -118,8 +118,24 @@ enum __ptrace_request
 #define PT_DETACH PTRACE_DETACH
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/s390/sys/user.h b/sysdeps/unix/sysv/linux/s390/sys/user.h
index eddd196c72..f00caea84d 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/user.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/user.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
@@ -19,6 +19,65 @@
 #ifndef _SYS_USER_H
 #define _SYS_USER_H	1
 
-#include <asm/user.h>
+/* The whole purpose of this file is for GDB and GDB only.  Don't read
+   too much into it.  Don't use it for anything other than GDB unless
+   you know what you are doing.  */
+
+struct _user_psw_struct
+{
+  unsigned long mask;
+  unsigned long addr;
+};
+
+struct _user_fpregs_struct
+{
+  unsigned int fpc;
+  double fprs[16];
+};
+
+struct _user_per_struct
+{
+  unsigned long control_regs[3];
+  unsigned single_step       : 1;
+  unsigned instruction_fetch : 1;
+  unsigned                   : 30;
+  unsigned long starting_addr;
+  unsigned long ending_addr;
+  unsigned short perc_atmid;
+  unsigned long address;
+  unsigned char access_id;
+};
+
+struct _user_regs_struct
+{
+  struct _user_psw_struct psw;		/* Program status word.  */
+  unsigned long gprs[16];		/* General purpose registers.  */
+  unsigned int  acrs[16];		/* Access registers.  */
+  unsigned long orig_gpr2;		/* Original gpr2.  */
+  struct _user_fpregs_struct fp_regs;	/* Floating point registers.  */
+  struct _user_per_struct per_info;	/* Hardware tracing registers.  */
+  unsigned long ieee_instruction_pointer; 
+};
+
+struct user {
+  struct _user_regs_struct regs;	/* User registers.  */
+  unsigned long int u_tsize;		/* Text segment size (pages).  */
+  unsigned long int u_dsize;		/* Data segment size (pages).  */
+  unsigned long int u_ssize;		/* Stack segment size (pages).  */
+  unsigned long start_code;		/* Starting address of text.  */
+  unsigned long start_stack;		/* Starting address of stack area.  */
+  long int signal;			/* Signal causing the core dump.  */
+  struct _user_regs_struct *u_ar0;	/* Help gdb find registers.  */
+  unsigned long magic;			/* Identifies a core file.  */
+  char u_comm[32];			/* User command naem.  */
+};
+
+#define PAGE_SHIFT		12
+#define PAGE_SIZE		(1UL << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
+#define NBPG			PAGE_SIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
 
 #endif	/* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
new file mode 100644
index 0000000000..525b54300c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
@@ -0,0 +1,23 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_UNBLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+SC_FLGS		ucontext (uc_flags)
+SC_LINK		ucontext (uc_link)
+SC_STCK		ucontext (uc_stack.ss_sp)
+SC_STSZ		ucontext (uc_stack.ss_size)
+SC_PSW		mcontext (psw)
+SC_GPRS		mcontext (gregs)
+SC_ACRS		mcontext (aregs)
+SC_FPC		mcontext (fpregs.fpc)
+SC_FPRS		mcontext (fpregs.fprs)
+SC_MASK		ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
index 50443c6482..ab171123b0 100644
--- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 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
@@ -20,6 +20,7 @@
 #include <sched.h>
 #include <string.h>
 #include <sysdep.h>
+#include <sys/param.h>
 #include <sys/types.h>
 #include <shlib-compat.h>
 
@@ -28,8 +29,8 @@
 int
 __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
 {
-  int res = INLINE_SYSCALL (sched_getaffinity, 3, pid, sizeof (cpu_set_t),
-			    cpuset);
+  int res = INLINE_SYSCALL (sched_getaffinity, 3, pid,
+			    MIN (INT_MAX, cpusetsize), cpuset);
   if (res != -1)
     {
       /* Clean the rest of the memory the kernel didn't do.  */
@@ -54,5 +55,5 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset)
 compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3);
 # endif
 #else
-# include <sysdeps/generic/sched_getaffinity.c>
+# include <posix/sched_getaffinity.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
index 5b1b8ee878..ccd3c8f514 100644
--- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -84,5 +84,5 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
 compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3);
 # endif
 #else
-# include <sysdeps/generic/sched_setaffinity.c>
+# include <posix/sched_setaffinity.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/segfault.c b/sysdeps/unix/sysv/linux/segfault.c
index 088c329b7f..a417df9c41 100644
--- a/sysdeps/unix/sysv/linux/segfault.c
+++ b/sysdeps/unix/sysv/linux/segfault.c
@@ -1,2 +1,2 @@
 #define HAVE_PROC_SELF	1
-#include <sysdeps/generic/segfault.c>
+#include <debug/segfault.c>
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index ecd23ce53e..2f5471f8f8 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <sys/syscall.h>
 #include <shlib-compat.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_semid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/setegid.c b/sysdeps/unix/sysv/linux/setegid.c
index f87af0d16f..c0400aa121 100644
--- a/sysdeps/unix/sysv/linux/setegid.c
+++ b/sysdeps/unix/sysv/linux/setegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresgid || __ASSUME_SETRESGID_SYSCALL > 0
diff --git a/sysdeps/unix/sysv/linux/seteuid.c b/sysdeps/unix/sysv/linux/seteuid.c
index 5e5d1e184f..4a1a29eaa5 100644
--- a/sysdeps/unix/sysv/linux/seteuid.c
+++ b/sysdeps/unix/sysv/linux/seteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresuid || __ASSUME_SETRESUID_SYSCALL > 0
diff --git a/sysdeps/unix/sysv/linux/setsourcefilter.c b/sysdeps/unix/sysv/linux/setsourcefilter.c
index f5c4d9786f..dc223de844 100644
--- a/sysdeps/unix/sysv/linux/setsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setsourcefilter.c
@@ -1,5 +1,5 @@
 /* Set source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -57,14 +57,15 @@ setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
+  else
+    result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
 
   if (! use_alloca)
     {
diff --git a/sysdeps/unix/sysv/linux/sh/Dist b/sysdeps/unix/sysv/linux/sh/Dist
deleted file mode 100644
index 8a1cdff7c5..0000000000
--- a/sysdeps/unix/sysv/linux/sh/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-clone.S
-pipe.S
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/io.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile
index e8544b5dc6..6d72cb0294 100644
--- a/sysdeps/unix/sysv/linux/sh/Makefile
+++ b/sysdeps/unix/sysv/linux/sh/Makefile
@@ -5,3 +5,7 @@ endif
 ifeq ($(subdir),misc)
 sysdep_headers += sys/io.h
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index c883002641..6de33302ee 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -43,18 +46,18 @@
 #define O_ASYNC		 020000
 
 #ifdef __USE_GNU
-# define O_DIRECT	 040000	/* Direct disk access.  */
-# define O_DIRECTORY	0200000	/* Must be a directory.  */
-# define O_NOFOLLOW	0400000	/* Do not follow links.  */
+# define O_DIRECT	 040000	/* Direct disk access.	*/
+# define O_DIRECTORY	0200000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0400000	/* Do not follow links.	 */
 # define O_NOATIME     01000000 /* Do not set atime.  */
 #endif
 
 /* For now Linux has synchronisity options for data and read operations.
    We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.  */
+   this is a superset.	*/
 #if defined __USE_POSIX199309 || defined __USE_UNIX98
 # define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
 #endif
 
 #ifdef __USE_LARGEFILE64
@@ -70,15 +73,15 @@
 #ifndef __USE_FILE_OFFSET64
 # define F_GETLK	5	/* Get record locking info.  */
 # define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).	*/
 #else
-# define F_GETLK	F_GETLK64  /* Get record locking info.  */
+# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
 # define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
 # define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
 #endif
 #define F_GETLK64	12	/* Get record locking info.  */
 #define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).  */
+#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
 
 #if defined __USE_BSD || defined __USE_UNIX98
 # define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
@@ -90,20 +93,26 @@
 # define F_GETSIG	11	/* Get number of signal to be sent.  */
 #endif
 
-/* For F_[GET|SET]FL.  */
+#ifdef __USE_GNU
+# define F_SETLEASE	1024	/* Set a lease.	 */
+# define F_GETLEASE	1025	/* Enquire what lease is active.  */
+# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
+#endif
+
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
 #define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.  */
-#define F_UNLCK		2	/* Remove lock.  */
+#define F_WRLCK		1	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
 
 /* For old implementation of bsd flock().  */
 #define F_EXLCK		4	/* or 3 */
 #define F_SHLCK		8	/* or 4 */
 
 #ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation.  */
+/* Operations for bsd flock(), also used by the kernel implementation.	*/
 # define LOCK_SH	1	/* shared lock */
 # define LOCK_EX	2	/* exclusive lock */
 # define LOCK_NB	4	/* or'd with one of the above to prevent
@@ -111,9 +120,27 @@
 # define LOCK_UN	8	/* remove lock */
 #endif
 
+#ifdef __USE_GNU
+# define LOCK_MAND	32	/* This is a mandatory flock:	*/
+# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
+# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
+# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY.  */
+# define DN_ACCESS	0x00000001	/* File accessed.  */
+# define DN_MODIFY	0x00000002	/* File modified.  */
+# define DN_CREATE	0x00000004	/* File created.  */
+# define DN_DELETE	0x00000008	/* File removed.  */
+# define DN_RENAME	0x00000010	/* File renamed.  */
+# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
+# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
+#endif
+
 struct flock
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
 #ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
@@ -128,7 +155,7 @@ struct flock
 #ifdef __USE_LARGEFILE64
 struct flock64
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
     __off64_t l_start;	/* Offset where the lock begins.  */
     __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
@@ -150,16 +177,61 @@ struct flock64
 #ifdef __USE_XOPEN2K
 # define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
 # define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
 # define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
 # define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
index 673c7295fb..7a6b572a4e 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SH version.
-   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2000,2003,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
@@ -61,6 +61,8 @@
 # define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 # define MAP_LOCKED	0x2000		/* Lock the mapping.  */
 # define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+# define MAP_POPULATE	0x8000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -76,6 +78,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -85,6 +88,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/sh/chown.c b/sysdeps/unix/sysv/linux/sh/chown.c
index 1961622564..e7193dc23b 100644
--- a/sysdeps/unix/sysv/linux/sh/chown.c
+++ b/sysdeps/unix/sysv/linux/sh/chown.c
@@ -1 +1,69 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
+/* Copyright (C) 1998,2000,2002,2003,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
+   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 <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include <kernel-features.h>
+
+#ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+   uids.  */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+__chown (const char *file, uid_t owner, gid_t group)
+{
+#if __ASSUME_32BITUIDS > 0
+  return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+#else
+# ifdef __NR_chown32
+  if (__libc_missing_32bit_uids <= 0)
+    {
+      int result;
+      int saved_errno = errno;
+
+      result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+      if (result == 0 || errno != ENOSYS)
+	return result;
+
+      __set_errno (saved_errno);
+      __libc_missing_32bit_uids = 1;
+    }
+# endif /* __NR_chown32 */
+
+  if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
+#endif
+}
+libc_hidden_def (__chown)
+weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/sh/fchownat.c b/sysdeps/unix/sysv/linux/sh/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/sh/fxstatat.c b/sysdeps/unix/sysv/linux/sh/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
new file mode 100644
index 0000000000..877d78d396
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -0,0 +1,145 @@
+/* Create 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., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* void __makecontext (struct ucontext *ucp, void (*func)(), int argc, ...);
+  __makecontext sets up a stack and registers for context to run a given
+  function.  The registers are set up like this:
+    r4-r7: parameters 1 to 4
+    r8	 : uc_link from ucontext structure
+    pc	 : (*func) pointer
+    pr	 : address of exitcode
+    r15	 : stack pointer for func.  */
+
+	.text
+	.align	5
+ENTRY(__makecontext)
+	mov	#4, r3
+	mov.l	@(oSS_SP,r4), r1
+	mov.l	@(oSS_SIZE,r4), r2
+	add	r1, r2
+	cmp/gt	r6, r3
+	bf/s	1f
+	 shlr2	r2
+	sub	r6, r2
+	add	r3, r2
+1:
+	shll2	r2
+	mov	#oR15, r0
+	mov.l	@(oLINK,r4), r1
+	mov.l	r2, @(r0,r4)
+	mov.l	r1, @(oR8,r4)
+	mov	#oPC, r0
+	mov.l	r5, @(r0,r4)
+
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	r7, @(oR4,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(0,r15), r1
+	mov.l	r1, @(oR5,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(4,r15), r1
+	mov.l	r1, @(oR6,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(8,r15), r1
+	mov.l	r1, @(oR7,r4)
+	mov	#12,r0
+.L0:
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(r0,r15), r1
+	mov.l	r1, @r2
+	add	#4, r0
+	bra	.L0
+	 add	#4, r2
+.L1:
+#ifdef PIC
+	mova	.Lexitcode, r0
+#else
+	mov.l	.L2, r0
+#endif
+	add	#oPR, r4
+	rts
+	 mov.l	r0, @r4
+#ifndef PIC
+	.align	2
+.L2:
+	.long	.Lexitcode
+#endif
+	cfi_endproc
+
+	.align	5
+.Lexitcode:
+	tst	r8, r8
+	bt/s	2f
+	 mov	r8, r4
+#ifdef PIC
+	mova	.Lgot, r0
+	mov.l	.Lgot, r12
+	add	r0, r12
+	mov.l	.L3, r1
+	bsrf	r1
+.LPCS0:
+	 nop
+#else
+	mov.l	.L3, r1
+	jsr	@r1
+	 nop
+#endif
+2:
+	mov.l	.L4, r1
+#ifdef PIC
+	add	r12, r1
+#endif
+	jsr	@r1
+	 mov	r0, r4
+0:
+	bra	0b
+	 nop
+
+	.align	2
+#ifdef PIC
+.Lgot:
+	.long	_GLOBAL_OFFSET_TABLE_
+.L3:
+	.long	__setcontext@PLT-(.LPCS0+2-(.))
+.L4:
+	.long	HIDDEN_JUMPTARGET(exit)@GOTOFF
+#else
+.L3:
+	.long	__setcontext
+.L4:
+	.long	HIDDEN_JUMPTARGET(exit)
+#endif
+	cfi_startproc
+PSEUDO_END(__makecontext)
+
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/sysdeps/unix/sysv/linux/sh/pread.c
index 9ded53ebaa..0186e40c9c 100644
--- a/sysdeps/unix/sysv/linux/sh/pread.c
+++ b/sysdeps/unix/sysv/linux/sh/pread.c
@@ -1,3 +1,93 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pread.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <assert.h>
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
+
+# if __ASSUME_PREAD_SYSCALL == 0
+static ssize_t __emulate_pread (int fd, void *buf, size_t count,
+				off_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pread (fd, buf, count, offset)
+     int fd;
+     void *buf;
+     size_t count;
+     off_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+      /* First try the syscall.  */
+      result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			       __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PREAD_SYSCALL == 0
+      if (result == -1 && errno == ENOSYS)
+        /* No system call available.  Use the emulation.  */
+        result = __emulate_pread (fd, buf, count, offset);
+# endif
+      return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PREAD_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pread (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+strong_alias (__libc_pread, __pread)
+weak_alias (__libc_pread, pread)
+
+# define __libc_pread(fd, buf, count, offset) \
+     static internal_function __emulate_pread (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PREAD_SYSCALL == 0
+# include <sysdeps/posix/pread.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/sysdeps/unix/sysv/linux/sh/pread64.c
index 5b22a395ec..f23d619090 100644
--- a/sysdeps/unix/sysv/linux/sh/pread64.c
+++ b/sysdeps/unix/sysv/linux/sh/pread64.c
@@ -1,3 +1,94 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pread64.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
+
+# if __ASSUME_PREAD_SYSCALL == 0
+static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
+				  off64_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pread64 (fd, buf, count, offset)
+     int fd;
+     void *buf;
+     size_t count;
+     off64_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+     /* First try the syscall.  */
+     result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
+			      (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PREAD_SYSCALL == 0
+     if (result == -1 && errno == ENOSYS)
+     /* No system call available.  Use the emulation.  */
+     result = __emulate_pread64 (fd, buf, count, offset);
+# endif
+     return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PREAD_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pread64 (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+weak_alias (__libc_pread64, __pread64)
+weak_alias (__libc_pread64, pread64)
+
+# define __libc_pread64(fd, buf, count, offset) \
+     static internal_function __emulate_pread64 (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PREAD_SYSCALL == 0
+# include <sysdeps/posix/pread64.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c
index b75a6a968e..f0e2bc7e0f 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite.c
@@ -1,3 +1,93 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pwrite.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <assert.h>
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
+
+# if __ASSUME_PWRITE_SYSCALL == 0
+static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
+				 off_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pwrite (fd, buf, count, offset)
+     int fd;
+     const void *buf;
+     size_t count;
+     off_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+      /* First try the syscall.  */
+      result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			       __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PWRITE_SYSCALL == 0
+      if (result == -1 && errno == ENOSYS)
+        /* No system call available.  Use the emulation.  */
+        result = __emulate_pwrite (fd, buf, count, offset);
+# endif
+      return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PWRITE_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pwrite (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+strong_alias (__libc_pwrite, __pwrite)
+weak_alias (__libc_pwrite, pwrite)
+
+# define __libc_pwrite(fd, buf, count, offset) \
+     static internal_function __emulate_pwrite (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PWRITE_SYSCALL == 0
+# include <sysdeps/posix/pwrite.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/sysdeps/unix/sysv/linux/sh/pwrite64.c
index ae29280f85..eb1e507287 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite64.c
@@ -1,3 +1,96 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pwrite64.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
+
+   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 <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
+
+# if __ASSUME_PWRITE_SYSCALL == 0
+static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
+				   off64_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pwrite64 (fd, buf, count, offset)
+     int fd;
+     const void *buf;
+     size_t count;
+     off64_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+     /* First try the syscall.  */
+     result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
+			     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PWRITE_SYSCALL == 0
+     if (result == -1 && errno == ENOSYS)
+     /* No system call available.  Use the emulation.  */
+     result = __emulate_pwrite64 (fd, buf, count, offset);
+# endif
+
+     return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PWRITE_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pwrite64 (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+weak_alias (__libc_pwrite64, __pwrite64)
+libc_hidden_weak (__pwrite64)
+weak_alias (__libc_pwrite64, pwrite64)
+
+# define __libc_pwrite64(fd, buf, count, offset) \
+     static internal_function __emulate_pwrite64 (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PWRITE_SYSCALL == 0
+# include <sysdeps/posix/pwrite64.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
new file mode 100644
index 0000000000..66b3daaa3b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
@@ -0,0 +1,88 @@
+/* Save current 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., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __getcontext (ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__getcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	/* sigprocmask (SIG_BLOCK, NULL, &uc->uc_sigmask).  */
+	mov	r4, r6
+	add	#oSIGMASK, r6
+	mov	#SIG_BLOCK, r4
+	mov	#0, r5
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lgetcontext_end
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lgetcontext_end:
+	/* All done, return 0 for success.  */
+	mov	#0, r0
+.Lpseudo_end:
+	rts
+	 nop
+
+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
new file mode 100644
index 0000000000..3136267aca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
@@ -0,0 +1,99 @@
+/* Install given 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., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __setcontext (const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__setcontext)
+
+	mov	r4, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, NULL).  */
+	mov	r4, r5
+	add	#oSIGMASK, r5
+	mov	#SIG_SETMASK, r4
+	mov	#0, r6
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lsetcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+
+.Lsetcontext_restore:
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+
+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
new file mode 100644
index 0000000000..64035e5545
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
@@ -0,0 +1,132 @@
+/* Save current context and install the given one.
+   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 "ucontext_i.h"
+
+/*  int __swapcontext (ucontext_t *ouc, const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__swapcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r5, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, &ouc->uc_sigmask).  */
+	add	#oSIGMASK, r5
+	mov	r4, r6
+	add	#oSIGMASK, r6
+	mov	#SIG_SETMASK, r4
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lswapcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+.Lswapcontext_restore:	
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+	
+PSEUDO_END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h
index 6d6c8e3990..946df0dfd6 100644
--- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 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
@@ -16,23 +16,28 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* System V/ARM ABI compliant context switching support.  */
+/* Where is System V/SH ABI?  */
 
 #ifndef _SYS_UCONTEXT_H
 #define _SYS_UCONTEXT_H	1
 
 #include <features.h>
 #include <signal.h>
-#include <sys/procfs.h>
+
+/* We need the signal context definitions even if they are not used
+   included in <signal.h>.  */
+#include <bits/sigcontext.h>
+
 
 typedef int greg_t;
 
 /* Number of general registers.  */
-#define NGREG	16
+#define NFPREG	16
 
 /* Container for all general registers.  */
-typedef elf_gregset_t gregset_t;
+typedef greg_t gregset_t[NFPREG];
 
+#ifdef __USE_GNU
 /* Number of each register is the `gregset_t' array.  */
 enum
 {
@@ -66,18 +71,22 @@ enum
 #define R13	R13
   R14 = 14,
 #define R14	R14
-  R15 = 15
+  R15 = 15,
 #define R15	R15
 };
-
-/* Structure to describe FPU registers.  */
-typedef elf_fpregset_t	fpregset_t;
+#endif
 
 /* Context to describe whole processor state.  */
 typedef struct
   {
+    unsigned int oldmask;
     gregset_t gregs;
-    fpregset_t fpregs;
+    unsigned int pc;
+    unsigned int pr;
+    unsigned int sr;
+    unsigned int gbr;
+    unsigned int mach;
+    unsigned int macl;
   } mcontext_t;
 
 /* Userlevel context.  */
@@ -85,10 +94,9 @@ typedef struct ucontext
   {
     unsigned long int uc_flags;
     struct ucontext *uc_link;
-    __sigset_t uc_sigmask;
     stack_t uc_stack;
     mcontext_t uc_mcontext;
-    long int uc_filler[5];
+    __sigset_t uc_sigmask;
   } ucontext_t;
 
 #endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
new file mode 100644
index 0000000000..17397c5511
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
@@ -0,0 +1,38 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
new file mode 100644
index 0000000000..68bc235bcf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
@@ -0,0 +1,131 @@
+/* Save current 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., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __getcontext (ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__getcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r4, r0
+	/* We need 2 add instruction because oFPUL+4 > 127.  */
+	add	#124,r0
+	add	#(oFPUL+4-124),r0
+	sts.l	fpul, @-r0
+	sts.l	fpscr, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+
+	/* sigprocmask (SIG_BLOCK, NULL, &uc->uc_sigmask).  */
+	mov	r4, r6
+	/* We need 2 add instruction because oSIGMASK > 127.  */
+	add	#(oSIGMASK/2), r6
+	add	#(oSIGMASK/2), r6
+	mov	#SIG_BLOCK, r4
+	mov	#0, r5
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lgetcontext_end
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lgetcontext_end:
+	/* All done, return 0 for success.  */
+	mov	#0, r0
+.Lpseudo_end:
+	rts
+	 nop
+
+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
new file mode 100644
index 0000000000..2bc546d1a1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
@@ -0,0 +1,139 @@
+/* Install given 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., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __setcontext (const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__setcontext)
+
+	mov	r4, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, NULL).  */
+	mov	r4, r5
+	add	#(oSIGMASK/2), r5
+	add	#(oSIGMASK/2), r5
+	mov	#SIG_SETMASK, r4
+	mov	#0, r6
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lsetcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+
+.Lsetcontext_restore:
+	mov	r8, r0
+	add	#(oFR0),r0
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	lds.l	@r0+, fpscr
+	lds.l	@r0+, fpul
+
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+
+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
new file mode 100644
index 0000000000..1aeca1b1a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
@@ -0,0 +1,214 @@
+/* Save current context and install the given one.
+   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 "ucontext_i.h"
+
+/*  int __swapcontext (ucontext_t *ouc, const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__swapcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r4, r0
+	/* We need 2 add instruction because oFPUL+4 >= 127.  */
+	add	#124,r0
+	add	#(oFPUL+4-124),r0
+	sts.l	fpul, @-r0
+	sts.l	fpscr, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+
+	mov	r5, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, &ouc->uc_sigmask).  */
+	mov	#oSIGMASK, r1
+	extu.b	r1, r1
+	add	r1, r5
+	mov	r4, r6
+	add	r1, r6
+	mov	#SIG_SETMASK, r4
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lswapcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+.Lswapcontext_restore:	
+	mov	r8, r0
+	add	#(oFR0),r0
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	lds.l	@r0+, fpscr
+	lds.l	@r0+, fpul
+
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+	
+PSEUDO_END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h
index 78729c48f9..cd831a7a21 100644
--- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 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,13 +87,19 @@ typedef freg_t fpregset_t[NFPREG];
 /* Context to describe whole processor state.  */
 typedef struct
   {
+    unsigned int oldmask;
     gregset_t gregs;
+    unsigned int pc;
+    unsigned int pr;
+    unsigned int sr;
+    unsigned int gbr;
+    unsigned int mach;
+    unsigned int macl;
     fpregset_t fpregs;
     fpregset_t xfpregs;
     unsigned int fpscr;
     unsigned int fpul;
-    unsigned int macl;
-    unsigned int mach;
+    unsigned int ownedfp;
   } mcontext_t;
 
 /* Userlevel context.  */
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
new file mode 100644
index 0000000000..65633fbcf4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
@@ -0,0 +1,73 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oFR0		mcontext (fpregs[0])
+oFR1		mcontext (fpregs[1])
+oFR2		mcontext (fpregs[2])
+oFR3		mcontext (fpregs[3])
+oFR4		mcontext (fpregs[4])
+oFR5		mcontext (fpregs[5])
+oFR6		mcontext (fpregs[6])
+oFR7		mcontext (fpregs[7])
+oFR8		mcontext (fpregs[8])
+oFR9		mcontext (fpregs[9])
+oFR10		mcontext (fpregs[10])
+oFR11		mcontext (fpregs[11])
+oFR12		mcontext (fpregs[12])
+oFR13		mcontext (fpregs[13])
+oFR14		mcontext (fpregs[14])
+oFR15		mcontext (fpregs[15])
+oXFR0		mcontext (xfpregs[0])
+oXFR1		mcontext (xfpregs[1])
+oXFR2		mcontext (xfpregs[2])
+oXFR3		mcontext (xfpregs[3])
+oXFR4		mcontext (xfpregs[4])
+oXFR5		mcontext (xfpregs[5])
+oXFR6		mcontext (xfpregs[6])
+oXFR7		mcontext (xfpregs[7])
+oXFR8		mcontext (xfpregs[8])
+oXFR9		mcontext (xfpregs[9])
+oXFR10		mcontext (xfpregs[10])
+oXFR11		mcontext (xfpregs[11])
+oXFR12		mcontext (xfpregs[12])
+oXFR13		mcontext (xfpregs[13])
+oXFR14		mcontext (xfpregs[14])
+oXFR15		mcontext (xfpregs[15])
+oFPSCR		mcontext (fpscr)
+oFPUL		mcontext (fpul)
+oOWNEDFP	mcontext (ownedfp)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/socket.S b/sysdeps/unix/sysv/linux/sh/socket.S
index f1369eb49b..c83b0f2601 100644
--- a/sysdeps/unix/sysv/linux/sh/socket.S
+++ b/sysdeps/unix/sysv/linux/sh/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
@@ -33,7 +33,11 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
+#ifndef NO_WEAK_ALIAS
 #define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
 #endif
 
 #define PUSHARGS_1	mov.l r4,@-r15;	\
@@ -84,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
@@ -165,7 +168,6 @@ ENTRY (__socket)
 	bra	.Lsyscall_error
 	 nop
 #endif
-	cfi_endproc
 
 	.align 2
 .L1:
@@ -173,4 +175,6 @@ ENTRY (__socket)
 
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
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 d56ec454f9..f0be37edc8 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004
-	Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
+   2005,2006	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
    Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -24,6 +24,7 @@
 
 /* There is some commonality.  */
 #include <sysdeps/unix/sh/sysdep.h>
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -104,7 +105,7 @@
 	mova 0f,r0; \
 	add r0,r12; \
 	mov.l 1f,r0; \
-	mov.l r1,@(r0,r12)
+	mov.l r1,@(r0,r12); \
 	bra .Lpseudo_end; \
 	 mov _IMM1,r0; \
 	.align 2; \
@@ -140,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; \
@@ -359,4 +369,23 @@
 
 #endif	/* __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  Using a global variable
+   is too complicated here since we have no PC-relative addressing mode.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmp) \
+     stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
+#  define PTR_MANGLE2(reg, tmp)	xor tmp,reg
+#  define PTR_DEMANGLE(reg, tmp)	PTR_MANGLE (reg, tmp)
+#  define PTR_DEMANGLE2(reg, tmp)	PTR_MANGLE2 (reg, tmp)
+# else
+#  define PTR_MANGLE(var) \
+     (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sh/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 2e94b76cdb..0d40632e5f 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,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
@@ -29,6 +29,8 @@
 #include <bits/libc-lock.h>
 #include "linux_fsinfo.h"
 
+#include <kernel-features.h>
+
 
 /* Mount point of the shared memory filesystem.  */
 static struct
@@ -81,7 +83,10 @@ where_is_shmfs (void)
     /* The original name is "shm" but this got changed in early Linux
        2.4.x to "tmpfs".  */
     if (strcmp (mp->mnt_type, "tmpfs") == 0
-	|| strcmp (mp->mnt_type, "shm") == 0)
+#ifndef __ASSUME_TMPFS_NAME
+	|| strcmp (mp->mnt_type, "shm") == 0
+#endif
+	)
       {
 	/* Found it.  There might be more than one place where the
            filesystem is mounted but one is enough for us.  */
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index 5561cca36f..0fbddd9206 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -29,7 +29,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_shmid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 91c37824bc..7b44598c09 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,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
@@ -23,7 +23,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* The difference here is that the sigaction structure used in the
    kernel is not the same as we use in the libc.  Therefore we must
@@ -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/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index c19da4c764..f0036c1139 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2003,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
@@ -24,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* The variable is shared between all wrappers around signal handling
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 1573780d8e..1b13ea74de 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001,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 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* The variable is shared between all wrappers around signal handling
diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c
index 337f886257..22a8036b64 100644
--- a/sysdeps/unix/sysv/linux/sigqueue.c
+++ b/sysdeps/unix/sysv/linux/sigqueue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 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
@@ -48,5 +48,5 @@ __sigqueue (pid, sig, val)
 }
 weak_alias (__sigqueue, sigqueue)
 #else
-# include <sysdeps/generic/sigqueue.c>
+# include <signal/sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigreturn.c b/sysdeps/unix/sysv/linux/sigreturn.c
index 6b3116fef2..626b1eb8af 100644
--- a/sysdeps/unix/sysv/linux/sigreturn.c
+++ b/sysdeps/unix/sysv/linux/sigreturn.c
@@ -1,3 +1,3 @@
 /* The sigreturn syscall cannot be explicitly called on Linux, only
    implicitly by returning from a signal handler.  */
-#include <sysdeps/generic/sigreturn.c>
+#include <signal/sigreturn.c>
diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c
index 4faf4424fe..76d2126986 100644
--- a/sysdeps/unix/sysv/linux/sigstack.c
+++ b/sysdeps/unix/sysv/linux/sigstack.c
@@ -1,5 +1,5 @@
 /* Emulate sigstack function using sigaltstack.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -65,5 +65,5 @@ sigstack (ss, oss)
 
 link_warning (sigstack, "the `sigstack' function is dangerous.  `sigaltstack' should be used instead.")
 #else
-# include <sysdeps/generic/sigstack.c>
+# include <signal/sigstack.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 0cf8d5083c..adbdfddfdb 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2000,2002,2003,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 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if !__ASSUME_REALTIME_SIGNALS
@@ -56,6 +56,12 @@ do_sigsuspend (const sigset_t *set)
 
   return INLINE_SYSCALL (sigsuspend, 3, 0, 0, set->__val[0]);
 }
+#else
+static inline int __attribute__ ((always_inline))
+do_sigsuspend (const sigset_t *set)
+{
+  return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
+}
 #endif
 
 /* Change the set of blocked signals to SET,
@@ -64,19 +70,6 @@ int
 __sigsuspend (set)
      const sigset_t *set;
 {
-#if __ASSUME_REALTIME_SIGNALS
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set),
-			       _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-#else
   if (SINGLE_THREAD_P)
     return do_sigsuspend (set);
 
@@ -87,8 +80,16 @@ __sigsuspend (set)
   LIBC_CANCEL_RESET (oldtype);
 
   return result;
-#endif
 }
 libc_hidden_def (__sigsuspend)
 weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
+
+#ifndef NO_CANCELLATION
+int
+__sigsuspend_nocancel (set)
+     const sigset_t *set;
+{
+  return do_sigsuspend (set);
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
index adeadc1587..8795652766 100644
--- a/sysdeps/unix/sysv/linux/sigtimedwait.c
+++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,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
@@ -89,5 +89,5 @@ __sigtimedwait (set, info, timeout)
 libc_hidden_def (__sigtimedwait)
 weak_alias (__sigtimedwait, sigtimedwait)
 #else
-# include <sysdeps/generic/sigtimedwait.c>
+# include <signal/sigtimedwait.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c
index 7c865963cd..279ca0203c 100644
--- a/sysdeps/unix/sysv/linux/sigwait.c
+++ b/sysdeps/unix/sysv/linux/sigwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,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
@@ -58,8 +58,11 @@ do_sigwait (const sigset_t *set, int *sig)
      real size of the user-level sigset_t.  */
 #ifdef INTERNAL_SYSCALL
   INTERNAL_SYSCALL_DECL (err);
-  ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
-			  NULL, NULL, _NSIG / 8);
+  do
+    ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
+			    NULL, NULL, _NSIG / 8);
+  while (INTERNAL_SYSCALL_ERROR_P (ret, err)
+	 && INTERNAL_SYSCALL_ERRNO (ret, err) == EINTR);
   if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
     {
       *sig = ret;
@@ -68,8 +71,10 @@ do_sigwait (const sigset_t *set, int *sig)
   else
     ret = INTERNAL_SYSCALL_ERRNO (ret, err);
 #else
-  ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
-			NULL, NULL, _NSIG / 8);
+  do
+    ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
+			  NULL, NULL, _NSIG / 8);
+  while (ret == -1 && errno == EINTR);
   if (ret != -1)
     {
       *sig = ret;
diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c
index a51a01f20b..80790df9eb 100644
--- a/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,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
@@ -89,6 +89,6 @@ __sigwaitinfo (set, info)
 libc_hidden_def (__sigwaitinfo)
 weak_alias (__sigwaitinfo, sigwaitinfo)
 #else
-# include <sysdeps/generic/sigwaitinfo.c>
+# include <signal/sigwaitinfo.c>
 #endif
 strong_alias (__sigwaitinfo, __libc_sigwaitinfo)
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index d94e4f62fd..0e41a11338 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -1,5 +1,5 @@
 /* Implementation of the POSIX sleep function using nanosleep.
-   Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <time.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <unistd.h>
 #include <sys/param.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/Dist b/sysdeps/unix/sysv/linux/sparc/Dist
deleted file mode 100644
index 174d053909..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-kernel_termios.h
-sys/trap.h
-ldd-rewrite.sed
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
index 29e5406348..9cb2a634d5 100644
--- a/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -1 +1,5 @@
 64bit-predefine = __sparc_v9__ __arch64__
+
+ifeq ($(subdir),rt)
+librt-routines += rt-sysdep
+endif
diff --git a/sysdeps/unix/sysv/linux/sparc/Versions b/sysdeps/unix/sysv/linux/sparc/Versions
index 03d1d87176..be3d2b96c2 100644
--- a/sysdeps/unix/sysv/linux/sparc/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/Versions
@@ -1,8 +1,7 @@
 libc {
   # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
   # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
+  # version here.
 
   GLIBC_2.0 {
     #errlist-compat	127
@@ -16,6 +15,10 @@ libc {
     #errlist-compat	128
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
+  GLIBC_2.4 {
+    #errlist-compat	134
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
 }
 librt {
   GLIBC_2.3 {
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/errno.h b/sysdeps/unix/sysv/linux/sparc/bits/errno.h
index 96b7372f19..02e200c088 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux/Sparc specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,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
@@ -31,6 +31,12 @@
 #  define ECANCELED	127
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		132
+#  define ENOTRECOVERABLE	133
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 5dc8bf32f0..d68bfeb0ef 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/SPARC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -24,6 +24,9 @@
 
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -113,7 +116,7 @@
 # define F_SETLKW64	14	/* Set record locking info (blocking).  */
 #endif
 
-/* for F_[GET|SET]FL */
+/* for F_[GET|SET]FD */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -199,10 +202,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
index cc4917a54b..be2b7eb280 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SPARC version.
-   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2000,2003,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
@@ -57,12 +57,14 @@
 
 /* These are Linux-specific.  */
 #ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_GROWSDOWN	0x0200		/* Stack-like segment.  */
 # define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 # define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 # define MAP_LOCKED	0x0100		/* Lock the mapping.  */
 # define MAP_NORESERVE	0x0040		/* Don't check for reservations.  */
 # define _MAP_NEW	0x80000000	/* Binary compatibility with SunOS.  */
+# define MAP_POPULATE	0x8000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -78,6 +80,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -87,6 +90,10 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_FREE	 5	/* Content can be freed (Solaris).  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
index f7a7393154..53b94bc50e 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 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
@@ -35,6 +35,13 @@
 # define POLLWRBAND	0x100		/* Priority data may be written.  */
 #endif
 
+#ifdef __USE_GNU
+/* These are extensions for Linux.  */
+# define POLLMSG	0x200
+# define POLLREMOVE	0x400
+# define POLLRDHUP	0x800
+#endif
+
 /* Event types always implicitly polled for.  These bits need not be set in
    `events', but they will appear in `revents' to indicate the status of
    the file descriptor.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index ed31b0e89c..3f2c600141 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux/SPARC version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
index dac9ac5cba..b44cc0fcd5 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1999,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2003, 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
@@ -57,28 +58,12 @@ typedef struct __sparc64_jmp_buf
   } __jmp_buf[1];
 #endif
 
-/* 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)
-
 #else
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SP  0
-# define JB_FP  1
-# define JB_PC  2
-#endif
-
 #ifndef _ASM
 typedef int __jmp_buf[3];
 #endif
 
-/* 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])
-
 #endif
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/shm.h b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
index f075be8d8a..03decb110c 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
@@ -81,6 +81,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
index 1890a6f680..2fccb14cf9 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 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
@@ -60,15 +61,7 @@ struct stat
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
-#if __WORDSIZE == 64
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
-#else
-# ifdef __USE_MISC
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -78,17 +71,16 @@ struct stat
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# else
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-# endif
 #endif
     unsigned long int __unused4;
     unsigned long int __unused5;
@@ -112,15 +104,7 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if __WORDSIZE == 64
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
-#else
-# ifdef __USE_MISC
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -130,17 +114,16 @@ struct stat64
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# else
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-# endif
 #endif
     unsigned long int __unused4;
     unsigned long int __unused5;
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 16f76dfa54..cea13227f8 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -1,5 +1,6 @@
 /* termios type and macro definitions.  Linux/SPARC version.
-   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 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
@@ -84,34 +85,41 @@ struct termios
 #define ONLRET	0x00000020
 #define OFILL	0x00000040
 #define OFDEL	0x00000080
-#define NLDLY	0x00000100
-#define   NL0	0x00000000
-#define   NL1	0x00000100
-#define CRDLY	0x00000600
-#define   CR0	0x00000000
-#define   CR1	0x00000200
-#define   CR2	0x00000400
-#define   CR3	0x00000600
-#define TABDLY	0x00001800
-#define   TAB0	0x00000000
-#define   TAB1	0x00000800
-#define   TAB2	0x00001000
-#define   TAB3	0x00001800
-#define   XTABS	0x00001800
-#define BSDLY	0x00002000
-#define   BS0	0x00000000
-#define   BS1	0x00002000
-#define VTDLY	0x00004000
-#define   VT0	0x00000000
-#define   VT1	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	0x00000100
+# define   NL0	0x00000000
+# define   NL1	0x00000100
+# define CRDLY	0x00000600
+# define   CR0	0x00000000
+# define   CR1	0x00000200
+# define   CR2	0x00000400
+# define   CR3	0x00000600
+# define TABDLY	0x00001800
+# define   TAB0	0x00000000
+# define   TAB1	0x00000800
+# define   TAB2	0x00001000
+# define   TAB3	0x00001800
+# define BSDLY	0x00002000
+# define   BS0	0x00000000
+# define   BS1	0x00002000
 #define FFDLY	0x00008000
 #define   FF0	0x00000000
 #define   FF1	0x00008000
+#endif
+#define VTDLY	0x00004000
+#define   VT0	0x00000000
+#define   VT1	0x00004000
 #define PAGEOUT 0x00010000	/* SUNOS specific */
 #define WRAP    0x00020000	/* SUNOS specific */
 
+#ifdef __USE_MISC
+# define   XTABS	0x00001800
+#endif
+
 /* c_cflag bit meaning */
-#define CBAUD	0x0000100f
+#ifdef __USE_MISC
+# define CBAUD	0x0000100f
+#endif
 #define  B0	0x00000000	/* hang up */
 #define  B50	0x00000001
 #define  B75	0x00000002
@@ -128,8 +136,10 @@ struct termios
 #define  B9600	0x0000000d
 #define  B19200	0x0000000e
 #define  B38400	0x0000000f
-#define EXTA    B19200
-#define EXTB    B38400
+#ifdef __USE_MISC
+# define EXTA    B19200
+# define EXTB    B38400
+#endif
 #define  CSIZE  0x00000030
 #define   CS5	0x00000000
 #define   CS6	0x00000010
@@ -141,7 +151,9 @@ struct termios
 #define PARODD	0x00000200
 #define HUPCL	0x00000400
 #define CLOCAL	0x00000800
-#define CBAUDEX 0x00001000
+#ifdef __USE_MISC
+# define CBAUDEX 0x00001000
+#endif
 #define  B57600  0x00001001
 #define  B115200 0x00001002
 #define  B230400 0x00001003
@@ -159,26 +171,32 @@ struct termios
 #define B2000000 0x0000100f
 #define __MAX_BAUD B2000000
 
-#define CIBAUD	0x100f0000	/* input baud rate (not used) */
-#define CMSPAR	0x40000000	/* mark or space (stick) parity */
-#define CRTSCTS	0x80000000	/* flow control */
+#ifdef __USE_MISC
+# define CIBAUD	 0x100f0000	/* input baud rate (not used) */
+# define CMSPAR	 0x40000000	/* mark or space (stick) parity */
+# define CRTSCTS 0x80000000	/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000001
 #define ICANON	0x00000002
-#define XCASE	0x00000004
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00000004
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000010
 #define ECHOK	0x00000020
 #define ECHONL	0x00000040
 #define NOFLSH	0x00000080
 #define TOSTOP	0x00000100
-#define ECHOCTL	0x00000200
-#define ECHOPRT	0x00000400
-#define ECHOKE	0x00000800
-#define DEFECHO 0x00001000	/* SUNOS thing, what is it? */
-#define FLUSHO	0x00002000
-#define PENDIN	0x00004000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000200
+# define ECHOPRT	0x00000400
+# define ECHOKE		0x00000800
+# define DEFECHO 	0x00001000	/* SUNOS thing, what is it? */
+# define FLUSHO		0x00002000
+# define PENDIN		0x00004000
+#endif
 #define IEXTEN	0x00008000
 
 /* modem lines */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
new file mode 100644
index 0000000000..2d958d29e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -0,0 +1,20 @@
+/* Determine the wordsize from the preprocessor defines.  */
+
+#if defined __arch64__ || defined __sparcv9
+# define __WORDSIZE	64
+#else
+# define __WORDSIZE	32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+# if __WORDSIZE == 32
+/* Signal that in 32bit ABI we didn't used to have a `long double'.
+   The changes all the `long double' function variants to be redirects
+   to the double functions.  */
+#  define __LONG_DOUBLE_MATH_OPTIONAL   1
+#  ifndef __LONG_DOUBLE_128__
+#   define __NO_LONG_DOUBLE_MATH        1
+#  endif
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/readelflib.c b/sysdeps/unix/sysv/linux/sparc/readelflib.c
index ef5fa0e2cd..e12fbc7824 100644
--- a/sysdeps/unix/sysv/linux/sparc/readelflib.c
+++ b/sysdeps/unix/sysv/linux/sparc/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
new file mode 100644
index 0000000000..3ff55952e2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
@@ -0,0 +1 @@
+#include <sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
deleted file mode 100644
index 66f771a161..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-clone.S
-kernel_stat.h
-setfsuid.c
-setfsgid.c
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
index 05fd8523b7..cd1b3fb793 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
@@ -4,8 +4,18 @@ LD += -melf32_sparc
 
 # When I get this to work, this is the right thing
 ifeq ($(subdir),elf)
-CFLAGS-rtld.c += -mv8
+CFLAGS-rtld.c += -mcpu=v8
 #rtld-routines += dl-sysdepsparc
 sysdep-others += lddlibc4
 install-bin += lddlibc4
 endif   # elf
+
+ifeq ($(subdir),math)
+# These 2 routines are normally in libgcc{.a,_s.so.1}.
+# However, sparc32 -mlong-double-128 libgcc relies on
+# glibc providing _Q_* routines and without these files
+# glibc relies on __multc3/__divtc3 only provided
+# by libgcc if configured with -mlong-double-128.
+# Provide these routines here as well.
+libm-routines += multc3 divtc3
+endif   # math
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
index 1961622564..374131695c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
@@ -1 +1 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
+#include <sysdeps/unix/sysv/linux/sh/chown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 66cdbf3ca7..f91fc4f629 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -32,19 +33,26 @@
 	     pid_t *ptid, void *tls, pid_t *ctid); */
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
-
-__clone:
+ENTRY (__clone)
 	save	%sp,-96,%sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
-	tst	%i0
+	orcc	%i0,%g0,%g2
 	be	.Lerror
 	 orcc	%i1,%g0,%o1
 	be	.Lerror
 	 mov	%i2,%o0
+
+	/* The child_stack is the top of the stack, allocate one
+	   whole stack frame from that as this is what the kernel
+	   expects.  */
+	sub	%o1, 96, %o1
+	mov	%i3, %g3
+	mov	%i2, %g4
+
 	/* ptid */
 	mov	%i4,%o2
 	/* tls */
@@ -59,39 +67,43 @@ __clone:
 	 tst	%o1
 	bne	__thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0,%g0,%o0
 
 .Lerror:
 	call	__errno_location
 	 or	%g0,EINVAL,%i0
 	st	%i0,[%o0]
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-
-	.size	__clone, .-__clone
+END(__clone)
 
 	.type	__thread_start,@function
-
 __thread_start:
+	cfi_startproc
+
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
-	andcc	%i2, %l0, %g0
+	andcc	%g4, %l0, %g0
 	bne	1f
-	 andcc	%i2, CLONE_VM, %g0
+	 andcc	%g4, CLONE_VM, %g0
 	bne,a	2f
 	 mov	-1,%o0
 	set	__NR_getpid,%g1
 	ta	0x10
-2:	st	%o0,[%g7 + PID]
+2:
+	st	%o0,[%g7 + PID]
 	st	%o0,[%g7 + TID]
 1:
 #endif
-	call	%i0
-	 mov	%i3,%o0
+	mov	%g0, %fp	/* terminate backtrace */
+	call	%g2
+	 mov	%g3,%o0
 	call	_exit,0
 	 nop
 
+	cfi_endproc
+
 	.size	__thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c
deleted file mode 100644
index e9042d9717..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/sparc32 version of processor capability information.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-
-   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.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT
-   definition in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_sparc32_cap_flags
-#else
-PROCINFO_CLASS const char _dl_sparc32_cap_flags[6][7]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "flush", "stbar", "swap", "muldiv", "v9", "ultra3"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h
deleted file mode 100644
index 82a94fca9c..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Linux/sparc32 version of processor capability information handling macros.
-   Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
-
-   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_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 6
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_sparc32_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_sparc32_cap_flags)[idx];
-};
-
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_sparc32_cap_flags) [i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define HWCAP_IMPORTANT (HWCAP_SPARC_V9|HWCAP_SPARC_ULTRA3)
-
-/* There are no different platforms defined.  */
-#define _dl_platform_string(idx) ""
-
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies
new file mode 100644
index 0000000000..dbcd1e9e6f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies
@@ -0,0 +1,2 @@
+# We must list this here to move it ahead of the ldbl-opt code.
+sparc/sparc32/fpu
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
index 27ea9f8912..dbe0872616 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
@@ -19,20 +19,22 @@
 
 #include <sysdep.h>
 
-	.globl __libc_pipe
-ENTRY (__libc_pipe)
-        mov %o0, %o2            /* Save PIPEDES. */
-	mov SYS_ify(pipe),%g1
-	ta 0x10
-	bcs __syscall_error_handler
-	 nop
-	st %o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st %o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
+	.text
+	.globl		__syscall_error
+ENTRY(__libc_pipe)
+        mov	%o0, %o2            /* Save PIPEDES. */
+	mov	SYS_ify(pipe),%g1
+	ta	0x10
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
+        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
 	retl
-	 clr %o0
-	SYSCALL_ERROR_HANDLER
+	 clr	%o0
+END(__libc_pipe)
 
-PSEUDO_END (__libc_pipe)
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
 weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
index b28f009b06..64d47b34c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
@@ -1,6 +1,6 @@
 /* Semctl for architectures where word sized unions are passed indirectly
-   Copyright (C) 1995, 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1995,1997,1998,2000,2002,2003,2004,2006
+   	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_semid_ds
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/sparc32/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
index 3c12278e6a..71a63d5b79 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
@@ -40,10 +40,14 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
-.globl __socket
+	.globl		__syscall_error
 ENTRY (__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
@@ -72,18 +76,19 @@ ENTRY (__socket)
 	add %sp, 68, %o1		/* arg 2: parameter block */
 	LOADSYSCALL(socketcall)
 	t 0x10
-        bcs __syscall_error_handler
-	 nop
-	retl
+	bcc 1f
+	 mov %o7, %g1
+	call __syscall_error
+	 mov %g1, %o7
+1:	jmpl %o7 + 8, %g0
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save %sp, -96, %sp
-	cfi_def_cfa_register (%fp)
+	cfi_def_cfa_register(%fp)
 	cfi_window_save
-	cfi_register (%o7, %i7)
+	cfi_register(%o7, %i7)
 	CENABLE
 	 nop
 	mov %o0, %l0
@@ -91,18 +96,22 @@ ENTRY (__socket)
 	mov P(SOCKOP_,socket), %o0
 	LOADSYSCALL(socketcall)
 	t 0x10
-	bcs __syscall_error_handler2
+	bcc 1f
 	 mov %o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov %l0, %o0;
+	call __syscall_error;
+	 mov %l1, %o0;
+	b 1f
+	 mov -1, %l1;
+1:	CDISABLE
 	 mov %l0, %o0
-	jmpl %i7 + 8, %g0
+2:	jmpl %i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
 END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies
deleted file mode 100644
index 17ed964f79..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies
+++ /dev/null
@@ -1 +0,0 @@
-unix/sysv/linux/sparc/sparc32/sparcv9
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
index 3b135c8e86..1610745524 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
@@ -17,8 +17,10 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+
 	.text
-ENTRY (syscall)
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0, %g1
 	mov	%o1, %o0
 	mov	%o2, %o1
@@ -26,10 +28,10 @@ ENTRY (syscall)
 	mov	%o4, %o3
 	mov	%o5, %o4
 	ta	0x10
-	bcs	__syscall_error_handler
-	 nop
-	retl
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 29c5158b9f..c808a97fc5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
 
@@ -38,131 +38,54 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
+#undef PSEUDO_END
 #undef ENTRY
 #undef END
 #undef LOC
 
-#define ENTRY(name) \
-	.global C_SYMBOL_NAME(name); \
-	.align 4;\
-	C_LABEL(name);\
-	.type name,@function;
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
 
-#define END(name) \
+#define END(name)			\
+	cfi_endproc;			\
 	.size name, . - name
 
 #define LOC(name)  .L##name
 
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ld	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ld	[%l7 + %l1], %l1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	ld	[%g2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%o7+8, %g0;						\
-	 mov	-1, %o0;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-        .type   __errno_location,@function;				\
-	save   %sp, -96, %sp;						\
-	call   __errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10;						\
-	bcs __syscall_error_handler;				\
-	 nop;							\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)		\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;			\
+	bcc		1f;			\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
 #else  /* __ASSEMBLER__ */
 
@@ -214,4 +137,24 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
 
 #endif	/* __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dreg, reg, tmpreg) \
+  ld	[%g7 + POINTER_GUARD], tmpreg; \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
+#  define PTR_MANGLE2(dreg, reg, tmpreg) \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)     PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sparc/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/Dist b/sysdeps/unix/sysv/linux/sparc/sparc64/Dist
deleted file mode 100644
index 4ba3a60c2c..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-clone.S
-dl-brk.S
-kernel_stat.h
-getcontext.S
-setcontext.S
-sizes.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
index 1fabd11f71..134ce789f7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
@@ -37,8 +37,11 @@ __curbrk: .skip 8
 #endif
 
 	.text
-ENTRY(__brk)
+ENTRY (__brk)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 #ifdef PIC
 1:	call	2f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
@@ -90,7 +93,6 @@ ENTRY(__brk)
 	sub	%g0, 1, %i0
 	jmpl	%i7+8, %g0
 	 restore
-
-	.size __brk, .-__brk
+END (__brk)
 
 weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index a7c248b2e8..ebfce9e2c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -22,34 +22,52 @@
 
 #include <asm/errno.h>
 #include <asm/unistd.h>
+#include <tcb-offsets.h>
+#include <sysdep.h>
 
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+#define CLONE_VM	0x00000100
+#define CLONE_THREAD	0x00010000
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+	     pid_t *ptid, void *tls, pid_t *ctid); */
+
+	.register	%g2,#scratch
+	.register	%g3,#scratch
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
 
-__clone:
+ENTRY (__clone)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
-	brz,pn	%i0, 99f
-	 mov	%i0, %l0		/* save fn */
-	brz,pn	%i1, 99f
-	 mov	%i3, %l3		/* save arg */
+	brz,pn	%i0, 99f		/* fn non-NULL? */
+	 mov	%i0, %g2
+	brz,pn	%i1, 99f		/* child_stack non-NULL? */
+	 mov	%i2, %o0		/* clone flags */
+
+	/* The child_stack is the top of the stack, allocate one
+	   whole stack frame from that as this is what the kernel
+	   expects.  Also, subtract STACK_BIAS.  */
+	sub	%i1, 192 + 0x7ff, %o1
+	mov	%i3, %g3
+	mov	%i2, %g4
+
+	mov	%i4,%o2			/* PTID */
+	mov	%i5,%o3			/* TLS */
+	ldx	[%fp+0x7ff+176],%o4	/* CTID */
 
 	/* Do the system call */
-	sub	%i1, 0x7ff, %o1
-	mov	%i2, %o0
 	set	__NR_clone, %g1
 	ta	0x6d
 	bcs,pn	%xcc, 99f
 	 nop
 	brnz,pn	%o1, __thread_start
-	 mov	%o0, %i0
-	ret
-	 restore
+	 nop
+	jmpl	%i7 + 8, %g0
+	 restore %o0, %g0, %o0
 99:
 #ifndef _LIBC_REENTRANT
 #ifdef PIC
@@ -71,18 +89,33 @@ __clone:
 	 nop
 	st	%i0, [%o0]
 #endif
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-	.size __clone, .-__clone
+END(__clone)
 
 	.type __thread_start,@function
 __thread_start:
+	cfi_startproc
+#ifdef RESET_PID
+	sethi	%hi(CLONE_THREAD), %l0
+	andcc	%g4, %l0, %g0
+	bne,pt	%icc, 1f
+	 andcc	%g4, CLONE_VM, %g0
+	bne,a,pn %icc, 2f
+	 mov	-1,%o0
+	set	__NR_getpid,%g1
+	ta	0x6d
+2:	st	%o0,[%g7 + PID]
+	st	%o0,[%g7 + TID]
+1:
+#endif
 	mov	%g0, %fp	/* terminate backtrace */
-	sub	%sp, 6*8, %sp	/* provide arg storage */
-	call	%l0
-	 mov	%l3,%o0
+	call	%g2
+	 mov	%g3,%o0
 	call	_exit,0
 	 nop
-	.size __thread_start, .-__thread_start
+	cfi_endproc
+
+	.size	__thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c
deleted file mode 100644
index 0a453a6811..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/sparc64 version of processor capability information.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-
-   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.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT
-   definition in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_sparc64_cap_flags
-#else
-PROCINFO_CLASS const char _dl_sparc64_cap_flags[6][7]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "flush", "stbar", "swap", "muldiv", "v9", "ultra3"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h
deleted file mode 100644
index 3ce77a40e8..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Linux/sparc64 version of processor capability information handling macros.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
-
-   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_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 6
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_sparc64_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_sparc64_cap_flags)[idx];
-};
-
-
-static inline int
-__attribute__ ((unused))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_sparc64_cap_flags) [i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define HWCAP_IMPORTANT (HWCAP_SPARC_ULTRA3)
-
-/* There are no different platforms defined.  */
-#define _dl_platform_string(idx) ""
-
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c
new file mode 100644
index 0000000000..db08af8e0f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c
@@ -0,0 +1 @@
+#include "../../i386/fxstatat.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
index ea18a9ae4e..e6f5b55d6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
@@ -62,4 +62,4 @@ ENTRY(__getcontext)
 
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index 700dd127d0..a4e411d132 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -9,31 +9,39 @@ struct kernel_stat
     unsigned int st_gid;
     unsigned int st_rdev;
     long int st_size;
-    long int st_atime;
-    long int st_mtime;
-    long int st_ctime;
+    long int st_atime_sec;
+    long int st_mtime_sec;
+    long int st_ctime_sec;
     long int st_blksize;
     long int st_blocks;
     unsigned long int __unused1;
     unsigned long int __unused2;
   };
 
-#define _HAVE___UNUSED1
-#define _HAVE___UNUSED2
+/* Definition of `struct stat64' used in the kernel.  */
+struct kernel_stat64
+  {
+    unsigned long int st_dev;
+    unsigned long int st_ino;
+    unsigned long int st_nlink;
+
+    unsigned int st_mode;
+    unsigned int st_uid;
+    unsigned int st_gid;
+    unsigned int __pad0;
 
-#define _HAVE_STAT___UNUSED1
-#define _HAVE_STAT___UNUSED2
-#define _HAVE_STAT___UNUSED3
-#define _HAVE_STAT___UNUSED4
-#define _HAVE_STAT___UNUSED5
-#define _HAVE_STAT___PAD1
-#define _HAVE_STAT___PAD2
-#define _HAVE_STAT64___UNUSED1
-#define _HAVE_STAT64___UNUSED2
-#define _HAVE_STAT64___UNUSED3
-#define _HAVE_STAT64___UNUSED4
-#define _HAVE_STAT64___UNUSED5
-#define _HAVE_STAT64___PAD1
-#define _HAVE_STAT64___PAD2
+    unsigned long int st_rdev;
+    long int st_size;
+    long int st_blksize;
+    long int st_blocks;
+
+    unsigned long int st_atime_sec;
+    unsigned long int st_atime_nsec;
+    unsigned long int st_mtime_sec;
+    unsigned long int st_mtime_nsec;
+    unsigned long int st_ctime_sec;
+    unsigned long int st_ctime_nsec;
+    long int __unused[3];
+  };
 
 #define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
index 435bf99acb..88dc54e852 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
@@ -47,6 +47,6 @@ END(__libc_siglongjmp)
 strong_alias(__libc_siglongjmp, __longjmp)
 strong_alias(__libc_siglongjmp, __libc_longjmp)
 libc_hidden_def (__libc_longjmp)
-weak_alias(__libc_siglongjmp, longjmp)
-weak_alias(__libc_siglongjmp, _longjmp)
-weak_alias(__libc_siglongjmp, siglongjmp)
+weak_alias (__libc_siglongjmp, longjmp)
+weak_alias (__libc_siglongjmp, _longjmp)
+weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
index 7637472dfc..7f1e98e433 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
@@ -1 +1 @@
-#include "../../lxstat.c"
+#include "../../i386/lxstat.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c b/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
index 2ec5bd39ad..e399e7c7eb 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
@@ -1 +1,9 @@
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sysdep-cancel.h>
+
+#define __sigprocmask(how, set, oset) \
+  INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8)
+
 #include <sysdeps/posix/pause.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
index 5ccedff21a..14f244e628 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
@@ -19,18 +19,22 @@
 
 #include <sysdep.h>
 
-ENTRY (__libc_pipe)
+	.text
+
+	.globl	__syscall_error
+ENTRY(__libc_pipe)
 	mov	%o0, %o2		/* Save PIPEDES. */
 	LOADSYSCALL(pipe)
 	ta	0x6d
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
 	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
 	retl
 	 clr	%o0
-	SYSCALL_ERROR_HANDLER
-PSEUDO_END (__libc_pipe)
+END(__libc_pipe)
 
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
index 4e0bc96d22..90d47c18fa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
@@ -24,12 +24,15 @@
 .weak setcontext
 ENTRY(setcontext)
 
-	mov	1, %o1
+	ba,pt	%xcc, 1f
+	 mov	1, %o1
+
+END(setcontext)
 
 /* int __setcontext(ucontext_t *ctx, int restoremask); */
 ENTRY(__setcontext)
 
-	ldx	[%o0 + UC_SIGMASK], %o2
+1:	ldx	[%o0 + UC_SIGMASK], %o2
 	stx	%o2, [%o0 + __UC_SIGMASK]
 	ta	0x6f
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index 1a9359af5b..ab1690bb42 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -39,7 +39,8 @@ libc_hidden_def (_setjmp)
 /* int setjmp(jmp_buf) */
 
 ENTRY(setjmp)
-	set	1, %o1
+	ba,pt	%xcc, __sigsetjmp_local
+	 set	1, %o1
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
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/sparc/sparc64/sigsuspend.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
deleted file mode 100644
index 1f06e3d534..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../ia64/sigsuspend.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
index 575416ff3f..353705b4ac 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
@@ -40,11 +40,15 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
-.globl __socket
-ENTRY (__socket)
+	.globl	__syscall_error
+ENTRY(__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
 	   the caller for varargs, since that's really what we have.  */
@@ -73,14 +77,15 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save	%sp, -160, %sp
 	cfi_def_cfa_register (%fp)
 	cfi_window_save
@@ -93,18 +98,22 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler2
+	bcc,pt	%xcc, 1f
 	 mov	%o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov	%l0, %o0;
+	call	__syscall_error;
+	 mov	%l1, %o0;
+	ba,pt	%xcc, 2f
+	 mov	-1, %l1;
+1:	CDISABLE
 	 mov	%l0, %o0
-	jmpl	%i7 + 8, %g0
+2:	jmpl	%i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
-END (__socket)
+END(__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
index 27bd086206..27487d8ed9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
@@ -19,8 +19,8 @@
 #include <sysdep.h>
 	.text
 
-ENTRY (syscall)
-
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0,%g1
 	mov	%o1,%o0
 	mov	%o2,%o1
@@ -30,11 +30,10 @@ ENTRY (syscall)
 
 	ta	0x6d
 
-	bcs,pn %xcc,__syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index 3c6492aeca..f156f9241a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -25,6 +26,7 @@
 #ifdef IS_IN_rtld
 # include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
 #endif
+#include <tls.h>
 
 #undef SYS_ify
 #define SYS_ify(syscall_name) __NR_##syscall_name
@@ -47,99 +49,52 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
-#undef ENTRY
-
-#define ENTRY(name)							\
-	.global C_SYMBOL_NAME(name);					\
-	.align 2;							\
-	C_LABEL(name);							\
-	.type name,@function;
-
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp, -192, %sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ldx	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-	.type   __errno_location,@function;				\
-	save	%sp, -192, %sp;						\
-	call	__errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d;							\
-	bcs,pn	%xcc, __syscall_error_handler;				\
-	 nop;								\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)			\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
 #undef PSEUDO_END
-#define PSEUDO_END(name)						\
-	.size name,.-name
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					\
-	.size name,.-name
+#undef ENTRY
+#undef END
 
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)						\
-	.size name,.-name
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
+
+#define END(name)			\
+	cfi_endproc;			\
+	.size name, . - name
+
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;			\
+	bcc,pt		%xcc, 1f;		\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define	PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define	PSEUDO_ERRVAL(name, syscall_name, args) \
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
-#undef END
-#define END(name)							\
-	.size name,.-name
 
 /* Careful here!  This "ret" define can interfere; use jmpl if unsure.  */
 #define ret		retl; nop
@@ -197,4 +152,24 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
    register windows.  So if you poke stack memory directly you add this.  */
 #define STACK_BIAS	2047
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dreg, reg, tmpreg) \
+  ldx	[%g7 + POINTER_GUARD], tmpreg; \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
+#  define PTR_MANGLE2(dreg, reg, tmpreg) \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)     PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sparc64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
index 27d700b133..9f4c02c78b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
@@ -1 +1,8 @@
-#include "../../xstat.c"
+#include "../../i386/xstat.c"
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat{,64} calls.  */
+int __have_no_stat64;
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/xstatconv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c
index 41d1cbb768..d3f49eea43 100644
--- a/sysdeps/unix/sysv/linux/mips/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c
@@ -1,5 +1,6 @@
 /* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 1991,1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1996, 1997, 2000, 2002, 2003, 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
@@ -17,19 +18,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <kernel_stat.h>
-
-#ifdef STAT_IS_KERNEL_STAT
-
-/* Dummy.  */
-struct kernel_stat;
-
-#else
-
 #include <string.h>
-
+#include <kernel-features.h>
 
 int
 __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
@@ -49,27 +43,25 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 
 	/* Convert to current kernel version of `struct stat'.  */
 	buf->st_dev = kbuf->st_dev;
-	buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0;
+	buf->__pad1 = 0;
 	buf->st_ino = kbuf->st_ino;
 	buf->st_mode = kbuf->st_mode;
 	buf->st_nlink = kbuf->st_nlink;
 	buf->st_uid = kbuf->st_uid;
 	buf->st_gid = kbuf->st_gid;
 	buf->st_rdev = kbuf->st_rdev;
-	buf->st_pad2[0] = 0; buf->st_pad2[1] = 0;
-	buf->st_pad3 = 0;
+	buf->__pad2 = 0;
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
-
-	buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0;
-	buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0;
-	buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0;
-
-	buf->st_pad5[0] = 0; buf->st_pad5[1] = 0;
-	buf->st_pad5[2] = 0; buf->st_pad5[3] = 0;
-	buf->st_pad5[4] = 0; buf->st_pad5[5] = 0;
-	buf->st_pad5[6] = 0; buf->st_pad5[7] = 0;
+	buf->st_atim.tv_sec = kbuf->st_atime_sec;
+	buf->st_atim.tv_nsec = 0;
+	buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+	buf->st_mtim.tv_nsec = 0;
+	buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+	buf->st_ctim.tv_nsec = 0;
+	buf->__unused4 = 0;
+	buf->__unused5 = 0;
       }
       break;
 
@@ -82,39 +74,44 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 }
 
 int
-__xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+__xstat32_conv (int vers, struct stat64 *sbuf, struct stat *buf)
 {
-#ifdef XSTAT_IS_XSTAT64
-  return xstat_conv (vers, kbuf, ubuf);
-#else
+  struct kernel_stat64 *kbuf;
+
+  /* *stat64 syscalls on sparc64 really fill in struct kernel_stat64,
+     rather than struct stat64.  But it is the same size as
+     struct kernel_stat64, so use this hack so that we can reuse
+     i386 {,f,l}xstat{,at}.c routines.  */
+  __asm ("" : "=r" (kbuf) : "0" (sbuf));
+  assert (sizeof (struct stat) == sizeof (struct stat64));
+  assert (sizeof (struct stat64) >= sizeof (struct kernel_stat64));
+
   switch (vers)
     {
     case _STAT_VER_LINUX:
       {
-	struct stat64 *buf = ubuf;
-
+	/* Convert current kernel version of `struct stat64' to
+           `struct stat'.  */
 	buf->st_dev = kbuf->st_dev;
-	buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0;
+	buf->__pad1 = 0;
 	buf->st_ino = kbuf->st_ino;
 	buf->st_mode = kbuf->st_mode;
 	buf->st_nlink = kbuf->st_nlink;
 	buf->st_uid = kbuf->st_uid;
 	buf->st_gid = kbuf->st_gid;
 	buf->st_rdev = kbuf->st_rdev;
-	buf->st_pad2[0] = 0; buf->st_pad2[1] = 0; buf->st_pad2[2] = 0;
-	buf->st_pad3 = 0;
+	buf->__pad2 = 0;
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
-
-	buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0;
-	buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0;
-	buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0;
-
-	buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
-	buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
-	buf->st_pad4[4] = 0; buf->st_pad4[5] = 0;
-	buf->st_pad4[6] = 0; buf->st_pad4[7] = 0;
+	buf->st_atim.tv_sec = kbuf->st_atime_sec;
+	buf->st_atim.tv_nsec = kbuf->st_atime_nsec;
+	buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+	buf->st_mtim.tv_nsec = kbuf->st_mtime_nsec;
+	buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+	buf->st_ctim.tv_nsec = kbuf->st_ctime_nsec;
+	buf->__unused4 = 0;
+	buf->__unused5 = 0;
       }
       break;
 
@@ -127,7 +124,4 @@ __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
     }
 
   return 0;
-#endif
 }
-
-#endif /* ! STAT_IS_KERNEL_STAT */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
index d573f0e994..17907c4a38 100644
--- a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
@@ -1,5 +1,6 @@
 /* `ptrace' debugger support interface.  Linux/SPARC version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 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
@@ -148,12 +149,11 @@ enum __ptrace_request
 #endif
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PTRACE_SYSCALL PTRACE_SYSCALL
 
 #if __WORDSIZE == 64
 
-  ,
   /* Get all floating point registers used by a processes.
      This is not supported on all machines.  */
    PTRACE_GETFPREGS = 25,
@@ -161,10 +161,26 @@ enum __ptrace_request
 
   /* Set all floating point registers used by a processes.
      This is not supported on all machines.  */
-   PTRACE_SETFPREGS = 26
+   PTRACE_SETFPREGS = 26,
 #define PT_SETFPREGS PTRACE_SETFPREGS
 
 #endif
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sysdep.S
deleted file mode 100644
index b031238ceb..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sysdep.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Nothing to do here.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.c b/sysdeps/unix/sysv/linux/sparc/sysdep.c
new file mode 100644
index 0000000000..f86414570d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/powerpc/sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/statvfs64.c b/sysdeps/unix/sysv/linux/statvfs64.c
index 79d82c756a..bcef1d3afb 100644
--- a/sysdeps/unix/sysv/linux/statvfs64.c
+++ b/sysdeps/unix/sysv/linux/statvfs64.c
@@ -1,5 +1,5 @@
 /* Return information about the filesystem on which FILE resides.
-   Copyright (C) 1998, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 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
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern void __internal_statvfs64 (const char *name, struct statvfs64 *buf,
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
new file mode 100644
index 0000000000..4cfc924bfc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Make a symbolic link to FROM named TO relative to TOFD.  */
+int
+symlinkat (from, tofd, to)
+     const char *from;
+     int tofd;
+     const char *to;
+{
+  int result;
+
+#ifdef __NR_symlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (symlinkat, 3, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (tofd != AT_FDCWD && to[0] != '/')
+    {
+      size_t tolen = strlen (to);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + tolen;
+      buf = __alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, tofd, to);
+      to = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), tofd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/mips/ustat.c b/sysdeps/unix/sysv/linux/sync_file_range.c
index a309f7104c..7519bb7fe6 100644
--- a/sysdeps/unix/sysv/linux/mips/ustat.c
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Selective file content synch'ing.
+   Copyright (C) 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -18,20 +18,30 @@
    02111-1307 USA.  */
 
 #include <errno.h>
-#include <sys/ustat.h>
-#include <sys/sysmacros.h>
+#include <fcntl.h>
+#include <sys/types.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
-#include <bp-checks.h>
 
+
+#ifdef __NR_sync_file_range
 int
-ustat (dev_t dev, struct ustat *ubuf)
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
 {
-  unsigned long k_dev;
-
-  /* We must convert the value to dev_t type used by the kernel.  */
-  k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff);
-
-  return INLINE_SYSCALL (ustat, 2, k_dev, CHECK_1 (ubuf));
+  return INLINE_SYSCALL (sync_file_range, 6, fd,
+			 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+			 __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+			 flags);
 }
+#else
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (sync_file_range)
+
+# include <stub-tag.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h
index 6c310bcff5..68f173a04d 100644
--- a/sysdeps/unix/sysv/linux/sys/epoll.h
+++ b/sysdeps/unix/sysv/linux/sys/epoll.h
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -98,9 +98,12 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
    "events" parameter is a buffer that will contain triggered
    events. The "maxevents" is the maximum number of events to be
    returned ( usually size of "events" ). The "timeout" parameter
-   specifies the maximum wait time in milliseconds (-1 == infinite).  */
+   specifies the maximum wait time in milliseconds (-1 == infinite).
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
-		       int __maxevents, int __timeout) __THROW;
+		       int __maxevents, int __timeout);
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h
new file mode 100644
index 0000000000..0131db9d3e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/inotify.h
@@ -0,0 +1,92 @@
+/* Copyright (C) 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
+   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	_SYS_INOTIFY_H
+#define	_SYS_INOTIFY_H	1
+
+#include <stdint.h>
+
+
+/* Structure describing an inotify event.  */
+struct inotify_event
+{
+  int wd;		/* Watch descriptor.  */
+  uint32_t mask;	/* Watch mask.  */
+  uint32_t cookie;	/* Cookie to synchronize two events.  */
+  uint32_t len;		/* Length (including NULs) of name.  */
+  char name __flexarr;	/* Name.  */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH.  */
+#define IN_ACCESS	 0x00000001	/* File was accessed.  */
+#define IN_MODIFY	 0x00000002	/* File was modified.  */
+#define IN_ATTRIB	 0x00000004	/* Metadata changed.  */
+#define IN_CLOSE_WRITE	 0x00000008	/* Writtable file was closed.  */
+#define IN_CLOSE_NOWRITE 0x00000010	/* Unwrittable file closed.  */
+#define IN_CLOSE	 (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close.  */
+#define IN_OPEN		 0x00000020	/* File was opened.  */
+#define IN_MOVED_FROM	 0x00000040	/* File was moved from X.  */
+#define IN_MOVED_TO      0x00000080	/* File was moved to Y.  */
+#define IN_MOVE		 (IN_MOVED_FROM | IN_MOVED_TO) /* Moves.  */
+#define IN_CREATE	 0x00000100	/* Subfile was created.  */
+#define IN_DELETE	 0x00000200	/* Subfile was deleted.  */
+#define IN_DELETE_SELF	 0x00000400	/* Self was deleted.  */
+#define IN_MOVE_SELF	 0x00000800	/* Self was moved.  */
+
+/* Events sent by the kernel.  */
+#define IN_UNMOUNT	 0x00002000	/* Backing fs was unmounted.  */
+#define IN_Q_OVERFLOW	 0x00004000	/* Event queued overflowed.  */
+#define IN_IGNORED	 0x00008000	/* File was ignored.  */
+
+/* Helper events.  */
+#define IN_CLOSE	 (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)	/* Close.  */
+#define IN_MOVE		 (IN_MOVED_FROM | IN_MOVED_TO)		/* Moves.  */
+
+/* Special flags.  */
+#define IN_ONLYDIR	 0x01000000	/* Only watch the path if it is a
+					   directory.  */
+#define IN_DONT_FOLLOW	 0x02000000	/* Do not follow a sym link.  */
+#define IN_MASK_ADD	 0x20000000	/* Add to the mask of an already
+					   existing watch.  */
+#define IN_ISDIR	 0x40000000	/* Event occurred against dir.  */
+#define IN_ONESHOT	 0x80000000	/* Only send event once.  */
+
+/* All events which a program can wait on.  */
+#define IN_ALL_EVENTS	 (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE  \
+			  | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM	      \
+			  | IN_MOVED_TO | IN_CREATE | IN_DELETE		      \
+			  | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance.  */
+extern int inotify_init (void) __THROW;
+
+/* Add watch of object NAME to inotify instance FD.  Notify about
+   events specified by MASK.  */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+  __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD.  */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/sysdeps/unix/sysv/linux/sys/kd.h b/sysdeps/unix/sysv/linux/sys/kd.h
index e0d2e869cf..d459c079ed 100644
--- a/sysdeps/unix/sysv/linux/sys/kd.h
+++ b/sysdeps/unix/sysv/linux/sys/kd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 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
@@ -21,9 +21,15 @@
 
 /* Make sure the <linux/types.h> header is not loaded.  */
 #ifndef _LINUX_TYPES_H
-# define _LINUX_TYPES_H	1
+# define _LINUX_TYPES_H		1
+# define __undef_LINUX_TYPES_H
 #endif
 
 #include <linux/kd.h>
 
+#ifdef __undef_LINUX_TYPES_H
+# undef _LINUX_TYPES_H
+# undef __undef_LINUX_TYPES_H
+#endif
+
 #endif	/* sys/kd.h */
diff --git a/sysdeps/unix/sysv/linux/sys/ptrace.h b/sysdeps/unix/sysv/linux/sys/ptrace.h
index b4aec4f208..44284cb307 100644
--- a/sysdeps/unix/sysv/linux/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2000,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
@@ -109,8 +109,24 @@ enum __ptrace_request
 #define PT_SETFPXREGS PTRACE_SETFPXREGS
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index a8baf40a91..5aa0ec07d2 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -30,8 +30,6 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * Version: $Id$
  */
 
 #ifndef _SYS_QUOTA_H
@@ -41,6 +39,14 @@
 #include <sys/types.h>
 
 /*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later.  */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
+/*
  * Convert diskblocks to blocks and the other way around.
  * currently only to fool the BSD source. :-)
  */
@@ -94,21 +100,33 @@
 #define SUBCMDSHIFT 8
 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
 
-#define Q_QUOTAON  0x0100	/* enable quotas */
-#define Q_QUOTAOFF 0x0200	/* disable quotas */
-#define Q_GETQUOTA 0x0300	/* get limits and usage */
-#define Q_SETQUOTA 0x0400	/* set limits and usage */
-#define Q_SETUSE   0x0500	/* set usage */
-#define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM  0x0700	/* set limits */
-#define Q_GETSTATS 0x0800	/* get collected stats */
-#define Q_RSQUASH  0x1000	/* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON  0x0100	/* enable quotas */
+# define Q_QUOTAOFF 0x0200	/* disable quotas */
+# define Q_GETQUOTA 0x0300	/* get limits and usage */
+# define Q_SETQUOTA 0x0400	/* set limits and usage */
+# define Q_SETUSE   0x0500	/* set usage */
+# define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM  0x0700	/* set limits */
+# define Q_GETSTATS 0x0800	/* get collected stats */
+# define Q_RSQUASH  0x1000	/* set root_squash option */
+#else
+# define Q_SYNC     0x800001	/* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON  0x800002	/* turn quotas on */
+# define Q_QUOTAOFF 0x800003	/* turn quotas off */
+# define Q_GETFMT   0x800004	/* get quota format used on given filesystem */
+# define Q_GETINFO  0x800005	/* get information about quota files */
+# define Q_SETINFO  0x800006	/* set information about quota files */
+# define Q_GETQUOTA 0x800007	/* get user quota structure */
+# define Q_SETQUOTA 0x800008	/* set user quota structure */
+#endif
 
 /*
  * The following structure defines the format of the disk quota file
  * (as it appears on disk) - the file is an array of these structures
  * indexed by user or group number.
  */
+#if _LINUX_QUOTA_VERSION < 2
 struct dqblk
   {
     u_int32_t dqb_bhardlimit;	/* absolute limit on disk blks alloc */
@@ -120,13 +138,45 @@ struct dqblk
     time_t dqb_btime;		/* time limit for excessive disk use */
     time_t dqb_itime;		/* time limit for excessive files */
   };
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid.  */
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+  {
+    u_int64_t dqb_bhardlimit;	/* absolute limit on disk quota blocks alloc */
+    u_int64_t dqb_bsoftlimit;	/* preferred limit on disk quota blocks */
+    u_int64_t dqb_curspace;	/* current quota block count */
+    u_int64_t dqb_ihardlimit;	/* maximum # allocated inodes */
+    u_int64_t dqb_isoftlimit;	/* preferred inode limit */
+    u_int64_t dqb_curinodes;	/* current # allocated inodes */
+    u_int64_t dqb_btime;	/* time limit for excessive disk use */
+    u_int64_t dqb_itime;	/* time limit for excessive files */
+    u_int32_t dqb_valid;	/* bitmask of QIF_* constants */
+  };
+#endif
 
 /*
  * Shorthand notation.
  */
 #define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
 #define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
-#define	dq_curblocks	dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks	dq_dqb.dqb_curblocks
+#else
+# define dq_curspace	dq_dqb.dqb_curspace
+# define dq_valid	dq_dqb.dqb_valid
+#endif
 #define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
 #define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
 #define	dq_curinodes	dq_dqb.dqb_curinodes
@@ -135,6 +185,7 @@ struct dqblk
 
 #define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
 
+#if _LINUX_QUOTA_VERSION < 2
 struct dqstats
   {
     u_int32_t lookups;
@@ -147,6 +198,22 @@ struct dqstats
     u_int32_t free_dquots;
     u_int32_t syncs;
   };
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid.  */
+# define IIF_BGRACE	1
+# define IIF_IGRACE	2
+# define IIF_FLAGS	4
+# define IIF_ALL	(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+  {
+    u_int64_t dqi_bgrace;
+    u_int64_t dqi_igrace;
+    u_int32_t dqi_flags;
+    u_int32_t dqi_valid;
+  };
+#endif
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index a97305e822..e16110480f 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	Args	Strong name	Weak names
 
-add_key		EXTRA	add_key		i:pppii	add_key
 adjtimex	adjtime	adjtimex	i:p	__adjtimex	adjtimex ntp_adjtime __adjtimex_internal
 bdflush		EXTRA	bdflush		i:ii	bdflush
 capget		EXTRA	capget		i:pp	capget
@@ -10,8 +9,8 @@ create_module	EXTRA	create_module	3	create_module
 delete_module	EXTRA	delete_module	3	delete_module
 epoll_create	EXTRA	epoll_create	i:i	epoll_create
 epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
-epoll_wait	EXTRA	epoll_wait	i:ipii	epoll_wait
-fdatasync	-	fdatasync	i:i	fdatasync
+epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
+fdatasync	-	fdatasync	Ci:i	fdatasync
 flock		-	flock		i:ii	__flock		flock
 fork		-	fork		i:	__libc_fork	__fork fork
 get_kernel_syms	EXTRA	get_kernel_syms	i:p	get_kernel_syms
@@ -25,19 +24,20 @@ getresuid	-	getresuid	i:ppp	getresuid
 getresgid	-	getresgid	i:ppp	getresgid
 getsid		-	getsid		i:i	getsid
 init_module	EXTRA	init_module	5	init_module
+inotify_add_watch	EXTRA	inotify_add_watch	i:isi	inotify_add_watch
+inotify_init	EXTRA	inotify_init	i:	inotify_init
+inotify_rm_watch	EXTRA	inotify_rm_watch	i:ii	inotify_rm_watch
 ioperm		-	ioperm		i:iii	ioperm
 iopl		-	iopl		i:i	iopl
-keyctl		EXTRA	keyctl		i:iiiii	keyctl
 klogctl		EXTRA	syslog		i:isi	klogctl
 lchown		-	lchown		i:sii	__lchown	lchown
-posix_madvise	-	madvise		Vi:pii	posix_madvise
 madvise		-	madvise		i:pii	madvise
 mincore		-	mincore		i:anV	mincore
 mlock		-	mlock		i:bn	mlock
 mlockall	-	mlockall	i:i	mlockall
 mmap		-	mmap		b:aniiii	__mmap		mmap
 mount		EXTRA	mount		i:sssip	__mount	mount
-mremap		EXTRA	mremap		b:aini	__mremap	mremap
+mremap		EXTRA	mremap		b:ainip	__mremap	mremap
 munlock		-	munlock		i:ai	munlock
 munlockall	-	munlockall	i:	munlockall
 nanosleep	-	nanosleep	Ci:pp	__libc_nanosleep	__nanosleep nanosleep
@@ -51,7 +51,6 @@ putpmsg		-	putpmsg		i:ippii	putpmsg
 query_module	EXTRA	query_module	i:sipip	query_module
 quotactl	EXTRA	quotactl	i:isip	quotactl
 remap_file_pages -	remap_file_pages i:piiii	__remap_file_pages remap_file_pages
-request_key	EXTRA	request_key	i:pppi	request_key
 sched_getp	-	sched_getparam	i:ip	__sched_getparam	sched_getparam
 sched_gets	-	sched_getscheduler	i:i	__sched_getscheduler	sched_getscheduler
 sched_primax	-	sched_get_priority_max	i:i	__sched_get_priority_max	sched_get_priority_max
@@ -67,10 +66,14 @@ setfsgid	EXTRA	setfsgid	i:i	setfsgid
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
 sigaltstack	-	sigaltstack	i:PP	__sigaltstack	sigaltstack
+splice		EXTRA	splice		i:iPiPii	splice
 sysinfo		EXTRA	sysinfo		i:p	sysinfo
 swapon		-	swapon		i:si	__swapon	swapon
 swapoff		-	swapoff		i:s	__swapoff	swapoff
+tee		EXTRA	tee		i:iiii	tee
+unshare		EXTRA	unshare		i:i	unshare
 uselib		EXTRA	uselib		i:s	uselib
+vmsplice	EXTRA	vmsplice	i:iPii	vmsplice
 wait4		-	wait4		i:iWiP	__wait4		wait4
 
 chown		-	chown		i:sii	__libc_chown	__chown chown
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 3cf6aa70bb..f9f6f1bfa5 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -48,6 +48,28 @@ __sysconf (int name)
       }
 #endif
 
+#if defined __NR_clock_getres || HP_TIMING_AVAIL
+    case _SC_CPUTIME:
+    case _SC_THREAD_CPUTIME:
+      {
+	/* If we have HP_TIMING, we will fall back on that if the system
+	   call does not work, so we support it either way.  */
+# if !HP_TIMING_AVAIL
+	/* Check using the clock_getres system call.  */
+	struct timespec ts;
+	INTERNAL_SYSCALL_DECL (err);
+	int r = INTERNAL_SYSCALL (clock_getres, err, 2,
+				  (name == _SC_CPUTIME
+				   ? CLOCK_PROCESS_CPUTIME_ID
+				   : CLOCK_THREAD_CPUTIME_ID),
+				  &ts);
+	if (INTERNAL_SYSCALL_ERROR_P (r, err))
+	  return -1;
+# endif
+	return _POSIX_VERSION;
+      }
+#endif
+
     case _SC_NGROUPS_MAX:
       /* Try to read the information from the /proc/sys/kernel/ngroups_max
 	 file.  */
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 7e601acf2c..637fca5968 100644
--- a/sysdeps/unix/sysv/linux/sysctl.c
+++ b/sysdeps/unix/sysv/linux/sysctl.c
@@ -1,5 +1,5 @@
 /* Read or write system information.  Linux version.
-   Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-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
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sys/sysctl.h>
 
 #include <sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/syslog.c b/sysdeps/unix/sysv/linux/syslog.c
new file mode 100644
index 0000000000..145e22b520
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/syslog.c
@@ -0,0 +1,10 @@
+#include <kernel-features.h>
+
+#if __ASSUME_MSG_NOSIGNAL
+# define NO_SIGPIPE
+# define send_flags MSG_NOSIGNAL
+#else
+# define send_flags 0
+#endif
+
+#include <misc/syslog.c>
diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c
index 3fdff04c22..c5b389ea29 100644
--- a/sysdeps/unix/sysv/linux/system.c
+++ b/sysdeps/unix/sysv/linux/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -18,6 +18,7 @@
 
 #include <sched.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/wait.h>
diff --git a/sysdeps/unix/sysv/linux/tcflow.c b/sysdeps/unix/sysv/linux/tcflow.c
index 5be68e2ea2..6e72370272 100644
--- a/sysdeps/unix/sysv/linux/tcflow.c
+++ b/sysdeps/unix/sysv/linux/tcflow.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/bsd/sun/sunos4/tcflow.c>
+/* tcflow -- Suspend or restart transmission on termios file descriptor.
+   Copyright (C) 1993,1997,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 <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Suspend or restart transmission on FD.  */
+int
+tcflow (fd, action)
+     int fd;
+     int action;
+{
+  return __ioctl (fd, TCXONC, action);
+}
diff --git a/sysdeps/unix/sysv/linux/tcflush.c b/sysdeps/unix/sysv/linux/tcflush.c
index 78e09b2f75..cae419f4a9 100644
--- a/sysdeps/unix/sysv/linux/tcflush.c
+++ b/sysdeps/unix/sysv/linux/tcflush.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/bsd/sun/sunos4/tcflush.c>
+/* tcflush -- Flush pending data on termios file descriptor.  Linux version.
+   Copyright (C) 1993,1997,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 <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Flush pending data on FD.  */
+int
+tcflush (fd, queue_selector)
+     int fd;
+     int queue_selector;
+{
+  return __ioctl (fd, TCFLSH, queue_selector);
+}
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index 63453ca031..28e3e535ba 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995,1997,1998,2003,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
@@ -40,39 +40,40 @@ __tcgetattr (fd, termios_p)
 
   retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
 
-  termios_p->c_iflag = k_termios.c_iflag;
-  termios_p->c_oflag = k_termios.c_oflag;
-  termios_p->c_cflag = k_termios.c_cflag;
-  termios_p->c_lflag = k_termios.c_lflag;
-  termios_p->c_line = k_termios.c_line;
+  if (__builtin_expect (retval == 0, 1))
+    {
+      termios_p->c_iflag = k_termios.c_iflag;
+      termios_p->c_oflag = k_termios.c_oflag;
+      termios_p->c_cflag = k_termios.c_cflag;
+      termios_p->c_lflag = k_termios.c_lflag;
+      termios_p->c_line = k_termios.c_line;
 #ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
 # ifdef _HAVE_C_ISPEED
-  termios_p->c_ispeed = k_termios.c_ispeed;
+      termios_p->c_ispeed = k_termios.c_ispeed;
 # else
-  termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+      termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
 # endif
 #endif
 #ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
 # ifdef _HAVE_C_OSPEED
-  termios_p->c_ospeed = k_termios.c_ospeed;
+      termios_p->c_ospeed = k_termios.c_ospeed;
 # else
-  termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+      termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
 # endif
 #endif
-  if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
-      || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
-    memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
-		       __KERNEL_NCCS * sizeof (cc_t)),
-	    _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
-  else
-    {
-      size_t cnt;
-
-      memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
-	      __KERNEL_NCCS * sizeof (cc_t));
+      if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
+	  || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
+	memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+			   __KERNEL_NCCS * sizeof (cc_t)),
+		_POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
+      else
+	{
+	  memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+		  __KERNEL_NCCS * sizeof (cc_t));
 
-      for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
-	termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+	  for (size_t cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
+	    termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+	}
     }
 
   return retval;
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index f73ec8883e..21e6ab2ede 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -49,6 +49,7 @@ tcsetattr (fd, optional_actions, termios_p)
 {
   struct __kernel_termios k_termios;
   unsigned long int cmd;
+  int retval;
 
   switch (optional_actions)
     {
@@ -80,6 +81,35 @@ tcsetattr (fd, optional_actions, termios_p)
   memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
 	  __KERNEL_NCCS * sizeof (cc_t));
 
-  return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+  retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+
+  if (retval == 0 && cmd == TCSETS)
+    {
+      /* The Linux kernel has a bug which silently ignore the invalid
+        c_cflag on pty. We have to check it here. */
+      int save = errno;
+      retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
+      if (retval)
+       {
+         /* We cannot verify if the setting is ok. We don't return
+            an error (?). */
+         __set_errno (save);
+         retval = 0;
+       }
+      else if ((termios_p->c_cflag & (PARENB | CREAD))
+              != (k_termios.c_cflag & (PARENB | CREAD))
+              || ((termios_p->c_cflag & CSIZE)
+                  && ((termios_p->c_cflag & CSIZE)
+                      != (k_termios.c_cflag & CSIZE))))
+       {
+         /* It looks like the Linux kernel silently changed the
+            PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
+            error. */
+         __set_errno (EINVAL);
+         retval = -1;
+       }
+    }
+
+  return retval;
 }
 libc_hidden_def (tcsetattr)
diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h
index cf36ab08a7..f823a3f5af 100644
--- a/sysdeps/unix/sysv/linux/testrtsig.h
+++ b/sysdeps/unix/sysv/linux/testrtsig.h
@@ -1,5 +1,5 @@
 /* Test whether RT signals are really available.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 static int
 kernel_has_rtsig (void)
diff --git a/sysdeps/unix/bsd/sun/m68k/sethostid.S b/sysdeps/unix/sysv/linux/time.c
index 73ee79682e..83667906dd 100644
--- a/sysdeps/unix/bsd/sun/m68k/sethostid.S
+++ b/sysdeps/unix/sysv/linux/time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,29 +16,28 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+#include <stddef.h>
+#include <time.h>
 
-#ifdef	 SYS_sethostid
+#include <sysdep.h>
 
-SYSCALL (sethostid, 1)
-	ret
+#ifdef __NR_time
+
+time_t
+time (t)
+     time_t *t;
+{
+  INTERNAL_SYSCALL_DECL (err);
+  time_t res = INTERNAL_SYSCALL (time, err, 1, NULL);
+  /* There cannot be any error.  */
+  if (t != NULL)
+    *t = res;
+  return res;
+}
+libc_hidden_def (time)
 
 #else
 
-#include <bits/errno.h>
-
-.globl _sethostid
-.even
-_sethostid:
-	movel #ENOSYS, _errno
-	moveq #-1, d0
-	rts
-
-#ifdef	HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
+# include <sysdeps/unix/time.c>
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index e6af2c4b04..f43cffe01a 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997-2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2003,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
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -71,5 +72,5 @@ truncate64 (const char *path, off64_t length)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
+# include <misc/truncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/arm/brk.c b/sysdeps/unix/sysv/linux/tst-clone.c
index 153d89358a..8e249c2f04 100644
--- a/sysdeps/unix/sysv/linux/arm/brk.c
+++ b/sysdeps/unix/sysv/linux/tst-clone.c
@@ -1,5 +1,5 @@
-/* brk system call for Linux/ARM.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Test for proper error/errno handling in clone.
+   Copyright (C) 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
@@ -17,33 +17,40 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+/* BZ #2386 */
 #include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
-#include <sysdep.h>
+#include <sched.h>
 
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
+int child_fn(void *arg)
 {
-  void *newbrk;
+  puts ("FAIL: in child_fn(); should not be here");
+  exit(1);
+}
 
-  asm ("mov a1, %1\n"	/* save the argment in r0 */
-       "swi %2\n"	/* do the system call */
-       "mov %0, a1;"	/* keep the return value */
-       : "=r"(newbrk) 
-       : "r"(addr), "i" (SYS_ify (brk))
-       : "a1");
+static int
+do_test (void)
+{
+  int result;
 
-  __curbrk = newbrk;
+#ifdef __ia64__
+  result = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL);
+#else
+  result = clone(child_fn, NULL, (int) NULL, NULL);
+#endif
 
-  if (newbrk < addr)
+  if (errno != EINVAL || result != -1)
     {
-      __set_errno (ENOMEM);
-      return -1;
+      printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n",
+              result, errno, EINVAL);
+      return 1;
     }
 
+  puts ("All OK");
   return 0;
 }
-weak_alias (__brk, brk)
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 68d24f195e..1b79787515 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1996-2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1996-2002,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
@@ -22,11 +22,13 @@
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <termios.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 #if 0
 /* Is this used anywhere?  It is not exported.  */
@@ -41,7 +43,7 @@ static char *getttyname (const char *dev, dev_t mydev,
 libc_freeres_ptr (static char *getttyname_name);
 
 static char *
-internal_function
+internal_function attribute_compat_text_section
 getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
 {
   static size_t namelen;
@@ -117,9 +119,11 @@ ttyname (int fd)
   int dostat = 0;
   char *name;
   int save = errno;
-  int len;
+  struct termios term;
 
-  if (!__isatty (fd))
+  /* isatty check, tcgetattr is used because it sets the correct
+     errno (EBADF resp. ENOTTY) on error.  */
+  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
     return NULL;
 
   /* We try using the /proc filesystem.  */
@@ -136,10 +140,19 @@ ttyname (int fd)
 	}
     }
 
-  len = __readlink (procname, ttyname_buf, buflen);
-  if (len != -1
-      /* This is for Linux 2.0.  */
-      && ttyname_buf[0] != '[')
+  ssize_t len = __readlink (procname, ttyname_buf, buflen);
+  if (__builtin_expect (len == -1 && errno == ENOENT, 0))
+    {
+      __set_errno (EBADF);
+      return NULL;
+    }
+
+  if (__builtin_expect (len != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& ttyname_buf[0] != '['
+#endif
+			, 1))
     {
       if ((size_t) len >= buflen)
 	return NULL;
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index eee4d862b2..cef8624dc6 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1995-2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1995-2001,2003,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
@@ -22,18 +22,20 @@
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <termios.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 static int getttyname_r (char *buf, size_t buflen,
 			 dev_t mydev, ino64_t myino, int save,
 			 int *dostat) internal_function;
 
 static int
-internal_function
+internal_function attribute_compat_text_section
 getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
 	      int save, int *dostat)
 {
@@ -99,7 +101,6 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   struct stat64 st, st1;
   int dostat = 0;
   int save = errno;
-  int ret;
 
   /* Test for the absolute minimal size.  This makes life easier inside
      the loop.  */
@@ -115,29 +116,34 @@ __ttyname_r (int fd, char *buf, size_t buflen)
       return ERANGE;
     }
 
+  /* isatty check, tcgetattr is used because it sets the correct
+     errno (EBADF resp. ENOTTY) on error.  */
+  struct termios term;
+  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+    return errno;
+
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
-  ret = __readlink (procname, buf, buflen - 1);
-  if (ret == -1 && errno == ENOENT)
+  ssize_t ret = __readlink (procname, buf, buflen - 1);
+  if (__builtin_expect (ret == -1 && errno == ENOENT, 0))
     {
       __set_errno (EBADF);
       return EBADF;
     }
 
-  if (!__isatty (fd))
-    {
-      __set_errno (ENOTTY);
-      return ENOTTY;
-    }
-
-  if (ret == -1 && errno == ENAMETOOLONG)
+  if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
     {
       __set_errno (ERANGE);
       return ERANGE;
     }
 
-  if (ret != -1 && buf[0] != '[')
+  if (__builtin_expect (ret != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& buf[0] != '['
+#endif
+			, 1))
     {
       buf[ret] = '\0';
       return 0;
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
new file mode 100644
index 0000000000..0a07a8a875
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -0,0 +1,97 @@
+/* unlinkat -- Remove a link by relative name.
+   Copyright (C) 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
+   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 <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Remove the link named NAME.  */
+int
+unlinkat (fd, file, flag)
+     int fd;
+     const char *file;
+     int flag;
+{
+  int result;
+
+#ifdef __NR_unlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (unlinkat, 3, fd, file, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_REMOVEDIR)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = __alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_REMOVEDIR)
+    result = INTERNAL_SYSCALL (rmdir, err, 1, file);
+  else
+    result = INTERNAL_SYSCALL (unlink, err, 1, file);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/updwtmp.c b/sysdeps/unix/sysv/linux/updwtmp.c
index 63dd87e418..d4d3f2cb7a 100644
--- a/sysdeps/unix/sysv/linux/updwtmp.c
+++ b/sysdeps/unix/sysv/linux/updwtmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -31,4 +31,4 @@
 	 && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
 	file_name))))
 
-#include <sysdeps/generic/updwtmp.c>
+#include <login/updwtmp.c>
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index d777672125..a6095aaea5 100644
--- a/sysdeps/unix/sysv/linux/utimes.c
+++ b/sysdeps/unix/sysv/linux/utimes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 2000, 2003, 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
@@ -21,7 +21,7 @@
 #include <utime.h>
 #include <sys/time.h>
 #include <sysdep.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* Change the access time of FILE to TVP[0] and
diff --git a/sysdeps/unix/sysv/linux/utmp_file.c b/sysdeps/unix/sysv/linux/utmp_file.c
index 3a27802b11..958619a032 100644
--- a/sysdeps/unix/sysv/linux/utmp_file.c
+++ b/sysdeps/unix/sysv/linux/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -31,4 +31,4 @@
 	 && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
 	file_name))))
 
-#include <sysdeps/generic/utmp_file.c>
+#include <login/utmp_file.c>
diff --git a/sysdeps/unix/sysv/linux/vfork.c b/sysdeps/unix/sysv/linux/vfork.c
index 9b4dd5f121..c8c13d0fd5 100644
--- a/sysdeps/unix/sysv/linux/vfork.c
+++ b/sysdeps/unix/sysv/linux/vfork.c
@@ -1 +1 @@
-#include <sysdeps/generic/vfork.c>
+#include <posix/vfork.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
new file mode 100644
index 0000000000..8b1c932ba9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -0,0 +1,109 @@
+/* Copyright (C) 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
+   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.  */
+
+/* Ho hum, since fxstatat == fxstatat64 we must get rid of the
+   prototype or gcc will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <kernel-features.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+
+/* Get information about the file NAME relative to FD in ST.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  if (vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  int res;
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (newfstatat, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    res = INTERNAL_SYSCALL (lstat, err, 2, file, CHECK_1 (st));
+  else
+    res = INTERNAL_SYSCALL (stat, err, 2, file, CHECK_1 (st));
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
+libc_hidden_def (__fxstatat)
+#undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c
new file mode 100644
index 0000000000..05e7f413bb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c
@@ -0,0 +1 @@
+/* fxstatat64 is in fxstatat.c */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
index 491fa9dfb2..5ea4c572a3 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
@@ -1,4 +1,4 @@
 #define __getdents64 __no___getdents64_decl
 #include <sysdeps/unix/sysv/linux/getdents.c>
 #undef __getdents64
-weak_alias(__getdents, __getdents64);
+weak_alias (__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 58904fc4d4..d377db9687 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -14,3 +14,4 @@ getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit getrlimit64
 setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit setrlimit64
 readahead	-	readahead	i:iii	__readahead	readahead
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
+sync_file_range	-	sync_file_range	i:iiii	sync_file_range
diff --git a/sysdeps/unix/sysv/linux/x86_64/Dist b/sysdeps/unix/sysv/linux/x86_64/Dist
deleted file mode 100644
index 57dd1b2221..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/Dist
+++ /dev/null
@@ -1,11 +0,0 @@
-clone.S
-ldd-rewrite.sed
-__start_context.S
-ucontext_i.h
-umount.c
-sys/debugreg.h
-sys/io.h
-sys/perm.h
-sys/procfs.h
-sys/reg.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
index 627275db09..0f20367236 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -9,3 +9,7 @@ endif
 ifeq ($(subdir),stdlib)
 sysdep_routines += __start_context
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index 9198c70bd4..fa1d02bc1f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/x86-64.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 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
@@ -21,9 +21,12 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -110,7 +113,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -194,10 +197,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
index a7bac26935..535c9edcf9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/x86_64 version.
-   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
index 4282d75617..3d8c05d212 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
@@ -80,6 +80,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
index 08d4c52b2f..c0d5fe72d4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
@@ -70,6 +70,14 @@ struct _fpstate
   __uint32_t		padding[56];
 };
 
+#ifndef sigcontext_struct
+/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
+   we need sigcontext.  Some packages have come to rely on
+   sigcontext_struct being defined on 32-bit x86, so define this for
+   their benefit.  */
+# define sigcontext_struct sigcontext
+#endif
+
 struct sigcontext
 {
   unsigned short gs, __gsh;
diff --git a/sysdeps/unix/sysv/linux/x86_64/brk.c b/sysdeps/unix/sysv/linux/x86_64/brk.c
index 09b7dd4707..8b18c4dbb9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/brk.c
+++ b/sysdeps/unix/sysv/linux/x86_64/brk.c
@@ -1 +1,42 @@
-#include <sysdeps/unix/sysv/linux/hppa/brk.c>
+/* brk system call for Linux/x86_64.
+   Copyright (C) 1995, 1996, 2000, 2001, 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
+   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 <unistd.h>
+#include <sysdep.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void *__curbrk = 0;
+
+int
+__brk (void *addr)
+{
+  void *newbrk;
+
+  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
index 9695e1eaf8..8a12b09035 100644
--- a/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -74,7 +74,7 @@ ENTRY (BP_SYM (__clone))
 	movq	%r8, %rdx
 	movq	%r9, %r8
 	movq	8(%rsp), %r10
-	movq	$SYS_ify(clone),%rax
+	movl	$SYS_ify(clone),%eax
 
 	/* End FDE now, because in the child the unwind info will be
 	   wrong.  */
@@ -91,7 +91,7 @@ L(pseudo_end):
 L(thread_start):
 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
 	   the outermost frame obviously.  */
-	xorq	%rbp, %rbp
+	xorl	%ebp, %ebp
 
 #ifdef RESET_PID
 	testq	$CLONE_THREAD, %rdi
@@ -99,7 +99,7 @@ L(thread_start):
 	testq	$CLONE_VM, %rdi
 	movl	$-1, %eax
 	jne	2f
-	movq	$SYS_ify(getpid), %rax
+	movl	$SYS_ify(getpid), %eax
 	syscall
 2:	movl	%eax, %fs:PID
 	movl	%eax, %fs:TID
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
index 7e26fecb3a..6662a94d09 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
@@ -1,5 +1,5 @@
 #ifdef IS_IN_ldconfig
-#include <sysdeps/i386/dl-procinfo.c>
+# include <sysdeps/i386/dl-procinfo.c>
 #else
-#include <sysdeps/generic/dl-procinfo.c>
+# include <sysdeps/generic/dl-procinfo.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
index b360b4288a..31455204c3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
@@ -1,5 +1,5 @@
 #ifdef IS_IN_ldconfig
-#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
+# include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
 #else
-#include <sysdeps/generic/dl-procinfo.h>
+# include <sysdeps/generic/dl-procinfo.h>
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
index 2f2c710040..4bbc7a4d2e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -67,18 +67,22 @@ ENTRY(__getcontext)
 	/* Save the current signal mask with
 	   rt_sigprocmask (SIG_BLOCK, NULL, set,_NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rdx
-	xorq	%rsi,%rsi
-	movq	$SIG_BLOCK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	xorl	%esi,%esi
+#if SIG_BLOCK == 0
+	xorl	%edi, %edi
+#else
+	movl	$SIG_BLOCK, %edi
+#endif
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	cmpq	$-4095, %rax		/* Check %rax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
 	/* All done, return 0 for success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index c763556b93..5deea7d1b2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -1,5 +1,5 @@
 /* Create 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.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -20,6 +20,7 @@
 
 #include <sysdep.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <ucontext.h>
 
 #include "ucontext_i.h"
@@ -52,28 +53,29 @@ void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __start_context (void);
-  unsigned long *sp, idx_uc_link;
+  unsigned long int *sp, idx_uc_link;
   va_list ap;
   int i;
 
   /* Generate room on stack for parameter if needed and uc_link.  */
-  sp = (long *) ((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+  sp = (unsigned long int *) ((uintptr_t) ucp->uc_stack.ss_sp
+			      + ucp->uc_stack.ss_size);
   sp -= (argc > 6 ? argc - 6 : 0) + 1;
   /* Align stack and make space for trampoline address.  */
-  sp = (long *) ((((long) sp) & -16L) - 8);
+  sp = (unsigned long int *) ((((uintptr_t) sp) & -16L) - 8);
 
   idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
 
   /* Setup context ucp.  */
   /* Address to jump to.  */
-  ucp->uc_mcontext.gregs[REG_RIP] = (long) func;
+  ucp->uc_mcontext.gregs[REG_RIP] = (long int) func;
   /* Setup rbx.*/
-  ucp->uc_mcontext.gregs[REG_RBX] = (long) &sp[idx_uc_link];
-  ucp->uc_mcontext.gregs[REG_RSP] = (long) sp;
+  ucp->uc_mcontext.gregs[REG_RBX] = (long int) &sp[idx_uc_link];
+  ucp->uc_mcontext.gregs[REG_RSP] = (long int) sp;
 
   /* Setup stack.  */
-  sp[0] = (long) &__start_context;
-  sp[idx_uc_link] = (long) ucp->uc_link;
+  sp[0] = (unsigned long int) &__start_context;
+  sp[idx_uc_link] = (unsigned long int) ucp->uc_link;
 
   va_start (ap, argc);
   /* Handle arguments.  */
@@ -108,4 +110,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 }
 
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
index c672f1df5a..5a49af3fa6 100644
--- a/sysdeps/unix/sysv/linux/x86_64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
index 65c03d8a01..61fc07f44f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
@@ -1,5 +1,5 @@
 /* Install given 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.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -40,10 +40,10 @@ ENTRY(__setcontext)
 	/* Set the signal mask with
 	   rt_sigprocmask (SIG_SETMASK, mask, NULL, _NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rsi
-	xorq	%rdx, %rdx
-	movq	$SIG_SETMASK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	xorl	%edx, %edx
+	movl	$SIG_SETMASK, %edi
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	popq	%rdi			/* Reload %rdi, adjust stack.  */
 	cfi_adjust_cfa_offset(-8)
@@ -96,10 +96,10 @@ ENTRY(__setcontext)
 	cfi_startproc
 
 	/* Clear rax to indicate success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 
 L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
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/unix/sysv/linux/x86_64/sigsuspend.c b/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
deleted file mode 100644
index 9c5c79e63e..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
index 4394e2ae9f..fc7996ccdc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and install the given one.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -73,9 +73,9 @@ ENTRY(__swapcontext)
 	   rt_sigprocmask (SIG_BLOCK, newset, oldset,_NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rdx
 	leaq	oSIGMASK(%rsi), %rsi
-	movq	$SIG_SETMASK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	movl	$SIG_SETMASK, %edi
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	cmpq	$-4095, %rax		/* Check %rax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
@@ -114,10 +114,10 @@ ENTRY(__swapcontext)
 	movq	oRSI(%rsi), %rsi
 
 	/* Clear rax to indicate success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 
 L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h b/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
index cffddb58b3..02672d3c75 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,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
@@ -98,9 +98,12 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
    "events" parameter is a buffer that will contain triggered
    events. The "maxevents" is the maximum number of events to be
    returned ( usually size of "events" ). The "timeout" parameter
-   specifies the maximum wait time in milliseconds (-1 == infinite).  */
+   specifies the maximum wait time in milliseconds (-1 == infinite).
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
-		       int __maxevents, int __timeout) __THROW;
+		       int __maxevents, int __timeout);
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysconf.c b/sysdeps/unix/sysv/linux/x86_64/sysconf.c
index 407fd46bc3..5a898b7857 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysconf.c
+++ b/sysdeps/unix/sysv/linux/x86_64/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -45,11 +45,24 @@ static const struct intel_02_cache_info
     { 0x29, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
     { 0x2c, _SC_LEVEL1_DCACHE_SIZE, 32768, 8, 64 },
     { 0x30, _SC_LEVEL1_ICACHE_SIZE, 32768, 8, 64 },
+    { 0x39, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 64 },
+    { 0x3a, _SC_LEVEL2_CACHE_SIZE, 196608, 6, 64 },
+    { 0x3b, _SC_LEVEL2_CACHE_SIZE, 131072, 2, 64 },
+    { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
+    { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
+    { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
     { 0x44, _SC_LEVEL2_CACHE_SIZE, 1048576, 4, 32 },
     { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
+    { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
+    { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
+    { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
+    { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
+    { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
+    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
+    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
     { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
     { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
     { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
@@ -60,6 +73,7 @@ static const struct intel_02_cache_info
     { 0x7b, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 64 },
     { 0x7c, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
     { 0x7d, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 64 },
+    { 0x7f, _SC_LEVEL2_CACHE_SIZE, 524288, 2, 64 },
     { 0x82, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 32 },
     { 0x83, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 32 },
     { 0x84, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 32 },
@@ -87,6 +101,7 @@ intel_02_known_compare (const void *p1, const void *p2)
 
 
 static long int
+__attribute__ ((noinline))
 intel_check_word (int name, unsigned int value, bool *has_level_2,
 		  bool *no_level_2_or_3)
 {
@@ -113,6 +128,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 	}
       else
 	{
+	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	    {
+	      /* Intel reused this value.  For family 15, model 6 it
+		 specifies the 3rd level cache.  Otherwise the 2nd
+		 level cache.  */
+	      unsigned int eax;
+	      unsigned int ebx;
+	      unsigned int ecx;
+	      unsigned int edx;
+	      asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+			    : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+			    : "0" (1));
+
+	      unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+	      unsigned int model = ((((eax >>16) & 0xf) << 4)
+				    + ((eax >> 4) & 0xf));
+	      if (family == 15 && model == 6)
+		{
+		  /* The level 3 cache is encoded for this model like
+		     the level 2 cache is for other models.  Pretend
+		     the caller asked for the level 2 cache.  */
+		  name = (_SC_LEVEL2_CACHE_SIZE
+			  + (name - _SC_LEVEL3_CACHE_SIZE));
+		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		}
+	    }
+
 	  struct intel_02_cache_info *found;
 	  struct intel_02_cache_info search;
 
@@ -149,7 +191,7 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
   assert (maxidx >= 2);
@@ -206,7 +248,7 @@ handle_intel (int name, unsigned int maxidx)
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_amd (int name)
 {
   unsigned int eax;
@@ -279,12 +321,6 @@ handle_amd (int name)
 long int
 __sysconf (int name)
 {
-  if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME)
-    {
-      /* XXX Test whether TSC is usable.  */
-      return 200112L;
-    }
-
   /* We only handle the cache information here (for now).  */
   if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
     return linux_sysconf (name);
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index fd92d7ae16..5dfffca455 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -119,7 +119,7 @@
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
   leaq rtld_errno(%rip), %rcx;			\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
@@ -133,7 +133,7 @@
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
   movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, %fs:(%rcx);			\
   orq $-1, %rax;				\
@@ -143,7 +143,7 @@
    Note that errno occupies only 4 bytes.  */
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   pushq %rdx;					\
   cfi_adjust_cfa_offset(8);			\
@@ -161,7 +161,7 @@
 #else /* Not _LIBC_REENTRANT.  */
 # define SYSCALL_ERROR_HANDLER			\
 0:movq errno@GOTPCREL(%RIP), %rcx;		\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
@@ -208,7 +208,7 @@
 #undef	DO_CALL
 #define DO_CALL(syscall_name, args)		\
     DOARGS_##args				\
-    movq $SYS_ify (syscall_name), %rax;		\
+    movl $SYS_ify (syscall_name), %eax;		\
     syscall;
 
 #define DOARGS_0 /* nothing */
@@ -311,4 +311,31 @@
 
 #endif	/* __ASSEMBLER__ */
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorq __pointer_chk_guard_local(%rip), reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(reg)	asm ("xorq __pointer_chk_guard_local(%%rip), %0"\
+				     : "=r" (reg) : "0" (reg))
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# endif
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorq %fs:POINTER_GUARD, reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(var)	asm ("xorq %%fs:%c2, %0"		      \
+				     : "=r" (var)			      \
+				     : "0" (var),			      \
+				       "i" (offsetof (tcbhead_t,	      \
+						      pointer_guard)))
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/x86_64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
deleted file mode 100644
index 5451a308ee..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation for Linux/x86-64.
-   Copyright (C) 2002 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.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Since we cannot include a header to define _NSIG/8, we define it
-   here.  */
-#define _NSIG8		8
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oRBP		120
-#define oRSP		160
-#define oRBX		128
-#define oR8		40
-#define oR9		48
-#define oR12		72
-#define oR13		80
-#define oR14		88
-#define oR15		96
-#define oRDI		104
-#define oRSI		112
-#define oRDX		136
-#define oRAX		144
-#define oRCX		152
-#define oRIP		168
-#define oFPREGS		208
-#define oSIGMASK	280
-#define oFPREGSMEM	408
-#define oMXCSR		432
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
new file mode 100644
index 0000000000..b3cfe9aa4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
@@ -0,0 +1,34 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+_NSIG8		(_NSIG / 8)
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oRBP		mreg (RBP)
+oRSP		mreg (RSP)
+oRBX		mreg (RBX)
+oR8		mreg (R8)
+oR9		mreg (R9)
+oR12		mreg (R12)
+oR13		mreg (R13)
+oR14		mreg (R14)
+oR15		mreg (R15)
+oRDI		mreg (RDI)
+oRSI		mreg (RSI)
+oRDX		mreg (RDX)
+oRAX		mreg (RAX)
+oRCX		mreg (RCX)
+oRIP		mreg (RIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
+oMXCSR		ucontext (__fpregs_mem.mxcsr)
diff --git a/sysdeps/unix/sysv/linux/x86_64/umount.c b/sysdeps/unix/sysv/linux/x86_64/umount.c
index 9a91ba5b2f..a17c5c5799 100644
--- a/sysdeps/unix/sysv/linux/x86_64/umount.c
+++ b/sysdeps/unix/sysv/linux/x86_64/umount.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
+/* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
+
+   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.  */
+
+/* Since we don't have an oldumount system call, do what the kernel
+   does down here.  */
+
+extern long int __umount2 (const char *name, int flags);
+
+long int
+__umount (const char *name)
+{
+  return __umount2 (name, 0);
+}
+
+weak_alias (__umount, umount);
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
new file mode 100644
index 0000000000..ef27b686cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -0,0 +1,95 @@
+/* Copyright (C) 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
+   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 <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+#include <sysdep.h>
+#include <kernel-features.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+
+/* Create a device file named PATH relative to FD, with permission and
+   special bits MODE and device number DEV (which can be constructed
+   from major and minor device numbers with the `makedev' macro above).  */
+int
+__xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
+{
+  if (vers != _MKNOD_VER)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We must convert the value to dev_t type used by the kernel.  */
+  unsigned long long int k_dev =  (*dev) & ((1ULL << 32) - 1);
+  if (k_dev != *dev)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+#ifdef __NR_mknodat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      int res = INLINE_SYSCALL (mknodat, 4, fd, file, mode,
+				(unsigned int) k_dev);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  return INLINE_SYSCALL (mknod, 3, CHECK_STRING (file), mode,
+			 (unsigned int) k_dev);
+#endif
+}
+
+libc_hidden_def (__xmknodat)
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index 9e5110657a..096aac813b 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -1,5 +1,5 @@
 /* xstat64 using old-style Unix stat system call.
-   Copyright (C) 1991, 1995-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-2002,2003,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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/xstatconv.h b/sysdeps/unix/sysv/linux/xstatconv.h
index 387a9feffc..7e36620430 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.h
+++ b/sysdeps/unix/sysv/linux/xstatconv.h
@@ -1,5 +1,6 @@
 /* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 1991,1995-1997,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-1997,2000,2002,2003,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
@@ -17,7 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifndef STAT_IS_KERNEL_STAT
 extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
diff --git a/sysdeps/unix/sysv/tcflow.c b/sysdeps/unix/sysv/tcflow.c
index 1a91bd47db..dc67d0664f 100644
--- a/sysdeps/unix/sysv/tcflow.c
+++ b/sysdeps/unix/sysv/tcflow.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 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,7 +22,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 
-#include "sysv_termio.h"
+#include <sysv_termio.h>
 
 /* Suspend or restart transmission on FD.  */
 int
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
index 0d0d715052..aca81fef2f 100644
--- a/sysdeps/unix/x86_64/sysdep.S
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 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
@@ -42,7 +42,7 @@ syscall_error:
 	   EWOULDBLOCK_sys is the original number.  */
 	cmpq $EWOULDBLOCK_sys, %rax /* Is it the old EWOULDBLOCK?  */
 	jne notb		/* Branch if not.  */
-	movq $EAGAIN, %rax	/* Yes; translate it to EAGAIN.  */
+	movl $EAGAIN, %eax	/* Yes; translate it to EAGAIN.  */
 notb:
 #endif
 #if USE___THREAD