about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-05-10 17:06:32 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-05-10 17:06:32 -0700
commit73ba80e963b9d5b8d5dd120ebe3fc6f1b0eb52b4 (patch)
treea8aa28784af92823ce5b35336c11566668c90d5c
parent63494e2428228987d4904bf461ba8503c42dc631 (diff)
parentdf8a552f6f93f62c494177a49ee49d3bf40949b8 (diff)
downloadglibc-73ba80e963b9d5b8d5dd120ebe3fc6f1b0eb52b4.tar.gz
glibc-73ba80e963b9d5b8d5dd120ebe3fc6f1b0eb52b4.tar.xz
glibc-73ba80e963b9d5b8d5dd120ebe3fc6f1b0eb52b4.zip
Merge remote-tracking branch 'origin/master' into hjl/x32/master
-rw-r--r--ChangeLog393
-rw-r--r--NEWS11
-rw-r--r--bits/in.h16
-rw-r--r--bits/libc-lock.h5
-rw-r--r--bits/sigaction.h4
-rw-r--r--config.h.in3
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure18
-rw-r--r--configure.in11
-rw-r--r--elf/Makefile5
-rw-r--r--hurd/catch-signal.c13
-rw-r--r--hurd/hurd/fd.h8
-rw-r--r--hurd/hurdchdir.c5
-rw-r--r--hurd/hurdselect.c28
-rw-r--r--hurd/hurdsock.c8
-rw-r--r--hurd/intern-fd.c4
-rw-r--r--hurd/lookup-retry.c9
-rw-r--r--hurd/port2fd.c4
-rw-r--r--include/libc-symbols.h11
-rw-r--r--include/sys/socket.h3
-rw-r--r--include/unistd.h3
-rw-r--r--io/fcntl.h26
-rw-r--r--libio/fileops.c4
-rw-r--r--libio/freopen.c5
-rw-r--r--libio/freopen64.c5
-rw-r--r--math/libm-test.inc16
-rw-r--r--math/w_ilogbf.c1
-rw-r--r--misc/syslog.c2
-rw-r--r--nis/Makefile6
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/sysdeps/pthread/bits/libc-lockP.h2
-rw-r--r--nscd/connections.c7
-rw-r--r--nscd/netgroupcache.c7
-rw-r--r--nss/makedb.c8
-rw-r--r--nss/nss_db/db-initgroups.c2
-rw-r--r--posix/tst-sysconf.c6
-rw-r--r--streams/stropts.h3
-rw-r--r--sunrpc/Makefile6
-rw-r--r--sunrpc/auth_des.c4
-rw-r--r--sunrpc/auth_none.c2
-rw-r--r--sunrpc/auth_unix.c4
-rw-r--r--sunrpc/authdes_prot.c4
-rw-r--r--sunrpc/authuxprot.c2
-rw-r--r--sunrpc/clnt_gen.c2
-rw-r--r--sunrpc/clnt_perr.c10
-rw-r--r--sunrpc/clnt_raw.c2
-rw-r--r--sunrpc/clnt_simp.c2
-rw-r--r--sunrpc/clnt_tcp.c2
-rw-r--r--sunrpc/clnt_udp.c6
-rw-r--r--sunrpc/clnt_unix.c2
-rw-r--r--sunrpc/des_crypt.c4
-rw-r--r--sunrpc/des_soft.c2
-rw-r--r--sunrpc/get_myaddr.c2
-rw-r--r--sunrpc/key_call.c18
-rw-r--r--sunrpc/key_prot.c20
-rw-r--r--sunrpc/netname.c10
-rw-r--r--sunrpc/pm_getmaps.c2
-rw-r--r--sunrpc/pm_getport.c4
-rw-r--r--sunrpc/pmap_clnt.c4
-rw-r--r--sunrpc/pmap_prot.c2
-rw-r--r--sunrpc/pmap_prot2.c2
-rw-r--r--sunrpc/pmap_rmt.c8
-rw-r--r--sunrpc/publickey.c4
-rw-r--r--sunrpc/rpc_cmsg.c2
-rw-r--r--sunrpc/rpc_common.c2
-rw-r--r--sunrpc/rpc_dtable.c2
-rw-r--r--sunrpc/rpc_prot.c14
-rw-r--r--sunrpc/rpc_thread.c8
-rw-r--r--sunrpc/rtime.c2
-rw-r--r--sunrpc/svc.c32
-rw-r--r--sunrpc/svc_auth.c2
-rw-r--r--sunrpc/svc_raw.c2
-rw-r--r--sunrpc/svc_run.c4
-rw-r--r--sunrpc/svc_tcp.c4
-rw-r--r--sunrpc/svc_udp.c6
-rw-r--r--sunrpc/svc_unix.c4
-rw-r--r--sunrpc/svcauth_des.c2
-rw-r--r--sunrpc/xcrypt.c4
-rw-r--r--sunrpc/xdr.c44
-rw-r--r--sunrpc/xdr_array.c4
-rw-r--r--sunrpc/xdr_float.c4
-rw-r--r--sunrpc/xdr_intXX_t.c20
-rw-r--r--sunrpc/xdr_mem.c2
-rw-r--r--sunrpc/xdr_rec.c8
-rw-r--r--sunrpc/xdr_ref.c4
-rw-r--r--sunrpc/xdr_sizeof.c2
-rw-r--r--sunrpc/xdr_stdio.c2
-rw-r--r--sysdeps/generic/ldsodefs.h6
-rw-r--r--sysdeps/generic/paths.h8
-rw-r--r--sysdeps/gnu/configure36
-rw-r--r--sysdeps/gnu/configure.in36
-rw-r--r--sysdeps/ieee754/dbl-64/s_logb.c37
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c13
-rw-r--r--sysdeps/ieee754/flt-32/s_logbf.c32
-rw-r--r--sysdeps/ieee754/ldbl-128/s_logbl.c31
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c35
-rw-r--r--sysdeps/ieee754/ldbl-96/s_logbl.c35
-rw-r--r--sysdeps/mach/bits/libc-lock.h5
-rw-r--r--sysdeps/mach/hurd/Makefile3
-rw-r--r--sysdeps/mach/hurd/accept.c65
-rw-r--r--sysdeps/mach/hurd/accept4.c100
-rw-r--r--sysdeps/mach/hurd/bits/fcntl.h11
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h3
-rw-r--r--sysdeps/mach/hurd/bits/libc-lock.h5
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h30
-rw-r--r--sysdeps/mach/hurd/bits/socket.h362
-rw-r--r--sysdeps/mach/hurd/bits/stat.h59
-rw-r--r--sysdeps/mach/hurd/brk.c20
-rw-r--r--sysdeps/mach/hurd/chroot.c5
-rw-r--r--sysdeps/mach/hurd/configure170
-rw-r--r--sysdeps/mach/hurd/configure.in4
-rw-r--r--sysdeps/mach/hurd/dirfd.c5
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c11
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.h5
-rw-r--r--sysdeps/mach/hurd/dup2.c114
-rw-r--r--sysdeps/mach/hurd/dup3.c140
-rw-r--r--sysdeps/mach/hurd/i386/Makefile4
-rw-r--r--sysdeps/mach/hurd/i386/____longjmp_chk.S107
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c47
-rw-r--r--sysdeps/mach/hurd/i386/signal-defines.sym10
-rw-r--r--sysdeps/mach/hurd/ioctl.c21
-rw-r--r--sysdeps/mach/hurd/kernel-features.h13
-rw-r--r--sysdeps/mach/hurd/mkdir.c8
-rw-r--r--sysdeps/mach/hurd/mkdirat.c9
-rw-r--r--sysdeps/mach/hurd/mlock.c4
-rw-r--r--sysdeps/mach/hurd/openat.c6
-rw-r--r--sysdeps/mach/hurd/opendir.c42
-rw-r--r--sysdeps/mach/hurd/readlinkat.c64
-rw-r--r--sysdeps/mach/hurd/recvfrom.c6
-rw-r--r--sysdeps/mach/hurd/setitimer.c5
-rw-r--r--sysdeps/mach/hurd/setresgid.c76
-rw-r--r--sysdeps/mach/hurd/setresuid.c75
-rw-r--r--sysdeps/mach/hurd/xmknodat.c10
-rw-r--r--sysdeps/mach/hurd/xstatconv.c11
-rw-r--r--sysdeps/mach/nanosleep.c33
-rw-r--r--sysdeps/posix/getaddrinfo.c2
-rw-r--r--sysdeps/posix/getcwd.c3
-rw-r--r--sysdeps/unix/sysv/linux/configure32
-rw-r--r--sysdeps/unix/sysv/linux/configure.in32
-rw-r--r--sysdeps/x86_64/dl-machine.h4
140 files changed, 2264 insertions, 724 deletions
diff --git a/ChangeLog b/ChangeLog
index 559754ec6f..2f0880257c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,362 @@
+2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf/elf.h (R_X86_64_RELATIVE64): New.
+	(R_X86_64_NUM): Updated.
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Handle
+	R_X86_64_RELATIVE64.  Always use Elf64_Addr with R_X86_64_64.
+	(elf_machine_rela_relative): Handle R_X86_64_RELATIVE64.
+	* sysdeps/x86_64/Makefile (tests): Add tst-quad1 tst-quad2
+	tst-quad1pie tst-quad2pie
+	(modules-names): Add tst-quadmod1 tst-quadmod2.
+	($(objpfx)tst-quad1): New dependency.
+	($(objpfx)tst-quad2): Likewise.
+	($(objpfx)tst-quad1pie): Likewise.
+	($(objpfx)tst-quad2pie): Likewise.
+	* sysdeps/x86_64/tst-quad1.c: New file.
+	* sysdeps/x86_64/tst-quad1pie.c: New file.
+	* sysdeps/x86_64/tst-quad2.c: Likewise.
+	* sysdeps/x86_64/tst-quad2pie.c: Likewise.
+	* sysdeps/x86_64/tst-quadmod1.S: Likewise.
+	* sysdeps/x86_64/tst-quadmod1pie.S: Likewise.
+	* sysdeps/x86_64/tst-quadmod2.S: Likewise.
+	* sysdeps/x86_64/tst-quadmod2pie.S: Likewise.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* io/fcntl.h (mode_t, off_t, pid_t): Define types.
+	(__mode_t_defined, __off_t_defined, __pid_t_defined): Define macros.
+	* streams/stropts.h (t_scalar_t): Define type.
+
+	* sysdeps/generic/paths.h (_PATH_MAN): Set to "/usr/share/man"
+	(_PATH_PRESERVE): Set to "/var/lib".
+	(_PATH_RWHODIR): Set to "/var/spool/rwho".
+
+	* sysdeps/mach/hurd/openat.c (__openat): Set type of MODE to mode_t
+	instead of int.
+
+	* sysdeps/mach/hurd/xmknodat.c (__xmknodat): Deallocate NODE port only
+	if __dir_mkfile succeeded.
+
+	* sysdeps/mach/hurd/dup3.c: Lock _hurd_dtable_lock before
+	checking for _hurd_dtablesize.  Unlock it right after having
+	finished _hurd_dtable allocation.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/configure.in: Remove warning for --prefix=[...].
+	* sysdeps/mach/hurd/configure: Regenerated.
+	* sysdeps/unix/sysv/linux/configure.in: Move --prefix=/usr
+	special-casing to...
+	* sysdeps/gnu/configure.in: ... this new file.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+	* sysdeps/gnu/configure: New generated file.
+
+	* sysdeps/mach/hurd/bits/stat.h (struct stat): Align to what is done
+	for Linux: use nsec instead of usec, as well as:
+	[__USE_MISC || __USE_XOPEN2K8] (st_atim, st_mtim, st_ctim): New
+	members of type struct timespec.
+	[__USE_MISC || __USE_XOPEN2K8] (st_atime, st_mtime, st_ctime):
+	New macros.
+	(struct stat64): Likewise.
+	(_STATBUF_ST_NSEC): New macro.
+	* sysdeps/mach/hurd/xstatconv.c (xstat64_conv): Adapt to that.
+
+	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Use
+	__strtoul_internal rather than strtoul.
+
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* hurd/hurdsock.c (_hurd_socket_server): Check for negative domains,
+	and reject them.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/setresgid.c (__setresgid): Handle the -1 case,
+	which preserves existing values.
+	* sysdeps/mach/hurd/setresuid.c (__setresuid): Likewise.
+
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* hurd/hurdselect.c (_hurd_select): Return EINVAL for negative
+	TIMEOUT values.  Return EINVAL for NFDS values either negative or
+	greater than FD_SETSIZE.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/brk.c (_hurd_set_brk): When more space needs to be
+	allocated, call __vm_protect to finish enabling the existing space, and
+	pass a copy of _hurd_data_end instead of PAGEBRK to __vm_allocate to
+	allocate the remainder.
+
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/recvfrom.c (__recvfrom): Check also for a null
+	address port.  Set ADDR_LEN to 0 when not filling ADDRARG.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/readlinkat.c: New file, heavily derived from
+	sysdeps/mach/hurd/readlink.c.
+
+	* posix/tst-sysconf.c (posix_options): Only use
+	_POSIX_PRIORITIZED_IO, _POSIX_PRIORITY_SCHEDULING, and
+	_POSIX_SYNCHRONIZED_IO when they are defined
+	* sysdeps/mach/hurd/bits/posix_opt.h:
+	(_POSIX_PRIORITY_SCHEDULING): Undefine macro.
+	(_XOPEN_REALTIME): Undefine macro.
+	(_XOPEN_REALTIME_THREADS): Undefine macro.
+	(_XOPEN_SHM): Undefine macro.
+	[__USE_XOPEN2K8] (_POSIX_THREAD_ROBUST_PRIO_INHERIT): Define
+	macro to -1.
+	[__USE_XOPEN2K8] (_POSIX_THREAD_ROBUST_PRIO_PROTECT): Define
+	macro to -1.
+	(_POSIX_ASYNC_IO): Undefine macro.
+	(_POSIX_PRIORITIZED_IO): Undefine macro.
+	(_POSIX_SPIN_LOCKS): Define macro to -1.
+
+	* bits/sigaction.h [__USE_XOPEN2K8]: Define SA_RESTART,
+	SA_NODEFER, SA_RESETHAND.
+	* sysdeps/mach/hurd/bits/fcntl.h [__USE_XOPEN2K8]: Define
+	O_NOFOLLOW, O_DIRECTORY, O_CLOEXEC, F_GETOWN, F_SETOWN,
+	F_DUPFD_CLOEXEC.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* elf/Makefile (pldd-modules): Define unconditionally.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/opendir.c (__opendirat): New function.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* hurd/hurdchdir.c (_hurd_change_directory_port_from_name):
+	Return ENOENT when name is empty.
+	* sysdeps/mach/hurd/chroot.c (chroot): Likewise.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* include/libc-symbols.h [NO_HIDDEN] (hidden_nolink): New macro.
+
+	* nss/makedb.c (MAP_POPULATE): If not defined, define to zero.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	Fix mlock in all cases except non-readable pages.
+	* sysdeps/mach/hurd/mlock.c (mlock): Give VM_PROT_READ
+	instead of VM_PROT_ALL as parameter to __vm_wire function.
+
+	* sysdeps/mach/hurd/mkdir.c: Include <string.h>.
+	(__mkdir): When path is `/', just fail with EEXIST.
+	* sysdeps/mach/hurd/mkdirat.c: Likewise.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* nss/makedb.c: Include <sys/param.h> (for MAX and roundup), and
+	<sys/uio.h> (for writev).
+	* nss/nss_db/db-initgroups.c: Include <limits.h> (for ULONG_MAX),
+	and <sys/param.h> (for MIN).
+
+2012-05-10  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/nanosleep.c: Return EINVAL for invalid values of
+	REQUESTED_TIME.  Properly set the remaining time and return EINTR
+	if interrupted.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/Makefile ($(common-objpfx)linkobj/libc.so):
+	Depend on against $(link-rpcuserlibs).
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/generic/ldsodefs.h [LIBC_STACK_END_NOT_RELRO]
+	(__libc_stack_end): Do not use attribute_relro.
+	* sysdeps/mach/hurd/dl-sysdep.h (LIBC_STACK_END_NOT_RELRO): Define.
+	* sysdeps/mach/hurd/i386/init-first.c (init): Update __libc_stack_end
+	to libthread-provided value.
+	* sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Do not use
+	attribute_relro.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	[BZ #3748]
+	* bits/libc-lock.h (__libc_once_get): New macro.
+	* sysdeps/mach/bits/libc-lock.h: Likewise.
+	* sysdeps/mach/hurd/bits/libc-lock.h: Likewise.
+	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Use __libc_once_get
+	instead of using implementation details.
+
+	* libio/fileops.c: Unconditionally include <kernel-features.h>.
+	* libio/freopen.c: Likewise.
+	* libio/freopen64.c: Likewise.
+	* misc/syslog.c: Likewise.
+	* nscd/connections.c: Likewise.
+	* nscd/netgroupcache.c: Likewise.
+	* sysdeps/posix/getcwd.c: Likewise.
+
+2012-05-10  Roland McGrath  <roland@hack.frob.com>
+
+	* math/w_ilogbf.c: Add #include <limits.h>.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/setitimer.c (setitimer_locked): Use common exit
+	path instead of returning without unlocking.
+
+	* sysdeps/mach/hurd/bits/ioctls.h (_IOIW): New macro for
+	immediate-write ioctls.
+	* sysdeps/mach/hurd/ioctl.c: Handle cases with no arguments.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/i386/init-first.c (init): Use
+	__builtin_frame_address instead of making assumptions about the
+	location of the return address relative to DATA.  Force early load of
+	the return address.
+	(_dl_init_first, doinit1 in doinit in _hurd_stack_setup): Don't use
+	__builtin_frame_address.
+
+	dup3 for GNU Hurd.
+	* include/unistd.h: Declare __dup3 and use libc_hidden_proto on it.
+	* sysdeps/mach/hurd/dup3.c: New file, copy from dup2.c.  Evolve it to
+	implement dup3 and do some further code clean-ups.
+	* sysdeps/mach/hurd/dup2.c (__dup2): Reimplement using __dup3.
+	* sysdeps/mach/hurd/kernel-features.h (__ASSUME_DUP3): Define.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/dl-sysdep.c: Conditionalize contents on [SHARED].
+
+	* hurd/hurd/fd.h (_hurd_fd_get): Call HURD_CRITICAL_BEGIN/
+	HURD_CRITICAL_END around holding _hurd_dtable_lock.
+	* sysdeps/mach/hurd/dirfd (dirfd): Likewise.
+	* sysdeps/mach/hurd/opendir.c (_hurd_fd_opendir): Call
+	HURD_CRITICAL_BEGIN/HURD_CRITICAL_END around holding
+	d->port.lock.
+
+	* hurd/catch-signal.c (hurd_catch_signal): Use sigsetjmp/siglongjmp
+	instead of setjmp/longjmp to restore the signal mask.  Call sigsetjmp
+	when handler == SIG_ERR, not when handler != SIG_ERR.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/bits/socket.h: New file, copy from the bsd4.4 one.
+	(SOCK_MAX, SOCK_TYPE_MASK, SOCK_CLOEXEC, SOCK_NONBLOCK): New
+	definitions.
+
+	accept4 for GNU Hurd.
+	* include/sys/socket.h (__libc_accept4): New prototype.
+	* sysdeps/mach/hurd/accept4.c: New file, copy from accept.c.  Evolve it
+	to implement __libc_accept4.
+	* sysdeps/mach/hurd/accept.c (accept): Reimplement using
+	__libc_accept4.
+	* sysdeps/mach/hurd/kernel-features.h (__ASSUME_ACCEPT4): Define.
+
+	* sysdeps/mach/hurd/i386/____longjmp_chk.S: New file.
+	* sysdeps/mach/hurd/i386/signal-defines.sym: New file.
+	* sysdeps/mach/hurd/i386/Makefile (gen-as-const-headers): Add
+	signal-defines.sym.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* bits/in.h (SOL_IP, SOL_IPV6, SOL_ICMPV6): New macros.
+
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	* sysdeps/mach/hurd/dl-sysdep.c (open_file): Do not raise
+	assertion on O_CLOEXEC flag.
+	* hurd/hurd/fd.h: Update comment to mention O_CLOEXEC.
+	* hurd/intern-fd.c: Likewise.
+	* hurd/port2fd.c: Likewise.
+
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	[BZ #3906]
+	* bits/in.h (IPV6_PKTINFO): Define new macro.
+	(IPV6_RXINFO,IPV6_TXINFO,SCM_SRCINFO): Redefine to IPV6_PKTINFO.
+
+2012-05-09  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
+	[BZ #13954]
+	[BZ #13955]
+	[BZ #13956]
+	* sysdeps/ieee754/dbl-64/s_logb.c (__logb): Fix for subnormal number.
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c (__logb): Likewise.
+	* sysdeps/ieee754/flt-32/s_logbf.c (__logf): Likewise.
+	* sysdeps/ieee754/ldbl-128/s_logbl.c (__logbl): Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise.
+	* sysdeps/ieee754/ldbl-96/s_logbl.c (__logbl): Likewise.
+	* math/libm-test.inc (logb_test) : Additional logb tests.
+
+2012-05-09  Andreas Schwab  <schwab@linux-m68k.org>
+	    Andreas Jaeger  <aj@suse.de>
+
+	* configure.in (obsolete-rpc): Add new option --enable-obsolete-rpc.
+	* configure: Regenerated.
+	* config.h.in (LINK_OBSOLETE_RPC): New macro.
+	* config.make.in (link-obsolete-rpc): New substituted variable.
+	* include/libc-symbols.h (libc_hidden_nolink_sunrpc): Rename from
+	libc_hidden_nolink and define based on LINK_OBSOLETE_RPC.
+	* sunrpc/Makefile (headers) [link-obsolete-rpc]: Add rpc headers.
+	(shared-only-routines): Don't set it under [link-obsolete-rpc],
+	so that libc.a contains the symbols.
+	* nis/Makefile (headers) [link-obsolete-rpc]: Add rpc headers.
+	* sunrpc/auth_des.c: Use libc_hidden_nolink_sunrpc.
+	* sunrpc/auth_none.c: Likewise.
+	* sunrpc/auth_unix.c: Likewise.
+	* sunrpc/authdes_prot.c: Likewise.
+	* sunrpc/authuxprot.c: Likewise.
+	* sunrpc/clnt_gen.c: Likewise.
+	* sunrpc/clnt_perr.c: Likewise.
+	* sunrpc/clnt_raw.c: Likewise.
+	* sunrpc/clnt_simp.c: Likewise.
+	* sunrpc/clnt_tcp.c: Likewise.
+	* sunrpc/clnt_udp.c: Likewise.
+	* sunrpc/clnt_unix.c: Likewise.
+	* sunrpc/des_crypt.c: Likewise.
+	* sunrpc/des_soft.c: Likewise.
+	* sunrpc/get_myaddr.c: Likewise.
+	* sunrpc/key_call.c: Likewise.
+	* sunrpc/key_prot.c: Likewise.
+	* sunrpc/netname.c: Likewise.
+	* sunrpc/pm_getmaps.c: Likewise.
+	* sunrpc/pm_getport.c: Likewise.
+	* sunrpc/pmap_clnt.c: Likewise.
+	* sunrpc/pmap_prot.c: Likewise.
+	* sunrpc/pmap_prot2.c: Likewise.
+	* sunrpc/pmap_rmt.c: Likewise.
+	* sunrpc/publickey.c: Likewise.
+	* sunrpc/rpc_cmsg.c: Likewise.
+	* sunrpc/rpc_common.c: Likewise.
+	* sunrpc/rpc_dtable.c: Likewise.
+	* sunrpc/rpc_prot.c: Likewise.
+	* sunrpc/rpc_thread.c: Likewise.
+	* sunrpc/rtime.c: Likewise.
+	* sunrpc/svc.c: Likewise.
+	* sunrpc/svc_auth.c: Likewise.
+	* sunrpc/svc_raw.c: Likewise.
+	* sunrpc/svc_run.c: Likewise.
+	* sunrpc/svc_tcp.c: Likewise.
+	* sunrpc/svc_udp.c: Likewise.
+	* sunrpc/svc_unix.c: Likewise.
+	* sunrpc/svcauth_des.c: Likewise.
+	* sunrpc/xcrypt.c: Likewise.
+	* sunrpc/xdr.c: Likewise.
+	* sunrpc/xdr_array.c: Likewise.
+	* sunrpc/xdr_float.c: Likewise.
+	* sunrpc/xdr_intXX_t.c: Likewise.
+	* sunrpc/xdr_mem.c: Likewise.
+	* sunrpc/xdr_rec.c: Likewise.
+	* sunrpc/xdr_ref.c: Likewise.
+	* sunrpc/xdr_sizeof.c: Likewise.
+	* sunrpc/xdr_stdio.c: Likewise.
+
+2012-05-10  Roland McGrath  <roland@hack.frob.com>
+
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Fix typo in last
+	change.  Update copyright years.
+
 2012-05-10  Joseph Myers  <joseph@codesourcery.com>
 
 	* include/stdc-predef.h (__STDC_NO_THREADS__): Define.
@@ -69,16 +428,16 @@
 	(main): Remove informal message about syslog.
 	(options): Fix typo.
 
-        [BZ #14053]
-        * sysdeps/x86_64/fpu/bits/mathinline.h (lrintf): Add __volatile
+	[BZ #14053]
+	* sysdeps/x86_64/fpu/bits/mathinline.h (lrintf): Add __volatile
 	to asm.
-        (lrint): Likewise.
-        (llrintf): Likewise.
-        (llrint): Likewise.
-        (rint): Likewise.
-        (rintf): Likewise.
-        (nearbyint): Likewise.
-        (nearbyintf): Likewise.
+	(lrint): Likewise.
+	(llrintf): Likewise.
+	(llrint): Likewise.
+	(rint): Likewise.
+	(rintf): Likewise.
+	(nearbyint): Likewise.
+	(nearbyintf): Likewise.
 
 2012-05-09  Andreas Jaeger  <aj@suse.de>
 	    Pedro Alves  <palves@redhat.com>
@@ -89,12 +448,12 @@
 2012-05-09  Alexandre Oliva  <aoliva@redhat.com>
 	    Andreas Jaeger  <aj@suse.de>
 
-        * nscd/nscd.c (go_background): Replaced with...
-        (run_mode): ... this.
+	* nscd/nscd.c (go_background): Replaced with...
+	(run_mode): ... this.
 	(RUN_FOREGROUND, RUN_DAEMONIZE, RUN_DEBUG): Add.
-        (options): Add -F --foreground.
-        (main): Implement it.
-        (parse_opt): Parse it.
+	(options): Add -F --foreground.
+	(main): Implement it.
+	(parse_opt): Parse it.
 
 2012-05-09  Andreas Jaeger  <aj@suse.de>
 
@@ -270,9 +629,9 @@
 
 2012-05-08  Roland Mc Grath  <roland@hack.frob.com>
 
-        [BZ #13979]
-        * include/features.h: Warn if user requests __FORTIFY_SOURCE
-        checking but the checks are disabled for any reason.
+	[BZ #13979]
+	* include/features.h: Warn if user requests __FORTIFY_SOURCE
+	checking but the checks are disabled for any reason.
 
 2012-05-08  H.J. Lu  <hongjiu.lu@intel.com>
 
diff --git a/NEWS b/NEWS
index ba00909f29..b3a1233482 100644
--- a/NEWS
+++ b/NEWS
@@ -23,8 +23,9 @@ Version 2.16
   13852, 13854, 13871, 13872, 13873, 13879, 13883, 13884, 13885, 13886,
   13892, 13895, 13908, 13910, 13911, 13912, 13913, 13914, 13915, 13916,
   13917, 13918, 13919, 13920, 13921, 13922, 13923, 13924, 13926, 13927,
-  13928, 13938, 13941, 13942, 13963, 13967, 13970, 13973, 13979, 13983,
-  14027, 14033, 14034, 14040, 14049, 14053, 14055, 14064, 14080, 14083
+  13928, 13938, 13941, 13942, 13954, 13955, 13956, 13963, 13967, 13970,
+  13973, 13979, 13983, 14027, 14033, 14034, 14040, 14049, 14053, 14055,
+  14064, 14080, 14083
 
 * ISO C11 support:
 
@@ -56,6 +57,12 @@ Version 2.16
 
 * More generic and 64-bit performance optimizations to math functions.
   Implemented by Ulrich Drepper.
+
+* New configure option --enable-obsolete-rpc makes the deprecated RPC
+  headers and functions available at compile time as they were before
+  version 2.14.  This option will be removed at some time in the future
+  after the TI-RPC library becomes fully sufficient for the needs of
+  existing applications.
 
 Version 2.15
 
diff --git a/bits/in.h b/bits/in.h
index 85f747ebaf..db9305709a 100644
--- a/bits/in.h
+++ b/bits/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software 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,9 @@
 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
 #endif
 
+/* To select the IP level.  */
+#define SOL_IP		0
+
 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
    The first word in the comment at the right is the data type used;
    "bool" means a boolean value stored in an `int'.  */
@@ -47,9 +50,13 @@ struct ip_opts
     char ip_opts[40];		/* Actually variable in size.  */
   };
 
+/* Socket-level values for IPv6.  */
+#define SOL_IPV6		41
+#define SOL_ICMPV6		58
+
 /* IPV6 socket options.  */
 #define IPV6_ADDRFORM		1
-#define IPV6_RXINFO		2
+#define IPV6_PKTINFO		2
 #define IPV6_HOPOPTS		3
 #define IPV6_DSTOPTS		4
 #define IPV6_RTHDR		5
@@ -57,8 +64,9 @@ struct ip_opts
 #define IPV6_CHECKSUM		7
 #define IPV6_HOPLIMIT		8
 
-#define IPV6_TXINFO		IPV6_RXINFO
-#define SCM_SRCINFO		IPV6_TXINFO
+#define IPV6_RXINFO		IPV6_PKTINFO
+#define IPV6_TXINFO		IPV6_PKTINFO
+#define SCM_SRCINFO		IPV6_PKTINFO
 #define SCM_SRCRT		IPV6_RXSRCRT
 
 #define IPV6_UNICAST_HOPS	16
diff --git a/bits/libc-lock.h b/bits/libc-lock.h
index 4f0029fa2b..d7c49e7bb5 100644
--- a/bits/libc-lock.h
+++ b/bits/libc-lock.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Stub version.
-   Copyright (C) 1996,97,99,2000-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -97,6 +97,9 @@
     }									      \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL) \
+  ((ONCE_CONTROL) == 1)
 
 /* Start a critical region with a cleanup function */
 #define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
diff --git a/bits/sigaction.h b/bits/sigaction.h
index a5e1d186ac..a737660ce4 100644
--- a/bits/sigaction.h
+++ b/bits/sigaction.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,96,97,98,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -54,6 +54,8 @@ struct sigaction
 /* Bits in `sa_flags'.  */
 #if defined __USE_UNIX98 || defined __USE_MISC
 # define SA_ONSTACK	0x0001	/* Take signal on signal stack.  */
+#endif
+#if defined __USE_UNIX98 || defined __USE_MISC || defined __USE_XOPEN2K8
 # define SA_RESTART	0x0002	/* Restart syscall on signal return.  */
 # define SA_NODEFER	0x0010	/* Don't automatically block the signal when
 				    its handler is being executed.  */
diff --git a/config.h.in b/config.h.in
index 787873b4c0..54952609ef 100644
--- a/config.h.in
+++ b/config.h.in
@@ -178,6 +178,9 @@
 /* Define if `.ctors' and `.dtors' sections shouldn't be used.  */
 #undef	NO_CTORS_DTORS_SECTIONS
 
+/* Define if obsolete RPC code should be made available for user-level code
+   to link against.  */
+#undef LINK_OBSOLETE_RPC
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index f87f774b1d..e60afcf504 100644
--- a/config.make.in
+++ b/config.make.in
@@ -98,6 +98,7 @@ add-on-subdirs = @add_on_subdirs@
 sysdeps-add-ons = @sysdeps_add_ons@
 cross-compiling = @cross_compiling@
 force-install = @force_install@
+link-obsolete-rpc = @link_obsolete_rpc@
 
 # Build tools.
 CC = @CC@
diff --git a/configure b/configure
index 55b178472e..98a7b73dbb 100755
--- a/configure
+++ b/configure
@@ -688,6 +688,7 @@ multi_arch
 base_machine
 add_on_subdirs
 add_ons
+link_obsolete_rpc
 libc_cv_nss_crypt
 all_warnings
 force_install
@@ -780,6 +781,7 @@ enable_kernel
 enable_all_warnings
 enable_multi_arch
 enable_nss_crypt
+enable_obsolete_rpc
 with_cpu
 '
       ac_precious_vars='build_alias
@@ -1435,6 +1437,8 @@ Optional Features:
   --enable-multi-arch     enable single DSO with optimizations for multiple
                           architectures
   --enable-nss-crypt      enable libcrypt to use nss
+  --enable-obsolete-rpc   build and install the obsolete RPC code for
+                          link-time usage
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3747,6 +3751,20 @@ else
 fi
 
 
+# Check whether --enable-obsolete-rpc was given.
+if test "${enable_obsolete_rpc+set}" = set; then :
+  enableval=$enable_obsolete_rpc; link_obsolete_rpc=$enableval
+else
+  link_obsolete_rpc=no
+fi
+
+
+
+if test "$link_obsolete_rpc" = yes; then
+  $as_echo "#define LINK_OBSOLETE_RPC 1" >>confdefs.h
+
+fi
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
diff --git a/configure.in b/configure.in
index 3090223ef6..3ca448eeb2 100644
--- a/configure.in
+++ b/configure.in
@@ -252,6 +252,17 @@ else
 fi
 AC_SUBST(libc_cv_nss_crypt)
 
+AC_ARG_ENABLE([obsolete-rpc],
+              AC_HELP_STRING([--enable-obsolete-rpc],
+                             [build and install the obsolete RPC code for link-time usage]),
+              [link_obsolete_rpc=$enableval],
+              [link_obsolete_rpc=no])
+AC_SUBST(link_obsolete_rpc)
+
+if test "$link_obsolete_rpc" = yes; then
+  AC_DEFINE(LINK_OBSOLETE_RPC)
+fi
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
diff --git a/elf/Makefile b/elf/Makefile
index 8743ee0ceb..f6c6fb4644 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -80,15 +80,14 @@ install-rootsbin += ldconfig
 
 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
 extra-objs	+= $(ldconfig-modules:=.o)
+endif
+endif
 
 pldd-modules := xmalloc
 
 # To find xmalloc.c and xstrdup.c
 vpath %.c ../locale/programs
 
-endif
-endif
-
 ifeq ($(have-ksh)$(build-shared),yesyes)
 extra-objs += sotruss-lib.os sotruss-lib.so
 install-others += $(inst_auditdir)/sotruss-lib.so
diff --git a/hurd/catch-signal.c b/hurd/catch-signal.c
index 50cd36600d..3f946e1033 100644
--- a/hurd/catch-signal.c
+++ b/hurd/catch-signal.c
@@ -1,5 +1,5 @@
 /* Convenience function to catch expected signals during an operation.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software 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,9 +27,12 @@ hurd_catch_signal (sigset_t sigset,
 		   error_t (*operate) (struct hurd_signal_preemptor *),
 		   sighandler_t handler)
 {
-  jmp_buf buf;
+  /* We need to restore the signal mask, because otherwise the
+     signal-handling code will have blocked the caught signal and for
+     instance calling hurd_catch_signal again would then dump core.  */
+  sigjmp_buf buf;
   void throw (int signo, long int sigcode, struct sigcontext *scp)
-    { longjmp (buf, scp->sc_error ?: EGRATUITOUS); }
+    { siglongjmp (buf, scp->sc_error ?: EGRATUITOUS); }
 
   struct hurd_signal_preemptor preemptor =
     {
@@ -40,12 +43,12 @@ hurd_catch_signal (sigset_t sigset,
   struct hurd_sigstate *const ss = _hurd_self_sigstate ();
   error_t error;
 
-  if (handler == SIG_ERR)
+  if (handler != SIG_ERR)
     /* Not our handler; don't bother saving state.  */
     error = 0;
   else
     /* This returns again with nonzero value when we preempt a signal.  */
-    error = setjmp (buf);
+    error = sigsetjmp (buf, 1);
 
   if (error == 0)
     {
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index 5f3ee6a8c9..6a79738cb6 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -1,6 +1,5 @@
 /* File descriptors.
-   Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006,2007
-   	Free Software Foundation, Inc.
+   Copyright (C) 1993-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -64,6 +63,7 @@ _hurd_fd_get (int fd)
 {
   struct hurd_fd *descriptor;
 
+  HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_dtable_lock);
   if (fd < 0 || fd >= _hurd_dtablesize)
     descriptor = NULL;
@@ -86,6 +86,7 @@ _hurd_fd_get (int fd)
 	}
     }
   __mutex_unlock (&_hurd_dtable_lock);
+  HURD_CRITICAL_END;
 
   return descriptor;
 }
@@ -199,7 +200,8 @@ extern void _hurd_port2fd (struct hurd_fd *fd, io_t port, int flags);
 
 /* Allocate a new file descriptor and install PORT in it (doing any
    appropriate ctty magic); consumes a user reference on PORT.  FLAGS are
-   as for `open'; only O_IGNORE_CTTY is meaningful, but all are saved.
+   as for `open'; only O_IGNORE_CTTY and O_CLOEXEC are meaningful, but all are
+   saved.
 
    If the descriptor table is full, set errno, and return -1.
    If DEALLOC is nonzero, deallocate PORT first.  */
diff --git a/hurd/hurdchdir.c b/hurd/hurdchdir.c
index 6881956d40..1669358a57 100644
--- a/hurd/hurdchdir.c
+++ b/hurd/hurdchdir.c
@@ -1,5 +1,5 @@
 /* Change a port cell to a directory by looking up a name.
-   Copyright (C) 1999,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1999-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,9 @@ _hurd_change_directory_port_from_name (struct hurd_port *portcell,
   len = strlen (name);
   if (len >= 2 && name[len - 2] == '/' && name[len - 1] == '.')
     lookup = name;
+  else if (len == 0)
+    /* Special-case empty file name according to POSIX.  */
+    return __hurd_fail (ENOENT);
   else
     {
       char *n = alloca (len + 3);
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 25d9d9f23a..21ba5f42a4 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -1,6 +1,5 @@
 /* Guts of both `select' and `poll' for Hurd.
-   Copyright (C) 1991,92,93,94,95,96,97,98,99,2001
-   	Free Software Foundation, Inc.
+   Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -49,10 +48,7 @@ _hurd_select (int nfds,
   error_t err;
   fd_set rfds, wfds, xfds;
   int firstfd, lastfd;
-  mach_msg_timeout_t to = (timeout != NULL ?
-			   (timeout->tv_sec * 1000 +
-			    (timeout->tv_nsec + 999999) / 1000000) :
-			   0);
+  mach_msg_timeout_t to = 0;
   struct
     {
       struct hurd_userlink ulink;
@@ -71,6 +67,24 @@ _hurd_select (int nfds,
   assert (sizeof (union typeword) == sizeof (mach_msg_type_t));
   assert (sizeof (uint32_t) == sizeof (mach_msg_type_t));
 
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (timeout != NULL)
+    {
+      if (timeout->tv_sec < 0 || timeout->tv_nsec < 0)
+	{
+	  errno = EINVAL;
+	  return -1;
+	}
+
+      to = (timeout->tv_sec * 1000 +
+            (timeout->tv_nsec + 999999) / 1000000);
+    }
+
   if (sigmask && __sigprocmask (SIG_SETMASK, sigmask, &oset))
     return -1;
 
@@ -364,7 +378,7 @@ _hurd_select (int nfds,
 		}
 
 	      /* Look up the respondent's reply port and record its
-                 readiness.  */
+		 readiness.  */
 	      {
 		int had = got;
 		if (firstfd != -1)
diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c
index f3611ecf27..4b32ad4314 100644
--- a/hurd/hurdsock.c
+++ b/hurd/hurdsock.c
@@ -1,5 +1,5 @@
 /* _hurd_socket_server - Find the server for a socket domain.
-   Copyright (C) 1991,92,93,94,95,97,99 Free Software Foundation, Inc.
+   Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -46,6 +46,12 @@ _hurd_socket_server (int domain, int dead)
 {
   socket_t server;
 
+  if (domain < 0)
+    {
+      errno = EAFNOSUPPORT;
+      return MACH_PORT_NULL;
+    }
+
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&lock);
 
diff --git a/hurd/intern-fd.c b/hurd/intern-fd.c
index 52e0606c96..ac89173942 100644
--- a/hurd/intern-fd.c
+++ b/hurd/intern-fd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 Free Software 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 <hurd/fd.h>
 
 /* Allocate a new file descriptor and install PORT in it.  FLAGS are as for
-   `open'; only O_IGNORE_CTTY is meaningful.
+   `open'; only O_IGNORE_CTTY and O_CLOEXEC are meaningful.
 
    If the descriptor table is full, set errno, and return -1.
    If DEALLOC is nonzero, deallocate PORT first.  */
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 3c506a043a..4fa2a2199c 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -1,6 +1,5 @@
 /* hairy bits of Hurd file name lookup
-   Copyright (C) 1992,1993,1994,1995,1996,1997,1999,2001,2002,2003,2005
-	Free Software Foundation, Inc.
+   Copyright (C) 1992-2012 Free Software 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,10 +43,10 @@ lookup_error (error_t error)
 
 error_t
 __hurd_file_name_lookup_retry (error_t (*use_init_port)
-			         (int which, error_t (*operate) (file_t)),
+				 (int which, error_t (*operate) (file_t)),
 			       file_t (*get_dtable_port) (int fd),
 			       error_t (*lookup)
-			         (file_t dir, char *name,
+				 (file_t dir, char *name,
 				  int flags, mode_t mode,
 				  retry_type *do_retry, string_t retry_name,
 				  mach_port_t *result),
@@ -193,7 +192,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
 		  char *end;
 		  int save = errno;
 		  errno = 0;
-		  fd = (int) strtoul (&retryname[3], &end, 10);
+		  fd = (int) __strtoul_internal (&retryname[3], &end, 10, 0);
 		  if (end == NULL || errno || /* Malformed number.  */
 		      /* Check for excess text after the number.  A slash
 			 is valid; it ends the component.  Anything else
diff --git a/hurd/port2fd.c b/hurd/port2fd.c
index bef07ad3bf..451d6306e7 100644
--- a/hurd/port2fd.c
+++ b/hurd/port2fd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 Free Software 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 <fcntl.h>
 
 /* Store PORT in file descriptor D, doing appropriate ctty magic.
-   FLAGS are as for `open'; only O_IGNORE_CTTY is meaningful.
+   FLAGS are as for `open'; only O_IGNORE_CTTY and O_CLOEXEC are meaningful.
    D should be locked, and will not be unlocked.  */
 
 void
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 951e46a6e3..12b3639647 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -1,7 +1,6 @@
 /* Support macros for making weak and strong aliases for symbols,
    and for using symbol sets and linker warnings with GNU ld.
-   Copyright (C) 1995-1998,2000-2006,2008,2009,2011,2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -550,13 +549,19 @@ for linking")
 # define hidden_data_weak(name)
 # define hidden_data_def(name)
 # define hidden_data_ver(local, name)
+# define hidden_nolink(name, lib, version)
 #endif
 
 #if !defined NOT_IN_libc
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version)
+# ifdef LINK_OBSOLETE_RPC
+   /* libc_hidden_nolink_sunrpc should only get used in sunrpc code.  */
+#  define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
+# else
+#  define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
+# endif
 # define libc_hidden_ver(local, name) hidden_ver (local, name)
 # define libc_hidden_data_def(name) hidden_data_def (name)
 # define libc_hidden_data_weak(name) hidden_data_weak (name)
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 2ae3428bdd..eac82136dd 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -135,6 +135,9 @@ extern int __libc_accept (int __fd, __SOCKADDR_ARG __addr,
 			  socklen_t *__restrict __addr_len)
      __THROW;
 libc_hidden_proto (accept)
+extern int __libc_accept4 (int __fd, __SOCKADDR_ARG __addr,
+			   socklen_t *__restrict __addr_len, int __flags)
+     __THROW;
 
 /* Return the length of a `sockaddr' structure.  */
 #ifdef _HAVE_SA_LEN
diff --git a/include/unistd.h b/include/unistd.h
index 2e6101b0d0..7971a8a71a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -80,7 +80,8 @@ char *__canonicalize_directory_name_internal (const char *__thisdir,
 extern int __dup (int __fd);
 extern int __dup2 (int __fd, int __fd2);
 libc_hidden_proto (__dup2)
-libc_hidden_proto (dup3)
+extern int __dup3 (int __fd, int __fd2, int flags);
+libc_hidden_proto (__dup3)
 extern int __execve (const char *__path, char *const __argv[],
 		     char *const __envp[]);
 extern long int __pathconf (const char *__path, int __name);
diff --git a/io/fcntl.h b/io/fcntl.h
index 8b8726a440..c7d5e6972c 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,1992,1994-2001,2003-2007,2009-2011,2012
-	Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software 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,6 +31,29 @@ __BEGIN_DECLS
    numbers and flag bits for `open', `fcntl', et al.  */
 #include <bits/fcntl.h>
 
+#if defined __USE_XOPEN || defined __USE_XOPEN2K
+/* The Single Unix specification says that some more types are
+   available here.  */
+# ifndef __mode_t_defined
+typedef __mode_t mode_t;
+#  define __mode_t_defined
+# endif
+
+# ifndef __off_t_defined
+#  ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+#  else
+typedef __off64_t off_t;
+#  endif
+#  define __off_t_defined
+# endif
+
+# ifndef __pid_t_defined
+typedef __pid_t pid_t;
+#  define __pid_t_defined
+# endif
+#endif	/* X/Open */
+
 /* For XPG all symbols from <sys/stat.h> should also be available.  */
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <bits/types.h>         /* For __mode_t and __dev_t.  */
diff --git a/libio/fileops.c b/libio/fileops.c
index a2e8dacd77..93750f8084 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008, 2009, 2011-2012
-   Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Per Bothner <bothner@cygnus.com>.
 
@@ -46,6 +45,7 @@
 # include "../iconv/gconv_int.h"
 # include <shlib-compat.h>
 # include <not-cancel.h>
+# include <kernel-features.h>
 #endif
 #ifndef errno
 extern int errno;
diff --git a/libio/freopen.c b/libio/freopen.c
index 418f412f32..025c55b655 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993,95,96,97,98,2000,2001,2002,2003,2008,2011
-	Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software 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,6 +33,8 @@
 #include <shlib-compat.h>
 #include <fd_to_filename.h>
 
+#include <kernel-features.h>
+
 FILE*
 freopen (filename, mode, fp)
      const char* filename;
diff --git a/libio/freopen64.c b/libio/freopen64.c
index 7e1beeff33..24d0360625 100644
--- a/libio/freopen64.c
+++ b/libio/freopen64.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993,1995,1996,1997,1998,2000,2001,2002, 2003, 2008, 2011
-   Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software 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,6 +32,8 @@
 
 #include <fd_to_filename.h>
 
+#include <kernel-features.h>
+
 FILE *
 freopen64 (filename, mode, fp)
      const char* filename;
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 542131dc7b..5a38dbf3a7 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -5376,6 +5376,22 @@ logb_test (void)
   TEST_f_f (logb, 1024, 10);
   TEST_f_f (logb, -2000, 10);
 
+  TEST_f_f (logb, 0x0.1p-127, -131);
+  TEST_f_f (logb, 0x0.01p-127, -135);
+  TEST_f_f (logb, 0x0.011p-127, -135);
+#ifndef TEST_FLOAT
+  TEST_f_f (logb, 0x0.8p-1022, -1023);
+  TEST_f_f (logb, 0x0.1p-1022, -1026);
+  TEST_f_f (logb, 0x0.00111p-1022, -1034);
+  TEST_f_f (logb, 0x0.00001p-1022, -1042);
+  TEST_f_f (logb, 0x0.000011p-1022, -1042);
+  TEST_f_f (logb, 0x0.0000000000001p-1022, -1074);
+#endif
+#if defined TEST_LDOUBLE && LDBL_MIN_EXP - LDBL_MANT_DIG <= -16400
+  TEST_f_f (logb, 0x1p-16400L, -16400);
+  TEST_f_f (logb, 0x.00000000001p-16382L, -16426);
+#endif
+
   END (logb);
 }
 
diff --git a/math/w_ilogbf.c b/math/w_ilogbf.c
index ae3574a75d..27a0c582d3 100644
--- a/math/w_ilogbf.c
+++ b/math/w_ilogbf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <errno.h>
+#include <limits.h>
 #include <math_private.h>
 
 /* wrapper ilogbf */
diff --git a/misc/syslog.c b/misc/syslog.c
index 57d4db9b5b..4e18883f50 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -56,6 +56,8 @@ static char sccsid[] = "@(#)syslog.c	8.4 (Berkeley) 3/18/94";
 #include <libio/iolibio.h>
 #include <math_ldbl_opt.h>
 
+#include <kernel-features.h>
+
 #define ftell(s) INTUSE(_IO_ftell) (s)
 
 static int	LogType = SOCK_DGRAM;	/* type of socket connection */
diff --git a/nis/Makefile b/nis/Makefile
index a48753f7a9..b412cee304 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -23,6 +23,12 @@ subdir	:= nis
 
 aux			:= nis_hash
 
+include ../Makeconfig
+
+ifeq ($(link-obsolete-rpc),yes)
+headers			:= $(wildcard rpcsvc/*.[hx])
+endif
+
 # These are the databases available for the nis (and perhaps later nisplus)
 # service.  This must be a superset of the services in nss.
 databases		= proto service hosts network grp pwd rpc ethers \
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 7e17ca010c..905a6beb64 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+	[BZ #3748]
+	* sysdeps/pthread/bits/libc-lockP.h (__libc_once_get): New macro.
+
 2012-05-09  Chung-Lin Tang  <cltang@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
diff --git a/nptl/sysdeps/pthread/bits/libc-lockP.h b/nptl/sysdeps/pthread/bits/libc-lockP.h
index d08fb9db3c..0ebac917d7 100644
--- a/nptl/sysdeps/pthread/bits/libc-lockP.h
+++ b/nptl/sysdeps/pthread/bits/libc-lockP.h
@@ -257,6 +257,8 @@ typedef pthread_key_t __libc_key_t;
     }									      \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)	((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
 
 /* Note that for I/O cleanup handling we are using the old-style
    cancel handling.  It does not have to be integrated with C++ snce
diff --git a/nscd/connections.c b/nscd/connections.c
index a8f287ef3e..77b9ac40a3 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1,5 +1,5 @@
 /* Inner loops of cache daemon.
-   Copyright (C) 1998-2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1998-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -56,9 +56,8 @@
 #include "dbg_log.h"
 #include "selinux.h"
 #include <resolv/resolv.h>
-#ifdef HAVE_SENDFILE
-# include <kernel-features.h>
-#endif
+
+#include <kernel-features.h>
 
 
 /* Support to run nscd as an unprivileged user */
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index 276e66ff44..70cf9c14b3 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -1,5 +1,5 @@
 /* Cache handling for netgroup lookup.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
@@ -27,9 +27,8 @@
 #include "../inet/netgroup.h"
 #include "nscd.h"
 #include "dbg_log.h"
-#ifdef HAVE_SENDFILE
-# include <kernel-features.h>
-#endif
+
+#include <kernel-features.h>
 
 
 /* This is the standard reply in case the service is disabled.  */
diff --git a/nss/makedb.c b/nss/makedb.c
index d4ac16e4bf..5890c054f0 100644
--- a/nss/makedb.c
+++ b/nss/makedb.c
@@ -1,5 +1,5 @@
 /* Create simple DB database from textual input.
-   Copyright (C) 1996-2000, 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -32,7 +32,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <sys/param.h>
 #include <sys/stat.h>
+#include <sys/uio.h>
 #include "nss_db/nss_db.h"
 
 /* Get libc version number.  */
@@ -46,6 +48,10 @@
 # include <selinux/selinux.h>
 #endif
 
+#ifndef MAP_POPULATE
+# define MAP_POPULATE 0
+#endif
+
 #define PACKAGE _libc_intl_domainname
 
 /* List of data bases.  */
diff --git a/nss/nss_db/db-initgroups.c b/nss/nss_db/db-initgroups.c
index e56f58a445..16eb8e2d82 100644
--- a/nss/nss_db/db-initgroups.c
+++ b/nss/nss_db/db-initgroups.c
@@ -20,8 +20,10 @@
 #include <ctype.h>
 #include <errno.h>
 #include <grp.h>
+#include <limits.h>
 #include <paths.h>
 #include <string.h>
+#include <sys/param.h>
 
 #include "nss_db.h"
 
diff --git a/posix/tst-sysconf.c b/posix/tst-sysconf.c
index e2972291ae..105c7c2625 100644
--- a/posix/tst-sysconf.c
+++ b/posix/tst-sysconf.c
@@ -29,8 +29,12 @@ static struct
     N (MEMORY_PROTECTION),
     N (MESSAGE_PASSING),
     N (MONOTONIC_CLOCK),
+#ifdef _POSIX_PRIORITIZED_IO
     N (PRIORITIZED_IO),
+#endif
+#ifdef _POSIX_PRIORITY_SCHEDULING
     N (PRIORITY_SCHEDULING),
+#endif
     N (RAW_SOCKETS),
     N (READER_WRITER_LOCKS),
     N (REALTIME_SIGNALS),
@@ -42,7 +46,9 @@ static struct
     N (SPAWN),
     N (SPIN_LOCKS),
     N (SPORADIC_SERVER),
+#ifdef _POSIX_SYNCHRONIZED_IO
     N (SYNCHRONIZED_IO),
+#endif
     N (THREAD_ATTR_STACKADDR),
     N (THREAD_ATTR_STACKSIZE),
     N (THREAD_CPUTIME),
diff --git a/streams/stropts.h b/streams/stropts.h
index 80fe460b77..fa67fef400 100644
--- a/streams/stropts.h
+++ b/streams/stropts.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2000, 2002, 2003, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2012 Free Software 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,6 +32,7 @@ typedef __uid_t uid_t;
 # define __uid_t_defined
 #endif
 
+typedef __t_scalar_t t_scalar_t;
 typedef __t_uscalar_t t_uscalar_t;
 
 /* Get system specific contants.  */
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index e61efd02b3..3b79dcdb72 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -60,6 +60,10 @@ generated-dirs := rpcsvc
 
 include ../Makeconfig
 
+ifeq ($(link-obsolete-rpc),yes)
+headers += $(headers-in-tirpc) $(headers-not-in-tirpc)
+endif
+
 ifeq ($(versioning),yes)
 need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
 			clnt_udp get_myaddr key_call netname pm_getport \
@@ -73,9 +77,11 @@ routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
 	    svc_simple xdr_float xdr_rec publickey authdes_prot \
 	    des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
 	    clnt_unix svc_unix create_xid $(need-export-routines)
+ifneq ($(link-obsolete-rpc),yes)
 # We only add the RPC for compatibility to libc.so.
 shared-only-routines = $(routines)
 endif
+endif
 
 # We do not build rpcinfo anymore.  It is not needed for a bootstrap
 # and not wanted on complete systems.
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index 96bbcfc328..0408d60826 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -117,7 +117,7 @@ authdes_create (const char *servername, u_int window,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (authdes_create)
 #else
-libc_hidden_nolink (authdes_create, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (authdes_create, GLIBC_2_1)
 #endif
 
 AUTH *
@@ -211,7 +211,7 @@ failed:
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (authdes_pk_create)
 #else
-libc_hidden_nolink (authdes_pk_create, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (authdes_pk_create, GLIBC_2_1)
 #endif
 
 /*
diff --git a/sunrpc/auth_none.c b/sunrpc/auth_none.c
index 5f252a9544..3af5966794 100644
--- a/sunrpc/auth_none.c
+++ b/sunrpc/auth_none.c
@@ -95,7 +95,7 @@ authnone_create (void)
   __libc_once (authnone_private_guard, authnone_create_once);
   return &authnone_private.no_client;
 }
-libc_hidden_nolink (authnone_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (authnone_create, GLIBC_2_0)
 
 static bool_t
 authnone_marshal (AUTH *client, XDR *xdrs)
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index d3b5dc7dee..68b42d7b1f 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -149,7 +149,7 @@ no_memory:
   marshal_new_auth (auth);
   return auth;
 }
-libc_hidden_nolink (authunix_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (authunix_create, GLIBC_2_0)
 
 /*
  * Returns an auth handle with parameters determined by doing lots of
@@ -216,7 +216,7 @@ authunix_create_default (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (authunix_create_default)
 #else
-libc_hidden_nolink (authunix_create_default, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (authunix_create_default, GLIBC_2_0)
 #endif
 
 /*
diff --git a/sunrpc/authdes_prot.c b/sunrpc/authdes_prot.c
index 0a25bac143..164c1223ca 100644
--- a/sunrpc/authdes_prot.c
+++ b/sunrpc/authdes_prot.c
@@ -63,7 +63,7 @@ xdr_authdes_cred (XDR *xdrs, struct authdes_cred *cred)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_authdes_cred, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_authdes_cred, GLIBC_2_1)
 
 
 bool_t
@@ -78,4 +78,4 @@ xdr_authdes_verf (register XDR *xdrs, register struct authdes_verf *verf)
 		       sizeof (verf->adv_int_u)));
   return TRUE;
 }
-libc_hidden_nolink (xdr_authdes_verf, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_authdes_verf, GLIBC_2_1)
diff --git a/sunrpc/authuxprot.c b/sunrpc/authuxprot.c
index 64da1799e0..d37faee0c7 100644
--- a/sunrpc/authuxprot.c
+++ b/sunrpc/authuxprot.c
@@ -63,4 +63,4 @@ xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p)
     }
   return FALSE;
 }
-libc_hidden_nolink (xdr_authunix_parms, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_authunix_parms, GLIBC_2_0)
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index 2b7096cf20..df34672d72 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -175,5 +175,5 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clnt_create)
 #else
-libc_hidden_nolink (clnt_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_create, GLIBC_2_0)
 #endif
diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c
index 175370ebfc..b4f84c92e8 100644
--- a/sunrpc/clnt_perr.c
+++ b/sunrpc/clnt_perr.c
@@ -127,7 +127,7 @@ clnt_sperror (CLIENT * rpch, const char *msg)
 
   return str;
 }
-libc_hidden_nolink (clnt_sperror, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_sperror, GLIBC_2_0)
 
 void
 clnt_perror (CLIENT * rpch, const char *msg)
@@ -137,7 +137,7 @@ clnt_perror (CLIENT * rpch, const char *msg)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clnt_perror)
 #else
-libc_hidden_nolink (clnt_perror, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_perror, GLIBC_2_0)
 #endif
 
 
@@ -270,7 +270,7 @@ clnt_perrno (enum clnt_stat num)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clnt_perrno)
 #else
-libc_hidden_nolink (clnt_perrno, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_perrno, GLIBC_2_0)
 #endif
 
 char *
@@ -308,7 +308,7 @@ clnt_spcreateerror (const char *msg)
 
   return str;
 }
-libc_hidden_nolink (clnt_spcreateerror, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_spcreateerror, GLIBC_2_0)
 
 void
 clnt_pcreateerror (const char *msg)
@@ -318,7 +318,7 @@ clnt_pcreateerror (const char *msg)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clnt_pcreateerror)
 #else
-libc_hidden_nolink (clnt_pcreateerror, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_pcreateerror, GLIBC_2_0)
 #endif
 
 struct auth_errtab
diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c
index 95e3eae988..4004c6b6a8 100644
--- a/sunrpc/clnt_raw.c
+++ b/sunrpc/clnt_raw.c
@@ -129,7 +129,7 @@ clntraw_create (u_long prog, u_long vers)
   client->cl_auth = authnone_create ();
   return client;
 }
-libc_hidden_nolink (clntraw_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0)
 
 static enum clnt_stat
 clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout)
diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c
index d2dd3b307a..d612df09a0 100644
--- a/sunrpc/clnt_simp.c
+++ b/sunrpc/clnt_simp.c
@@ -139,7 +139,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
     crp->valid = 0;
   return (int) clnt_stat;
 }
-libc_hidden_nolink (callrpc, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0)
 
 #ifdef _RPC_THREAD_SAFE_
 void
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index d1fc43dbfd..6bd4c8c0cd 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -220,7 +220,7 @@ fooy:
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clnttcp_create)
 #else
-libc_hidden_nolink (clnttcp_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnttcp_create, GLIBC_2_0)
 #endif
 
 static enum clnt_stat
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 294e13a58c..7ecf2ef5a5 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -239,7 +239,7 @@ fooy:
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (__libc_clntudp_bufcreate)
 #else
-libc_hidden_nolink (__libc_clntudp_bufcreate, GLIBC_PRIVATE)
+libc_hidden_nolink_sunrpc (__libc_clntudp_bufcreate, GLIBC_PRIVATE)
 #endif
 
 CLIENT *
@@ -250,7 +250,7 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
   return __libc_clntudp_bufcreate (raddr, program, version, wait,
 				   sockp, sendsz, recvsz, 0);
 }
-libc_hidden_nolink (clntudp_bufcreate, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clntudp_bufcreate, GLIBC_2_0)
 
 CLIENT *
 clntudp_create (raddr, program, version, wait, sockp)
@@ -266,7 +266,7 @@ clntudp_create (raddr, program, version, wait, sockp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (clntudp_create)
 #else
-libc_hidden_nolink (clntudp_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clntudp_create, GLIBC_2_0)
 #endif
 
 static int
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 282127bb8b..776ceab484 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -200,7 +200,7 @@ fooy:
   mem_free ((caddr_t) h, sizeof (CLIENT));
   return (CLIENT *) NULL;
 }
-libc_hidden_nolink (clntunix_create, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (clntunix_create, GLIBC_2_1)
 
 static enum clnt_stat
 clntunix_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
diff --git a/sunrpc/des_crypt.c b/sunrpc/des_crypt.c
index 8745900b82..22a34b7f3a 100644
--- a/sunrpc/des_crypt.c
+++ b/sunrpc/des_crypt.c
@@ -102,7 +102,7 @@ cbc_crypt (char *key, char *buf, unsigned int len, unsigned int mode,
   COPY8 (dp.des_ivec, ivec);
   return err;
 }
-libc_hidden_nolink (cbc_crypt, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (cbc_crypt, GLIBC_2_1)
 
 /*
  * ECB mode encryption
@@ -115,4 +115,4 @@ ecb_crypt (char *key, char *buf, unsigned int len, unsigned int mode)
   dp.des_mode = ECB;
   return common_crypt (key, buf, len, mode, &dp);
 }
-libc_hidden_nolink (ecb_crypt, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (ecb_crypt, GLIBC_2_1)
diff --git a/sunrpc/des_soft.c b/sunrpc/des_soft.c
index 27d918c64d..cddef5d76b 100644
--- a/sunrpc/des_soft.c
+++ b/sunrpc/des_soft.c
@@ -70,4 +70,4 @@ des_setparity (char *p)
       p++;
     }
 }
-libc_hidden_nolink (des_setparity, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (des_setparity, GLIBC_2_1)
diff --git a/sunrpc/get_myaddr.c b/sunrpc/get_myaddr.c
index def5b7a74a..24407b53ec 100644
--- a/sunrpc/get_myaddr.c
+++ b/sunrpc/get_myaddr.c
@@ -99,5 +99,5 @@ get_myaddress (struct sockaddr_in *addr)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (get_myaddress)
 #else
-libc_hidden_nolink (get_myaddress, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (get_myaddress, GLIBC_2_0)
 #endif
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index 6d08bf8e80..e0a076b47f 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -80,7 +80,7 @@ key_setsecret (char *secretkey)
     }
   return 0;
 }
-libc_hidden_nolink (key_setsecret, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_setsecret, GLIBC_2_1)
 
 /* key_secretkey_is_set() returns 1 if the keyserver has a secret key
  * stored for the caller's effective uid; it returns 0 otherwise
@@ -109,7 +109,7 @@ key_secretkey_is_set (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (key_secretkey_is_set)
 #else
-libc_hidden_nolink (key_secretkey_is_set, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_secretkey_is_set, GLIBC_2_1)
 #endif
 
 int
@@ -133,7 +133,7 @@ key_encryptsession (char *remotename, des_block *deskey)
   *deskey = res.cryptkeyres_u.deskey;
   return 0;
 }
-libc_hidden_nolink (key_encryptsession, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_encryptsession, GLIBC_2_1)
 
 int
 key_decryptsession (char *remotename, des_block *deskey)
@@ -155,7 +155,7 @@ key_decryptsession (char *remotename, des_block *deskey)
   *deskey = res.cryptkeyres_u.deskey;
   return 0;
 }
-libc_hidden_nolink (key_decryptsession, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_decryptsession, GLIBC_2_1)
 
 int
 key_encryptsession_pk (char *remotename, netobj *remotekey,
@@ -180,7 +180,7 @@ key_encryptsession_pk (char *remotename, netobj *remotekey,
   *deskey = res.cryptkeyres_u.deskey;
   return 0;
 }
-libc_hidden_nolink (key_encryptsession_pk, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_encryptsession_pk, GLIBC_2_1)
 
 int
 key_decryptsession_pk (char *remotename, netobj *remotekey,
@@ -205,7 +205,7 @@ key_decryptsession_pk (char *remotename, netobj *remotekey,
   *deskey = res.cryptkeyres_u.deskey;
   return 0;
 }
-libc_hidden_nolink (key_decryptsession_pk, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_decryptsession_pk, GLIBC_2_1)
 
 int
 key_gendes (des_block *key)
@@ -239,7 +239,7 @@ key_gendes (des_block *key)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (key_gendes)
 #else
-libc_hidden_nolink (key_gendes, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_gendes, GLIBC_2_1)
 #endif
 
 int
@@ -259,7 +259,7 @@ key_setnet (struct key_netstarg *arg)
     }
   return 1;
 }
-libc_hidden_nolink (key_setnet, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_setnet, GLIBC_2_1)
 
 int
 key_get_conv (char *pkey, des_block *deskey)
@@ -278,7 +278,7 @@ key_get_conv (char *pkey, des_block *deskey)
   *deskey = res.cryptkeyres_u.deskey;
   return 0;
 }
-libc_hidden_nolink (key_get_conv, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (key_get_conv, GLIBC_2_1)
 
 /*
  * Hack to allow the keyserver to use AUTH_DES (for authenticated
diff --git a/sunrpc/key_prot.c b/sunrpc/key_prot.c
index dd73f5e3cb..2899c9a448 100644
--- a/sunrpc/key_prot.c
+++ b/sunrpc/key_prot.c
@@ -38,7 +38,7 @@ xdr_keystatus (XDR * xdrs, keystatus * objp)
 
   return TRUE;
 }
-libc_hidden_nolink (xdr_keystatus, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_keystatus, GLIBC_2_0)
 
 bool_t
 xdr_keybuf (XDR * xdrs, keybuf objp)
@@ -48,7 +48,7 @@ xdr_keybuf (XDR * xdrs, keybuf objp)
 
   return TRUE;
 }
-libc_hidden_nolink (xdr_keybuf, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_keybuf, GLIBC_2_0)
 
 bool_t
 xdr_netnamestr (XDR * xdrs, netnamestr * objp)
@@ -58,7 +58,7 @@ xdr_netnamestr (XDR * xdrs, netnamestr * objp)
 
   return TRUE;
 }
-libc_hidden_nolink (xdr_netnamestr, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_netnamestr, GLIBC_2_1)
 
 bool_t
 xdr_cryptkeyarg (XDR * xdrs, cryptkeyarg * objp)
@@ -71,7 +71,7 @@ xdr_cryptkeyarg (XDR * xdrs, cryptkeyarg * objp)
 
   return TRUE;
 }
-libc_hidden_nolink (xdr_cryptkeyarg, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_cryptkeyarg, GLIBC_2_0)
 
 bool_t
 xdr_cryptkeyarg2 (XDR * xdrs, cryptkeyarg2 * objp)
@@ -84,7 +84,7 @@ xdr_cryptkeyarg2 (XDR * xdrs, cryptkeyarg2 * objp)
     return FALSE;
   return TRUE;
 }
-libc_hidden_nolink (xdr_cryptkeyarg2, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_cryptkeyarg2, GLIBC_2_0)
 
 bool_t
 xdr_cryptkeyres (XDR * xdrs, cryptkeyres * objp)
@@ -102,7 +102,7 @@ xdr_cryptkeyres (XDR * xdrs, cryptkeyres * objp)
     }
   return TRUE;
 }
-libc_hidden_nolink (xdr_cryptkeyres, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_cryptkeyres, GLIBC_2_0)
 
 bool_t
 xdr_unixcred (XDR * xdrs, unixcred * objp)
@@ -117,7 +117,7 @@ xdr_unixcred (XDR * xdrs, unixcred * objp)
     return FALSE;
   return TRUE;
 }
-libc_hidden_nolink (xdr_unixcred, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_unixcred, GLIBC_2_1)
 
 bool_t
 xdr_getcredres (XDR * xdrs, getcredres * objp)
@@ -135,7 +135,7 @@ xdr_getcredres (XDR * xdrs, getcredres * objp)
     }
   return TRUE;
 }
-libc_hidden_nolink (xdr_getcredres, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_getcredres, GLIBC_2_1)
 
 bool_t
 xdr_key_netstarg (XDR * xdrs, key_netstarg * objp)
@@ -148,7 +148,7 @@ xdr_key_netstarg (XDR * xdrs, key_netstarg * objp)
     return FALSE;
   return TRUE;
 }
-libc_hidden_nolink (xdr_key_netstarg, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_key_netstarg, GLIBC_2_0)
 
 bool_t
 xdr_key_netstres (XDR * xdrs, key_netstres * objp)
@@ -166,4 +166,4 @@ xdr_key_netstres (XDR * xdrs, key_netstres * objp)
     }
   return TRUE;
 }
-libc_hidden_nolink (xdr_key_netstres, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_key_netstres, GLIBC_2_0)
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index 0b4980074c..197d503eae 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -54,7 +54,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
     netname[i - 1] = '\0';
   return 1;
 }
-libc_hidden_nolink (user2netname, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (user2netname, GLIBC_2_1)
 
 int
 host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
@@ -118,7 +118,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (host2netname)
 #else
-libc_hidden_nolink (host2netname, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (host2netname, GLIBC_2_1)
 #endif
 
 int
@@ -134,7 +134,7 @@ getnetname (char name[MAXNETNAMELEN + 1])
     dummy = user2netname (name, uid, NULL);
   return (dummy);
 }
-libc_hidden_nolink (getnetname, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (getnetname, GLIBC_2_1)
 
 /* Type of the lookup function for netname2user.  */
 typedef int (*netname2user_function) (const char netname[MAXNETNAMELEN + 1],
@@ -187,7 +187,7 @@ netname2user (const char netname[MAXNETNAMELEN + 1], uid_t * uidp, gid_t * gidp,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (netname2user)
 #else
-libc_hidden_nolink (netname2user, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (netname2user, GLIBC_2_1)
 #endif
 
 int
@@ -214,4 +214,4 @@ netname2host (const char netname[MAXNETNAMELEN + 1], char *hostname,
 
   return 1;
 }
-libc_hidden_nolink (netname2host, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (netname2host, GLIBC_2_1)
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index 6b61d324f9..6f7ad10ef6 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -84,4 +84,4 @@ pmap_getmaps (struct sockaddr_in *address)
   address->sin_port = 0;
   return head;
 }
-libc_hidden_nolink (pmap_getmaps, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (pmap_getmaps, GLIBC_2_0)
diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c
index 58974a5661..f10f87250d 100644
--- a/sunrpc/pm_getport.c
+++ b/sunrpc/pm_getport.c
@@ -142,7 +142,7 @@ __libc_rpc_getport (address, program, version, protocol, timeout_sec,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (__libc_rpc_getport)
 #else
-libc_hidden_nolink (__libc_rpc_getport, GLIBC_PRIVATE)
+libc_hidden_nolink_sunrpc (__libc_rpc_getport, GLIBC_PRIVATE)
 #endif
 
 
@@ -160,4 +160,4 @@ pmap_getport (address, program, version, protocol)
 {
   return __libc_rpc_getport (address, program, version, protocol, 5, 60);
 }
-libc_hidden_nolink (pmap_getport, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (pmap_getport, GLIBC_2_0)
diff --git a/sunrpc/pmap_clnt.c b/sunrpc/pmap_clnt.c
index 36479f0e5c..5d7d185766 100644
--- a/sunrpc/pmap_clnt.c
+++ b/sunrpc/pmap_clnt.c
@@ -131,7 +131,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port)
   /* (void)close(socket); CLNT_DESTROY closes it */
   return rslt;
 }
-libc_hidden_nolink (pmap_set, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (pmap_set, GLIBC_2_0)
 
 /*
  * Remove the mapping between program,version and port.
@@ -162,4 +162,4 @@ pmap_unset (u_long program, u_long version)
   /* (void)close(socket); CLNT_DESTROY already closed it */
   return rslt;
 }
-libc_hidden_nolink (pmap_unset, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (pmap_unset, GLIBC_2_0)
diff --git a/sunrpc/pmap_prot.c b/sunrpc/pmap_prot.c
index 5a2e052728..8df41dc5f2 100644
--- a/sunrpc/pmap_prot.c
+++ b/sunrpc/pmap_prot.c
@@ -49,4 +49,4 @@ xdr_pmap (xdrs, regs)
     return xdr_u_long (xdrs, &regs->pm_port);
   return FALSE;
 }
-libc_hidden_nolink (xdr_pmap, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_pmap, GLIBC_2_0)
diff --git a/sunrpc/pmap_prot2.c b/sunrpc/pmap_prot2.c
index 3213898ce8..57b0800178 100644
--- a/sunrpc/pmap_prot2.c
+++ b/sunrpc/pmap_prot2.c
@@ -110,4 +110,4 @@ xdr_pmaplist (xdrs, rp)
       rp = freeing ? &next : &((*rp)->pml_next);
     }
 }
-libc_hidden_nolink (xdr_pmaplist, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_pmaplist, GLIBC_2_0)
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 16f322773e..fd8de85589 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -104,7 +104,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p
   addr->sin_port = 0;
   return stat;
 }
-libc_hidden_nolink (pmap_rmtcall, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (pmap_rmtcall, GLIBC_2_0)
 
 
 /*
@@ -137,7 +137,7 @@ xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap)
     }
   return FALSE;
 }
-libc_hidden_nolink (xdr_rmtcall_args, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_rmtcall_args, GLIBC_2_0)
 
 /*
  * XDR remote call results
@@ -160,7 +160,7 @@ xdr_rmtcallres (xdrs, crp)
     }
   return FALSE;
 }
-libc_hidden_nolink (xdr_rmtcallres, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_rmtcallres, GLIBC_2_0)
 
 
 /*
@@ -388,4 +388,4 @@ done_broad:
   AUTH_DESTROY (unix_auth);
   return stat;
 }
-libc_hidden_nolink (clnt_broadcast, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (clnt_broadcast, GLIBC_2_0)
diff --git a/sunrpc/publickey.c b/sunrpc/publickey.c
index 4d0b09874c..089b544953 100644
--- a/sunrpc/publickey.c
+++ b/sunrpc/publickey.c
@@ -75,7 +75,7 @@ getpublickey (const char *name, char *key)
 
   return status == NSS_STATUS_SUCCESS;
 }
-libc_hidden_nolink (getpublickey, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (getpublickey, GLIBC_2_0)
 
 
 int
@@ -118,4 +118,4 @@ getsecretkey (const char *name, char *key, const char *passwd)
 
   return status == NSS_STATUS_SUCCESS;
 }
-libc_hidden_nolink (getsecretkey, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (getsecretkey, GLIBC_2_0)
diff --git a/sunrpc/rpc_cmsg.c b/sunrpc/rpc_cmsg.c
index ed70104b68..62d95fcc83 100644
--- a/sunrpc/rpc_cmsg.c
+++ b/sunrpc/rpc_cmsg.c
@@ -194,4 +194,4 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
     return xdr_opaque_auth (xdrs, &(cmsg->rm_call.cb_verf));
   return FALSE;
 }
-libc_hidden_nolink (xdr_callmsg, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_callmsg, GLIBC_2_0)
diff --git a/sunrpc/rpc_common.c b/sunrpc/rpc_common.c
index 44b4b38f4d..710191163c 100644
--- a/sunrpc/rpc_common.c
+++ b/sunrpc/rpc_common.c
@@ -45,7 +45,7 @@
    section but we cannot add const to the type because this isn't how
    the variable is declared.  So we use the section attribute.  */
 struct opaque_auth _null_auth __attribute__ ((nocommon));
-libc_hidden_nolink (_null_auth, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (_null_auth, GLIBC_2_0)
 fd_set svc_fdset;
 struct rpc_createerr rpc_createerr;
 struct pollfd *svc_pollfd;
diff --git a/sunrpc/rpc_dtable.c b/sunrpc/rpc_dtable.c
index 9bee215496..81ddf8f55a 100644
--- a/sunrpc/rpc_dtable.c
+++ b/sunrpc/rpc_dtable.c
@@ -46,4 +46,4 @@ _rpc_dtablesize (void)
 
   return size;
 }
-libc_hidden_nolink (_rpc_dtablesize, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (_rpc_dtablesize, GLIBC_2_0)
diff --git a/sunrpc/rpc_prot.c b/sunrpc/rpc_prot.c
index 9a23cc1b02..dc24f3673b 100644
--- a/sunrpc/rpc_prot.c
+++ b/sunrpc/rpc_prot.c
@@ -57,7 +57,7 @@ xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap)
 		      &ap->oa_length, MAX_AUTH_BYTES);
   return FALSE;
 }
-libc_hidden_nolink (xdr_opaque_auth, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_opaque_auth, GLIBC_2_0)
 
 /*
  * XDR a DES block
@@ -67,7 +67,7 @@ xdr_des_block (XDR *xdrs, des_block *blkp)
 {
   return xdr_opaque (xdrs, (caddr_t) blkp, sizeof (des_block));
 }
-libc_hidden_nolink (xdr_des_block, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_des_block, GLIBC_2_0)
 
 /* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
 
@@ -95,7 +95,7 @@ xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar)
     }
   return TRUE;		/* TRUE => open ended set of problems */
 }
-libc_hidden_nolink (xdr_accepted_reply, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_accepted_reply, GLIBC_2_0)
 
 /*
  * XDR the MSG_DENIED part of a reply message union
@@ -118,7 +118,7 @@ xdr_rejected_reply (XDR *xdrs, struct rejected_reply *rr)
     }
   return FALSE;
 }
-libc_hidden_nolink (xdr_rejected_reply, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_rejected_reply, GLIBC_2_0)
 
 static const struct xdr_discrim reply_dscrm[3] =
 {
@@ -142,7 +142,7 @@ xdr_replymsg (xdrs, rmsg)
 		      NULL_xdrproc_t);
   return FALSE;
 }
-libc_hidden_nolink (xdr_replymsg, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_replymsg, GLIBC_2_0)
 
 
 /*
@@ -167,7 +167,7 @@ xdr_callhdr (xdrs, cmsg)
     return xdr_u_long (xdrs, &(cmsg->rm_call.cb_vers));
   return FALSE;
 }
-libc_hidden_nolink (xdr_callhdr, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_callhdr, GLIBC_2_0)
 
 /* ************************** Client utility routine ************* */
 
@@ -277,4 +277,4 @@ _seterr_reply (struct rpc_msg *msg,
       break;
     }
 }
-libc_hidden_nolink (_seterr_reply, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (_seterr_reply, GLIBC_2_0)
diff --git a/sunrpc/rpc_thread.c b/sunrpc/rpc_thread.c
index ac4c18fcee..94d9f1fd80 100644
--- a/sunrpc/rpc_thread.c
+++ b/sunrpc/rpc_thread.c
@@ -97,7 +97,7 @@ __rpc_thread_svc_fdset (void)
 		return &svc_fdset;
 	return &tvp->svc_fdset_s;
 }
-libc_hidden_nolink (__rpc_thread_svc_fdset, GLIBC_2_2_3)
+libc_hidden_nolink_sunrpc (__rpc_thread_svc_fdset, GLIBC_2_2_3)
 
 struct rpc_createerr *
 __rpc_thread_createerr (void)
@@ -109,7 +109,7 @@ __rpc_thread_createerr (void)
 		return &rpc_createerr;
 	return &tvp->rpc_createerr_s;
 }
-libc_hidden_nolink (__rpc_thread_createerr, GLIBC_2_2_3)
+libc_hidden_nolink_sunrpc (__rpc_thread_createerr, GLIBC_2_2_3)
 
 struct pollfd **
 __rpc_thread_svc_pollfd (void)
@@ -124,7 +124,7 @@ __rpc_thread_svc_pollfd (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (__rpc_thread_svc_pollfd)
 #else
-libc_hidden_nolink (__rpc_thread_svc_pollfd, GLIBC_2_2_3)
+libc_hidden_nolink_sunrpc (__rpc_thread_svc_pollfd, GLIBC_2_2_3)
 #endif
 
 int *
@@ -140,7 +140,7 @@ __rpc_thread_svc_max_pollfd (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (__rpc_thread_svc_max_pollfd)
 #else
-libc_hidden_nolink (__rpc_thread_svc_max_pollfd, GLIBC_2_2_3)
+libc_hidden_nolink_sunrpc (__rpc_thread_svc_max_pollfd, GLIBC_2_2_3)
 #endif
 
 #endif /* _RPC_THREAD_SAFE_ */
diff --git a/sunrpc/rtime.c b/sunrpc/rtime.c
index 8506df554c..bcb280b48f 100644
--- a/sunrpc/rtime.c
+++ b/sunrpc/rtime.c
@@ -140,4 +140,4 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep,
   timep->tv_usec = 0;
   return 0;
 }
-libc_hidden_nolink (rtime, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (rtime, GLIBC_2_1)
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index e1f4a322e8..103770a42c 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -115,7 +115,7 @@ xprt_register (SVCXPRT *xprt)
 					       POLLRDNORM | POLLRDBAND);
     }
 }
-libc_hidden_nolink (xprt_register, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xprt_register, GLIBC_2_0)
 
 /* De-activate a transport handle. */
 void
@@ -139,7 +139,7 @@ xprt_unregister (SVCXPRT *xprt)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xprt_unregister)
 #else
-libc_hidden_nolink (xprt_unregister, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xprt_unregister, GLIBC_2_0)
 #endif
 
 
@@ -218,7 +218,7 @@ pmap_it:
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svc_register)
 #else
-libc_hidden_nolink (svc_register, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_register, GLIBC_2_0)
 #endif
 
 /* Remove a service program from the callout list. */
@@ -242,7 +242,7 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers)
   if (! svc_is_mapped (prog, vers))
     pmap_unset (prog, vers);
 }
-libc_hidden_nolink (svc_unregister, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0)
 
 /* ******************* REPLY GENERATION ROUTINES  ************ */
 
@@ -264,7 +264,7 @@ svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results,
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svc_sendreply)
 #else
-libc_hidden_nolink (svc_sendreply, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_sendreply, GLIBC_2_0)
 #endif
 
 /* No procedure error reply */
@@ -282,7 +282,7 @@ svcerr_noproc (register SVCXPRT *xprt)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svcerr_noproc)
 #else
-libc_hidden_nolink (svcerr_noproc, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_noproc, GLIBC_2_0)
 #endif
 
 /* Can't decode args error reply */
@@ -300,7 +300,7 @@ svcerr_decode (register SVCXPRT *xprt)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svcerr_decode)
 #else
-libc_hidden_nolink (svcerr_decode, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_decode, GLIBC_2_0)
 #endif
 
 /* Some system error */
@@ -318,7 +318,7 @@ svcerr_systemerr (register SVCXPRT *xprt)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svcerr_systemerr)
 #else
-libc_hidden_nolink (svcerr_systemerr, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_systemerr, GLIBC_2_0)
 #endif
 
 /* Authentication error reply */
@@ -333,7 +333,7 @@ svcerr_auth (SVCXPRT *xprt, enum auth_stat why)
   rply.rjcted_rply.rj_why = why;
   SVC_REPLY (xprt, &rply);
 }
-libc_hidden_nolink (svcerr_auth, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_auth, GLIBC_2_0)
 
 /* Auth too weak error reply */
 void
@@ -341,7 +341,7 @@ svcerr_weakauth (SVCXPRT *xprt)
 {
   svcerr_auth (xprt, AUTH_TOOWEAK);
 }
-libc_hidden_nolink (svcerr_weakauth, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_weakauth, GLIBC_2_0)
 
 /* Program unavailable error reply */
 void
@@ -355,7 +355,7 @@ svcerr_noprog (register SVCXPRT *xprt)
   rply.acpted_rply.ar_stat = PROG_UNAVAIL;
   SVC_REPLY (xprt, &rply);
 }
-libc_hidden_nolink (svcerr_noprog, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_noprog, GLIBC_2_0)
 
 /* Program version mismatch error reply */
 void
@@ -372,7 +372,7 @@ svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers,
   rply.acpted_rply.ar_vers.high = high_vers;
   SVC_REPLY (xprt, &rply);
 }
-libc_hidden_nolink (svcerr_progvers, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcerr_progvers, GLIBC_2_0)
 
 /* ******************* SERVER INPUT STUFF ******************* */
 
@@ -401,7 +401,7 @@ svc_getreq (int rdfds)
   readfds.fds_bits[0] = rdfds;
   svc_getreqset (&readfds);
 }
-libc_hidden_nolink (svc_getreq, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_getreq, GLIBC_2_0)
 
 void
 svc_getreqset (fd_set *readfds)
@@ -420,7 +420,7 @@ svc_getreqset (fd_set *readfds)
     for (mask = *maskp++; (bit = ffsl (mask)); mask ^= (1L << (bit - 1)))
       svc_getreq_common (sock + bit - 1);
 }
-libc_hidden_nolink (svc_getreqset, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_getreqset, GLIBC_2_0)
 
 void
 svc_getreq_poll (struct pollfd *pfdp, int pollretval)
@@ -449,7 +449,7 @@ svc_getreq_poll (struct pollfd *pfdp, int pollretval)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svc_getreq_poll)
 #else
-libc_hidden_nolink (svc_getreq_poll, GLIBC_2_2)
+libc_hidden_nolink_sunrpc (svc_getreq_poll, GLIBC_2_2)
 #endif
 
 
@@ -542,7 +542,7 @@ svc_getreq_common (const int fd)
     }
   while (stat == XPRT_MOREREQS);
 }
-libc_hidden_nolink (svc_getreq_common, GLIBC_2_2)
+libc_hidden_nolink_sunrpc (svc_getreq_common, GLIBC_2_2)
 
 #ifdef _RPC_THREAD_SAFE_
 
diff --git a/sunrpc/svc_auth.c b/sunrpc/svc_auth.c
index facbb13982..f33bda2f20 100644
--- a/sunrpc/svc_auth.c
+++ b/sunrpc/svc_auth.c
@@ -105,7 +105,7 @@ _authenticate (register struct svc_req *rqst, struct rpc_msg *msg)
 
   return AUTH_REJECTEDCRED;
 }
-libc_hidden_nolink (_authenticate, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (_authenticate, GLIBC_2_1)
 
 static enum auth_stat
 _svcauth_null (struct svc_req *rqst, struct rpc_msg *msg)
diff --git a/sunrpc/svc_raw.c b/sunrpc/svc_raw.c
index 90f5d96e63..7d885574af 100644
--- a/sunrpc/svc_raw.c
+++ b/sunrpc/svc_raw.c
@@ -88,7 +88,7 @@ svcraw_create (void)
   xdrmem_create (&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE);
   return &srp->server;
 }
-libc_hidden_nolink (svcraw_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcraw_create, GLIBC_2_0)
 
 static enum xprt_stat
 svcraw_stat (SVCXPRT *xprt)
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c
index 09f40dd188..90dfc94056 100644
--- a/sunrpc/svc_run.c
+++ b/sunrpc/svc_run.c
@@ -46,7 +46,7 @@ svc_exit (void)
   svc_pollfd = NULL;
   svc_max_pollfd = 0;
 }
-libc_hidden_nolink (svc_exit, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_exit, GLIBC_2_0)
 
 void
 svc_run (void)
@@ -104,5 +104,5 @@ svc_run (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svc_run)
 #else
-libc_hidden_nolink (svc_run, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svc_run, GLIBC_2_0)
 #endif
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index e0515322a5..eb615494d8 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -187,7 +187,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svctcp_create)
 #else
-libc_hidden_nolink (svctcp_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svctcp_create, GLIBC_2_0)
 #endif
 
 /*
@@ -199,7 +199,7 @@ svcfd_create (int fd, u_int sendsize, u_int recvsize)
 {
   return makefd_xprt (fd, sendsize, recvsize);
 }
-libc_hidden_nolink (svcfd_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcfd_create, GLIBC_2_0)
 
 static SVCXPRT *
 internal_function
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 04c8407e64..6c4d75a814 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -184,7 +184,7 @@ svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svcudp_bufcreate)
 #else
-libc_hidden_nolink (svcudp_bufcreate, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcudp_bufcreate, GLIBC_2_0)
 #endif
 
 SVCXPRT *
@@ -196,7 +196,7 @@ svcudp_create (sock)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (svcudp_create)
 #else
-libc_hidden_nolink (svcudp_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcudp_create, GLIBC_2_0)
 #endif
 
 static enum xprt_stat
@@ -500,7 +500,7 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
   su->su_cache = (char *) uc;
   return 1;
 }
-libc_hidden_nolink (svcudp_enablecache, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (svcudp_enablecache, GLIBC_2_0)
 
 
 /*
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index 2b02682e72..94507b2403 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -184,7 +184,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
   xprt_register (xprt);
   return xprt;
 }
-libc_hidden_nolink (svcunix_create, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (svcunix_create, GLIBC_2_1)
 
 /*
  * Like svunix_create(), except the routine takes any *open* UNIX file
@@ -195,7 +195,7 @@ svcunixfd_create (int fd, u_int sendsize, u_int recvsize)
 {
   return makefd_xprt (fd, sendsize, recvsize);
 }
-libc_hidden_nolink (svcunixfd_create, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (svcunixfd_create, GLIBC_2_1)
 
 static SVCXPRT *
 internal_function
diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c
index b9656e25da..9609734960 100644
--- a/sunrpc/svcauth_des.c
+++ b/sunrpc/svcauth_des.c
@@ -583,7 +583,7 @@ authdes_getucred (const struct authdes_cred *adc, uid_t * uid, gid_t * gid,
     groups[i] = cred->groups[i];
   return 1;
 }
-libc_hidden_nolink (authdes_getucred, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (authdes_getucred, GLIBC_2_1)
 
 static void
 internal_function
diff --git a/sunrpc/xcrypt.c b/sunrpc/xcrypt.c
index 8b7642b503..2e53f2d9e9 100644
--- a/sunrpc/xcrypt.c
+++ b/sunrpc/xcrypt.c
@@ -127,7 +127,7 @@ xencrypt (char *secret, char *passwd)
   free (buf);
   return 1;
 }
-libc_hidden_nolink (xencrypt, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xencrypt, GLIBC_2_0)
 
 /*
  * Decrypt secret key using passwd
@@ -163,7 +163,7 @@ xdecrypt (char *secret, char *passwd)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdecrypt)
 #else
-libc_hidden_nolink (xdecrypt, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdecrypt, GLIBC_2_1)
 #endif
 
 /*
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index 4dd82ff044..7eac2d40f0 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -72,7 +72,7 @@ xdr_free (xdrproc_t proc, char *objp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_free)
 #else
-libc_hidden_nolink (xdr_free, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_free, GLIBC_2_0)
 #endif
 
 /*
@@ -86,7 +86,7 @@ xdr_void (void)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_void)
 #else
-libc_hidden_nolink (xdr_void, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_void, GLIBC_2_0)
 #endif
 
 /*
@@ -126,7 +126,7 @@ xdr_int (XDR *xdrs, int *ip)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_int)
 #else
-libc_hidden_nolink (xdr_int, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_int, GLIBC_2_0)
 #endif
 
 /*
@@ -165,7 +165,7 @@ xdr_u_int (XDR *xdrs, u_int *up)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_int)
 #else
-libc_hidden_nolink (xdr_u_int, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_u_int, GLIBC_2_0)
 #endif
 
 /*
@@ -193,7 +193,7 @@ xdr_long (XDR *xdrs, long *lp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_long)
 #else
-libc_hidden_nolink (xdr_long, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_long, GLIBC_2_0)
 #endif
 
 /*
@@ -232,7 +232,7 @@ xdr_u_long (XDR *xdrs, u_long *ulp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_long)
 #else
-libc_hidden_nolink (xdr_u_long, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_u_long, GLIBC_2_0)
 #endif
 
 /*
@@ -268,7 +268,7 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_hyper)
 #else
-libc_hidden_nolink (xdr_hyper, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_hyper, GLIBC_2_1_1)
 #endif
 
 /*
@@ -304,7 +304,7 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_hyper)
 #else
-libc_hidden_nolink (xdr_u_hyper, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_u_hyper, GLIBC_2_1_1)
 #endif
 
 bool_t
@@ -315,7 +315,7 @@ xdr_longlong_t (XDR *xdrs, quad_t *llp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_longlong_t)
 #else
-libc_hidden_nolink (xdr_longlong_t, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_longlong_t, GLIBC_2_1_1)
 #endif
 
 bool_t
@@ -326,7 +326,7 @@ xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_longlong_t)
 #else
-libc_hidden_nolink (xdr_u_longlong_t, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_u_longlong_t, GLIBC_2_1_1)
 #endif
 
 /*
@@ -359,7 +359,7 @@ xdr_short (XDR *xdrs, short *sp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_short)
 #else
-libc_hidden_nolink (xdr_short, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_short, GLIBC_2_0)
 #endif
 
 /*
@@ -392,7 +392,7 @@ xdr_u_short (XDR *xdrs, u_short *usp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_short)
 #else
-libc_hidden_nolink (xdr_u_short, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_u_short, GLIBC_2_0)
 #endif
 
 
@@ -415,7 +415,7 @@ xdr_char (XDR *xdrs, char *cp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_char)
 #else
-libc_hidden_nolink (xdr_char, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_char, GLIBC_2_0)
 #endif
 
 /*
@@ -437,7 +437,7 @@ xdr_u_char (XDR *xdrs, u_char *cp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_u_char)
 #else
-libc_hidden_nolink (xdr_u_char, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_u_char, GLIBC_2_0)
 #endif
 
 /*
@@ -470,7 +470,7 @@ xdr_bool (XDR *xdrs, bool_t *bp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_bool)
 #else
-libc_hidden_nolink (xdr_bool, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_bool, GLIBC_2_0)
 #endif
 
 /*
@@ -525,7 +525,7 @@ xdr_enum (XDR *xdrs, enum_t *ep)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_enum)
 #else
-libc_hidden_nolink (xdr_enum, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_enum, GLIBC_2_0)
 #endif
 
 /*
@@ -580,7 +580,7 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_opaque)
 #else
-libc_hidden_nolink (xdr_opaque, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_opaque, GLIBC_2_0)
 #endif
 
 /*
@@ -648,7 +648,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_bytes)
 #else
-libc_hidden_nolink (xdr_bytes, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_bytes, GLIBC_2_0)
 #endif
 
 /*
@@ -665,7 +665,7 @@ xdr_netobj (xdrs, np)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_netobj)
 #else
-libc_hidden_nolink (xdr_netobj, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_netobj, GLIBC_2_0)
 #endif
 
 /*
@@ -714,7 +714,7 @@ xdr_union (xdrs, dscmp, unp, choices, dfault)
   return ((dfault == NULL_xdrproc_t) ? FALSE :
 	  (*dfault) (xdrs, unp, LASTUNSIGNED));
 }
-libc_hidden_nolink (xdr_union, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_union, GLIBC_2_0)
 
 
 /*
@@ -806,7 +806,7 @@ xdr_string (xdrs, cpp, maxsize)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_string)
 #else
-libc_hidden_nolink (xdr_string, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_string, GLIBC_2_0)
 #endif
 
 /*
@@ -827,5 +827,5 @@ xdr_wrapstring (xdrs, cpp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_wrapstring)
 #else
-libc_hidden_nolink (xdr_wrapstring, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_wrapstring, GLIBC_2_0)
 #endif
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index b832078342..a634861278 100644
--- a/sunrpc/xdr_array.c
+++ b/sunrpc/xdr_array.c
@@ -127,7 +127,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_array)
 #else
-libc_hidden_nolink (xdr_array, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_array, GLIBC_2_0)
 #endif
 
 /*
@@ -162,4 +162,4 @@ xdr_vector (xdrs, basep, nelem, elemsize, xdr_elem)
     }
   return TRUE;
 }
-libc_hidden_nolink (xdr_vector, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_vector, GLIBC_2_0)
diff --git a/sunrpc/xdr_float.c b/sunrpc/xdr_float.c
index 1a9c260617..78e8f3bd2d 100644
--- a/sunrpc/xdr_float.c
+++ b/sunrpc/xdr_float.c
@@ -158,7 +158,7 @@ xdr_float(xdrs, fp)
 	}
 	return (FALSE);
 }
-libc_hidden_nolink (xdr_float, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_float, GLIBC_2_0)
 
 /*
  * This routine works on Suns (Sky / 68000's) and Vaxen.
@@ -300,4 +300,4 @@ xdr_double(xdrs, dp)
 	}
 	return (FALSE);
 }
-libc_hidden_nolink (xdr_double, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_double, GLIBC_2_0)
diff --git a/sunrpc/xdr_intXX_t.c b/sunrpc/xdr_intXX_t.c
index fe06f45df3..02a0c09b5b 100644
--- a/sunrpc/xdr_intXX_t.c
+++ b/sunrpc/xdr_intXX_t.c
@@ -46,14 +46,14 @@ xdr_int64_t (XDR *xdrs, int64_t *ip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_int64_t, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_int64_t, GLIBC_2_1_1)
 
 bool_t
 xdr_quad_t (XDR *xdrs, quad_t *ip)
 {
   return xdr_int64_t (xdrs, (int64_t *) ip);
 }
-libc_hidden_nolink (xdr_quad_t, GLIBC_2_3_4)
+libc_hidden_nolink_sunrpc (xdr_quad_t, GLIBC_2_3_4)
 
 /* XDR 64bit unsigned integers */
 bool_t
@@ -82,14 +82,14 @@ xdr_uint64_t (XDR *xdrs, uint64_t *uip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_uint64_t, GLIBC_2_1_1)
+libc_hidden_nolink_sunrpc (xdr_uint64_t, GLIBC_2_1_1)
 
 bool_t
 xdr_u_quad_t (XDR *xdrs, u_quad_t *ip)
 {
   return xdr_uint64_t (xdrs, (uint64_t *) ip);
 }
-libc_hidden_nolink (xdr_u_quad_t, GLIBC_2_3_4)
+libc_hidden_nolink_sunrpc (xdr_u_quad_t, GLIBC_2_3_4)
 
 /* XDR 32bit integers */
 bool_t
@@ -107,7 +107,7 @@ xdr_int32_t (XDR *xdrs, int32_t *lp)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_int32_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_int32_t, GLIBC_2_1)
 
 /* XDR 32bit unsigned integers */
 bool_t
@@ -128,7 +128,7 @@ xdr_uint32_t (XDR *xdrs, uint32_t *ulp)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_uint32_t)
 #else
-libc_hidden_nolink (xdr_uint32_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_uint32_t, GLIBC_2_1)
 #endif
 
 /* XDR 16bit integers */
@@ -153,7 +153,7 @@ xdr_int16_t (XDR *xdrs, int16_t *ip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_int16_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_int16_t, GLIBC_2_1)
 
 /* XDR 16bit unsigned integers */
 bool_t
@@ -177,7 +177,7 @@ xdr_uint16_t (XDR *xdrs, uint16_t *uip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_uint16_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_uint16_t, GLIBC_2_1)
 
 /* XDR 8bit integers */
 bool_t
@@ -201,7 +201,7 @@ xdr_int8_t (XDR *xdrs, int8_t *ip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_int8_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_int8_t, GLIBC_2_1)
 
 /* XDR 8bit unsigned integers */
 bool_t
@@ -225,4 +225,4 @@ xdr_uint8_t (XDR *xdrs, uint8_t *uip)
       return FALSE;
     }
 }
-libc_hidden_nolink (xdr_uint8_t, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_uint8_t, GLIBC_2_1)
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index 093a718739..ba7661aa54 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -81,7 +81,7 @@ xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdrmem_create)
 #else
-libc_hidden_nolink (xdrmem_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrmem_create, GLIBC_2_0)
 #endif
 
 /*
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index 556c6c4bc0..f5d6ef2af9 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -189,7 +189,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
   rstrm->fbtbc = 0;
   rstrm->last_frag = TRUE;
 }
-libc_hidden_nolink (xdrrec_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrrec_create, GLIBC_2_0)
 
 
 /*
@@ -477,7 +477,7 @@ xdrrec_skiprecord (XDR *xdrs)
   rstrm->last_frag = FALSE;
   return TRUE;
 }
-libc_hidden_nolink (xdrrec_skiprecord, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrrec_skiprecord, GLIBC_2_0)
 
 /*
  * Lookahead function.
@@ -501,7 +501,7 @@ xdrrec_eof (XDR *xdrs)
     return TRUE;
   return FALSE;
 }
-libc_hidden_nolink (xdrrec_eof, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrrec_eof, GLIBC_2_0)
 
 /*
  * The client must tell the package when an end-of-record has occurred.
@@ -528,7 +528,7 @@ xdrrec_endofrecord (XDR *xdrs, bool_t sendnow)
   rstrm->out_finger += BYTES_PER_XDR_UNIT;
   return TRUE;
 }
-libc_hidden_nolink (xdrrec_endofrecord, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrrec_endofrecord, GLIBC_2_0)
 
 
 /*
diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c
index 7510bed873..8fb4584a75 100644
--- a/sunrpc/xdr_ref.c
+++ b/sunrpc/xdr_ref.c
@@ -90,7 +90,7 @@ xdr_reference (xdrs, pp, size, proc)
     }
   return stat;
 }
-libc_hidden_nolink (xdr_reference, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_reference, GLIBC_2_0)
 
 
 /*
@@ -137,5 +137,5 @@ xdr_pointer (xdrs, objpp, obj_size, xdr_obj)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_pointer)
 #else
-libc_hidden_nolink (xdr_pointer, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdr_pointer, GLIBC_2_0)
 #endif
diff --git a/sunrpc/xdr_sizeof.c b/sunrpc/xdr_sizeof.c
index 0119486c3d..56e870a455 100644
--- a/sunrpc/xdr_sizeof.c
+++ b/sunrpc/xdr_sizeof.c
@@ -161,5 +161,5 @@ xdr_sizeof (xdrproc_t func, void *data)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdr_sizeof)
 #else
-libc_hidden_nolink (xdr_sizeof, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (xdr_sizeof, GLIBC_2_1)
 #endif
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index d9866063f9..667515e0a6 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -191,5 +191,5 @@ xdrstdio_putint32 (XDR *xdrs, const int32_t *ip)
 #ifdef EXPORT_RPC_SYMBOLS
 libc_hidden_def (xdrstdio_create)
 #else
-libc_hidden_nolink (xdrstdio_create, GLIBC_2_0)
+libc_hidden_nolink_sunrpc (xdrstdio_create, GLIBC_2_0)
 #endif
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 602b429cea..e071015cee 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -717,7 +717,11 @@ rtld_hidden_proto (_dl_make_stack_executable)
    might use the variable which results in copy relocations on some
    platforms.  But this does not matter, ld.so can always use the local
    copy.  */
-extern void *__libc_stack_end attribute_relro;
+extern void *__libc_stack_end
+#ifndef LIBC_STACK_END_NOT_RELRO
+     attribute_relro
+#endif
+     ;
 rtld_hidden_proto (__libc_stack_end)
 
 /* Parameters passed to the dynamic linker.  */
diff --git a/sysdeps/generic/paths.h b/sysdeps/generic/paths.h
index 439992fe7b..f85e88cb95 100644
--- a/sysdeps/generic/paths.h
+++ b/sysdeps/generic/paths.h
@@ -46,15 +46,15 @@
 #define	_PATH_DRUM	"/dev/drum"
 #define	_PATH_GSHADOW	"/etc/gshadow"
 #define	_PATH_KMEM	"/dev/kmem"
-#define	_PATH_MAILDIR	"/var/mail"
 #define	_PATH_LASTLOG	"/var/log/lastlog"
-#define	_PATH_MAN	"/usr/man"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
 #define	_PATH_MEM	"/dev/mem"
 #define	_PATH_MNTTAB    "/etc/fstab"
 #define	_PATH_MOUNTED   "/var/run/mtab"
 #define	_PATH_NOLOGIN	"/etc/nologin"
-#define	_PATH_PRESERVE	"/var/preserve"
-#define	_PATH_RWHODIR	"/var/rwho"
+#define	_PATH_PRESERVE	"/var/lib"
+#define	_PATH_RWHODIR	"/var/spool/rwho"
 #define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
 #define	_PATH_SHADOW	"/etc/shadow"
 #define	_PATH_SHELLS	"/etc/shells"
diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
new file mode 100644
index 0000000000..634e1d0cc6
--- /dev/null
+++ b/sysdeps/gnu/configure
@@ -0,0 +1,36 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+
+# Local configure fragment for sysdeps/gnu.
+
+# The Filesystem Hierarchy Standard prescribes where to place "essential"
+# files.  I.e., when the installation prefix is "/usr" we have to place
+# shared library objects and the configuration files on the root partition
+# in /lib and /etc.
+case "$prefix" in
+/usr | /usr/)
+  # 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)
+    libc_cv_slibdir=/lib64
+    if test "$libdir" = '${exec_prefix}/lib'; then
+      libdir='${exec_prefix}/lib64';
+      # Locale data can be shared between 32bit and 64bit libraries
+      libc_cv_localedir='${exec_prefix}/lib/locale'
+    fi
+    ;;
+  *)
+    libc_cv_slibdir=/lib
+    ;;
+  esac
+  # Allow the user to override the path with --sysconfdir
+  if test "$sysconfdir" = '${prefix}/etc'; then
+    libc_cv_sysconfdir=/etc
+  else
+    libc_cv_sysconfdir=$sysconfdir
+   fi
+  libc_cv_rootsbindir=/sbin
+  ;;
+esac
diff --git a/sysdeps/gnu/configure.in b/sysdeps/gnu/configure.in
new file mode 100644
index 0000000000..3422007ffe
--- /dev/null
+++ b/sysdeps/gnu/configure.in
@@ -0,0 +1,36 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+
+# Local configure fragment for sysdeps/gnu.
+
+# The Filesystem Hierarchy Standard prescribes where to place "essential"
+# files.  I.e., when the installation prefix is "/usr" we have to place
+# shared library objects and the configuration files on the root partition
+# in /lib and /etc.
+case "$prefix" in
+/usr | /usr/)
+  # 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)
+    libc_cv_slibdir=/lib64
+    if test "$libdir" = '${exec_prefix}/lib'; then
+      libdir='${exec_prefix}/lib64';
+      # Locale data can be shared between 32bit and 64bit libraries
+      libc_cv_localedir='${exec_prefix}/lib/locale'
+    fi
+    ;;
+  *)
+    libc_cv_slibdir=/lib
+    ;;
+  esac
+  # Allow the user to override the path with --sysconfdir
+  if test "$sysconfdir" = '${prefix}/etc'; then
+    libc_cv_sysconfdir=/etc
+  else
+    libc_cv_sysconfdir=$sysconfdir
+   fi
+  libc_cv_rootsbindir=/sbin
+  ;;
+esac
diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c
index 2382fbb414..baa35e14d8 100644
--- a/sysdeps/ieee754/dbl-64/s_logb.c
+++ b/sysdeps/ieee754/dbl-64/s_logb.c
@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $";
-#endif
-
 /*
  * double logb(x)
  * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
@@ -23,20 +19,29 @@ static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $";
 #include <math.h>
 #include <math_private.h>
 
-double __logb(double x)
+double
+__logb (double x)
 {
-	int32_t lx,ix;
-	EXTRACT_WORDS(ix,lx,x);
-	ix &= 0x7fffffff;			/* high |x| */
-	if((ix|lx)==0) return -1.0/fabs(x);
-	if(ix>=0x7ff00000) return x*x;
-	if((ix>>=20)==0) 			/* IEEE 754 logb */
-		return -1022.0;
-	else
-		return (double) (ix-1023);
+  int32_t lx, ix, rix;
+
+  EXTRACT_WORDS (ix, lx, x);
+  ix &= 0x7fffffff;		/* high |x| */
+  if ((ix | lx) == 0)
+    return -1.0 / fabs (x);
+  if (ix >= 0x7ff00000)
+    return x * x;
+  if (__builtin_expect ((rix = ix >> 20) == 0, 0))
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int m1 = (ix == 0) ? 0 : __builtin_clz (ix);
+      int m2 = (lx == 0) ? 0 : __builtin_clz (lx);
+      int ma = (m1 == 0) ? m2 + 32 : m1;
+      return -1022.0 + (double)(11 - ma);
+    }
+  return (double) (rix - 1023);
 }
 weak_alias (__logb, logb)
 #ifdef NO_LONG_DOUBLE
-strong_alias (__logb, __logbl)
-weak_alias (__logb, logbl)
+strong_alias (__logb, __logbl) weak_alias (__logb, logbl)
 #endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
index 2ad6c7ddbd..474eeef36b 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
@@ -1,5 +1,5 @@
 /* Compute radix independent exponent.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
@@ -25,16 +25,21 @@
 double
 __logb (double x)
 {
-  int64_t ix;
+  int64_t ix, ex;
 
   EXTRACT_WORDS64 (ix, x);
   ix &= UINT64_C(0x7fffffffffffffff);
   if (ix == 0)
     return -1.0 / fabs (x);
-  unsigned int ex = ix >> 52;
+  ex = ix >> 52;
   if (ex == 0x7ff)
     return x * x;
-  return ex == 0 ? -1022.0 : (double) (ex - 1023);
+  if (__builtin_expect (ex == 0, 0))
+    {
+      int m = (ix == 0) ? 0 : __builtin_clzl (ix);
+      return -1022.0 + (double)(11 -m);
+    }
+  return (double) (ex - 1023);
 }
 weak_alias (__logb, logb)
 #ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c
index b6aa0f057d..025c70de7e 100644
--- a/sysdeps/ieee754/flt-32/s_logbf.c
+++ b/sysdeps/ieee754/flt-32/s_logbf.c
@@ -13,23 +13,27 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_logbf.c,v 1.4 1995/05/10 20:47:51 jtc Exp $";
-#endif
-
 #include <math.h>
 #include <math_private.h>
 
-float __logbf(float x)
+float
+__logbf (float x)
 {
-	int32_t ix;
-	GET_FLOAT_WORD(ix,x);
-	ix &= 0x7fffffff;			/* high |x| */
-	if(ix==0) return (float)-1.0/fabsf(x);
-	if(ix>=0x7f800000) return x*x;
-	if((ix>>=23)==0) 			/* IEEE 754 logb */
-		return -126.0; 
-	else
-		return (float) (ix-127); 
+  int32_t ix, rix;
+
+  GET_FLOAT_WORD (ix, x);
+  ix &= 0x7fffffff;		/* high |x| */
+  if (ix == 0)
+    return (float) -1.0 / fabsf (x);
+  if (ix >= 0x7f800000)
+    return x * x;
+  if (__builtin_expect ((rix = ix >> 23) == 0, 0))
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int m = (ix == 0) ? 0 : __builtin_clz (ix);
+      return -126.0 + (float)(8 - m);
+    }
+  return (float) (rix - 127);
 }
 weak_alias (__logbf, logbf)
diff --git a/sysdeps/ieee754/ldbl-128/s_logbl.c b/sysdeps/ieee754/ldbl-128/s_logbl.c
index 0b09b289c2..cf6003e055 100644
--- a/sysdeps/ieee754/ldbl-128/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128/s_logbl.c
@@ -26,16 +26,27 @@ static char rcsid[] = "$NetBSD: $";
 #include <math.h>
 #include <math_private.h>
 
-long double __logbl(long double x)
+long double
+__logbl (long double x)
 {
-	int64_t lx,hx;
-	GET_LDOUBLE_WORDS64(hx,lx,x);
-	hx &= 0x7fffffffffffffffLL;		/* high |x| */
-	if((hx|lx)==0) return -1.0/fabs(x);
-	if(hx>=0x7fff000000000000LL) return x*x;
-	if((hx>>=48)==0) 			/* IEEE 754 logb */
-		return -16382.0;
-	else
-		return (long double) (hx-0x3fff);
+  int64_t lx, hx, ex;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  hx &= 0x7fffffffffffffffLL;	/* high |x| */
+  if ((hx | lx) == 0)
+    return -1.0 / fabs (x);
+  if (hx >= 0x7fff000000000000LL)
+    return x * x;
+  if ((ex = hx >> 48) == 0)	/* IEEE 754 logb */
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
+      int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
+      int ma = (m1 == 0) ? m2 + 64 : m1;
+      return -16382.0 + (long double)(15 - ma);
+    }
+  return (long double) (ex - 16383);
 }
+
 weak_alias (__logbl, logbl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
index f38b129971..678b6cad57 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -13,10 +13,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
 /*
  * long double logbl(x)
  * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
@@ -27,16 +23,27 @@ static char rcsid[] = "$NetBSD: $";
 #include <math_private.h>
 #include <math_ldbl_opt.h>
 
-long double __logbl(long double x)
+long double
+__logbl (long double x)
 {
-	int64_t lx,hx;
-	GET_LDOUBLE_WORDS64(hx,lx,x);
-	hx &= 0x7fffffffffffffffLL;		/* high |x| */
-	if((hx|(lx&0x7fffffffffffffffLL))==0) return -1.0/fabs(x);
-	if(hx>=0x7ff0000000000000LL) return x*x;
-	if((hx>>=52)==0) 			/* IEEE 754 logb */
-		return -1022.0;
-	else
-		return (long double) (hx-0x3ff);
+  int64_t lx, hx, rhx;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  hx &= 0x7fffffffffffffffLL;	/* high |x| */
+  if ((hx | (lx & 0x7fffffffffffffffLL)) == 0)
+    return -1.0 / fabs (x);
+  if (hx >= 0x7ff0000000000000LL)
+    return x * x;
+  if (__builtin_expect ((rhx = hx >> 52) == 0, 0))
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int m1 = (hx == 0) ? 0 : __builtin_clzll (hx);
+      int m2 = (lx == 0) ? 0 : __builtin_clzll (lx);
+      int ma = (m1 == 0) ? m2 + 64 : m1;
+      return -1022.0 + (long double)(11 - ma);
+    }
+  return (long double) (rhx - 1023);
 }
+
 long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-96/s_logbl.c b/sysdeps/ieee754/ldbl-96/s_logbl.c
index 95b644c030..d8ad4bcfcf 100644
--- a/sysdeps/ieee754/ldbl-96/s_logbl.c
+++ b/sysdeps/ieee754/ldbl-96/s_logbl.c
@@ -14,10 +14,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
 /*
  * long double logbl(x)
  * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
@@ -27,16 +23,27 @@ static char rcsid[] = "$NetBSD: $";
 #include <math.h>
 #include <math_private.h>
 
-long double __logbl(long double x)
+long double
+__logbl (long double x)
 {
-	int32_t es,lx,ix;
-	GET_LDOUBLE_WORDS(es,ix,lx,x);
-	es &= 0x7fff;				/* exponent */
-	if((es|ix|lx)==0) return -1.0/fabs(x);
-	if(es==0x7fff) return x*x;
-	if(es==0) 			/* IEEE 754 logb */
-		return -16382.0;
-	else
-		return (long double) (es-0x3fff);
+  int32_t es, lx, ix;
+
+  GET_LDOUBLE_WORDS (es, ix, lx, x);
+  es &= 0x7fff;			/* exponent */
+  if ((es | ix | lx) == 0)
+    return -1.0 / fabs (x);
+  if (es == 0x7fff)
+    return x * x;
+  if (es == 0)			/* IEEE 754 logb */
+    {
+      /* POSIX specifies that denormal number is treated as
+         though it were normalized.  */
+      int m1 = (ix == 0) ? 0 : __builtin_clz (ix);
+      int m2 = (lx == 0) ? 0 : __builtin_clz (lx);
+      int ma = (m1 == 0) ? m2 + 32 : m1;
+      return -16382.0 - (long double)(ma);
+    }
+  return (long double) (es - 16383);
 }
+
 weak_alias (__logbl, logbl)
diff --git a/sysdeps/mach/bits/libc-lock.h b/sysdeps/mach/bits/libc-lock.h
index 0a627e75ff..110e25e965 100644
--- a/sysdeps/mach/bits/libc-lock.h
+++ b/sysdeps/mach/bits/libc-lock.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Mach cthreads version.
-   Copyright (C) 1996,97,98,2000,01, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -115,6 +115,9 @@ struct __libc_once
     __libc_lock_unlock (ONCE_CONTROL.lock);				      \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)	((ONCE_CONTROL).done != 0)
+
 #ifdef _LIBC
 /* We need portable names for some functions.  E.g., when they are
    used as argument to __libc_cleanup_region_start.  */
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 80749c2572..107eaafb05 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1993-2004,2009,2011,2012 Free Software Foundation, Inc.
+# Copyright (C) 1993-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -133,6 +133,7 @@ rpcuserlibs := $(common-objpfx)mach/libmachuser.so \
 	       $(common-objpfx)hurd/libhurduser.so
 link-rpcuserlibs := $(rpcuserlibs:%user.so=%user-link.so)
 $(common-objpfx)libc.so: $(link-rpcuserlibs)
+$(common-objpfx)linkobj/libc.so: $(link-rpcuserlibs)
 rpath-dirs += mach hurd
 
 # Make sure the `lib' pass builds the dummy shared objects so
diff --git a/sysdeps/mach/hurd/accept.c b/sysdeps/mach/hurd/accept.c
index 78b5c67d81..52dfdf8baa 100644
--- a/sysdeps/mach/hurd/accept.c
+++ b/sysdeps/mach/hurd/accept.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,1993,1994,1997,1999,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
+
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,72 +16,16 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
 #include <sys/socket.h>
-#include <hurd.h>
-#include <hurd/fd.h>
-#include <hurd/socket.h>
 
 /* Await a connection on socket FD.
    When a connection arrives, open a new socket to communicate with it,
-   set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+   set *ADDRARG (which is *ADDR_LEN bytes long) to the address of the connecting
    peer and *ADDR_LEN to the address's actual length, and return the
    new socket's descriptor, or -1 for errors.  */
 int
-accept (fd, addrarg, addr_len)
-      int fd;
-      __SOCKADDR_ARG addrarg;
-      socklen_t *addr_len;
+accept (int fd, __SOCKADDR_ARG addrarg, socklen_t *addr_len)
 {
-  error_t err;
-  socket_t new;
-  addr_port_t aport;
-  struct sockaddr *addr = addrarg.__sockaddr__;
-  char *buf = (char *) addr;
-  mach_msg_type_number_t buflen;
-  int type;
-
-  if (err = HURD_DPORT_USE (fd, __socket_accept (port, &new, &aport)))
-    return __hurd_dfail (fd, err);
-
-  if (addr != NULL)
-    {
-      buflen = *addr_len;
-      err = __socket_whatis_address (aport, &type, &buf, &buflen);
-      if (err == EOPNOTSUPP)
-	/* If the protocol server can't tell us the address, just return a
-	   zero-length one.  */
-	{
-	  buf = (char *)addr;
-	  buflen = 0;
-	  err = 0;
-	}
-    }
-  __mach_port_deallocate (__mach_task_self (), aport);
-
-  if (err)
-    {
-      __mach_port_deallocate (__mach_task_self (), new);
-      return __hurd_dfail (fd, err);
-    }
-
-  if (addr != NULL)
-    {
-      if (*addr_len > buflen)
-	*addr_len = buflen;
-      
-      if (buf != (char *) addr)
-	{
-	  memcpy (addr, buf, *addr_len);
-	  __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
-	}
-
-      if (buflen > 0)
-	addr->sa_family = type;
-    }
-
-  return _hurd_intern_fd (new, O_IGNORE_CTTY, 1);
+  return __libc_accept4 (fd, addrarg, addr_len, 0);
 }
 libc_hidden_def (accept)
diff --git a/sysdeps/mach/hurd/accept4.c b/sysdeps/mach/hurd/accept4.c
new file mode 100644
index 0000000000..a86e1771d6
--- /dev/null
+++ b/sysdeps/mach/hurd/accept4.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1992-2012 Free Software 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 <fcntl-internal.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+#include <hurd/socket.h>
+
+/* Await a connection on socket FD.
+   When a connection arrives, open a new socket to communicate with it,
+   set *ADDRARG (which is *ADDR_LEN bytes long) to the address of the connecting
+   peer and *ADDR_LEN to the address's actual length, and return the
+   new socket's descriptor, or -1 for errors.  The operation can be influenced
+   by the FLAGS parameter.  */
+int
+__libc_accept4 (int fd, __SOCKADDR_ARG addrarg, socklen_t *addr_len, int flags)
+{
+  error_t err;
+  socket_t new;
+  addr_port_t aport;
+  struct sockaddr *addr = addrarg.__sockaddr__;
+  char *buf = (char *) addr;
+  mach_msg_type_number_t buflen;
+  int type;
+
+  flags = sock_to_o_flags (flags);
+
+  if (flags & ~(O_CLOEXEC | O_NONBLOCK))
+    return __hurd_fail (EINVAL);
+
+  if (err = HURD_DPORT_USE (fd, __socket_accept (port, &new, &aport)))
+    return __hurd_dfail (fd, err);
+
+  if (addr != NULL)
+    {
+      buflen = *addr_len;
+      err = __socket_whatis_address (aport, &type, &buf, &buflen);
+      if (err == EOPNOTSUPP)
+	/* If the protocol server can't tell us the address, just return a
+	   zero-length one.  */
+	{
+	  buf = (char *)addr;
+	  buflen = 0;
+	  err = 0;
+	}
+    }
+  __mach_port_deallocate (__mach_task_self (), aport);
+
+  if (! err)
+    {
+      if (flags & O_NONBLOCK)
+	err = __io_set_some_openmodes (new, O_NONBLOCK);
+      /* TODO: do we need special ERR massaging after the previous call?  */
+    }
+
+  if (err)
+    {
+      __mach_port_deallocate (__mach_task_self (), new);
+      return __hurd_dfail (fd, err);
+    }
+
+  if (addr != NULL)
+    {
+      if (*addr_len > buflen)
+	*addr_len = buflen;
+
+      if (buf != (char *) addr)
+	{
+	  memcpy (addr, buf, *addr_len);
+	  __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
+	}
+
+      if (buflen > 0)
+	addr->sa_family = type;
+    }
+
+  return _hurd_intern_fd (new, O_IGNORE_CTTY | flags, 1);
+}
+libc_hidden_def (__libc_accept4)
+weak_alias (__libc_accept4, accept4)
diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h
index 4224bf18ff..1d24c7399d 100644
--- a/sysdeps/mach/hurd/bits/fcntl.h
+++ b/sysdeps/mach/hurd/bits/fcntl.h
@@ -1,6 +1,5 @@
 /* O_*, F_*, FD_* bit values for GNU.
-   Copyright (C) 1993,1994,1996,1997,1998,1999,2000,2001,2004,2007
-	Free Software Foundation, Inc.
+   Copyright (C) 1993-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -54,7 +53,9 @@
 #ifdef __USE_GNU
 # define O_NOLINK	0x0040	/* No name mappings on final component.  */
 # define O_NOTRANS	0x0080	/* No translator on final component. */
+#endif
 
+#ifdef __USE_XOPEN2K8
 # define O_NOFOLLOW	0x00100000 /* Produce ENOENT if file is a symlink.  */
 # define O_DIRECTORY	0x00200000 /* Produce ENOTDIR if not a directory.  */
 #endif
@@ -118,7 +119,7 @@
    once the file has been opened.  */
 
 #define	O_TRUNC		0x00010000 /* Truncate file to zero length.  */
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
 # define O_CLOEXEC	0x00400000 /* Set FD_CLOEXEC.  */
 #endif
 
@@ -158,7 +159,7 @@
 #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
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
 # define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
 # define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
 #endif
@@ -166,7 +167,7 @@
 #define	F_SETLK		8	/* Set record locking info (non-blocking).  */
 #define	F_SETLKW	9	/* Set record locking info (blocking).  */
 
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
 # define F_DUPFD_CLOEXEC 1030	/* Duplicate, set FD_CLOEXEC on new one.  */
 #endif
 
diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index 65f2ec1dd0..c4cfce65a3 100644
--- a/sysdeps/mach/hurd/bits/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,93,96,97,98,99,2001,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -157,6 +157,7 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
    _IOT_foobar is defined either in this file,
    or where struct foobar is defined.  */
 #define	_IO(g, n)	_IOC (IOC_VOID, (g), (n), 0)
+#define	_IOIW(g, n, t)	_IOC (IOC_VOID, (g), (n), _IOC_ENCODE_TYPE (t))
 #define	_IOR(g, n, t)	_IOC (IOC_OUT, (g), (n), _IOC_ENCODE_TYPE (t))
 #define	_IOW(g, n, t)	_IOC (IOC_IN, (g), (n), _IOC_ENCODE_TYPE (t))
 #define	_IOWR(g, n, t)	_IOC (IOC_INOUT, (g), (n), _IOC_ENCODE_TYPE (t))
diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h
index af531da54f..d18a10c457 100644
--- a/sysdeps/mach/hurd/bits/libc-lock.h
+++ b/sysdeps/mach/hurd/bits/libc-lock.h
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Hurd version using Mach cthreads.
-   Copyright (C) 1996,97,98,2000,01, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -187,6 +187,9 @@ struct __libc_once
     __libc_lock_unlock (ONCE_CONTROL.lock);				      \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)	((ONCE_CONTROL).done != 0)
+
 #ifdef _LIBC
 /* We need portable names for some functions.  E.g., when they are
    used as argument to __libc_cleanup_region_start.  */
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 23d32ce761..3c0830710a 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -1,5 +1,5 @@
 /* Define POSIX options for GNU/Hurd.
-   Copyright (C) 1998,2000,2001,2002,2006,2009 Free Software Foundation, Inc.
+   Copyright (C) 1998-2012 Free Software 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,9 @@
 /* Processes have a saved set-user-ID and a saved set-group-ID.  */
 #define	_POSIX_SAVED_IDS	1
 
+/* Priority scheduling is not supported.  */
+#undef	_POSIX_PRIORITY_SCHEDULING
+
 /* Synchronizing file data is supported, but msync is missing.  */
 #undef _POSIX_SYNCHRONIZED_IO
 
@@ -59,6 +62,14 @@
 #undef _POSIX_NO_TRUNC		/* Overlong file names get error?  */
 #undef _POSIX_SYNC_IO		/* File supports O_SYNC et al?  */
 
+/* X/Open realtime support is not supported.  */
+#undef _XOPEN_REALTIME
+
+/* X/Open thread realtime support is not supported.  */
+#undef _XOPEN_REALTIME_THREADS
+
+/* XPG4.2 shared memory is not supported.  */
+#undef	_XOPEN_SHM
 
 /* We do not have the POSIX threads interface.  */
 #define _POSIX_THREADS	-1
@@ -71,6 +82,12 @@
 #define _POSIX_THREAD_PRIORITY_SCHEDULING	-1
 #define _POSIX_THREAD_ATTR_STACKSIZE		-1
 #define _POSIX_THREAD_ATTR_STACKADDR		-1
+#define _POSIX_THREAD_PRIO_INHERIT		-1
+#define _POSIX_THREAD_PRIO_PROTECT		-1
+#ifdef __USE_XOPEN2K8
+# define _POSIX_THREAD_ROBUST_PRIO_INHERIT	-1
+# define _POSIX_THREAD_ROBUST_PRIO_PROTECT	-1
+#endif
 #define _POSIX_SEMAPHORES			-1
 
 /* Real-time signals are not yet supported.  */
@@ -78,8 +95,11 @@
 
 /* Asynchronous I/O might supported with the existing ABI.  */
 #define _POSIX_ASYNCHRONOUS_IO	0
+#undef _POSIX_ASYNC_IO
 /* Alternative name for Unix98.  */
 #define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+/* Support for prioritization is not available.  */
+#undef _POSIX_PRIORITIZED_IO
 
 /* The LFS support in asynchronous I/O is also available.  */
 #define _LFS64_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
@@ -110,6 +130,9 @@
 /* We cannot support the Timeouts option without _POSIX_THREADS.  */
 #define _POSIX_TIMEOUTS	-1
 
+/* We do not support spinlocks.  */
+#define _POSIX_SPIN_LOCKS	-1
+
 /* The `spawn' function family is supported.  */
 #define _POSIX_SPAWN	200809L
 
@@ -156,9 +179,4 @@
 /* Typed memory objects are not available.  */
 #define _POSIX_TYPED_MEMORY_OBJECTS	-1
 
-/* No support for priority inheritance or protection so far.  */
-#define _POSIX_THREAD_PRIO_INHERIT	-1
-#define _POSIX_THREAD_PRIO_PROTECT	-1
-
-
 #endif /* bits/posix_opt.h */
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
new file mode 100644
index 0000000000..6d53599b30
--- /dev/null
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -0,0 +1,362 @@
+/* System-specific socket constants and types.  Hurd version.
+   Copyright (C) 1991-2012 Free Software 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; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H	1
+
+#ifndef _SYS_SOCKET_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>		/* XXX Is this allowed?  */
+#include <bits/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_STREAM = 1,		/* Sequenced, reliable, connection-based
+				   byte streams.  */
+#define SOCK_STREAM SOCK_STREAM
+  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
+				   of fixed maximum length.  */
+#define SOCK_DGRAM SOCK_DGRAM
+  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
+
+#define SOCK_MAX (SOCK_SEQPACKET + 1)
+  /* Mask which covers at least up to SOCK_MASK-1.  The
+     remaining bits are used as flags. */
+#define SOCK_TYPE_MASK 0xf
+
+  /* Flags to be ORed into the type parameter of socket and socketpair and
+     used for the flags parameter of accept4.  */
+
+  SOCK_CLOEXEC = 0x00400000,	/* Atomically set close-on-exec flag for the
+				   new descriptor(s).  */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+
+  /* Changed from the O_NONBLOCK value (0x8, which is unusable for us as it is
+     conflicting with the original SOCK_* flags' values) to the Linux value
+     (04000).  TODO: is there a ``better'' value?  */
+  SOCK_NONBLOCK = 0x0800	/* Atomically mark descriptor(s) as
+				   non-blocking.  */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
+};
+
+/* 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 /* POSIX name for PF_LOCAL.  */
+#define	PF_INET		2	/* IP protocol family.  */
+#define	PF_IMPLINK	3	/* ARPAnet IMP protocol.  */
+#define	PF_PUP		4	/* PUP protocols.  */
+#define	PF_CHAOS	5	/* MIT Chaos protocols.  */
+#define	PF_NS		6	/* Xerox NS protocols.  */
+#define	PF_ISO		7	/* ISO protocols.  */
+#define	PF_OSI		PF_ISO
+#define	PF_ECMA		8	/* ECMA protocols.  */
+#define	PF_DATAKIT	9	/* AT&T Datakit protocols.  */
+#define	PF_CCITT	10	/* CCITT protocols (X.25 et al).  */
+#define	PF_SNA		11	/* IBM SNA protocol.  */
+#define	PF_DECnet	12	/* DECnet protocols.  */
+#define	PF_DLI		13	/* Direct data link interface.  */
+#define	PF_LAT		14	/* DEC Local Area Transport protocol.  */
+#define	PF_HYLINK	15	/* NSC Hyperchannel protocol.  */
+#define	PF_APPLETALK	16	/* Don't use this.  */
+#define	PF_ROUTE	17	/* Internal Routing Protocol.  */
+#define	PF_LINK		18	/* Link layer interface.  */
+#define	PF_XTP		19	/* eXpress Transfer Protocol (no AF).  */
+#define	PF_COIP		20	/* Connection-oriented IP, aka ST II.  */
+#define	PF_CNT		21	/* Computer Network Technology.  */
+#define PF_RTIP		22	/* Help Identify RTIP packets.  **/
+#define	PF_IPX		23	/* Novell Internet Protocol.  */
+#define	PF_SIP		24	/* Simple Internet Protocol.  */
+#define PF_PIP		25	/* Help Identify PIP packets.  */
+#define PF_INET6	26	/* IP version 6.  */
+#define	PF_MAX		27
+
+/* 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_IMPLINK	PF_IMPLINK
+#define	AF_PUP		PF_PUP
+#define	AF_CHAOS	PF_CHAOS
+#define	AF_NS		PF_NS
+#define	AF_ISO		PF_ISO
+#define	AF_OSI		PF_OSI
+#define	AF_ECMA		PF_ECMA
+#define	AF_DATAKIT	PF_DATAKIT
+#define	AF_CCITT	PF_CCITT
+#define	AF_SNA		PF_SNA
+#define	AF_DECnet	PF_DECnet
+#define	AF_DLI		PF_DLI
+#define	AF_LAT		PF_LAT
+#define	AF_HYLINK	PF_HYLINK
+#define	AF_APPLETALK	PF_APPLETALK
+#define	AF_ROUTE	PF_ROUTE
+#define	AF_LINK		PF_LINK
+#define	pseudo_AF_XTP	PF_XTP
+#define	AF_COIP		PF_COIP
+#define	AF_CNT		PF_CNT
+#define pseudo_AF_RTIP	PF_RTIP
+#define	AF_IPX		PF_IPX
+#define	AF_SIP		PF_SIP
+#define pseudo_AF_PIP	PF_PIP
+#define AF_INET6	PF_INET6
+#define	AF_MAX		PF_MAX
+
+/* Maximum queue length specifiable by listen.  */
+#define SOMAXCONN	128	/* 5 on the origional 4.4 BSD.  */
+
+/* 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
+    MSG_EOR		= 0x08,	/* Data completes record.  */
+#define MSG_EOR MSG_EOR
+    MSG_TRUNC		= 0x10,	/* Data discarded before delivery.  */
+#define MSG_TRUNC MSG_TRUNC
+    MSG_CTRUNC		= 0x20,	/* Control data lost before delivery.  */
+#define MSG_CTRUNC MSG_CTRUNC
+    MSG_WAITALL		= 0x40,	/* Wait for full request or error.  */
+#define MSG_WAITALL MSG_WAITALL
+    MSG_DONTWAIT	= 0x80,	/* This message should be nonblocking.  */
+#define MSG_DONTWAIT MSG_DONTWAIT
+    MSG_NOSIGNAL	= 0x0400	/* Do not generate SIGPIPE on EPIPE.  */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+  };
+
+
+/* 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 in received message.  */
+  };
+
+/* Structure used for storage of ancillary data object information.  */
+struct cmsghdr
+  {
+    socklen_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 NULL;
+
+  __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 NULL;
+  return __cmsg;
+}
+#endif	/* Use `extern inline'.  */
+
+/* Socket level message types.  */
+enum
+  {
+    SCM_RIGHTS = 0x01,		/* Access rights (array of int).  */
+#define SCM_RIGHTS SCM_RIGHTS
+    SCM_TIMESTAMP = 0x02,	/* Timestamp (struct timeval).  */
+#define SCM_TIMESTAMP SCM_TIMESTAMP
+    SCM_CREDS = 0x03		/* Process creds (struct cmsgcred).  */
+#define SCM_CREDS SCM_CREDS
+  };
+
+/* Unfortunately, BSD practice dictates this structure be of fixed size.
+   If there are more than CMGROUP_MAX groups, the list is truncated.
+   (On GNU systems, the `cmcred_euid' field is just the first in the
+   list of effective UIDs.)  */
+#define CMGROUP_MAX	16
+
+/* Structure delivered by SCM_CREDS.  This describes the identity of the
+   sender of the data simultaneously received on the socket.  By BSD
+   convention, this is included only when a sender on a AF_LOCAL socket
+   sends cmsg data of this type and size; the sender's structure is
+   ignored, and the system fills in the various IDs of the sender process.  */
+struct cmsgcred
+  {
+    __pid_t cmcred_pid;
+    __uid_t cmcred_uid;
+    __uid_t cmcred_euid;
+    __gid_t cmcred_gid;
+    int cmcred_ngroups;
+    __gid_t cmcred_groups[CMGROUP_MAX];
+  };
+
+/* Protocol number used to manipulate socket-level options
+   with `getsockopt' and `setsockopt'.  */
+#define	SOL_SOCKET	0xffff
+
+/* Socket-level options for `getsockopt' and `setsockopt'.  */
+enum
+  {
+    SO_DEBUG = 0x0001,		/* Record debugging information.  */
+#define SO_DEBUG SO_DEBUG
+    SO_ACCEPTCONN = 0x0002,	/* Accept connections on socket.  */
+#define SO_ACCEPTCONN SO_ACCEPTCONN
+    SO_REUSEADDR = 0x0004,	/* Allow reuse of local addresses.  */
+#define SO_REUSEADDR SO_REUSEADDR
+    SO_KEEPALIVE = 0x0008,	/* Keep connections alive and send
+				   SIGPIPE when they die.  */
+#define SO_KEEPALIVE SO_KEEPALIVE
+    SO_DONTROUTE = 0x0010,	/* Don't do local routing.  */
+#define SO_DONTROUTE SO_DONTROUTE
+    SO_BROADCAST = 0x0020,	/* Allow transmission of
+				   broadcast messages.  */
+#define SO_BROADCAST SO_BROADCAST
+    SO_USELOOPBACK = 0x0040,	/* Use the software loopback to avoid
+				   hardware use when possible.  */
+#define SO_USELOOPBACK SO_USELOOPBACK
+    SO_LINGER = 0x0080,		/* Block on close of a reliable
+				   socket to transmit pending data.  */
+#define SO_LINGER SO_LINGER
+    SO_OOBINLINE = 0x0100,	/* Receive out-of-band data in-band.  */
+#define SO_OOBINLINE SO_OOBINLINE
+    SO_REUSEPORT = 0x0200,	/* Allow local address and port reuse.  */
+#define SO_REUSEPORT SO_REUSEPORT
+    SO_SNDBUF = 0x1001,		/* Send buffer size.  */
+#define SO_SNDBUF SO_SNDBUF
+    SO_RCVBUF = 0x1002,		/* Receive buffer.  */
+#define SO_RCVBUF SO_RCVBUF
+    SO_SNDLOWAT = 0x1003,	/* Send low-water mark.  */
+#define SO_SNDLOWAT SO_SNDLOWAT
+    SO_RCVLOWAT = 0x1004,	/* Receive low-water mark.  */
+#define SO_RCVLOWAT SO_RCVLOWAT
+    SO_SNDTIMEO = 0x1005,	/* Send timeout.  */
+#define SO_SNDTIMEO SO_SNDTIMEO
+    SO_RCVTIMEO = 0x1006,	/* Receive timeout.  */
+#define SO_RCVTIMEO SO_RCVTIMEO
+    SO_ERROR = 0x1007,		/* Get and clear error status.  */
+#define SO_ERROR SO_ERROR
+    SO_STYLE = 0x1008,		/* Get socket connection style.  */
+#define SO_STYLE SO_STYLE
+    SO_TYPE = SO_STYLE		/* Compatible name for SO_STYLE.  */
+#define SO_TYPE SO_TYPE
+  };
+
+/* 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/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
index 15fcda117b..e6ffda8921 100644
--- a/sysdeps/mach/hurd/bits/stat.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992-1994,1996,1997,1999,2000,2005,2010
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 Free Software 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,12 +57,27 @@ struct stat
     __off64_t st_size;		/* Size in bytes.  */
 #endif
 
-    __time_t st_atime;		/* Access time, seconds */
-    unsigned long int st_atime_usec; /* and microseconds.  */
-    __time_t st_mtime;		/* Modification time, seconds */
-    unsigned long int st_mtime_usec; /* and microseconds.  */
-    __time_t st_ctime;		/* Status change time, seconds */
-    unsigned long int st_ctime_usec; /* and microseconds.  */
+#if defined __USE_MISC || defined __USE_XOPEN2K8
+    /* 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
 
     __blksize_t st_blksize;	/* Optimal size for I/O.  */
 
@@ -107,12 +121,24 @@ struct stat64
 
     __off64_t st_size;		/* Size in bytes.  */
 
-    __time_t st_atime;		/* Access time, seconds */
-    unsigned long int st_atime_usec; /* and microseconds.  */
-    __time_t st_mtime;		/* Modification time, seconds */
-    unsigned long int st_mtime_usec; /* and microseconds.  */
-    __time_t st_ctime;		/* Status change time, seconds */
-    unsigned long int st_ctime_usec; /* and microseconds.  */
+#if defined __USE_MISC || defined __USE_XOPEN2K8
+    /* 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
 
     __blksize_t st_blksize;	/* Optimal size for I/O.  */
 
@@ -130,7 +156,10 @@ struct stat64
   };
 #endif
 
-#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
 
 /* Encoding of the file mode.  */
 
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index 275d7bea3a..1900277d1b 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -63,7 +63,7 @@ weak_alias (__brk, brk)
 int
 _hurd_set_brk (vm_address_t addr)
 {
-  error_t err;
+  error_t err = 0;
   vm_address_t pagend = round_page (addr);
   vm_address_t pagebrk = round_page (_hurd_brk);
   long int rlimit;
@@ -100,8 +100,22 @@ _hurd_set_brk (vm_address_t addr)
 
   if (pagend > _hurd_data_end)
     {
+      vm_address_t alloc_start = _hurd_data_end;
+
       /* We didn't allocate enough space!  Hopefully we can get some more!  */
-      err = __vm_allocate (__mach_task_self (), &pagebrk, pagend - pagebrk, 0);
+
+      if (_hurd_data_end > pagebrk)
+	/* First finish allocation.  */
+	err = __vm_protect (__mach_task_self (), pagebrk,
+			    alloc_start - pagebrk, 0,
+			    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+      if (! err)
+	_hurd_brk = alloc_start;
+
+      if (! err)
+	err = __vm_allocate (__mach_task_self (), &alloc_start,
+			     pagend - alloc_start, 0);
+
       if (! err)
 	_hurd_data_end = pagend;
     }
diff --git a/sysdeps/mach/hurd/chroot.c b/sysdeps/mach/hurd/chroot.c
index 1a6b1e44da..95bee33176 100644
--- a/sysdeps/mach/hurd/chroot.c
+++ b/sysdeps/mach/hurd/chroot.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,97,99,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,9 @@ chroot (const char *path)
   len = strlen (path);
   if (len >= 2 && path[len - 2] == '/' && path[len - 1] == '.')
     lookup = path;
+  else if (len == 0)
+    /* Special-case empty file name according to POSIX.  */
+    return __hurd_fail (ENOENT);
   else
     {
       char *n = alloca (len + 3);
diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure
index ebf8bb03a5..3c90a665aa 100644
--- a/sysdeps/mach/hurd/configure
+++ b/sysdeps/mach/hurd/configure
@@ -1,22 +1,135 @@
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
 
 # GNU libc on the Hurd is always reentrant.
 DEFINES="$DEFINES -D_LIBC_REENTRANT"
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_HIDDEN 1
-_ACEOF
+$as_echo "#define NO_HIDDEN 1" >>confdefs.h
 
 
 # Don't bother trying to generate any glue code to be compatible with the
 # existing system library, because we are the only system library.
 inhibit_glue=yes
 
-if test "x$prefix" != x; then
-  { $as_echo "$as_me:$LINENO: WARNING: --prefix= (empty) is required for GNU/Hurd to work normally" >&5
-$as_echo "$as_me: WARNING: --prefix= (empty) is required for GNU/Hurd to work normally" >&2;}
-fi
-
 case "$machine" in
   i386*)
     # The default oldest ABI is 2.2.6.
@@ -28,16 +141,12 @@ case "$machine" in
 esac
 
 
-{ $as_echo "$as_me:$LINENO: checking Hurd header version" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Hurd header version" >&5
 $as_echo_n "checking Hurd header version... " >&6; }
-if test "${libc_cv_hurd_version+set}" = set; then
+if ${libc_cv_hurd_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <hurd/version.h>
 int
@@ -52,38 +161,15 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   libc_cv_hurd_version=ok
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	libc_cv_hurd_version=bad
+  libc_cv_hurd_version=bad
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $libc_cv_hurd_version" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hurd_version" >&5
 $as_echo "$libc_cv_hurd_version" >&6; }
 if test "x$libc_cv_hurd_version" != xok; then
-  { { $as_echo "$as_me:$LINENO: error: Hurd headers not installed or too old" >&5
-$as_echo "$as_me: error: Hurd headers not installed or too old" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "Hurd headers not installed or too old" "$LINENO" 5
 fi
diff --git a/sysdeps/mach/hurd/configure.in b/sysdeps/mach/hurd/configure.in
index 87c07c11dc..6220142265 100644
--- a/sysdeps/mach/hurd/configure.in
+++ b/sysdeps/mach/hurd/configure.in
@@ -10,10 +10,6 @@ AC_DEFINE([NO_HIDDEN])
 # existing system library, because we are the only system library.
 inhibit_glue=yes
 
-if test "x$prefix" != x; then
-  AC_MSG_WARN([--prefix= (empty) is required for GNU/Hurd to work normally])
-fi
-
 case "$machine" in
   i386*)
     # The default oldest ABI is 2.2.6.
diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c
index 587ae7b2f1..42dbc78839 100644
--- a/sysdeps/mach/hurd/dirfd.c
+++ b/sysdeps/mach/hurd/dirfd.c
@@ -1,5 +1,5 @@
 /* dirfd -- Return the file descriptor used by a DIR stream.  Hurd version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software 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,6 +25,8 @@ int
 dirfd (DIR *dirp)
 {
   int fd;
+
+  HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_dtable_lock);
   for (fd = 0; fd < _hurd_dtablesize; ++fd)
     if (_hurd_dtable[fd] == dirp->__fd)
@@ -35,6 +37,7 @@ dirfd (DIR *dirp)
       fd = -1;
     }
   __mutex_unlock (&_hurd_dtable_lock);
+  HURD_CRITICAL_END;
 
   return fd;
 }
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index d928cd2478..13b0010436 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -1,6 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Hurd version.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2010
-	Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software 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 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* In the static library, this is all handled by dl-support.c
+   or by the vanilla definitions in the rest of the C library.  */
+#ifdef SHARED
+
 #include <hurd.h>
 #include <link.h>
 #include <unistd.h>
@@ -315,7 +318,7 @@ open_file (const char *file_name, int flags,
       return MACH_PORT_NULL;
     }
 
-  assert (!(flags & ~O_READ));
+  assert (!(flags & ~(O_READ | O_CLOEXEC)));
 
   startdir = _dl_hurd_data->portarray[file_name[0] == '/' ?
 				      INIT_PORT_CRDIR : INIT_PORT_CWDIR];
@@ -668,3 +671,5 @@ _dl_init_first (int argc, ...)
 {
   /* This no-op definition only gets used if libc is not linked in.  */
 }
+
+#endif /* SHARED */
diff --git a/sysdeps/mach/hurd/dl-sysdep.h b/sysdeps/mach/hurd/dl-sysdep.h
index 671b241839..c64a39d924 100644
--- a/sysdeps/mach/hurd/dl-sysdep.h
+++ b/sysdeps/mach/hurd/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  Hurd version.
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 Free Software 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,8 @@
 #define RTLD_PRIVATE_ERRNO 0
 
 #ifdef SHARED
-/* _dl_argv cannot be attribute_relro, because the stack-switching
+/* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching
    libc initializer for using cthreads might write into it.  */
 # define DL_ARGV_NOT_RELRO 1
+# define LIBC_STACK_END_NOT_RELRO 1
 #endif
diff --git a/sysdeps/mach/hurd/dup2.c b/sysdeps/mach/hurd/dup2.c
index d2329c936f..b697a90ecb 100644
--- a/sysdeps/mach/hurd/dup2.c
+++ b/sysdeps/mach/hurd/dup2.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
+
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,119 +16,20 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <fcntl.h>
 #include <unistd.h>
-#include <hurd.h>
-#include <hurd/fd.h>
 
 /* Duplicate FD to FD2, closing the old FD2 and making FD2 be
    open on the same file as FD is.  Return FD2 or -1.  */
 int
-__dup2 (fd, fd2)
-     int fd;
-     int fd2;
+__dup2 (int fd, int fd2)
 {
-  struct hurd_fd *d;
-
-  /* Extract the ports and flags from FD.  */
-  d = _hurd_fd_get (fd);
-  if (d == NULL)
-    {
-      errno = EBADF;
-      return -1;
-    }
-
-  HURD_CRITICAL_BEGIN;
-
-  __spin_lock (&d->port.lock);
-  if (d->port.port == MACH_PORT_NULL)
-    {
-      __spin_unlock (&d->port.lock);
-      errno = EBADF;
-      fd2 = -1;
-    }
-  else if (fd2 == fd)
-    /* FD is valid and FD2 is already the same; just return it.  */
-    __spin_unlock (&d->port.lock);
-  else
-    {
-      struct hurd_userlink ulink, ctty_ulink;
-      int flags = d->flags;
-      io_t ctty = _hurd_port_get (&d->ctty, &ctty_ulink);
-      io_t port = _hurd_port_locked_get (&d->port, &ulink); /* Unlocks D.  */
-
-      if (fd2 < 0)
-	{
-	  errno = EBADF;
-	  fd2 = -1;
-	}
-      else
-	{
-	  /* Get a hold of the destination descriptor.  */
-	  struct hurd_fd *d2;
-
-	  if (fd2 >= _hurd_dtablesize)
-	    {
-	      /* The table is not large enough to hold the destination
-		 descriptor.  Enlarge it as necessary to allocate this
-		 descriptor.  */
-	      __mutex_unlock (&_hurd_dtable_lock);
-	      /* We still hold FD1's lock, but this is safe because
-		 _hurd_alloc_fd will only examine the cells starting
-		 at FD2.  */
-	      d2 = _hurd_alloc_fd (NULL, fd2);
-	      if (d2)
-		__spin_unlock (&d2->port.lock);
-	      __mutex_lock (&_hurd_dtable_lock);
-	    }
-	  else
-	    {
-	      d2 = _hurd_dtable[fd2];
-	      if (d2 == NULL)
-		{
-		  /* Must allocate a new one.  We don't initialize the port
-		     cells with this call so that if it fails (out of
-		     memory), we will not have already added user
-		     references for the ports, which we would then have to
-		     deallocate.  */
-		  d2 = _hurd_dtable[fd2] = _hurd_new_fd (MACH_PORT_NULL,
-							 MACH_PORT_NULL);
-		}
-	    }
-
-	  if (d2 == NULL)
-	    {
-	      fd2 = -1;
-	      if (errno == EINVAL)
-		errno = EBADF;	/* POSIX.1-1990 6.2.1.2 ll 54-55.  */
-	    }
-	  else
-	    {
-	      /* Give the ports each a user ref for the new descriptor.  */
-	      __mach_port_mod_refs (__mach_task_self (), port,
-				    MACH_PORT_RIGHT_SEND, 1);
-	      if (ctty != MACH_PORT_NULL)
-		__mach_port_mod_refs (__mach_task_self (), ctty,
-				      MACH_PORT_RIGHT_SEND, 1);
-
-	      /* Install the ports and flags in the new descriptor slot.  */
-	      __spin_lock (&d2->port.lock);
-	      d2->flags = flags & ~FD_CLOEXEC; /* Dup clears FD_CLOEXEC. */
-	      _hurd_port_set (&d2->ctty, ctty);
-	      _hurd_port_locked_set (&d2->port, port); /* Unlocks D2.  */
-	    }
-	}
-      __mutex_unlock (&_hurd_dtable_lock);
-
-      _hurd_port_free (&d->port, &ulink, port);
-      if (ctty != MACH_PORT_NULL)
-	_hurd_port_free (&d->ctty, &ctty_ulink, port);
-    }
+  int flags = 0;
 
-  HURD_CRITICAL_END;
+  if (fd2 == fd)
+    /* See the comment in dup3.  */
+    flags = -1;
 
-  return fd2;
+  return __dup3 (fd, fd2, flags);
 }
 libc_hidden_def (__dup2)
 weak_alias (__dup2, dup2)
diff --git a/sysdeps/mach/hurd/dup3.c b/sysdeps/mach/hurd/dup3.c
new file mode 100644
index 0000000000..523ca42285
--- /dev/null
+++ b/sysdeps/mach/hurd/dup3.c
@@ -0,0 +1,140 @@
+/* Duplicate a file descriptor to a given number, with flags.  Hurd version.
+   Copyright (C) 1991-2012 Free Software 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 <unistd.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
+   open on the same file as FD is, and setting FD2's flags according to FLAGS.
+   Return FD2 or -1.  */
+int
+__dup3 (int fd, int fd2, int flags)
+{
+  struct hurd_fd *d;
+
+  /* Both passing flags different from O_CLOEXEC and FD2 being the same as FD
+     are invalid.  */
+  if ((flags & ~O_CLOEXEC
+       || fd2 == fd)
+      /* ... with the exception in case that dup2 behavior is requested: if FD
+	 is valid and FD2 is already the same then just return it.  */
+      && ! (flags == -1
+	    && fd2 == fd))
+    return __hurd_fail (EINVAL);
+
+  /* Extract the ports and flags from FD.  */
+  d = _hurd_fd_get (fd);
+  if (d == NULL)
+    return __hurd_fail (EBADF);
+
+  HURD_CRITICAL_BEGIN;
+
+  __spin_lock (&d->port.lock);
+  if (d->port.port == MACH_PORT_NULL)
+    {
+      __spin_unlock (&d->port.lock);
+      fd2 = __hurd_fail (EBADF);
+    }
+  else if (fd2 == fd)
+    __spin_unlock (&d->port.lock);
+  else
+    {
+      struct hurd_userlink ulink, ctty_ulink;
+      int d_flags = d->flags;
+      io_t ctty = _hurd_port_get (&d->ctty, &ctty_ulink);
+      io_t port = _hurd_port_locked_get (&d->port, &ulink); /* Unlocks D.  */
+
+      if (fd2 < 0)
+	fd2 = __hurd_fail (EBADF);
+      else
+	{
+	  /* Get a hold of the destination descriptor.  */
+	  struct hurd_fd *d2;
+
+	  __mutex_lock (&_hurd_dtable_lock);
+
+	  if (fd2 >= _hurd_dtablesize)
+	    {
+	      /* The table is not large enough to hold the destination
+		 descriptor.  Enlarge it as necessary to allocate this
+		 descriptor.  */
+	      __mutex_unlock (&_hurd_dtable_lock);
+	      d2 = _hurd_alloc_fd (NULL, fd2);
+	      if (d2)
+		__spin_unlock (&d2->port.lock);
+	      __mutex_lock (&_hurd_dtable_lock);
+	    }
+	  else
+	    {
+	      d2 = _hurd_dtable[fd2];
+	      if (d2 == NULL)
+		{
+		  /* Must allocate a new one.  We don't initialize the port
+		     cells with this call so that if it fails (out of
+		     memory), we will not have already added user
+		     references for the ports, which we would then have to
+		     deallocate.  */
+		  d2 = _hurd_dtable[fd2] = _hurd_new_fd (MACH_PORT_NULL,
+							 MACH_PORT_NULL);
+		}
+	    }
+	  __mutex_unlock (&_hurd_dtable_lock);
+
+	  if (d2 == NULL)
+	    {
+	      fd2 = -1;
+	      if (errno == EINVAL)
+		errno = EBADF;	/* POSIX.1-1990 6.2.1.2 ll 54-55.  */
+	    }
+	  else
+	    {
+	      /* Give the ports each a user ref for the new descriptor.  */
+	      __mach_port_mod_refs (__mach_task_self (), port,
+				    MACH_PORT_RIGHT_SEND, 1);
+	      if (ctty != MACH_PORT_NULL)
+		__mach_port_mod_refs (__mach_task_self (), ctty,
+				      MACH_PORT_RIGHT_SEND, 1);
+
+	      /* Install the ports and flags in the new descriptor slot.  */
+	      __spin_lock (&d2->port.lock);
+	      if (flags & O_CLOEXEC)
+		d2->flags = d_flags | FD_CLOEXEC;
+	      else
+		/* dup clears FD_CLOEXEC.  */
+		d2->flags = d_flags & ~FD_CLOEXEC;
+	      _hurd_port_set (&d2->ctty, ctty);
+	      _hurd_port_locked_set (&d2->port, port); /* Unlocks D2.  */
+	    }
+	}
+
+      _hurd_port_free (&d->port, &ulink, port);
+      if (ctty != MACH_PORT_NULL)
+	_hurd_port_free (&d->ctty, &ctty_ulink, port);
+    }
+
+  HURD_CRITICAL_END;
+
+  return fd2;
+}
+libc_hidden_def (__dup3)
+weak_alias (__dup3, dup3)
diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile
index 0eef17e8f2..5f988097c2 100644
--- a/sysdeps/mach/hurd/i386/Makefile
+++ b/sysdeps/mach/hurd/i386/Makefile
@@ -2,3 +2,7 @@ ifeq ($(subdir),misc)
 sysdep_routines += ioperm
 sysdep_headers += sys/io.h
 endif
+
+ifeq ($(subdir),debug)
+gen-as-const-headers += signal-defines.sym
+endif
diff --git a/sysdeps/mach/hurd/i386/____longjmp_chk.S b/sysdeps/mach/hurd/i386/____longjmp_chk.S
new file mode 100644
index 0000000000..f499fbd1e7
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/____longjmp_chk.S
@@ -0,0 +1,107 @@
+/* Copyright (C) 2001-2012 Free Software 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include <jmpbuf-offsets.h>
+#include <asm-syntax.h>
+
+#include <signal-defines.h>
+/* #include <signal.h> */
+#define SS_ONSTACK 1
+
+
+	.section .rodata.str1.1,"aMS",@progbits,1
+	.type	longjmp_msg,@object
+longjmp_msg:
+	.string "longjmp causes uninitialized stack frame"
+	.size	longjmp_msg, .-longjmp_msg
+
+
+#ifdef PIC
+# define CALL_FAIL	movl	%ebx, %ecx; /* TODO: what's this mov good for? */ \
+			cfi_register(%ebx,%ecx);			      \
+			LOAD_PIC_REG (bx);				      \
+			leal	longjmp_msg@GOTOFF(%ebx), %eax;		      \
+			call	HIDDEN_JUMPTARGET(__fortify_fail)
+#else
+# define CALL_FAIL	movl	$longjmp_msg, %eax;			      \
+			call	HIDDEN_JUMPTARGET(__fortify_fail)
+#endif
+
+
+	.text
+ENTRY (____longjmp_chk)
+	movl	4(%esp), %ecx	/* User's jmp_buf in %ecx.  */
+
+	/* Save the return address now.  */
+	movl	(JB_PC*4)(%ecx), %edx
+	/* Get the stack pointer.  */
+	movl	(JB_SP*4)(%ecx), %edi
+	cfi_undefined(%edi)
+	PTR_DEMANGLE (%edx)
+	PTR_DEMANGLE (%edi)
+
+	cmpl	%edi, %esp
+	/* Jumping to a higher-address frame is always allowed.  */
+	jbe	.Lok
+
+	/* Passing here, we're either about to do something invalid, or we're
+	executing on an alternative signal stack.  */
+
+	/* TODO: need locking?  */
+	/* struct hurd_sigstate * _hurd_self_sigstate (void) */
+	call	_hurd_self_sigstate
+	/* TODO: %eax and %eax->sigaltstack are always valid?  */
+
+	testl	$SS_ONSTACK, (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)(%eax)
+	/* Fail if SS_ONSTACK is not set.  */
+	jz	.Lfail
+
+	movl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SP__OFFSET)(%eax), %ebx
+	addl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
+	subl	%edi, %ebx
+	cmpl	(HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)(%eax), %ebx
+	/* TODO: comment this calculation.  */
+	jae	.Lok
+
+.Lfail:	CALL_FAIL
+
+.Lok:	/* We add unwind information for the target here.  */
+	cfi_def_cfa(%ecx, 0)
+	cfi_register(%eip, %edx)
+	cfi_register(%esp, %edi)
+	cfi_offset(%ebx, JB_BX*4)
+	cfi_offset(%esi, JB_SI*4)
+	cfi_offset(%edi, JB_DI*4)
+	cfi_offset(%ebp, JB_BP*4)
+
+	movl	8(%esp), %eax	/* Second argument is return value.  */
+	movl	%edi, %esp
+
+	/* Restore registers.  */
+	movl	(JB_BX*4)(%ecx), %ebx
+	movl	(JB_SI*4)(%ecx), %esi
+	movl	(JB_DI*4)(%ecx), %edi
+	movl	(JB_BP*4)(%ecx), %ebp
+	cfi_restore(%ebx)
+	cfi_restore(%esi)
+	cfi_restore(%edi)
+	cfi_restore(%ebp)
+
+	/* Jump to saved PC.  */
+	jmp	*%edx
+END (____longjmp_chk)
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 4785e8dbec..fa4e3d9f6e 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -122,7 +122,7 @@ init1 (int argc, char *arg0, ...)
     {
 #ifndef SHARED
       /* We may need to see our own phdrs, e.g. for TLS setup.
-         Try the usual kludge to find the headers without help from
+	 Try the usual kludge to find the headers without help from
 	 the exec server.  */
       extern const void _start;
       const ElfW(Ehdr) *const ehdr = &_start;
@@ -214,6 +214,8 @@ init (int *data)
 
       void switch_stacks (void);
 
+      __libc_stack_end = newsp;
+
       /* Copy per-thread variables from that temporary
 	 area onto the new cthread stack.  */
       memcpy (__hurd_threadvar_location_from_sp (0, newsp),
@@ -225,7 +227,7 @@ init (int *data)
 
 #ifdef SHARED
       /* And readjust the dynamic linker's idea of where the argument
-         vector lives.  */
+	 vector lives.  */
       assert (_dl_argv == argv);
       _dl_argv = (void *) (newsp + 1);
 #endif
@@ -244,9 +246,16 @@ init (int *data)
       /* Push the user code address on the top of the new stack.  It will
 	 be the return address for `init1'; we will jump there with NEWSP
 	 as the stack pointer.  */
-      *--newsp = data[-1];
-      ((void **) data)[-1] = switch_stacks;
-      /* Force NEWSP into %ecx and &init1 into %eax, which are not restored
+      /* The following expression would typically be written as
+	 ``__builtin_return_address (0)''.  But, for example, GCC 4.4.6 doesn't
+	 recognize that this read operation may alias the following write
+	 operation, and thus is free to reorder the two, clobbering the
+	 original return address.  */
+      *--newsp = *((int *) __builtin_frame_address (0) + 1);
+      /* GCC 4.4.6 also wants us to force loading *NEWSP already here.  */
+      asm volatile ("# %0" : : "X" (*newsp));
+      *((void **) __builtin_frame_address (0) + 1) = &switch_stacks;
+      /* Force NEWSP into %eax and &init1 into %ecx, which are not restored
 	 by function return.  */
       asm volatile ("# a %0 c %1" : : "a" (newsp), "c" (&init1));
     }
@@ -273,8 +282,15 @@ init (int *data)
 
       /* The argument data is just above the stack frame we will unwind by
 	 returning.  Mutate our own return address to run the code below.  */
-      usercode = data[-1];
-      data[-1] = (int) &call_init1;
+      /* The following expression would typically be written as
+	 ``__builtin_return_address (0)''.  But, for example, GCC 4.4.6 doesn't
+	 recognize that this read operation may alias the following write
+	 operation, and thus is free to reorder the two, clobbering the
+	 original return address.  */
+      usercode = *((int *) __builtin_frame_address (0) + 1);
+      /* GCC 4.4.6 also wants us to force loading USERCODE already here.  */
+      asm volatile ("# %0" : : "X" (usercode));
+      *((void **) __builtin_frame_address (0) + 1) = &call_init1;
       /* Force USERCODE into %eax and &init1 into %ecx, which are not
 	 restored by function return.  */
       asm volatile ("# a %0 c %1" : : "a" (usercode), "c" (&init1));
@@ -322,11 +338,12 @@ first_init (void)
    stack set up just as the user will see it, so it can switch stacks.  */
 
 void
-_dl_init_first (void)
+_dl_init_first (int argc, ...)
 {
   first_init ();
 
-  init ((int *) __builtin_frame_address (0) + 2);
+  /* If we use ``__builtin_frame_address (0) + 2'' here, GCC gets confused.  */
+  init (&argc);
 }
 #endif
 
@@ -360,15 +377,17 @@ _hurd_stack_setup (void)
   void doinit (intptr_t *data)
     {
       /* This function gets called with the argument data at TOS.  */
-      void doinit1 (void)
+      void doinit1 (int argc, ...)
 	{
-	  init ((int *) __builtin_frame_address (0) + 2);
+	  /* If we use ``__builtin_frame_address (0) + 2'' here, GCC gets
+	     confused.  */
+	  init ((int *) &argc);
 	}
 
       /* Push the user return address after the argument data, and then
-         jump to `doinit1' (above), so it is as if __libc_init_first's
-         caller had called `doinit1' with the argument data already on the
-         stack.  */
+	 jump to `doinit1' (above), so it is as if __libc_init_first's
+	 caller had called `doinit1' with the argument data already on the
+	 stack.  */
       *--data = caller;
       asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack.  */
 		    "movl $0, %%ebp\n" /* Clear outermost frame pointer.  */
diff --git a/sysdeps/mach/hurd/i386/signal-defines.sym b/sysdeps/mach/hurd/i386/signal-defines.sym
new file mode 100644
index 0000000000..9521bd723c
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/signal-defines.sym
@@ -0,0 +1,10 @@
+#include <hurd/signal.h>
+#include <signal.h>
+
+--
+
+HURD_SIGSTATE__SIGALTSTACK__OFFSET	offsetof(struct hurd_sigstate, sigaltstack)
+
+SIGALTSTACK__SS_SP__OFFSET		offsetof(struct sigaltstack, ss_sp)
+SIGALTSTACK__SS_SIZE__OFFSET		offsetof(struct sigaltstack, ss_size)
+SIGALTSTACK__SS_FLAGS__OFFSET		offsetof(struct sigaltstack, ss_flags)
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index beffe4365e..543d437c1e 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992,93,94,95,96,97,99,2000,2002,2005
-	Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -88,7 +87,7 @@ __ioctl (int fd, unsigned long int request, ...)
   void *p;
 #endif
 
-  void *arg;
+  void *arg = NULL;
 
   error_t err;
 
@@ -111,7 +110,7 @@ __ioctl (int fd, unsigned long int request, ...)
       if (_IOC_INOUT (request) & IOC_IN)
 	{
 	  /* We don't want to advance ARG since it will be used to copy out
-             too if IOC_OUT is also set.  */
+	     too if IOC_OUT is also set.  */
 	  void *argptr = arg;
 
 	  /* Pack an argument into the message buffer.  */
@@ -139,7 +138,7 @@ __ioctl (int fd, unsigned long int request, ...)
 	  in (_IOT_COUNT1 (type), _IOT_TYPE1 (type));
 	  in (_IOT_COUNT2 (type), _IOT_TYPE2 (type));
 	}
-      else if (_IOC_INOUT (request) == IOC_VOID)
+      else if (_IOC_INOUT (request) == IOC_VOID && _IOT_COUNT0 (type) != 0)
 	{
 	  /* The RPC takes a single integer_t argument.
 	     Rather than pointing to the value, ARG is the value itself.  */
@@ -208,11 +207,15 @@ __ioctl (int fd, unsigned long int request, ...)
       return msg.header.RetCode;
     }
 
-  va_list ap;
+  if (_IOT_COUNT0 (type) != 0)
+    {
+      /* Data need either be sent, received, or even both.  */
+      va_list ap;
 
-  va_start (ap, request);
-  arg = va_arg (ap, void *);
-  va_end (ap);
+      va_start (ap, request);
+      arg = va_arg (ap, void *);
+      va_end (ap);
+    }
 
   {
     /* Check for a registered handler for REQUEST.  */
diff --git a/sysdeps/mach/hurd/kernel-features.h b/sysdeps/mach/hurd/kernel-features.h
index 07caf31f21..96a0d568f0 100644
--- a/sysdeps/mach/hurd/kernel-features.h
+++ b/sysdeps/mach/hurd/kernel-features.h
@@ -1,5 +1,5 @@
 /* Set flags signalling availability of certain operating system features.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2012 Free Software 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,11 +20,6 @@
    Almost none of these are used outside of sysdeps/unix/sysv/linux code.
    But those referring to POSIX-level features like O_* flags can be.  */
 
-#include <fcntl.h>
-
-/* If a system defines the O_CLOEXEC constant but it is sometimes ignored,
-   it must override this file to define __ASSUME_O_CLOEXEC conditionally
-   (or not at all) to indicate when O_CLOEXEC actually works.  */
-#ifdef O_CLOEXEC
-# define __ASSUME_O_CLOEXEC	1
-#endif
+#define __ASSUME_O_CLOEXEC	1
+#define __ASSUME_DUP3		1
+#define __ASSUME_ACCEPT4	1
diff --git a/sysdeps/mach/hurd/mkdir.c b/sysdeps/mach/hurd/mkdir.c
index d3627ee5e1..8ad648e0a3 100644
--- a/sysdeps/mach/hurd/mkdir.c
+++ b/sysdeps/mach/hurd/mkdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,93,94,95,96,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software 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,7 @@
 #include <stddef.h>
 #include <sys/stat.h>
 #include <hurd.h>
+#include <string.h>
 
 /* Create a directory named FILE_NAME with protections MODE.  */
 int
@@ -28,7 +29,10 @@ __mkdir (file_name, mode)
 {
   error_t err;
   const char *name;
-  file_t parent = __directory_name_split (file_name, (char **) &name);
+  file_t parent;
+  if (!strcmp (file_name, "/"))
+    return __hurd_fail (EEXIST);
+  parent = __directory_name_split (file_name, (char **) &name);
   if (parent == MACH_PORT_NULL)
     return -1;
   err = __dir_mkdir (parent, name, mode & ~_hurd_umask);
diff --git a/sysdeps/mach/hurd/mkdirat.c b/sysdeps/mach/hurd/mkdirat.c
index 9201f7d35e..d6d672ead9 100644
--- a/sysdeps/mach/hurd/mkdirat.c
+++ b/sysdeps/mach/hurd/mkdirat.c
@@ -1,6 +1,5 @@
 /* Create a directory named relative to another open directory.  Hurd version.
-   Copyright (C) 1991,1993,1994,1995,1996,1997,2002,2006
-	Free Software Foundation, Inc.
+   Copyright (C) 1991-2012 Free Software 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,6 +21,7 @@
 #include <sys/stat.h>
 #include <hurd.h>
 #include <hurd/fd.h>
+#include <string.h>
 
 int
 mkdirat (fd, path, mode)
@@ -31,7 +31,10 @@ mkdirat (fd, path, mode)
 {
   error_t err;
   const char *name;
-  file_t parent = __directory_name_split_at (fd, path, (char **) &name);
+  file_t parent;
+  if (!strcmp (path, "/"))
+    return __hurd_fail (EEXIST);
+  parent = __directory_name_split_at (fd, path, (char **) &name);
   if (parent == MACH_PORT_NULL)
     return -1;
   err = __dir_mkdir (parent, name, mode & ~_hurd_umask);
diff --git a/sysdeps/mach/hurd/mlock.c b/sysdeps/mach/hurd/mlock.c
index 2cb3e56321..47bafaae19 100644
--- a/sysdeps/mach/hurd/mlock.c
+++ b/sysdeps/mach/hurd/mlock.c
@@ -1,5 +1,5 @@
 /* mlock -- guarantee pages are resident in memory.  Mach/Hurd version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@ mlock (const void *addr, size_t len)
   page = trunc_page ((vm_address_t) addr);
   len = round_page ((vm_address_t) addr + len) - page;
   err = __vm_wire (hostpriv, __mach_task_self (), page, len,
-		   VM_PROT_ALL); /* XXX ? */
+		   VM_PROT_READ);
   __mach_port_deallocate (__mach_task_self (), hostpriv);
 
   return err ? __hurd_fail (err) : 0;
diff --git a/sysdeps/mach/hurd/openat.c b/sysdeps/mach/hurd/openat.c
index 69d257c181..c6fcf49d8b 100644
--- a/sysdeps/mach/hurd/openat.c
+++ b/sysdeps/mach/hurd/openat.c
@@ -1,5 +1,5 @@
 /* openat -- Open a file named relative to an open directory.  Hurd version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 Free Software 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,14 +34,14 @@ __openat (fd, file, oflag)
      const char *file;
      int oflag;
 {
-  int mode;
+  mode_t mode;
   io_t port;
 
   if (oflag & O_CREAT)
     {
       va_list arg;
       va_start (arg, oflag);
-      mode = va_arg (arg, int);
+      mode = va_arg (arg, mode_t);
       va_end (arg);
     }
   else
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index 217d4c85dd..175944418c 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993,1994,1995,1996,1997,1998,2001,2003,2005,2006
-	Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software 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 +28,7 @@
 #include <stdio.h>
 #include <hurd.h>
 #include <hurd/fd.h>
+#include <not-cancel.h>
 #include "dirstream.h"
 
 
@@ -50,9 +50,11 @@ _hurd_fd_opendir (struct hurd_fd *d)
     return NULL;
 
   /* Set the descriptor to close on exec. */
+  HURD_CRITICAL_BEGIN;
   __spin_lock (&d->port.lock);
   d->flags |= FD_CLOEXEC;
   __spin_unlock (&d->port.lock);
+  HURD_CRITICAL_END;
 
   dirp->__fd = d;
   dirp->__data = dirp->__ptr = NULL;
@@ -66,10 +68,45 @@ _hurd_fd_opendir (struct hurd_fd *d)
 }
 
 
+DIR *
+internal_function
+__opendirat (int dfd, const char *name)
+{
+  if (name[0] == '\0')
+    {
+      /* POSIX.1-1990 says an empty name gets ENOENT;
+	 but `open' might like it fine.  */
+      __set_errno (ENOENT);
+      return NULL;
+    }
+
+  int flags = O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC;
+  int fd;
+#ifdef IS_IN_rtld
+  assert (dfd == AT_FDCWD);
+  fd = open_not_cancel_2 (name, flags);
+#else
+  fd = openat_not_cancel_3 (dfd, name, flags);
+#endif
+  if (fd < 0)
+    return NULL;
+
+  /* Extract the pointer to the descriptor structure.  */
+  DIR *dirp = _hurd_fd_opendir (_hurd_fd_get (fd));
+  if (dirp == NULL)
+    __close (fd);
+
+  return dirp;
+}
+
+
 /* Open a directory stream on NAME.  */
 DIR *
 __opendir (const char *name)
 {
+#if 0 /* TODO.  */
+  return __opendirat (AT_FDCWD, name);
+#else
   if (name[0] == '\0')
     {
       /* POSIX.1-1990 says an empty name gets ENOENT;
@@ -88,5 +125,6 @@ __opendir (const char *name)
     __close (fd);
 
   return dirp;
+#endif
 }
 weak_alias (__opendir, opendir)
diff --git a/sysdeps/mach/hurd/readlinkat.c b/sysdeps/mach/hurd/readlinkat.c
new file mode 100644
index 0000000000..b70f9c8dea
--- /dev/null
+++ b/sysdeps/mach/hurd/readlinkat.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 1991-2012 Free Software 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 <unistd.h>
+#include <hurd.h>
+#include <hurd/paths.h>
+#include <hurd/fd.h>
+#include <fcntl.h>
+#include <string.h>
+
+/* Read the contents of the symbolic link FILE_NAME relative to FD into no more
+   than LEN bytes of BUF.  The contents are not null-terminated.
+   Returns the number of characters read, or -1 for errors.  */
+ssize_t
+readlinkat (fd, file_name, buf, len)
+     int fd;
+     const char *file_name;
+     char *buf;
+     size_t len;
+{
+  error_t err;
+  file_t file;
+  struct stat64 st;
+
+  file = __file_name_lookup_at (fd, 0, file_name, O_READ | O_NOLINK, 0);
+  if (file == MACH_PORT_NULL)
+    return -1;
+
+  err = __io_stat (file, &st);
+  if (! err)
+    if (S_ISLNK (st.st_mode))
+      {
+	char *rbuf = buf;
+
+	err = __io_read (file, &rbuf, &len, 0, len);
+	if (!err && rbuf != buf)
+	  {
+	    memcpy (buf, rbuf, len);
+	    __vm_deallocate (__mach_task_self (), (vm_address_t)rbuf, len);
+	  }
+      }
+    else
+      err = EINVAL;
+
+  __mach_port_deallocate (__mach_task_self (), file);
+
+  return err ? __hurd_fail (err) : len;
+}
+libc_hidden_def (readlinkat)
diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c
index f591336115..3a094aa0d2 100644
--- a/sysdeps/mach/hurd/recvfrom.c
+++ b/sysdeps/mach/hurd/recvfrom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -54,7 +54,7 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len)
     return __hurd_sockfail (fd, flags, err);
 
   /* Get address data for the returned address port if requested.  */
-  if (addr != NULL)
+  if (addr != NULL && addrport != MACH_PORT_NULL)
     {
       char *buf = (char *) addr;
       mach_msg_type_number_t buflen = *addr_len;
@@ -88,6 +88,8 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len)
       if (buflen > 0)
 	addr->sa_family = type;
     }
+  else if (addr_len != NULL)
+    *addr_len = 0;
 
   __mach_port_deallocate (__mach_task_self (), addrport);
 
diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
index a7b2e29d16..00cd0cc445 100644
--- a/sysdeps/mach/hurd/setitimer.c
+++ b/sysdeps/mach/hurd/setitimer.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1994,1995,1996,1997,2000,2001,2005
-	Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -219,7 +218,7 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,
 	  /* Start up the itimer thread running `timer_thread' (below).  */
 	  if (err = __thread_create (__mach_task_self (),
 				     &_hurd_itimer_thread))
-	    return __hurd_fail (err);
+	    goto out;
 	  _hurd_itimer_thread_stack_base = 0; /* Anywhere.  */
 	  _hurd_itimer_thread_stack_size = __vm_page_size; /* Small stack.  */
 	  if (err = __mach_setup_thread (__mach_task_self (),
diff --git a/sysdeps/mach/hurd/setresgid.c b/sysdeps/mach/hurd/setresgid.c
index 9d5885beda..eebd364fc6 100644
--- a/sysdeps/mach/hurd/setresgid.c
+++ b/sysdeps/mach/hurd/setresgid.c
@@ -1,5 +1,5 @@
 /* setresgid -- set real group ID, effective group ID, and saved-set group ID
-   Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,6 @@ __setresgid (gid_t rgid, gid_t egid, gid_t sgid)
 {
   auth_t newauth;
   error_t err;
-  gid_t agids[2] = { rgid, sgid };
 
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_id.lock);
@@ -37,31 +36,78 @@ __setresgid (gid_t rgid, gid_t egid, gid_t sgid)
   if (!err)
     {
       /* Make a new auth handle which has EGID as the first element in the
-         list of effective gids.  */
+	 list of effective gids.  */
 
-      if (_hurd_id.gen.ngids > 0)
+      uid_t *newgen, *newaux;
+      uid_t auxs[2] = { rgid, sgid };
+      size_t ngen, naux;
+
+      newgen = _hurd_id.gen.gids;
+      ngen = _hurd_id.gen.ngids;
+      if (egid != -1)
+	{
+	  if (_hurd_id.gen.ngids == 0)
+	    {
+	      /* No effective gids now.  The new set will be just UID.  */
+	      newgen = &egid;
+	      ngen = 1;
+	    }
+	  else
+	    {
+	      _hurd_id.gen.gids[0] = egid;
+	      _hurd_id.valid = 0;
+	    }
+	}
+
+      newaux = _hurd_id.aux.gids;
+      naux = _hurd_id.aux.ngids;
+      if (rgid != -1)
 	{
-	  _hurd_id.gen.gids[0] = egid;
-	  _hurd_id.valid = 0;
+	  if (_hurd_id.aux.ngids == 0)
+	    {
+	      newaux = &rgid;
+	      naux = 1;
+	    }
+	  else
+	    {
+	      _hurd_id.aux.gids[0] = rgid;
+	      _hurd_id.valid = 0;
+	    }
 	}
-      if (_hurd_id.aux.ngids > 1)
+
+      if (sgid != -1)
 	{
-	  _hurd_id.aux.gids[0] = rgid;
-	  _hurd_id.aux.gids[1] = sgid;
-	  _hurd_id.valid = 0;
+	  if (rgid == -1)
+	    {
+	      if (_hurd_id.aux.ngids >= 1)
+		auxs[0] = _hurd_id.aux.gids[0];
+	      else if (_hurd_id.gen.ngids >= 1)
+		auxs[0] = _hurd_id.gen.gids[0];
+	      else
+		/* Not even an effective GID.
+                   Fall back to the only GID we have. */
+		auxs[0] = sgid;
+	    }
+	  if (_hurd_id.aux.ngids <= 1)
+	    {
+	      /* No saved gids now.  The new set will be just UID.  */
+	      newaux = auxs;
+	      naux = 2;
+	    }
+	  else
+	    {
+	      _hurd_id.aux.gids[1] = sgid;
+	      _hurd_id.valid = 0;
+	    }
 	}
 
       err = __USEPORT (AUTH, __auth_makeauth
 		       (port, NULL, MACH_MSG_TYPE_COPY_SEND, 0,
 			_hurd_id.gen.uids, _hurd_id.gen.nuids,
 			_hurd_id.aux.uids, _hurd_id.aux.nuids,
-			_hurd_id.gen.ngids ? _hurd_id.gen.gids : &egid,
-			_hurd_id.gen.ngids ?: 1,
-			_hurd_id.aux.ngids > 1 ? _hurd_id.aux.gids : agids,
-			_hurd_id.aux.ngids > 1 ? _hurd_id.aux.ngids : 2,
+			newgen, ngen, newaux, naux,
 			&newauth));
     }
-
   __mutex_unlock (&_hurd_id.lock);
   HURD_CRITICAL_END;
 
diff --git a/sysdeps/mach/hurd/setresuid.c b/sysdeps/mach/hurd/setresuid.c
index 35aea85876..751763f5a9 100644
--- a/sysdeps/mach/hurd/setresuid.c
+++ b/sysdeps/mach/hurd/setresuid.c
@@ -1,5 +1,5 @@
 /* setresuid -- set real user ID, effective user ID, and saved-set user ID
-   Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,6 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
 {
   auth_t newauth;
   error_t err;
-  uid_t auids[2] = { ruid, suid };
 
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_id.lock);
@@ -37,26 +36,74 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
   if (!err)
     {
       /* Make a new auth handle which has EUID as the first element in the
-         list of effective uids.  */
+	 list of effective uids.  */
 
-      if (_hurd_id.gen.nuids > 0)
+      uid_t *newgen, *newaux;
+      uid_t auxs[2] = { ruid, suid };
+      size_t ngen, naux;
+
+      newgen = _hurd_id.gen.uids;
+      ngen = _hurd_id.gen.nuids;
+      if (euid != -1)
 	{
-	  _hurd_id.gen.uids[0] = euid;
-	  _hurd_id.valid = 0;
+	  if (_hurd_id.gen.nuids == 0)
+	    {
+	      /* No effective uids now.  The new set will be just UID.  */
+	      newgen = &euid;
+	      ngen = 1;
+	    }
+	  else
+	    {
+	      _hurd_id.gen.uids[0] = euid;
+	      _hurd_id.valid = 0;
+	    }
 	}
-      if (_hurd_id.aux.nuids > 1)
+
+      newaux = _hurd_id.aux.uids;
+      naux = _hurd_id.aux.nuids;
+      if (ruid != -1)
+	{
+	  if (_hurd_id.aux.nuids == 0)
+	    {
+	      newaux = &ruid;
+	      naux = 1;
+	    }
+	  else
+	    {
+	      _hurd_id.aux.uids[0] = ruid;
+	      _hurd_id.valid = 0;
+	    }
+	}
+
+      if (suid != -1)
 	{
-	  _hurd_id.aux.uids[0] = ruid;
-	  _hurd_id.aux.uids[1] = suid;
-	  _hurd_id.valid = 0;
+	  if (ruid == -1)
+	    {
+	      if (_hurd_id.aux.nuids >= 1)
+		auxs[0] = _hurd_id.aux.uids[0];
+	      else if (_hurd_id.gen.nuids >= 1)
+		auxs[0] = _hurd_id.gen.uids[0];
+	      else
+		/* Not even an effective UID.
+                   Fall back to the only UID we have. */
+		auxs[0] = suid;
+	    }
+	  if (_hurd_id.aux.nuids <= 1)
+	    {
+	      /* No saved uids now.  The new set will be just UID.  */
+	      newaux = auxs;
+	      naux = 2;
+	    }
+	  else
+	    {
+	      _hurd_id.aux.uids[1] = suid;
+	      _hurd_id.valid = 0;
+	    }
 	}
 
       err = __USEPORT (AUTH, __auth_makeauth
 		       (port, NULL, MACH_MSG_TYPE_COPY_SEND, 0,
-			_hurd_id.gen.nuids ? _hurd_id.gen.uids : &euid,
-			_hurd_id.gen.nuids ?: 1,
-			_hurd_id.aux.nuids > 1 ? _hurd_id.aux.uids : auids,
-			_hurd_id.aux.nuids > 1 ? _hurd_id.aux.nuids : 2,
+			newgen, ngen, newaux, naux,
 			_hurd_id.gen.gids, _hurd_id.gen.ngids,
 			_hurd_id.aux.gids, _hurd_id.aux.ngids,
 			&newauth));
diff --git a/sysdeps/mach/hurd/xmknodat.c b/sysdeps/mach/hurd/xmknodat.c
index acd1a8c683..645f222809 100644
--- a/sysdeps/mach/hurd/xmknodat.c
+++ b/sysdeps/mach/hurd/xmknodat.c
@@ -1,6 +1,5 @@
 /* Create a device file relative to an open directory.  Hurd version.
-   Copyright (C) 1991,1992,1993,1994,1995,1996,1999,2002,2005,2006
-	Free Software Foundation, Inc.
+   Copyright (C) 1991-2012 Free Software 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,7 +33,7 @@
 int
 __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
 {
-  error_t err;
+  error_t errnode, err;
   file_t dir, node;
   char *name;
   char buf[100], *bp;
@@ -94,7 +93,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
     return -1;
 
   /* Create a new, unlinked node in the target directory.  */
-  err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
+  errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
 
   if (! err && translator != NULL)
     /* Set the node's translator to make it a device.  */
@@ -109,7 +108,8 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
     err = __dir_link (dir, node, name, 1);
 
   __mach_port_deallocate (__mach_task_self (), dir);
-  __mach_port_deallocate (__mach_task_self (), node);
+  if (! errnode)
+    __mach_port_deallocate (__mach_task_self (), node);
 
   if (err)
     return __hurd_fail (err);
diff --git a/sysdeps/mach/hurd/xstatconv.c b/sysdeps/mach/hurd/xstatconv.c
index db704c6f30..ebe6471ac5 100644
--- a/sysdeps/mach/hurd/xstatconv.c
+++ b/sysdeps/mach/hurd/xstatconv.c
@@ -1,5 +1,5 @@
 /* Convert between `struct stat' format, and `struct stat64' format.
-   Copyright (C) 2000,01,02 Free Software Foundation, Inc.
+   Copyright (C) 2000-2012 Free Software 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,12 +41,9 @@ xstat64_conv (struct stat *buf, const struct stat64 *buf64)
   buf->st_uid = buf64->st_uid;
   buf->st_gid = buf64->st_gid;
   buf->st_size = buf64->st_size;
-  buf->st_atime = buf64->st_atime;
-  buf->st_atime_usec = buf64->st_atime_usec;
-  buf->st_mtime = buf64->st_mtime;
-  buf->st_mtime_usec = buf64->st_mtime_usec;
-  buf->st_ctime = buf64->st_ctime;
-  buf->st_ctime_usec = buf64->st_ctime_usec;
+  buf->st_atim = buf64->st_atim;
+  buf->st_mtim = buf64->st_mtim;
+  buf->st_ctim = buf64->st_ctim;
   buf->st_blksize = buf64->st_blksize;
   buf->st_blocks = buf64->st_blocks;
   buf->st_author = buf64->st_author;
diff --git a/sysdeps/mach/nanosleep.c b/sysdeps/mach/nanosleep.c
index 0192ff0bd7..a1ba19c17f 100644
--- a/sysdeps/mach/nanosleep.c
+++ b/sysdeps/mach/nanosleep.c
@@ -1,5 +1,5 @@
 /* nanosleep -- sleep for a period specified with a struct timespec
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 Free Software 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,15 @@ __nanosleep (const struct timespec *requested_time,
 {
   mach_port_t recv;
   struct timeval before, after;
+
+  if (requested_time->tv_sec < 0
+      || requested_time->tv_nsec < 0
+      || requested_time->tv_nsec >= 1000000000)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
   const mach_msg_timeout_t ms
     = requested_time->tv_sec * 1000
     + (requested_time->tv_nsec + 999999) / 1000000;
@@ -35,16 +44,22 @@ __nanosleep (const struct timespec *requested_time,
 
   if (remaining && __gettimeofday (&before, NULL) < 0)
     return -1;
-  (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
-		     0, 0, recv, ms, MACH_PORT_NULL);
+  error_t err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
+			    0, 0, recv, ms, MACH_PORT_NULL);
   __mach_port_destroy (mach_task_self (), recv);
-  if (remaining && __gettimeofday (&after, NULL) < 0)
-    return -1;
-
-  if (remaining)
+  if (err == EMACH_RCV_INTERRUPTED)
     {
-      timersub (&after, &before, &after);
-      TIMEVAL_TO_TIMESPEC (&after, remaining);
+      if (remaining && __gettimeofday (&after, NULL) >= 0)
+	{
+	  struct timeval req_time, elapsed, rem;
+	  TIMESPEC_TO_TIMEVAL (&req_time, requested_time);
+	  timersub (&after, &before, &elapsed);
+	  timersub (&req_time, &elapsed, &rem);
+	  TIMEVAL_TO_TIMESPEC (&rem, remaining);
+	}
+
+      errno = EINTR;
+      return -1;
     }
 
   return 0;
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 1a023f91f5..2eca2ae0e4 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2604,7 +2604,7 @@ getaddrinfo (const char *name, const char *service,
 	  __libc_lock_define_initialized (static, lock);
 
 	  __libc_lock_lock (lock);
-	  if (old_once && gaiconf_reload_flag)
+	  if (__libc_once_get (old_once) && gaiconf_reload_flag)
 	    gaiconf_reload ();
 	  qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src);
 	  __libc_lock_unlock (lock);
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index 6c41977eb0..1dc45e8ee2 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999,2011-2012 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -173,6 +173,7 @@ extern char *alloca ();
 
 #if defined _LIBC
 # include <not-cancel.h>
+# include <kernel-features.h>
 #else
 # define openat64_not_cancel_3(dfd, name, mode) openat64 (dfd, name, mode)
 # define close_not_cancel_no_status(fd) close (fd)
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index 31031613d3..d571d0b62b 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -382,38 +382,6 @@ fi
 if test -n "$sysheaders"; then
   CPPFLAGS=$OLD_CPPFLAGS
 fi
-# The Linux filesystem standard prescribes where to place "essential"
-# files.  I.e., when the installation prefix is "/usr" we have to place
-# shared library objects and the configuration files on the root partition
-# in /lib and /etc.
-case "$prefix" in
-/usr | /usr/)
-  # 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)
-    libc_cv_slibdir="/lib64"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib64';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
-  *)
-    libc_cv_slibdir="/lib"
-    ;;
-  esac
-  # Allow the user to override the path with --sysconfdir
-  if test $sysconfdir = '${prefix}/etc'; then
-    libc_cv_sysconfdir=/etc
-  else
-    libc_cv_sysconfdir=$sysconfdir
-   fi
-  libc_cv_rootsbindir="/sbin"
-  ;;
-esac
 
 # Under Linux the NPTL add-on should be available.
 case $add_ons in
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index 556ca84517..916d64a605 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -121,38 +121,6 @@ fi
 if test -n "$sysheaders"; then
   CPPFLAGS=$OLD_CPPFLAGS
 fi
-# The Linux filesystem standard prescribes where to place "essential"
-# files.  I.e., when the installation prefix is "/usr" we have to place
-# shared library objects and the configuration files on the root partition
-# in /lib and /etc.
-case "$prefix" in
-/usr | /usr/)
-  # 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)
-    libc_cv_slibdir="/lib64"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib64';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
-  *)
-    libc_cv_slibdir="/lib"
-    ;;
-  esac
-  # Allow the user to override the path with --sysconfdir
-  if test $sysconfdir = '${prefix}/etc'; then
-    libc_cv_sysconfdir=/etc
-  else
-    libc_cv_sysconfdir=$sysconfdir
-   fi
-  libc_cv_rootsbindir="/sbin"
-  ;;
-esac
 
 # Under Linux the NPTL add-on should be available.
 case $add_ons in
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 4f613cd67b..14df79740d 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  x86-64 version.
-   Copyright (C) 2001-2006, 2008-2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -343,7 +343,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 		 bits but the GOT entry is 64 bits wide and the whole
 		 64-bit entry is used as a signed quantity, so we need
 		 to sign-extend the computed value to 64 bits.  */
-	      *(Elf64_Sxword *) reloc_addr = (Elf64_Sxword) (Elf32_Sxword) value;
+	      *(Elf64_Sxword *) reloc_addr = (Elf64_Sxword) (Elf32_Sword) value;
 #   else
 	      *reloc_addr = value;
 #   endif