about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-20 15:59:03 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-20 15:59:03 +0000
commit27424b29289a49958e62450203f33a57dc1465e2 (patch)
tree7045409bd7d383127ecac0f78325a2a035b3f754
parent841d8c3466e6472c9cd16ee5bff701ba0380998a (diff)
downloadglibc-27424b29289a49958e62450203f33a57dc1465e2.tar.gz
glibc-27424b29289a49958e62450203f33a57dc1465e2.tar.xz
glibc-27424b29289a49958e62450203f33a57dc1465e2.zip
Updated to fedora-glibc-20050620T1530
-rw-r--r--ChangeLog349
-rw-r--r--config.h.in6
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure85
-rw-r--r--configure.in8
-rw-r--r--debug/pread64_chk.c2
-rw-r--r--dlfcn/dlerror.c6
-rw-r--r--elf/dl-deps.c31
-rw-r--r--elf/dl-error.c30
-rw-r--r--elf/dl-libc.c11
-rw-r--r--elf/dl-open.c15
-rw-r--r--elf/elf.h12
-rw-r--r--elf/rtld.c73
-rw-r--r--elf/tls-macros.h51
-rw-r--r--fedora/branch.mk4
-rw-r--r--gmon/gmon.c2
-rw-r--r--hesiod/README.hesiod8
-rw-r--r--hesiod/hesiod.c57
-rw-r--r--hesiod/hesiod_p.h1
-rw-r--r--include/dlfcn.h6
-rw-r--r--include/execinfo.h2
-rw-r--r--include/libintl.h1
-rw-r--r--include/string.h1
-rw-r--r--intl/dcgettext.c3
-rw-r--r--linuxthreads/ChangeLog9
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S2
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h30
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S8
-rw-r--r--locale/Makefile1
-rw-r--r--localedata/ChangeLog6
-rw-r--r--localedata/locales/pa_IN4
-rw-r--r--nptl/ChangeLog13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h17
-rw-r--r--nptl/tst-cancel4.c28
-rw-r--r--nscd/Makefile6
-rw-r--r--nscd/selinux.c43
-rw-r--r--posix/tst-mmap.c4
-rw-r--r--sysdeps/alpha/div_libc.h6
-rw-r--r--sysdeps/alpha/divl.S2
-rw-r--r--sysdeps/alpha/divq.S2
-rw-r--r--sysdeps/alpha/divqu.S2
-rw-r--r--sysdeps/alpha/dl-dtprocnum.h3
-rw-r--r--sysdeps/alpha/dl-machine.h146
-rw-r--r--sysdeps/alpha/dl-trampoline.S222
-rw-r--r--sysdeps/alpha/elf/start.S2
-rw-r--r--sysdeps/alpha/htonl.S2
-rw-r--r--sysdeps/alpha/htons.S2
-rw-r--r--sysdeps/alpha/reml.S2
-rw-r--r--sysdeps/alpha/remq.S2
-rw-r--r--sysdeps/alpha/remqu.S2
-rw-r--r--sysdeps/generic/backtrace.c3
-rw-r--r--sysdeps/generic/backtracesymsfd.c3
-rw-r--r--sysdeps/generic/elf/backtracesymsfd.c3
-rw-r--r--sysdeps/generic/ldsodefs.h6
-rw-r--r--sysdeps/generic/strnlen.c3
-rw-r--r--sysdeps/i386/backtrace.c3
-rw-r--r--sysdeps/i386/i386-mcount.S2
-rw-r--r--sysdeps/i386/sysdep.h27
-rw-r--r--sysdeps/ia64/backtrace.c3
-rw-r--r--sysdeps/ia64/fpu/e_lgamma_r.c4
-rw-r--r--sysdeps/ia64/fpu/e_lgammaf_r.c4
-rw-r--r--sysdeps/ia64/fpu/e_lgammal_r.c4
-rw-r--r--sysdeps/ia64/fpu/w_lgamma.c4
-rw-r--r--sysdeps/ia64/fpu/w_lgammaf.c4
-rw-r--r--sysdeps/ia64/fpu/w_lgammal.c4
-rw-r--r--sysdeps/ia64/strchr.S2
-rw-r--r--sysdeps/mach/hurd/readdir64_r.c2
-rw-r--r--sysdeps/mach/hurd/sigaltstack.c2
-rw-r--r--sysdeps/mach/i386/syscall.S3
-rw-r--r--sysdeps/posix/posix_fallocate64.c4
-rw-r--r--sysdeps/posix/sigignore.c4
-rw-r--r--sysdeps/posix/signal.c4
-rw-r--r--sysdeps/posix/sigset.c3
-rw-r--r--sysdeps/posix/sysv_signal.c4
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps30
-rw-r--r--sysdeps/powerpc/fpu/s_fabs.S8
-rw-r--r--sysdeps/powerpc/fpu/s_fmax.S8
-rw-r--r--sysdeps/powerpc/fpu/s_fmin.S8
-rw-r--r--sysdeps/powerpc/powerpc32/backtrace.c3
-rw-r--r--sysdeps/powerpc/powerpc32/configure33
-rw-r--r--sysdeps/powerpc/powerpc32/configure.in18
-rw-r--r--sysdeps/powerpc/powerpc32/dl-dtprocnum.h3
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.h124
-rw-r--r--sysdeps/powerpc/powerpc32/dl-start.S7
-rw-r--r--sysdeps/powerpc/powerpc32/elf/start.S12
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S9
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_ceil.S8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_ceilf.S10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysign.S6
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_floor.S8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_floorf.S10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_lround.S7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_rint.S8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_rintf.S10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_round.S7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_roundf.S7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_trunc.S8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_truncf.S10
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp-common.S19
-rw-r--r--sysdeps/powerpc/powerpc32/memset.S7
-rw-r--r--sysdeps/powerpc/powerpc32/ppc-mcount.S20
-rw-r--r--sysdeps/powerpc/powerpc32/sysdep.h23
-rw-r--r--sysdeps/powerpc/powerpc64/backtrace.c3
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_copysign.S6
-rw-r--r--sysdeps/s390/s390-32/backtrace.c5
-rw-r--r--sysdeps/s390/s390-32/s390-mcount.S2
-rw-r--r--sysdeps/s390/s390-64/backtrace.c5
-rw-r--r--sysdeps/s390/s390-64/s390x-mcount.S2
-rw-r--r--sysdeps/sparc/sparc32/memset.S2
-rw-r--r--sysdeps/sparc/sparc32/stpcpy.S2
-rw-r--r--sysdeps/sparc/sparc32/strchr.S4
-rw-r--r--sysdeps/sparc/sparc64/memcmp.S2
-rw-r--r--sysdeps/sparc/sparc64/memcpy.S4
-rw-r--r--sysdeps/sparc/sparc64/memset.S2
-rw-r--r--sysdeps/sparc/sparc64/sparcv9b/memcpy.S10
-rw-r--r--sysdeps/unix/clock_gettime.c5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrusage.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigsuspend.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscall.S2
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/hppa/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h26
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c12
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c168
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/mips/vfork.S2
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_tr.h78
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S6
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h89
-rw-r--r--sysdeps/unix/sysv/linux/sysctl.c3
-rw-r--r--sysdeps/unix/sysv/linux/system.c3
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/getdents.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/swapcontext.S2
-rw-r--r--sysdeps/x86_64/_mcount.S2
-rw-r--r--time/mktime.c3
173 files changed, 1976 insertions, 537 deletions
diff --git a/ChangeLog b/ChangeLog
index 6188d1cd31..47224b74cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,358 @@
+2005-06-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/sys/quota.h: Add definitions and types for
+	_LINUX_QUOTA_VERSION >= 2.
+	(_LINUX_QUOTA_VERSION): Define if not yet defined.
+
+	* sysdeps/unix/sysv/linux/bits/resource.h (RLIMIT_NICE,
+	RLIMIT_RTPRIO): Add.
+	(RLIMIT_NLIMITS): Adjust.
+	* sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIMIT_NICE,
+	RLIMIT_RTPRIO): Add.
+	(RLIMIT_NLIMITS): Adjust.
+	* sysdeps/unix/sysv/linux/mips/bits/resource.h (RLIMIT_NICE,
+	RLIMIT_RTPRIO): Add.
+	(RLIMIT_NLIMITS): Adjust.
+	* sysdeps/unix/sysv/linux/sparc/bits/resource.h (RLIMIT_NICE,
+	RLIMIT_RTPRIO): Add.
+	(RLIMIT_NLIMITS): Adjust.
+
+2005-06-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* time/mktime.c: Always include <string.h> for prototype of
+	implicitly used memcpy.
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+	(truncate64): Use __truncate, not truncate.
+	(__have_no_truncate64): Renamed from have_no_truncate64.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+	(__have_no_truncate64): Renamed from have_no_truncate64.
+
+	* sysdeps/powerpc/fpu/libm-test-ulps: Adjust ulps for complex
+	float functions for gcc 4.
+
+2005-06-10  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_runtime_setup):
+	Handle prelinked libraries and binaries with new style PLT.
+
+2005-06-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/elf.h (R_PPC_REL16, R_PPC_REL16_LO, R_PPC_REL16_HI,
+	R_PPC_REL16_HA): Define.
+
+2005-06-14  Alan Modra  <amodra@bigpond.net.au>
+
+	* config.h.in (HAVE_ASM_PPC_REL16): Add.
+	* elf/elf.h (DT_PPC_GOT, DT_PPC_NUM): Define.
+	* elf/tls-macros.h (PowerPC32): Include config.h.  Add variants of
+	TLS_IE, TLS_LD and TLS_GD for new PLT/GOT layout.
+	* sysdeps/powerpc/powerpc32/configure.in: New file,
+	* sysdeps/powerpc/powerpc32/dl-dtprocnum.h: New file.
+	* sysdeps/powerpc/powerpc32/dl-machine.h (DT_PPC): Define.
+	(ppc_got): New inline function.
+	(elf_machine_dynamic): Use ppc_got.  Add attribute const.
+	(elf_machine_load_address): Add attribute const.  Don't use int vars.
+	Use bcl rather than bl to save trashing branch target stack.  Use
+	elf_machine_dynamic rather than duplicating code here.
+	(elf_machine_runtime_setup): New inline function replacing define.
+	Handle new PLT.
+	(elf_machine_fixup_plt): Handle new PLT.
+	(elf_machine_rela): Likewise.
+	* sysdeps/powerpc/powerpc32/sysdep.h: Include config.h.
+	(CALL_MCOUNT): Don't set up counter vars.
+	* sysdeps/powerpc/powerpc32/ppc-mcount.S: Correct comment.
+	* sysdeps/powerpc/powerpc32/elf/start.S (start_addressesp): Don't
+	define when HAVE_ASM_PPC_REL16.
+	(_start): Add HAVE_ASM_PPC_REL16 code.
+	* sysdeps/powerpc/powerpc32/dl-start.S (_dl_start_user): Don't bl
+	into the GOT when HAVE_ASM_PPC_REL16.
+	* sysdeps/powerpc/powerpc32/memset.S (memset): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S (__longjmp): Ditto.
+	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S (__ceil): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (__ceilf): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_floor.S (__floor): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_floorf.S (__floorf): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_lround.S (__lround): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_rint.S (__rint): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_rintf.S (__rintf): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S (__trunc): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S (__truncf): Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S (__sigsetjmp):
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S (__brk): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+	(__getcontext): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+	(__setcontext): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+	(__swapcontext): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S (stackblock):
+	Comment.
+	(__socket): Bomb if NARGS >= 7.  Invoke CGOTSETUP and CGOTRESTORE.
+
+2005-06-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/sigignore.c: Include <string.h> to tell the compiler
+	to use __GI_memset.
+	* sysdeps/posix/signal.c: Likewise.
+	* sysdeps/posix/sigset.c: Likewise.
+	* sysdeps/posix/sysv_signal.c: Likewise.
+	* sysdeps/unix/sysv/linux/sleep.c: Likewise.
+	* sysdeps/unix/sysv/linux/sysctl.c: Likewise.
+	* sysdeps/unix/sysv/linux/system.c: Likewise.
+
+2005-06-15  Jakub Jelinek  <jakub@redhat.com>
+
+	* hesiod/hesiod.c (hesiod_init): Don't check for ctx->classes[0] == 0
+	or both classes equal here.
+	(parse_config_file): If both classes are equal, clear the second one.
+
+2005-06-08  Karl Kelley  <kekelley@iastate.edu>
+
+	* hesiod/hesiod_p.h (struct hesiod_p): Add classes array.
+	* hesiod/hesiod.c (hesiod_init): Initialize classes.  Fail if no
+	valid classes were given or if both are equal.
+	(hesiod_resolve): Use ctx->classes instead of hardcoded C_IN
+	and C_HS order.
+	(parse_config_file): Handle classes keyword.
+	* hesiod/README.hesiod: Mention addition of the classes keyword.
+
+2005-06-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* configure.in: Add test for availability of libaudit.
+	* config.h.in: Define HAVE_LIBAUDIT.
+	* config.make.in: Define have-libaudit.
+	* nscd/Makefile: If libaudit is available, link nscd with it.
+	* nscd/selinux.c: If HAVE_LIBAUDIT is defined, log using libaudit.
+	Patch by Steve Grubb <sgrubb@redhat.com>.
+
+	* debug/pread64_chk.c: Use __libc_pread64 instead of __pread64.
+	* sysdeps/posix/posix_fallocate64.c: Likewise.
+	* include/string.h: Use libc_hidden_proto for strnlen.
+	* sysdeps/generic/strnlen.c: Add libc_hidden_def.
+	* include/libintl.h: Use libc_hidden_proto for __dcgettext.
+	* intl/dcgettext.c: Add libc_hidden_def.
+	* include/execinfo.h: Add libc_hidden_proto for __backtrace and
+	__backtrace_symbols_fd.
+	* sysdeps/generic/backtrace.c: Add libc_hidden_def.
+	* sysdeps/generic/backtracesymsfd.c: Likewise.
+	* sysdeps/generic/elf/backtracesymsfd.c: Likewise.
+	* sysdeps/i386/backtrace.c: Likewise.
+	* sysdeps/ia64/backtrace.c: Likewise.
+	* sysdeps/powerpc/powerpc32/backtrace.c: Likewise.
+	* sysdeps/powerpc/powerpc64/backtrace.c: Likewise.
+	* sysdeps/s390/s390-32/backtrace.c: Likewise.
+	* sysdeps/s390/s390-64/backtrace.c: Likewise.
+
+2005-06-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/clock_gettime.c (clock_gettime): Implement case
+	where HANDLED_REALTIME is not defined.  [BZ #966]
+
+2005-06-13  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq,
+	__netlink_receive): Remove prototypes.
+	(__netlink_request): New prototype.
+	* sysdeps/unix/sysv/linux/ifaddrs.c: Include <alloca.h> and
+	<stdint.h>.
+	(__netlink_sendreq): Make static.
+	(__netlink_receive): Rename to...
+	(__netlink_request): ... this.  Add type argument, call
+	__netlink_sendreq.  If MSG_TRUNC is set after recvmsg, retry
+	with a bigger buffer.  Don't record buffers that contain no
+	messages we are expecting.
+	(getifaddrs): Use __netlink_request instead of __netlink_sendreq
+	and __netlink_receive pairs.  Formatting.
+	* sysdeps/unix/sysv/linux/if_index.c (if_nameindex_netlink): Use
+	__netlink_request instead of __netlink_sendreq and __netlink_receive
+	pair.
+
+2005-06-13  Thorsten Kukuk  <kukuk@suse.de>
+
+	* sysdeps/unix/sysv/linux/netinet/if_tr.h: Don't include kernel
+	headers, instead copy important structs/defines.
+
+2005-06-13  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/rtld.c (dl_main): Move DT_DEBUG setup before first
+	_dl_debug_state call.
+
+2005-06-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-error.c (_dl_signal_error): Store information about use of
+	real malloc in the catch object.
+	(_dl_catch_error): Forward information about malloc use to caller
+	in new parameter.
+	(_dl_out_of_memory): Make static.
+	* elf/dl-deps.c: Adjust callers of _dl_catch_error.
+	* elf/dl-libc.c: Likewise.
+	* elf/dl-open.c: Likewise.
+	* elf/rtld.c: Likewise.
+	Add new --audit option.
+	* sysdeps/generic/ldsodefs.h: Remove _dl_out_of_memory declaration.
+	(rtld_global_ro._dl_signal_error): Add new parameter.
+	* include/dlfcn.h (_dl_catch_error): Add new parameter.
+	* dlfcn/dlfcn.c (_dlerror_run): Pass additional parameter to
+	_dl_catch_error.  Only free if the returned newly value says so.
+
+2005-06-01  Roland McGrath  <roland@redhat.com>
+
+	[BZ #959]
+	* posix/tst-mmap.c (main): Fill the test file with enough data for the
+	page size.
+
 2005-05-30  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/dl-osinfo.h (DL_SYSDEP_OSCHECK): If
 	GLRO(dl_osversion) has been already set to a value smaller than
 	_dl_discover_osversion (), don't overwrite it here.
 
+2005-05-24  Thomas Schwinge  <schwinge@nic-nac-project.de>
+
+	* sysdeps/mach/i386/syscall.S (syscall): Call END.
+
+2005-05-28  Richard Henderson  <rth@redhat.com>
+
+	* elf/elf.h (DT_ALPHA_PLTRO, DT_ALPHA_NUM): New.
+	* sysdeps/alpha/dl-dtprocnum.h: New file.
+	* sysdeps/alpha/dl-machine.h (DT_ALPHA): New.
+	(elf_machine_load_address): Simplify to rely on gprel relocations.
+	(elf_machine_runtime_setup): Handle DT_ALPHA_PLTRO plt format.
+	Remove thread safety workaround for binutils 2.6.
+	(elf_machine_fixup_plt): Handle DT_ALPHA_PLTRO plt format.
+	* sysdeps/alpha/dl-trampoline.S (_dl_runtime_resolve_new): New.
+	(_dl_runtime_profile_new): New.
+	(_dl_runtime_resolve_old): Rename from _dl_runtime_resolve.
+	(_dl_runtime_profile_old): Rename from _dl_runtime_profile.  Fix
+	typo in _dl_call_pltexit argument loading.
+
+	* sysdeps/alpha/div_libc.h (funcnoplt): New.
+	* sysdeps/alpha/divl.S: Use it.
+	* sysdeps/alpha/divq.S: Likewise
+	* sysdeps/alpha/divqu.S: Likewise.
+	* sysdeps/alpha/reml.S: Likewise.
+	* sysdeps/alpha/remq.S: Likewise.
+	* sysdeps/alpha/remqu.S: Likewise.
+
+2005-05-26  Andreas Schwab  <schwab@suse.de>
+
+	* locale/Makefile (CFLAGS-loadlocale.c): Don't define.
+
+2005-05-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (O_DIRECT): Fix value.
+	Reported by Colin Gibbs <colin@gibbsonline.net>.  [BZ #954]
+
+2005-05-17  Alan Modra  <amodra@bigpond.net.au>
+
+	* sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S (__longjmp): Corrent
+	_dl_hwcap access in PIC && !SHARED case.
+	* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
+
+2005-05-25  Dwayne Grant McConnell  <dgm69@us.ibm.com>
+
+	* gmon/gmon.c: Add space in weak_alias use.
+	* linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S: Likewise.
+	* sysdeps/alpha/htonl.S: Likewise.
+	* sysdeps/alpha/htons.S: Likewise.
+	* sysdeps/alpha/elf/start.S: Likewise.
+	* sysdeps/i386/i386-mcount.S: Likewise.
+	* sysdeps/ia64/strchr.S: Likewise.
+	* sysdeps/ia64/fpu/e_lgamma_r.c: Likewise.
+	* sysdeps/ia64/fpu/e_lgamma_r.c: Likewise.
+	* sysdeps/ia64/fpu/e_lgammaf_r.c: Likewise.
+	* sysdeps/ia64/fpu/e_lgammaf_r.c: Likewise.
+	* sysdeps/ia64/fpu/e_lgammal_r.c: Likewise.
+	* sysdeps/ia64/fpu/e_lgammal_r.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgamma.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgamma.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammaf.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammaf.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammal.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammal.c: Likewise.
+	* sysdeps/mach/hurd/readdir64_r.c: Likewise.
+	* sysdeps/mach/hurd/sigaltstack.c: Likewise.
+	* sysdeps/powerpc/fpu/s_fabs.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fabs.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fabs.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fabs.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmax.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmax.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmax.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmax.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmin.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmin.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmin.S: Likewise.
+	* sysdeps/powerpc/fpu/s_fmin.S: Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Likewise.
+	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
+	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
+	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
+	* sysdeps/s390/s390-32/s390-mcount.S: Likewise.
+	* sysdeps/s390/s390-64/s390x-mcount.S: Likewise.
+	* sysdeps/sparc/sparc32/memset.S: Likewise.
+	* sysdeps/sparc/sparc32/stpcpy.S: Likewise.
+	* sysdeps/sparc/sparc32/strchr.S: Likewise.
+	* sysdeps/sparc/sparc32/strchr.S: Likewise.
+	* sysdeps/sparc/sparc64/memcmp.S: Likewise.
+	* sysdeps/sparc/sparc64/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/memset.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9b/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9b/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9b/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9b/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9b/memcpy.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/getrusage.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
+	* sysdeps/unix/sysv/linux/readdir64.c: Likewise.
+	* sysdeps/unix/sysv/linux/readdir64_r.c: Likewise.
+	* sysdeps/unix/sysv/linux/hppa/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/makecontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/mips/vfork.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/wordsize-64/getdents.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/getcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/makecontext.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/setcontext.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/swapcontext.S: Likewise.
+	* sysdeps/x86_64/_mcount.S: Likewise.
+
+2005-05-24  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h
+	(SETUP_PIC_REG, LOAD_PIC_REG): Move these macros ...
+	* sysdeps/i386/sysdep.h [PIC]: ... to here.
+
 2005-05-23  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/arm, sysdeps/unix/arm, sysdeps/unix/sysv/linux/arm:
diff --git a/config.h.in b/config.h.in
index db3defc6b0..70e67bb912 100644
--- a/config.h.in
+++ b/config.h.in
@@ -21,6 +21,9 @@
 /* Define if building with SELinux support.  Set by --with-selinux.  */
 #undef	HAVE_SELINUX
 
+/* Defined if building with SELinux support & audit libs are detected. */
+#undef	HAVE_LIBAUDIT
+
 /* Define if using XCOFF. Set by --with-xcoff.  */
 #undef	HAVE_XCOFF
 
@@ -217,6 +220,9 @@
 /* Define if inlined system calls are available.  */
 #undef HAVE_INLINED_SYSCALLS
 
+/* Define if your assembler and linker support R_PPC_REL16* relocs.  */
+#undef HAVE_ASM_PPC_REL16
+
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index 1bd025e97e..1ab4bfbfc4 100644
--- a/config.make.in
+++ b/config.make.in
@@ -59,6 +59,7 @@ enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
 have-selinux = @have_selinux@
+have-libaudit = @have_libaudit@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
 fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
diff --git a/configure b/configure
index cb86530899..8c978e7512 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1924,7 +1924,6 @@ fi
 test -n "$base_machine" || case "$machine" in
 a29k | am29000)	base_machine=a29k machine=a29k ;;
 alpha*)		base_machine=alpha machine=alpha/$machine ;;
-arm*)		base_machine=arm machine=arm/arm32/$machine ;;
 c3[012])	base_machine=cx0 machine=cx0/c30 ;;
 c4[04])		base_machine=cx0 machine=cx0/c40 ;;
 hppa*64*)	base_machine=hppa machine=hppa/hppa64 ;;
@@ -1980,7 +1979,6 @@ sparc64)
 		base_machine=sparc machine=sparc/sparc64 ;;
 sparc64b)
 		base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
-thumb*)		base_machine=thumb machine=arm/thumb/$machine ;;
 *)		base_machine=$machine ;;
 esac
 
@@ -6731,6 +6729,86 @@ cat >>confdefs.h <<\_ACEOF
 #define HAVE_SELINUX 1
 _ACEOF
 
+
+  # See if we have the libaudit library
+  echo "$as_me:$LINENO: checking for audit_log_avc in -laudit" >&5
+echo $ECHO_N "checking for audit_log_avc in -laudit... $ECHO_C" >&6
+if test "${ac_cv_lib_audit_audit_log_avc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-laudit  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char audit_log_avc ();
+int
+main ()
+{
+audit_log_avc ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_audit_audit_log_avc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_audit_audit_log_avc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_audit_audit_log_avc" >&5
+echo "${ECHO_T}$ac_cv_lib_audit_audit_log_avc" >&6
+if test $ac_cv_lib_audit_audit_log_avc = yes; then
+  have_libaudit=yes
+else
+  have_libaudit=no
+fi
+
+  if test "x$have_libaudit" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBAUDIT 1
+_ACEOF
+
+  fi
+
 fi
 
 
@@ -8343,6 +8421,7 @@ s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
 s,@no_whole_archive@,$no_whole_archive,;t t
 s,@exceptions@,$exceptions,;t t
 s,@LIBGD@,$LIBGD,;t t
+s,@have_libaudit@,$have_libaudit,;t t
 s,@have_selinux@,$have_selinux,;t t
 s,@EGREP@,$EGREP,;t t
 s,@sizeof_long_double@,$sizeof_long_double,;t t
diff --git a/configure.in b/configure.in
index 503611a6b9..5f46b5e4ef 100644
--- a/configure.in
+++ b/configure.in
@@ -1938,6 +1938,14 @@ fi
 # Check if we're building with SELinux support.
 if test "x$have_selinux" = xyes; then
   AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
+
+  # See if we have the libaudit library
+  AC_CHECK_LIB(audit, audit_log_avc,
+              have_libaudit=yes, have_libaudit=no)
+  if test "x$have_libaudit" = xyes; then
+    AC_DEFINE(HAVE_LIBAUDIT,1,[SELinux libaudit support])
+  fi
+  AC_SUBST(have_libaudit)
 fi
 AC_SUBST(have_selinux)
 
diff --git a/debug/pread64_chk.c b/debug/pread64_chk.c
index c0e0efdf85..9db1894765 100644
--- a/debug/pread64_chk.c
+++ b/debug/pread64_chk.c
@@ -26,6 +26,6 @@ __pread64_chk (int fd, void *buf, size_t nbytes, off64_t offset, size_t buflen)
   if (nbytes > buflen)
     __chk_fail ();
 
-  return __pread64 (fd, buf, nbytes, offset);
+  return __libc_pread64 (fd, buf, nbytes, offset);
 }
 #endif
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index 1254381f2b..7ea31d4392 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -19,6 +19,7 @@
 
 #include <dlfcn.h>
 #include <libintl.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -40,6 +41,7 @@ struct dl_action_result
   {
     int errcode;
     int returned;
+    bool malloced;
     const char *objname;
     const char *errstring;
   };
@@ -154,13 +156,13 @@ _dlerror_run (void (*operate) (void *), void *args)
     {
       /* Free the error string from the last failed command.  This can
 	 happen if `dlerror' was not run after an error was found.  */
-      if (strcmp (result->errstring, "out of memory") != 0)
+      if (result->malloced)
 	free ((char *) result->errstring);
       result->errstring = NULL;
     }
 
   result->errcode = GLRO(dl_catch_error) (&result->objname, &result->errstring,
-					  operate, args);
+					  &result->malloced, operate, args);
 
   /* If no error we mark that no error string is available.  */
   result->returned = result->errstring == NULL;
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 50d7a0e71c..a73e21db7b 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -235,16 +235,22 @@ _dl_map_object_deps (struct link_map *map,
 	      {
 		/* Map in the needed object.  */
 		struct link_map *dep;
-		int err;
 
 		/* Recognize DSTs.  */
 		name = expand_dst (l, strtab + d->d_un.d_val, 0);
 		/* Store the tag in the argument structure.  */
 		args.name = name;
 
-		err = _dl_catch_error (&objname, &errstring, openaux, &args);
+		bool malloced;
+		int err = _dl_catch_error (&objname, &errstring, &malloced,
+					   openaux, &args);
 		if (__builtin_expect (errstring != NULL, 0))
 		  {
+		    char *new_errstring = strdupa (errstring);
+		    if (malloced)
+		      free ((char *) errstring);
+		    errstring = new_errstring;
+
 		    if (err)
 		      errno_reason = err;
 		    else
@@ -288,8 +294,6 @@ _dl_map_object_deps (struct link_map *map,
 
 		if (d->d_tag == DT_AUXILIARY)
 		  {
-		    int err;
-
 		    /* Say that we are about to load an auxiliary library.  */
 		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
 					  0))
@@ -301,13 +305,14 @@ _dl_map_object_deps (struct link_map *map,
 
 		    /* We must be prepared that the addressed shared
 		       object is not available.  */
-		    err = _dl_catch_error (&objname, &errstring, openaux,
-					   &args);
+		    bool malloced;
+		    (void) _dl_catch_error (&objname, &errstring, &malloced,
+					    openaux, &args);
 		    if (__builtin_expect (errstring != NULL, 0))
 		      {
 			/* We are not interested in the error message.  */
 			assert (errstring != NULL);
-			if (errstring != _dl_out_of_memory)
+			if (malloced)
 			  free ((char *) errstring);
 
 			/* Simply ignore this error and continue the work.  */
@@ -316,8 +321,6 @@ _dl_map_object_deps (struct link_map *map,
 		  }
 		else
 		  {
-		    int err;
-
 		    /* Say that we are about to load an auxiliary library.  */
 		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
 					  0))
@@ -328,10 +331,16 @@ _dl_map_object_deps (struct link_map *map,
 					? l->l_name : rtld_progname);
 
 		    /* For filter objects the dependency must be available.  */
-		    err = _dl_catch_error (&objname, &errstring, openaux,
-					   &args);
+		    bool malloced;
+		    int err = _dl_catch_error (&objname, &errstring, &malloced,
+					       openaux, &args);
 		    if (__builtin_expect (errstring != NULL, 0))
 		      {
+			char *new_errstring = strdupa (errstring);
+			if (malloced)
+			  free ((char *) errstring);
+			errstring = new_errstring;
+
 			if (err)
 			  errno_reason = err;
 			else
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 993b7c29ab..a63d801411 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -19,6 +19,7 @@
 
 #include <libintl.h>
 #include <setjmp.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -30,6 +31,8 @@ struct catch
   {
     const char *objname;	/* Object/File name.  */
     const char *errstring;	/* Error detail filled in here.  */
+    bool malloced;		/* Nonzero if the string is malloced
+				   by the libc malloc.  */
     jmp_buf env;		/* longjmp here on error.  */
   };
 
@@ -44,8 +47,7 @@ struct catch
 /* This message we return as a last resort.  We define the string in a
    variable since we have to avoid freeing it and so have to enable
    a pointer comparison.  See below and in dlfcn/dlerror.c.  */
-const char _dl_out_of_memory[] = "out of memory";
-rtld_hidden_data_def (_dl_out_of_memory)
+static const char _dl_out_of_memory[] = "out of memory";
 
 
 /* This points to a function which is called when an continuable error is
@@ -87,15 +89,27 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
 
       lcatch->errstring = (char *) malloc (len_objname + len_errstring);
       if (lcatch->errstring != NULL)
-	/* Make a copy of the object file name and the error string.  */
-	lcatch->objname = memcpy (__mempcpy ((char *) lcatch->errstring,
-					     errstring, len_errstring),
-				  objname, len_objname);
+	{
+	  /* Make a copy of the object file name and the error string.  */
+	  lcatch->objname = memcpy (__mempcpy ((char *) lcatch->errstring,
+					       errstring, len_errstring),
+				    objname, len_objname);
+
+	  /* If the main executable is relocated it means the libc's malloc
+	     is used.  */
+#ifdef SHARED
+	  lcatch->malloced = (GL(dl_ns)[LM_ID_BASE]._ns_loaded->l_relocated
+			      != 0);
+#else
+	  lcatch->malloced = true;
+#endif
+	}
       else
 	{
 	  /* This is better than nothing.  */
 	  lcatch->objname = "";
 	  lcatch->errstring = _dl_out_of_memory;
+	  lcatch->malloced = false;
 	}
       longjmp (lcatch->env, errcode ?: -1);
     }
@@ -140,7 +154,7 @@ _dl_signal_cerror (int errcode, const char *objname, const char *occation,
 int
 internal_function
 _dl_catch_error (const char **objname, const char **errstring,
-		 void (*operate) (void *), void *args)
+		 bool *mallocedp, void (*operate) (void *), void *args)
 {
   int errcode;
   struct catch *volatile old;
@@ -162,6 +176,7 @@ _dl_catch_error (const char **objname, const char **errstring,
       *catchp = old;
       *objname = NULL;
       *errstring = NULL;
+      *mallocedp = false;
       return 0;
     }
 
@@ -169,6 +184,7 @@ _dl_catch_error (const char **objname, const char **errstring,
   *catchp = old;
   *objname = c.objname;
   *errstring = c.errstring;
+  *mallocedp = c.malloced;
   return errcode == -1 ? 0 : errcode;
 }
 
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index 5e76069139..1b995eda92 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -1,5 +1,5 @@
 /* Handle loading and unloading shared objects for internal libc purposes.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2001,2002,2004,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.columbia.edu>, 1999.
 
@@ -42,12 +42,13 @@ dlerror_run (void (*operate) (void *), void *args)
 {
   const char *objname;
   const char *last_errstring = NULL;
-  int result;
+  bool malloced;
 
-  (void) GLRO(dl_catch_error) (&objname, &last_errstring, operate, args);
+  (void) GLRO(dl_catch_error) (&objname, &last_errstring, &malloced,
+			       operate, args);
 
-  result = last_errstring != NULL;
-  if (result && last_errstring != _dl_out_of_memory)
+  int result = last_errstring != NULL;
+  if (result && malloced)
     free ((char *) last_errstring);
 
   return result;
diff --git a/elf/dl-open.c b/elf/dl-open.c
index a65690e5a3..984f4a4ec6 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -504,11 +504,6 @@ void *
 _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid,
 	  int argc, char *argv[], char *env[])
 {
-  struct dl_open_args args;
-  const char *objname;
-  const char *errstring;
-  int errcode;
-
   if ((mode & RTLD_BINDING_MASK) == 0)
     /* One of the flags must be set.  */
     _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()"));
@@ -543,6 +538,7 @@ no more namespaces available for dlmopen()"));
     _dl_signal_error (EINVAL, file, NULL,
 		      N_("invalid target namespace in dlmopen()"));
 
+  struct dl_open_args args;
   args.file = file;
   args.mode = mode;
   args.caller_dlopen = caller_dlopen;
@@ -552,7 +548,12 @@ no more namespaces available for dlmopen()"));
   args.argc = argc;
   args.argv = argv;
   args.env = env;
-  errcode = _dl_catch_error (&objname, &errstring, dl_open_worker, &args);
+
+  const char *objname;
+  const char *errstring;
+  bool malloced;
+  int errcode = _dl_catch_error (&objname, &errstring, &malloced,
+				 dl_open_worker, &args);
 
 #ifndef MAP_COPY
   /* We must munmap() the cache file.  */
@@ -603,7 +604,7 @@ no more namespaces available for dlmopen()"));
 	  memcpy (local_errstring, errstring, len_errstring);
 	}
 
-      if (errstring != _dl_out_of_memory)
+      if (malloced)
 	free ((char *) errstring);
 
       assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
diff --git a/elf/elf.h b/elf/elf.h
index e246519fab..a09d279dbf 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1866,6 +1866,9 @@ typedef Elf32_Addr Elf32_Conflict;
 #define LITUSE_ALPHA_TLS_GD	4
 #define LITUSE_ALPHA_TLS_LDM	5
 
+/* Legal values for d_tag of Elf64_Dyn.  */
+#define DT_ALPHA_PLTRO		0x70000000
+#define DT_ALPHA_NUM		1
 
 /* PowerPC specific declarations */
 
@@ -1976,10 +1979,19 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_PPC_DIAB_RELSDA_HI	184	/* like EMB_RELSDA, but high 16 bit */
 #define R_PPC_DIAB_RELSDA_HA	185	/* like EMB_RELSDA, adjusted high 16 */
 
+/* GNU relocs used in PIC code sequences.  */
+#define R_PPC_REL16		249	/* word32   (sym-.) */
+#define R_PPC_REL16_LO		250	/* half16   (sym-.)@l */
+#define R_PPC_REL16_HI		251	/* half16   (sym-.)@h */
+#define R_PPC_REL16_HA		252	/* half16   (sym-.)@ha */
+
 /* This is a phony reloc to handle any old fashioned TOC16 references
    that may still be in object files.  */
 #define R_PPC_TOC16		255
 
+/* PowerPC specific values for the Dyn d_tag field.  */
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_NUM		1
 
 /* PowerPC64 relocations defined by the ABIs */
 #define R_PPC64_NONE		R_PPC_NONE
diff --git a/elf/rtld.c b/elf/rtld.c
index b7f16f7b37..a3dbb867f3 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -61,6 +61,9 @@ static void print_missing_version (int errcode, const char *objname,
 /* Print the various times we collected.  */
 static void print_statistics (hp_timing_t *total_timep);
 
+/* Add audit objects.  */
+static void process_dl_audit (char *str);
+
 /* This is a list of all the modes the dynamic loader can be in.  */
 enum mode { normal, list, verify, trace };
 
@@ -771,6 +774,7 @@ do_preload (char *fname, struct link_map *main_map, const char *where)
   const char *objname;
   const char *err_str = NULL;
   struct map_args args;
+  bool malloced;
 
   args.str = fname;
   args.loader = main_map;
@@ -779,7 +783,7 @@ do_preload (char *fname, struct link_map *main_map, const char *where)
 
   unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
 
-  (void) _dl_catch_error (&objname, &err_str, map_doit, &args);
+  (void) _dl_catch_error (&objname, &err_str, &malloced, map_doit, &args);
   if (__builtin_expect (err_str != NULL, 0))
     {
       _dl_error_printf ("\
@@ -927,6 +931,14 @@ dl_main (const ElfW(Phdr) *phdr,
 	    _dl_argc -= 2;
 	    INTUSE(_dl_argv) += 2;
 	  }
+	else if (! strcmp (INTUSE(_dl_argv)[1], "--audit") && _dl_argc > 2)
+	  {
+	    process_dl_audit (INTUSE(_dl_argv)[2]);
+
+	    _dl_skip_args += 2;
+	    _dl_argc -= 2;
+	    INTUSE(_dl_argv) += 2;
+	  }
 	else
 	  break;
 
@@ -983,12 +995,14 @@ of this helper program; chances are you did not intend to run this program.\n\
 	  const char *objname;
 	  const char *err_str = NULL;
 	  struct map_args args;
+	  bool malloced;
 
 	  args.str = rtld_progname;
 	  args.loader = NULL;
 	  args.is_preloaded = 0;
 	  args.mode = __RTLD_OPENEXEC;
-	  (void) _dl_catch_error (&objname, &err_str, map_doit, &args);
+	  (void) _dl_catch_error (&objname, &err_str, &malloced, map_doit,
+				  &args);
 	  if (__builtin_expect (err_str != NULL, 0))
 	    /* We don't free the returned string, the programs stops
 	       anyway.  */
@@ -1451,14 +1465,17 @@ ld.so does not support TLS, but program uses it!\n");
 
 	  const char *objname;
 	  const char *err_str = NULL;
-	  (void) _dl_catch_error (&objname, &err_str, dlmopen_doit, &dlmargs);
+	  bool malloced;
+	  (void) _dl_catch_error (&objname, &err_str, &malloced, dlmopen_doit,
+				  &dlmargs);
 	  if (__builtin_expect (err_str != NULL, 0))
 	    {
 	    not_loaded:
 	      _dl_error_printf ("\
 ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 				al->name, err_str);
-	      free ((char *) err_str);
+	      if (malloced)
+		free ((char *) err_str);
 	    }
 	  else
 	    {
@@ -1467,7 +1484,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	      largs.map = dlmargs.map;
 
 	      /* Check whether the interface version matches.  */
-	      (void) _dl_catch_error (&objname, &err_str, lookup_doit, &largs);
+	      (void) _dl_catch_error (&objname, &err_str, &malloced,
+				      lookup_doit, &largs);
 
 	      unsigned int (*laversion) (unsigned int);
 	      unsigned int lav;
@@ -1508,8 +1526,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 		  do
 		    {
 		      largs.name = cp;
-		      (void) _dl_catch_error (&objname, &err_str, lookup_doit,
-					      &largs);
+		      (void) _dl_catch_error (&objname, &err_str, &malloced,
+					      lookup_doit, &largs);
 
 		      /* Store the pointer.  */
 		      if (err_str == NULL && largs.result != NULL)
@@ -1593,6 +1611,23 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	}
     }
 
+  /* Set up debugging before the debugger is notified for the first time.  */
+#ifdef ELF_MACHINE_DEBUG_SETUP
+  /* Some machines (e.g. MIPS) don't use DT_DEBUG in this way.  */
+  ELF_MACHINE_DEBUG_SETUP (main_map, r);
+  ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
+#else
+  if (main_map->l_info[DT_DEBUG] != NULL)
+    /* There is a DT_DEBUG entry in the dynamic section.  Fill it in
+       with the run-time address of the r_debug structure  */
+    main_map->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
+
+  /* Fill in the pointer in the dynamic linker's own dynamic section, in
+     case you run gdb on the dynamic linker directly.  */
+  if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
+    GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
+#endif
+
   /* We start adding objects.  */
   r->r_state = RT_ADD;
   _dl_debug_state ();
@@ -2162,30 +2197,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
     }
 
 
-  {
-    struct link_map *l = main_map;
-
-#ifdef ELF_MACHINE_DEBUG_SETUP
-
-    /* Some machines (e.g. MIPS) don't use DT_DEBUG in this way.  */
-
-    ELF_MACHINE_DEBUG_SETUP (l, r);
-    ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
-
-#else
-
-    if (l->l_info[DT_DEBUG] != NULL)
-      /* There is a DT_DEBUG entry in the dynamic section.  Fill it in
-	 with the run-time address of the r_debug structure  */
-      l->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
-
-    /* Fill in the pointer in the dynamic linker's own dynamic section, in
-       case you run gdb on the dynamic linker directly.  */
-    if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
-      GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
-#endif
-  }
-
   /* Now set up the variable which helps the assembler startup code.  */
   GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist = &main_map->l_searchlist;
   GL(dl_ns)[LM_ID_BASE]._ns_global_scope[0] = &main_map->l_searchlist;
diff --git a/elf/tls-macros.h b/elf/tls-macros.h
index 0ae9e65dc0..37cbe7514f 100644
--- a/elf/tls-macros.h
+++ b/elf/tls-macros.h
@@ -703,6 +703,8 @@ register void *__gp __asm__("$29");
 
 #elif defined __powerpc__ && !defined __powerpc64__
 
+#include "config.h"
+
 # define __TLS_CALL_CLOBBERS						\
 	"0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",	\
 	"lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7"
@@ -715,7 +717,20 @@ register void *__gp __asm__("$29");
      __result; })
 
 /* PowerPC32 Initial Exec TLS access.  */
-# define TLS_IE(x)					\
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_IE(x)					\
+  ({ int *__result;					\
+     asm ("bcl 20,31,1f\n1:\t"				\
+	  "mflr %0\n\t"					\
+	  "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "lwz %0," #x "@got@tprel(%0)\n\t"		\
+	  "add %0,%0," #x "@tls"			\
+	  : "=b" (__result) :				\
+	  : "lr");					\
+     __result; })
+# else
+#  define TLS_IE(x)					\
   ({ int *__result;					\
      asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
 	  "mflr %0\n\t"					\
@@ -724,9 +739,24 @@ register void *__gp __asm__("$29");
 	  : "=b" (__result) :				\
 	  : "lr");					\
      __result; })
+# endif
 
 /* PowerPC32 Local Dynamic TLS access.  */
-# define TLS_LD(x)					\
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_LD(x)					\
+  ({ int *__result;					\
+     asm ("bcl 20,31,1f\n1:\t"				\
+	  "mflr 3\n\t"					\
+	  "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "addi 3,3," #x "@got@tlsld\n\t"		\
+	  "bl __tls_get_addr@plt\n\t"			\
+	  "addi %0,3," #x "@dtprel"			\
+	  : "=r" (__result) :				\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# else
+#  define TLS_LD(x)					\
   ({ int *__result;					\
      asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
 	  "mflr 3\n\t"					\
@@ -736,9 +766,23 @@ register void *__gp __asm__("$29");
 	  : "=r" (__result) :				\
 	  : __TLS_CALL_CLOBBERS);			\
      __result; })
+# endif
 
 /* PowerPC32 General Dynamic TLS access.  */
-# define TLS_GD(x)					\
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_GD(x)					\
+  ({ register int *__result __asm__ ("r3");		\
+     asm ("bcl 20,31,1f\n1:\t"				\
+	  "mflr 3\n\t"					\
+	  "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "addi 3,3," #x "@got@tlsgd\n\t"		\
+	  "bl __tls_get_addr@plt"			\
+	  : :						\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# else
+#  define TLS_GD(x)					\
   ({ register int *__result __asm__ ("r3");		\
      asm ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
 	  "mflr 3\n\t"					\
@@ -747,6 +791,7 @@ register void *__gp __asm__("$29");
 	  : :						\
 	  : __TLS_CALL_CLOBBERS);			\
      __result; })
+# endif
 
 #elif defined __powerpc__ && defined __powerpc64__
 
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 022b255fbb..90bf380a3c 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2005-05-24 16:06 UTC
-fedora-sync-tag := fedora-glibc-20050524T1606
+fedora-sync-date := 2005-06-20 15:30 UTC
+fedora-sync-tag := fedora-glibc-20050620T1530
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 575adbcd8b..8eb0736193 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -171,7 +171,7 @@ __monstartup (lowpc, highpc)
 
   __moncontrol(1);
 }
-weak_alias(__monstartup, monstartup)
+weak_alias (__monstartup, monstartup)
 
 
 static void
diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod
index 18cd5d45dd..259ce8d447 100644
--- a/hesiod/README.hesiod
+++ b/hesiod/README.hesiod
@@ -71,6 +71,14 @@ will want to create your own.  It should look something like:
 
   rhs=.your.domain
   lhs=.ns
+  classes=in,hs
+
+The optional classes settings specifies which DNS classes Hesiod
+should do lookups in.  Possible values are IN (the preferred class)
+and  HS (the deprecated class, still used by some sites).
+You may specify both classes separated by a comma to try one class
+first and then the other if no entry is available in the first
+class.  The default value of the classes variable is `IN,HS'.
 
 The value of rhs can be overridden by the environment variable
 `HES_DOMAIN'.
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index 7fffb310f1..b73aa3ce94 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -83,6 +83,9 @@ hesiod_init(void **context) {
 	ctx->LHS = NULL;
 	ctx->RHS = NULL;
 	ctx->res = NULL;
+	/* Set default query classes. */
+	ctx->classes[0] = C_IN;
+	ctx->classes[1] = C_HS;
 
 	configname = __secure_getenv("HESIOD_CONFIG");
 	if (!configname)
@@ -234,15 +237,12 @@ hesiod_resolve(void *context, const char *name, const char *type) {
 		return (NULL);
 	}
 
-	if ((retvec = get_txt_records(ctx, C_IN, bindname))) {
-		free(bindname);
-		return (retvec);
-	}
+	retvec = get_txt_records(ctx, ctx->classes[0], bindname);
+
+	if (retvec == NULL && (errno == ENOENT || errno == ECONNREFUSED) && ctx->classes[1])
+		retvec = get_txt_records(ctx, ctx->classes[1], bindname);
 
-	if (errno != ENOENT && errno != ECONNREFUSED)
-		return (NULL);
 
-	retvec = get_txt_records(ctx, C_HS, bindname);
 	free(bindname);
 	return (retvec);
 }
@@ -261,7 +261,6 @@ hesiod_free_list(void *context, char **list) {
  */
 static int
 parse_config_file(struct hesiod_p *ctx, const char *filename) {
-	char *key, *data, *cp, **cpp;
 	char buf[MAXDNAME+7];
 	FILE *fp;
 
@@ -272,6 +271,9 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 	free(ctx->RHS);
 	free(ctx->LHS);
 	ctx->RHS = ctx->LHS = 0;
+	/* Set default query classes. */
+	ctx->classes[0] = C_IN;
+	ctx->classes[1] = C_HS;
 
 	/*
 	 * Now open and parse the file...
@@ -280,6 +282,8 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 		return (-1);
 
 	while (fgets(buf, sizeof(buf), fp) != NULL) {
+		char *key, *data, *cp, **cpp;
+
 		cp = buf;
 		if (*cp == '#' || *cp == '\n' || *cp == '\r')
 			continue;
@@ -297,17 +301,36 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 			cp++;
 		*cp++ = '\0';
 
-		if (strcmp(key, "lhs") == 0)
+		cpp = NULL;
+		if (strcasecmp(key, "lhs") == 0)
 			cpp = &ctx->LHS;
-		else if (strcmp(key, "rhs") == 0)
+		else if (strcasecmp(key, "rhs") == 0)
 			cpp = &ctx->RHS;
-		else
-			continue;
-
-		*cpp = malloc(strlen(data) + 1);
-		if (!*cpp)
-			goto cleanup;
-		strcpy(*cpp, data);
+		if (cpp) {
+			*cpp = strdup(data);
+			if (!*cpp)
+				goto cleanup;
+		} else if (strcasecmp(key, "classes") == 0) {
+			int n = 0;
+			while (*data && n < 2) {
+				cp = strchrnul(data, ',');
+				if (*cp != '\0')
+					*cp++ = '\0';
+				if (strcasecmp(data, "IN") == 0)
+					ctx->classes[n++] = C_IN;
+				else if (strcasecmp(data, "HS") == 0)
+					ctx->classes[n++] = C_HS;
+				data = cp;
+			}
+			if (n == 0) {
+				/* Restore the default.  Better than
+				   nother at all.  */
+				ctx->classes[0] = C_IN;
+				ctx->classes[1] = C_HS;
+			} else if (n == 1
+				   || ctx->classes[0] == ctx->classes[1])
+				ctx->classes[1] = 0;
+		}
 	}
 	fclose(fp);
 	return (0);
diff --git a/hesiod/hesiod_p.h b/hesiod/hesiod_p.h
index 71aca0976d..5010d71bc9 100644
--- a/hesiod/hesiod_p.h
+++ b/hesiod/hesiod_p.h
@@ -41,6 +41,7 @@ struct hesiod_p {
 	void		(*res_set)(struct hesiod_p *, struct __res_state *,
 				   void (*)(void *));
 	struct __res_state * (*res_get)(struct hesiod_p *);
+	int		classes[2];	/* The class search order. */
 };
 
 #define MAX_HESRESP	1024
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 460c037ed1..9144dd2f3f 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -1,6 +1,7 @@
 #ifndef _DLFCN_H
 #include <dlfcn/dlfcn.h>
 #include <link.h>		/* For ElfW.  */
+#include <stdbool.h>
 
 /* Internally used flag.  */
 #define __RTLD_DLOPEN	0x80000000
@@ -67,9 +68,10 @@ extern void *_dl_vsym (void *handle, const char *name, const char *version,
    and the error code passed is the return value and *OBJNAME is set to
    the object name which experienced the problems.  ERRSTRING if nonzero
    points to a malloc'ed string which the caller has to free after use.
-   ARGS is passed as argument to OPERATE.  */
+   ARGS is passed as argument to OPERATE.  MALLOCEDP is set to true only
+   if the returned string is allocated using the libc's malloc.  */
 extern int _dl_catch_error (const char **objname, const char **errstring,
-			    void (*operate) (void *),
+			    bool *mallocedp, void (*operate) (void *),
 			    void *args)
      internal_function;
 
diff --git a/include/execinfo.h b/include/execinfo.h
index 143a9cc4ce..840a0818cb 100644
--- a/include/execinfo.h
+++ b/include/execinfo.h
@@ -2,10 +2,12 @@
 #include <debug/execinfo.h>
 
 extern int __backtrace (void **__array, int __size);
+libc_hidden_proto (__backtrace)
 
 extern char **__backtrace_symbols (void *__const *__array, int __size);
 
 extern void __backtrace_symbols_fd (void *__const *__array, int __size,
 				    int __fd);
+libc_hidden_proto (__backtrace_symbols_fd)
 
 #endif
diff --git a/include/libintl.h b/include/libintl.h
index 20083d4264..8875c9444f 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -11,6 +11,7 @@ extern char *__dgettext (__const char *__domainname,
 extern char *__dcgettext (__const char *__domainname,
 			  __const char *__msgid, int __category)
      __attribute_format_arg__ (2);
+libc_hidden_proto (__dcgettext)
 extern char *__dcgettext_internal (__const char *__domainname,
 				   __const char *__msgid, int __category)
      __attribute_format_arg__ (2)
diff --git a/include/string.h b/include/string.h
index 738dd8e27c..532d5ed333 100644
--- a/include/string.h
+++ b/include/string.h
@@ -96,6 +96,7 @@ libc_hidden_builtin_proto (strcmp)
 libc_hidden_builtin_proto (strcpy)
 libc_hidden_builtin_proto (strcspn)
 libc_hidden_builtin_proto (strlen)
+libc_hidden_builtin_proto (strnlen)
 libc_hidden_builtin_proto (strncmp)
 libc_hidden_builtin_proto (strncpy)
 libc_hidden_builtin_proto (strpbrk)
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index 55f81eb887..edf98b6973 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -1,5 +1,5 @@
 /* Implementation of the dcgettext(3) function.
-   Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,4 +57,5 @@ DCGETTEXT (domainname, msgid, category)
 /* Alias for function name in GNU C Library.  */
 INTDEF(__dcgettext)
 weak_alias (__dcgettext, dcgettext);
+libc_hidden_def (__dcgettext)
 #endif
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 1ae8d3fd3a..d952f9c164 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,12 @@
+2005-06-14  Alan Modra  <amodra@bigpond.net.au>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h (PSEUDO):
+	Invoke CGOTSETUP and CGOTRESTORE.
+	(CGOTSETUP, CGOTRESTORE): Define.
+	(SINGLE_THREAD_P): Add variant for new PLT/GOT layout.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork): Avoid
+	bl into the GOT when HAVE_ASM_PPC_REL16.
+
 2005-05-30  Jakub Jelinek  <jakub@redhat.com>
 
 	* man/Makefile (SOURCES): Remove all man pages but
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
index bf541439b5..7bbab5c59c 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
+++ b/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
@@ -101,4 +101,4 @@ L(call_fork):
 	END(__vfork)
 
 libc_hidden_def(__vfork)
-weak_alias(__vfork, vfork)
+weak_alias (__vfork, vfork)
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
index 2f7c546a4c..865da8e8ca 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
@@ -37,6 +37,7 @@
     stwu 1,-48(1);							\
     mflr 9;								\
     stw 9,52(1);							\
+    CGOTSETUP;								\
     DOCARGS_##args;	/* save syscall args around CENABLE.  */	\
     CENABLE;								\
     stw 3,16(1);	/* store CENABLE return value (MASK).  */	\
@@ -50,6 +51,7 @@
     lwz 4,52(1);							\
     lwz 0,12(1);	/* restore CR/R3. */				\
     lwz 3,8(1);								\
+    CGOTRESTORE;							\
     mtlr 4;								\
     mtcr 0;								\
     addi 1,1,48;
@@ -75,6 +77,9 @@
 # define DOCARGS_6	stw 8,40(1); DOCARGS_5
 # define UNDOCARGS_6	lwz 8,40(1); UNDOCARGS_5
 
+# define CGOTSETUP
+# define CGOTRESTORE
+
 # ifdef IS_IN_libpthread
 #  define CENABLE	bl __pthread_enable_asynccancel@local
 #  define CDISABLE	bl __pthread_disable_asynccancel@local
@@ -84,6 +89,18 @@
 # else
 #  define CENABLE	bl JUMPTARGET(__librt_enable_asynccancel)
 #  define CDISABLE	bl JUMPTARGET(__librt_disable_asynccancel)
+#  if defined HAVE_AS_REL16 && defined PIC
+#   undef CGOTSETUP
+#   define CGOTSETUP							\
+    bcl 20,31,1f;							\
+ 1: stw 30,44(1);							\
+    mflr 30;								\
+    addis 30,30,_GLOBAL_OFFSET_TABLE-1b@ha;				\
+    addi 30,30,_GLOBAL_OFFSET_TABLE-1b@l
+#   undef CGOTRESTORE
+#   define CGOTRESTORE							\
+    lwz 30,44(1)
+#  endif
 # endif
 
 # ifdef HAVE_TLS_SUPPORT
@@ -111,7 +128,17 @@ extern int __local_multiple_threads attribute_hidden;
   lwz 10,__local_multiple_threads@l(10);				\
   cmpwi 10,0
 #   else
-#    define SINGLE_THREAD_P						\
+#    ifdef HAVE_ASM_PPC_REL16
+#     define SINGLE_THREAD_P						\
+  mflr 9;								\
+  bcl 20,31,1f;								\
+1:mflr 10;								\
+  addis 10,10,__local_multiple_threads-1b@ha;				\
+  lwz 10,__local_multiple_threads-1b@l(10);				\
+  mtlr 9;								\
+  cmpwi 10,0
+#    else
+#     define SINGLE_THREAD_P						\
   mflr 9;								\
   bl _GLOBAL_OFFSET_TABLE_@local-4;					\
   mflr 10;								\
@@ -119,6 +146,7 @@ extern int __local_multiple_threads attribute_hidden;
   lwz 10,__local_multiple_threads@got(10);				\
   lwz 10,0(10);								\
   cmpwi 10,0
+#    endif
 #   endif
 #  endif
 # endif
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
index 920c45eee2..724d4cc541 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
+++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
@@ -31,11 +31,19 @@ ENTRY (__vfork)
 #ifdef __NR_vfork
 # ifdef SHARED
 	mflr	9
+#  ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	10
+	addis	10,10,__libc_pthread_functions-1b@ha
+	lwz	10,__libc_pthread_functions-1b@l(10)
+	mtlr	9
+#  else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	10
 	mtlr	9
 	lwz	10,__libc_pthread_functions@got(10)
 	lwz	10,0(10)
+#  endif
 # else
 	.weak	pthread_create
 	lis	10,pthread_create@ha
diff --git a/locale/Makefile b/locale/Makefile
index b493c1c9b9..2f2d2ba5f1 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -100,7 +100,6 @@ locale-CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-charmap-dir.c = -Wno-write-strings
-CFLAGS-loadlocale.c = $(fno-unit-at-a-time)
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index d5b6cdd26e..d375eb62d9 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,9 @@
+2005-05-28  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #622]
+	* locales/pa_IN (am_pm): Fix typos.
+	Patch by Denis Barbier <barbier@linuxfr.org>.
+
 2005-05-22  Ulrich Drepper  <drepper@redhat.com>
 
 	* locales/mn_MN: Update.  Patch by Sanlig Badral <s_badral@yahoo.com>.
diff --git a/localedata/locales/pa_IN b/localedata/locales/pa_IN
index 96fa896e85..f7b0bf2173 100644
--- a/localedata/locales/pa_IN
+++ b/localedata/locales/pa_IN
@@ -122,8 +122,8 @@ mon         "<U0A1C><U0A28><U0A35><U0A30><U0A40>";/
 
 %
 % Equivalent of AM PM
-am_pm       "<U0A38><U0035><U0A47><U0A30><U0A47>";/
-            "<U0A36><U0A3E><U002E>"
+am_pm       "<U0A38><U0A35><U0A47><U0A30><U0A47>";/
+            "<U0A36><U0A3E><U0A2E>"
 
 %
 % Appropriate date and time representation
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0452afe8b5..470d4b9887 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,16 @@
+2005-06-14  Alan Modra  <amodra@bigpond.net.au>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h (PSEUDO):
+	Invoke CGOTSETUP and CGOTRESTORE.
+	(CGOTSETUP, CGOTRESTORE): Define.
+
+2005-05-29  Richard Henderson  <rth@redhat.com>
+
+	* tst-cancel4.c (WRITE_BUFFER_SIZE): New.
+	(tf_write, tf_writev): Use it.
+	(do_test): Use socketpair instead of pipe.  Set SO_SNDBUF to
+	the system minimum.
+
 2005-05-23  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
index 393c171eef..84acf38434 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
@@ -45,6 +45,7 @@
     mflr 9;								\
     stw 9,52(1);							\
     cfi_offset (lr, 4);							\
+    CGOTSETUP;								\
     DOCARGS_##args;	/* save syscall args around CENABLE.  */	\
     CENABLE;								\
     stw 3,16(1);	/* store CENABLE return value (MASK).  */	\
@@ -58,6 +59,7 @@
     lwz 4,52(1);							\
     lwz 0,12(1);	/* restore CR/R3. */				\
     lwz 3,8(1);								\
+    CGOTRESTORE;							\
     mtlr 4;								\
     mtcr 0;								\
     addi 1,1,48;							\
@@ -84,6 +86,9 @@
 # define DOCARGS_6	stw 8,40(1); DOCARGS_5
 # define UNDOCARGS_6	lwz 8,40(1); UNDOCARGS_5
 
+# define CGOTSETUP
+# define CGOTRESTORE
+
 # ifdef IS_IN_libpthread
 #  define CENABLE	bl __pthread_enable_asynccancel@local
 #  define CDISABLE	bl __pthread_disable_asynccancel@local
@@ -93,6 +98,18 @@
 # elif defined IS_IN_librt
 #  define CENABLE	bl JUMPTARGET(__librt_enable_asynccancel)
 #  define CDISABLE	bl JUMPTARGET(__librt_disable_asynccancel)
+#  if defined HAVE_AS_REL16 && defined PIC
+#   undef CGOTSETUP
+#   define CGOTSETUP							\
+    bcl 20,31,1f;							\
+ 1: stw 30,44(1);							\
+    mflr 30;								\
+    addis 30,30,_GLOBAL_OFFSET_TABLE-1b@ha;				\
+    addi 30,30,_GLOBAL_OFFSET_TABLE-1b@l
+#   undef CGOTRESTORE
+#   define CGOTRESTORE							\
+    lwz 30,44(1)
+#  endif
 # else
 #  error Unsupported library
 # endif
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
index c3e527fd1c..cb7619688e 100644
--- a/nptl/tst-cancel4.c
+++ b/nptl/tst-cancel4.c
@@ -84,6 +84,8 @@ static pthread_barrier_t b2;
 # define IPC_ADDVAL 0
 #endif
 
+#define WRITE_BUFFER_SIZE 4096
+
 /* Cleanup handling test.  */
 static int cl_called;
 
@@ -220,7 +222,7 @@ tf_write  (void *arg)
   ssize_t s;
   pthread_cleanup_push (cl, NULL);
 
-  char buf[100000];
+  char buf[WRITE_BUFFER_SIZE];
   memset (buf, '\0', sizeof (buf));
   s = write (fd, buf, sizeof (buf));
 
@@ -266,7 +268,7 @@ tf_writev  (void *arg)
   ssize_t s;
   pthread_cleanup_push (cl, NULL);
 
-  char buf[100000];
+  char buf[WRITE_BUFFER_SIZE];
   memset (buf, '\0', sizeof (buf));
   struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
   s = writev (fd, iov, 1);
@@ -2043,11 +2045,29 @@ static struct
 static int
 do_test (void)
 {
-  if (pipe (fds) != 0)
+  int val;
+  socklen_t len;
+
+  if (socketpair (AF_UNIX, SOCK_STREAM, PF_UNIX, fds) != 0)
+    {
+      perror ("socketpair");
+      exit (1);
+    }
+
+  val = 1;
+  len = sizeof(val);
+  setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val));
+  if (getsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, &len) < 0)
+    {
+      perror ("getsockopt");
+      exit (1);
+    }
+  if (val >= WRITE_BUFFER_SIZE)
     {
-      puts ("pipe failed");
+      puts ("minimum write buffer size too large");
       exit (1);
     }
+  setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val));
 
   int result = 0;
   size_t cnt;
diff --git a/nscd/Makefile b/nscd/Makefile
index 7e0c4eb30a..2ebd90b989 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -53,8 +53,12 @@ endif
 
 all-nscd-modules := $(nscd-modules) selinux
 ifeq (yes,$(have-selinux))
+ifeq (yes,$(have-libaudit))
+libaudit = -laudit
+endif
+
 nscd-modules += selinux
-selinux-LIBS := -lselinux
+selinux-LIBS := -lselinux $(libaudit)
 endif
 
 LDLIBS-nscd = $(selinux-LIBS)
diff --git a/nscd/selinux.c b/nscd/selinux.c
index f57f0920ae..4dc4df3648 100644
--- a/nscd/selinux.c
+++ b/nscd/selinux.c
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include "config.h"
 #include <error.h>
 #include <errno.h>
 #include <libintl.h>
@@ -30,6 +31,9 @@
 #include <selinux/avc.h>
 #include <selinux/flask.h>
 #include <selinux/selinux.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
 
 #include "dbg_log.h"
 #include "selinux.h"
@@ -66,6 +70,11 @@ static struct avc_entry_ref aeref;
 /* Thread to listen for SELinux status changes via netlink.  */
 static pthread_t avc_notify_thread;
 
+#ifdef HAVE_LIBAUDIT
+/* Prototype for supporting the audit daemon */
+static void log_callback (const char *fmt, ...);
+#endif
+
 /* Prototypes for AVC callback functions.  */
 static void *avc_create_thread (void (*run) (void));
 static void avc_stop_thread (void *thread);
@@ -77,7 +86,11 @@ static void avc_free_lock (void *lock);
 /* AVC callback structures for use in avc_init.  */
 static const struct avc_log_callback log_cb =
 {
+#ifdef HAVE_LIBAUDIT
+  .func_log = log_callback,
+#else
   .func_log = dbg_log,
+#endif
   .func_audit = NULL
 };
 static const struct avc_thread_callback thread_cb =
@@ -93,6 +106,30 @@ static const struct avc_lock_callback lock_cb =
   .func_free_lock = avc_free_lock
 };
 
+#ifdef HAVE_LIBAUDIT
+/* The audit system's netlink socket descriptor */
+static int audit_fd = -1;
+
+/* When an avc denial occurs, log it to audit system */
+static void 
+log_callback (const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start (ap, fmt);
+  audit_log_avc (audit_fd, AUDIT_USER_AVC, fmt, ap);
+  va_end (ap);
+}
+
+/* Initialize the connection to the audit system */
+static void 
+audit_init (void)
+{
+  audit_fd = audit_open ();
+  if (audit_fd < 0)
+     dbg_log (_("Failed opening connection to the audit subsystem"));
+}
+#endif /* HAVE_LIBAUDIT */
 
 /* Determine if we are running on an SELinux kernel. Set selinux_enabled
    to the result.  */
@@ -182,6 +219,9 @@ nscd_avc_init (void)
     error (EXIT_FAILURE, errno, _("Failed to start AVC"));
   else
     dbg_log (_("Access Vector Cache (AVC) started"));
+#ifdef HAVE_LIBAUDIT
+  audit_init ();
+#endif
 }
 
 
@@ -262,6 +302,9 @@ void
 nscd_avc_destroy (void)
 {
   avc_destroy ();
+#ifdef HAVE_LIBAUDIT
+  audit_close (audit_fd);
+#endif
 }
 
 #endif /* HAVE_SELINUX */
diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c
index 355a784124..c03acf5e16 100644
--- a/posix/tst-mmap.c
+++ b/posix/tst-mmap.c
@@ -30,7 +30,7 @@ main (void)
   for (c = 0; c < sizeof (buf); ++c)
     buf[c] = '0' + (c % 10);
 
-  for (c = 0; c < 20; ++c)
+  for (c = 0; c < (ps * 4) / sizeof (buf); ++c)
     if (fwrite (buf, 1, sizeof (buf), fp) != sizeof (buf))
       {
 	printf ("`fwrite' failed: %m\n");
@@ -40,7 +40,7 @@ main (void)
   assert (ps + 1000 < c * sizeof (buf));
 
   /* First try something which is not allowed: map at an offset which is
-     not module the pagesize.  */
+     not modulo the pagesize.  */
   ptr = mmap (NULL, 1000, PROT_READ, MAP_SHARED, fd, ps - 1);
   if (ptr != MAP_FAILED)
     {
diff --git a/sysdeps/alpha/div_libc.h b/sysdeps/alpha/div_libc.h
index 62b4470355..b731b02e25 100644
--- a/sysdeps/alpha/div_libc.h
+++ b/sysdeps/alpha/div_libc.h
@@ -34,6 +34,12 @@
 #define RV	t12
 #define RA	t9
 
+/* The secureplt format does not allow the division routines to be called
+   via plt; there aren't enough registers free to be clobbered.  Avoid 
+   setting the symbol type to STT_FUNC, so that the linker won't be tempted
+   to create a plt entry.  */
+#define funcnoplt notype
+
 /* None of these functions should use implicit anything.  */
 	.set	nomacro
 	.set	noat
diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S
index 408d66db00..9bac0450d0 100644
--- a/sysdeps/alpha/divl.S
+++ b/sysdeps/alpha/divl.S
@@ -36,7 +36,7 @@
 	.text
 	.align	4
 	.globl	__divl
-	.type	__divl, @function
+	.type	__divl, @funcnoplt
 	.usepv	__divl, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S
index 7f245ac056..d2ed2c5af6 100644
--- a/sysdeps/alpha/divq.S
+++ b/sysdeps/alpha/divq.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__divq
-	.type	__divq, @function
+	.type	__divq, @funcnoplt
 	.usepv	__divq, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S
index fc00fa133c..f2a8a4d533 100644
--- a/sysdeps/alpha/divqu.S
+++ b/sysdeps/alpha/divqu.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__divqu
-	.type	__divqu, @function
+	.type	__divqu, @funcnoplt
 	.usepv	__divqu, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/dl-dtprocnum.h b/sysdeps/alpha/dl-dtprocnum.h
new file mode 100644
index 0000000000..67845cdd62
--- /dev/null
+++ b/sysdeps/alpha/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture.  By
+   default there are none.  */
+#define DT_THISPROCNUM	DT_ALPHA_NUM
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 173a4111f8..88c357ea07 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -33,6 +33,9 @@
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK	0x120000000UL
 
+/* Translate a processor specific dynamic tag to the index in l_info array.  */
+#define DT_ALPHA(x) (DT_ALPHA_##x - DT_LOPROC + DT_NUM)
+
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf64_Ehdr *ehdr)
@@ -55,105 +58,74 @@ elf_machine_dynamic (void)
 }
 
 /* Return the run-time load address of the shared object.  */
+
 static inline Elf64_Addr
 elf_machine_load_address (void)
 {
-  /* NOTE: While it is generally unfriendly to put data in the text
-     segment, it is only slightly less so when the "data" is an
-     instruction.  While we don't have to worry about GLD just yet, an
-     optimizing linker might decide that our "data" is an unreachable
-     instruction and throw it away -- with the right switches, DEC's
-     linker will do this.  What ought to happen is we should add
-     something to GAS to allow us access to the new GPREL_HI32/LO32
-     relocation types stolen from OSF/1 3.0.  */
-  /* This code relies on the fact that BRADDR relocations do not
-     appear in dynamic relocation tables.  Not that that would be very
-     useful anyway -- br/bsr has a 4MB range and the shared libraries
-     are usually many many terabytes away.  */
-
-  Elf64_Addr dot;
-  long int zero_disp;
-
-  asm("br %0, 1f\n"
-      "0:\n\t"
-      "br $0, 2f\n"
-      "1:\n\t"
-      ".section\t.data\n"
-      "2:\n\t"
-      ".quad 0b\n\t"
-      ".previous"
-      : "=r"(dot));
-
-  zero_disp = *(int *) dot;
-  zero_disp = (zero_disp << 43) >> 41;
-
-  return dot - *(Elf64_Addr *) (dot + 4 + zero_disp);
+  /* This relies on the compiler using gp-relative addresses for static symbols.  */
+  static void *dot = &dot;
+  return (void *)&dot - dot;
 }
 
 /* Set up the loaded object described by L so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.  */
 
 static inline int
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 {
-  Elf64_Addr plt;
-  extern void _dl_runtime_resolve (void);
-  extern void _dl_runtime_profile (void);
+  extern char _dl_runtime_resolve_new[] attribute_hidden;
+  extern char _dl_runtime_profile_new[] attribute_hidden;
+  extern char _dl_runtime_resolve_old[] attribute_hidden;
+  extern char _dl_runtime_profile_old[] attribute_hidden;
+
+  struct pltgot {
+    char *resolve;
+    struct link_map *link;
+  };
+
+  struct pltgot *pg;
+  long secureplt;
+  char *resolve;
+
+  if (map->l_info[DT_JMPREL] == 0 || !lazy)
+    return lazy;
+
+  /* Check to see if we're using the read-only plt form.  */
+  secureplt = map->l_info[DT_ALPHA(PLTRO)] != 0;
+
+  /* If the binary uses the read-only secure plt format, PG points to
+     the .got.plt section, which is the right place for ld.so to place
+     its hooks.  Otherwise, PG is currently pointing at the start of
+     the plt; the hooks go at offset 16.  */
+  pg = (struct pltgot *) D_PTR (map, l_info[DT_PLTGOT]);
+  pg += !secureplt;
+
+  /* This function will be called to perform the relocation.  They're
+     not declared as functions to convince the compiler to use gp
+     relative relocations for them.  */
+  if (secureplt)
+    resolve = _dl_runtime_resolve_new;
+  else
+    resolve = _dl_runtime_resolve_old;
 
-  if (l->l_info[DT_JMPREL] && lazy)
+  if (__builtin_expect (profile, 0))
     {
-      /* The GOT entries for the functions in the PLT have not been
-	 filled in yet.  Their initial contents are directed to the
-	 PLT which arranges for the dynamic linker to be called.  */
-      plt = D_PTR (l, l_info[DT_PLTGOT]);
-
-      /* This function will be called to perform the relocation.  */
-      if (__builtin_expect (profile, 0))
-	{
-	  *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile;
-
-	  if (GLRO(dl_profile) != NULL
-	      && _dl_name_match_p (GLRO(dl_profile), l))
-	    {
-	      /* This is the object we are looking for.  Say that we really
-		 want profiling and the timers are started.  */
-	      GL(dl_profile_map) = l;
-	    }
-	}
+      if (secureplt)
+	resolve = _dl_runtime_profile_new;
       else
-        *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_resolve;
-
-      /* Identify this shared object */
-      *(Elf64_Addr *)(plt + 24) = (Elf64_Addr) l;
+	resolve = _dl_runtime_profile_old;
 
-      /* If the first instruction of the plt entry is not
-	 "br $28, plt0", we have to reinitialize .plt for lazy relocation.  */
-      if (*(unsigned int *)(plt + 32) != 0xc39ffff7)
+      if (GLRO(dl_profile) && _dl_name_match_p (GLRO(dl_profile), map))
 	{
-	  unsigned int val = 0xc39ffff7;
-	  unsigned int *slot, *end;
-	  const Elf64_Rela *rela = (const Elf64_Rela *)
-				   D_PTR (l, l_info[DT_JMPREL]);
-	  Elf64_Addr l_addr = l->l_addr;
-
-	  /* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */
-	  *(unsigned long *)plt = 0xa77b000cc3600000;
-	  *(unsigned long *)(plt + 8) = 0x6b7b000047ff041f;
-	  slot = (unsigned int *)(plt + 32);
-	  end = (unsigned int *)(plt + 32
-				 + l->l_info[DT_PLTRELSZ]->d_un.d_val / 2);
-	  while (slot < end)
-	    {
-	      /* br at,.plt+0 */
-	      *slot = val;
-	      *(Elf64_Addr *) rela->r_offset = (Elf64_Addr) slot - l_addr;
-	      val -= 3;
-	      slot += 3;
-	      ++rela;
-	    }
+	  /* This is the object we are looking for.  Say that we really
+	     want profiling and the timers are started.  */
+	  GL(dl_profile_map) = map;
 	}
     }
 
+  pg->resolve = resolve;
+  pg->link = map;
+
   return lazy;
 }
 
@@ -280,7 +252,7 @@ $fixup_stack:							\n\
 /* Fix up the instructions of a PLT entry to invoke the function
    rather than the dynamic linker.  */
 static inline Elf64_Addr
-elf_machine_fixup_plt (struct link_map *l, lookup_t t,
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 		       const Elf64_Rela *reloc,
 		       Elf64_Addr *got_addr, Elf64_Addr value)
 {
@@ -291,10 +263,16 @@ elf_machine_fixup_plt (struct link_map *l, lookup_t t,
   /* Store the value we are going to load.  */
   *got_addr = value;
 
+  /* If this binary uses the read-only secure plt format, we're done.  */
+  if (map->l_info[DT_ALPHA(PLTRO)])
+    return value;
+
+  /* Otherwise we have to modify the plt entry in place to do the branch.  */
+
   /* Recover the PLT entry address by calculating reloc's index into the
      .rela.plt, and finding that entry in the .plt.  */
-  rela_plt = (void *) D_PTR (l, l_info[DT_JMPREL]);
-  plte = (void *) (D_PTR (l, l_info[DT_PLTGOT]) + 32);
+  rela_plt = (const Elf64_Rela *) D_PTR (map, l_info[DT_JMPREL]);
+  plte = (Elf64_Word *) (D_PTR (map, l_info[DT_PLTGOT]) + 32);
   plte += 3 * (reloc - rela_plt);
 
   /* Find the displacement from the plt entry to the function.  */
diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S
index 42350836ef..c52efbb3bc 100644
--- a/sysdeps/alpha/dl-trampoline.S
+++ b/sysdeps/alpha/dl-trampoline.S
@@ -21,13 +21,202 @@
 
 	.set noat
 
-	.globl	_dl_runtime_resolve
-	.ent	_dl_runtime_resolve
+.macro savei regno, offset
+	stq	$\regno, \offset($30)
+	cfi_rel_offset(\regno, \offset)
+.endm
+
+.macro savef regno, offset
+	stt	$f\regno, \offset($30)
+	cfi_rel_offset(\regno+32, \offset)
+.endm
+
+	.align	4
+	.globl	_dl_runtime_resolve_new
+	.ent	_dl_runtime_resolve_new
+
+#undef FRAMESIZE
+#define FRAMESIZE	14*8
+
+_dl_runtime_resolve_new:
+	.frame	$30, FRAMESIZE, $26, 0
+	.mask	0x4000000, 0
+
+	ldah	$29, 0($27)		!gpdisp!1
+	lda	$30, -FRAMESIZE($30)
+	stq	$26, 0*8($30)
+	stq	$16, 2*8($30)
+
+	stq	$17, 3*8($30)
+	lda	$29, 0($29)		!gpdisp!1
+	stq	$18, 4*8($30)
+	mov	$28, $16		/* link_map from .got.plt */
+
+	stq	$19, 5*8($30)
+	mov	$25, $17		/* offset of reloc entry */
+	stq	$20, 6*8($30)
+	mov	$26, $18		/* return address */
+
+	stq	$21, 7*8($30)
+	stt	$f16, 8*8($30)
+	stt	$f17, 9*8($30)
+	stt	$f18, 10*8($30)
+
+	stt	$f19, 11*8($30)
+	stt	$f20, 12*8($30)
+	stt	$f21, 13*8($30)
+	.prologue 2
+
+	bsr	$26, _dl_fixup		!samegp
+	mov	$0, $27
+
+	ldq	$26, 0*8($30)
+	ldq	$16, 2*8($30)
+	ldq	$17, 3*8($30)
+	ldq	$18, 4*8($30)
+	ldq	$19, 5*8($30)
+	ldq	$20, 6*8($30)
+	ldq	$21, 7*8($30)
+	ldt	$f16, 8*8($30)
+	ldt	$f17, 9*8($30)
+	ldt	$f18, 10*8($30)
+	ldt	$f19, 11*8($30)
+	ldt	$f20, 12*8($30)
+	ldt	$f21, 13*8($30)
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27), 0
+	.end	_dl_runtime_resolve_new
+
+	.globl	_dl_runtime_profile_new
+	.type	_dl_runtime_profile_new, @function
+
+#undef FRAMESIZE
+#define FRAMESIZE	20*8
+
+	/* We save the registers in a different order than desired by
+	   .mask/.fmask, so we have to use explicit cfi directives.  */
+	cfi_startproc
+
+_dl_runtime_profile_new:
+	ldah	$29, 0($27)		!gpdisp!2
+	lda	$30, -FRAMESIZE($30)
+	savei	26, 0*8
+	stq	$16, 2*8($30)
+
+	stq	$17, 3*8($30)
+	lda	$29, 0($29)		!gpdisp!2
+	stq	$18, 4*8($30)
+	lda	$1, FRAMESIZE($30)	/* incoming sp value */
+
+	stq	$1, 1*8($30)
+	stq	$19, 5*8($30)
+	stq	$20, 6*8($30)
+	mov	$28, $16		/* link_map from .got.plt */
+
+	stq	$21, 7*8($30)
+	mov	$25, $17		/* offset of reloc entry */
+	stt	$f16, 8*8($30)
+	mov	$26, $18		/* return address */
+
+	stt	$f17, 9*8($30)
+	mov	$30, $19		/* La_alpha_regs address */
+	stt	$f18, 10*8($30)
+	lda	$20, 14*8($30)		/* framesize address */
+
+	stt	$f19, 11*8($30)
+	stt	$f20, 12*8($30)
+	stt	$f21, 13*8($30)
+	stq	$28, 16*8($30)
+	stq	$25, 17*8($30)
+
+	bsr	$26, _dl_profile_fixup	!samegp
+	mov	$0, $27
+
+	/* Discover if we're wrapping this call.  */
+	ldq	$18, 14*8($30)
+	bge	$18, 1f
+
+	ldq	$26, 0*8($30)
+	ldq	$16, 2*8($30)
+	ldq	$17, 3*8($30)
+	ldq	$18, 4*8($30)
+	ldq	$19, 5*8($30)
+	ldq	$20, 6*8($30)
+	ldq	$21, 7*8($30)
+	ldt	$f16, 8*8($30)
+	ldt	$f17, 9*8($30)
+	ldt	$f18, 10*8($30)
+	ldt	$f19, 11*8($30)
+	ldt	$f20, 12*8($30)
+	ldt	$f21, 13*8($30)
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27), 0
+
+1:
+	/* Create a frame pointer and allocate a new argument frame.  */
+	savei	15, 15*8
+	mov	$30, $15
+	cfi_def_cfa_register (15)
+	addq	$18, 15, $18
+	bic	$18, 15, $18
+	subq	$30, $18, $30
+
+	/* Save the call destination around memcpy.  */
+	stq	$0, 14*8($30)
+
+	/* Copy the stack arguments into place.  */
+	lda	$16, 0($30)
+	lda	$17, FRAMESIZE($15)
+	jsr	$26, memcpy
+	ldgp	$29, 0($26)
+
+	/* Reload the argument registers.  */
+	ldq	$27, 14*8($30)
+	ldq	$16, 2*8($15)
+	ldq	$17, 3*8($15)
+	ldq	$18, 4*8($15)
+	ldq	$19, 5*8($15)
+	ldq	$20, 6*8($15)
+	ldq	$21, 7*8($15)
+	ldt	$f16, 8*8($15)
+	ldt	$f17, 9*8($15)
+	ldt	$f18, 10*8($15)
+	ldt	$f19, 11*8($15)
+	ldt	$f20, 12*8($15)
+	ldt	$f21, 13*8($15)
+
+	jsr	$26, ($27), 0
+	ldgp	$29, 0($26)
+
+	/* Set up for call to _dl_call_pltexit.  */
+	ldq	$16, 16*8($15)
+	ldq	$17, 17*8($15)
+	stq	$0, 16*8($15)
+	lda	$18, 0($15)
+	stq	$1, 17*8($15)
+	lda	$19, 16*8($15)
+	stt	$f0, 18*8($15)
+	stt	$f1, 19*8($15)
+	bsr	$26, _dl_call_pltexit	!samegp
+
+	mov	$15, $30
+	cfi_def_cfa_register (30)
+	ldq	$26, 0($30)
+	ldq	$15, 15*8($30)
+	lda	$30, FRAMESIZE($30)
+	ret
+
+	cfi_endproc
+	.size	_dl_runtime_profile_new, .-_dl_runtime_profile_new
+
+	.align	4
+	.globl	_dl_runtime_resolve_old
+	.ent	_dl_runtime_resolve_old
 
 #undef FRAMESIZE
 #define FRAMESIZE	44*8
 
-_dl_runtime_resolve:
+_dl_runtime_resolve_old:
 	lda	$30, -FRAMESIZE($30)
 	.frame	$30, FRAMESIZE, $26
 	/* Preserve all registers that C normally doesn't.  */
@@ -146,30 +335,21 @@ _dl_runtime_resolve:
 	lda	$30, FRAMESIZE($30)
 	jmp	$31, ($27)
 
-	.end	_dl_runtime_resolve
+	.end	_dl_runtime_resolve_old
 
-	.globl	_dl_runtime_profile
-	.usepv	_dl_runtime_profile, no
-	.type	_dl_runtime_profile, @function
+	.globl	_dl_runtime_profile_old
+	.usepv	_dl_runtime_profile_old, no
+	.type	_dl_runtime_profile_old, @function
 
 	/* We save the registers in a different order than desired by
 	   .mask/.fmask, so we have to use explicit cfi directives.  */
 	cfi_startproc
 
-.macro savei regno, offset
-	stq	$\regno, \offset($30)
-	cfi_rel_offset(\regno, \offset)
-.endm
-
-.macro savef regno, offset
-	stt	$f\regno, \offset($30)
-	cfi_rel_offset(\regno+32, \offset)
-.endm
-
 #undef FRAMESIZE
 #define FRAMESIZE	50*8
 
-_dl_runtime_profile:
+	.align	4
+_dl_runtime_profile_old:
 	lda	$30, -FRAMESIZE($30)
 	cfi_adjust_cfa_offset (FRAMESIZE)
 
@@ -340,8 +520,8 @@ _dl_runtime_profile:
 	ldgp	$29, 0($26)
 
 	/* Set up for call to _dl_call_pltexit.  */
-	ldq	$16, 48($15)
-	ldq	$17, 49($15)
+	ldq	$16, 48*8($15)
+	ldq	$17, 49*8($15)
 	stq	$0, 46*8($15)
 	lda	$18, 0($15)
 	stq	$1, 47*8($15)
@@ -358,4 +538,4 @@ _dl_runtime_profile:
 	ret
 
 	cfi_endproc
-	.size	_dl_runtime_profile, .-_dl_runtime_profile
+	.size	_dl_runtime_profile_old, .-_dl_runtime_profile_old
diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S
index 3c2bc59adc..ebe14b4c8e 100644
--- a/sysdeps/alpha/elf/start.S
+++ b/sysdeps/alpha/elf/start.S
@@ -77,7 +77,7 @@ _start:
 	.end _start
 
 /* For ECOFF backwards compatibility. */
-weak_alias(_start, __start)
+weak_alias (_start, __start)
 
 /* Define a symbol for the first piece of initialized data.  */
 	.data
diff --git a/sysdeps/alpha/htonl.S b/sysdeps/alpha/htonl.S
index eb4fbd2ab4..ef2a575995 100644
--- a/sysdeps/alpha/htonl.S
+++ b/sysdeps/alpha/htonl.S
@@ -41,4 +41,4 @@ ENTRY(htonl)
 
 	END(htonl)
 
-weak_alias(htonl, ntohl)
+weak_alias (htonl, ntohl)
diff --git a/sysdeps/alpha/htons.S b/sysdeps/alpha/htons.S
index f1ef754814..7c6270226d 100644
--- a/sysdeps/alpha/htons.S
+++ b/sysdeps/alpha/htons.S
@@ -37,4 +37,4 @@ ENTRY(htons)
 
 	END(htons)
 
-weak_alias(htons, ntohs)
+weak_alias (htons, ntohs)
diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S
index bfc3be5c3f..ae291b0505 100644
--- a/sysdeps/alpha/reml.S
+++ b/sysdeps/alpha/reml.S
@@ -38,7 +38,7 @@
 	.text
 	.align	4
 	.globl	__reml
-	.type	__reml, @function
+	.type	__reml, @funcnoplt
 	.usepv	__reml, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S
index 645a834453..64e958bb95 100644
--- a/sysdeps/alpha/remq.S
+++ b/sysdeps/alpha/remq.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__remq
-	.type	__remq, @function
+	.type	__remq, @funcnoplt
 	.usepv	__remq, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S
index bfa78dff57..dcc1c88b3c 100644
--- a/sysdeps/alpha/remqu.S
+++ b/sysdeps/alpha/remqu.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__remqu
-	.type	__remqu, @function
+	.type	__remqu, @funcnoplt
 	.usepv	__remqu, no
 
 	cfi_startproc
diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c
index 6a3336c6d2..f2d52372d5 100644
--- a/sysdeps/generic/backtrace.c
+++ b/sysdeps/generic/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.  Generic version.
-   Copyright (C) 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -91,3 +91,4 @@ __backtrace (array, size)
   return cnt;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/generic/backtracesymsfd.c b/sysdeps/generic/backtracesymsfd.c
index c704362ec7..b01f8b0094 100644
--- a/sysdeps/generic/backtracesymsfd.c
+++ b/sysdeps/generic/backtracesymsfd.c
@@ -1,5 +1,5 @@
 /* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -61,3 +61,4 @@ __backtrace_symbols_fd (array, size, fd)
     }
 }
 weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
+libc_hidden_def (__backtrace_symbols_fd)
diff --git a/sysdeps/generic/elf/backtracesymsfd.c b/sysdeps/generic/elf/backtracesymsfd.c
index 16df53883c..6754d145b0 100644
--- a/sysdeps/generic/elf/backtracesymsfd.c
+++ b/sysdeps/generic/elf/backtracesymsfd.c
@@ -1,5 +1,5 @@
 /* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -107,3 +107,4 @@ __backtrace_symbols_fd (array, size, fd)
     }
 }
 weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
+libc_hidden_def (__backtrace_symbols_fd)
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 2e3254356b..a24c2ff58e 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -674,7 +674,7 @@ struct rtld_global_ro
   void (*_dl_debug_printf) (const char *, ...)
        __attribute__ ((__format__ (__printf__, 1, 2)));
   int (internal_function *_dl_catch_error) (const char **, const char **,
-					    void (*) (void *), void *);
+					    bool *, void (*) (void *), void *);
   void (internal_function *_dl_signal_error) (int, const char *, const char *,
 					      const char *);
   void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
@@ -754,10 +754,6 @@ extern char **_dl_argv_internal attribute_hidden
 # define rtld_progname _dl_argv[0]
 #endif
 
-/* The array with message we print as a last resort.  */
-extern const char _dl_out_of_memory[];
-rtld_hidden_proto (_dl_out_of_memory)
-
 /* Flag set at startup and cleared when the last initializer has run.  */
 extern int _dl_starting_up;
 weak_extern (_dl_starting_up)
diff --git a/sysdeps/generic/strnlen.c b/sysdeps/generic/strnlen.c
index c83520e349..454257b2bc 100644
--- a/sysdeps/generic/strnlen.c
+++ b/sysdeps/generic/strnlen.c
@@ -1,5 +1,5 @@
 /* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 1991, 1993, 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
    Based on strlen written by Torbjorn Granlund (tege@sics.se),
@@ -158,3 +158,4 @@ __strnlen (const char *str, size_t maxlen)
   return char_ptr - str;
 }
 weak_alias (__strnlen, strnlen)
+libc_hidden_def (strnlen)
diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c
index cb7530396b..8b61913dde 100644
--- a/sysdeps/i386/backtrace.c
+++ b/sysdeps/i386/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -141,3 +141,4 @@ __backtrace (array, size)
   return arg.cnt != -1 ? arg.cnt : 0;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S
index 727d7a0ab8..8b11adb2e3 100644
--- a/sysdeps/i386/i386-mcount.S
+++ b/sysdeps/i386/i386-mcount.S
@@ -52,4 +52,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index 56ba304328..2739cb00b3 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -131,6 +131,33 @@ lose: SYSCALL_PIC_SETUP							      \
 0:  popl %ebx;								      \
     cfi_adjust_cfa_offset (-4);						      \
     addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx;
+
+# ifndef HAVE_HIDDEN
+#  define SETUP_PIC_REG(reg) \
+  call 1f;								      \
+  .subsection 1;							      \
+1:movl (%esp), %e##reg;							      \
+  ret;									      \
+  .previous
+# else
+#  define SETUP_PIC_REG(reg) \
+  .ifndef __i686.get_pc_thunk.reg;					      \
+  .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits;	      \
+  .globl __i686.get_pc_thunk.reg;					      \
+  .hidden __i686.get_pc_thunk.reg;					      \
+  .type __i686.get_pc_thunk.reg,@function;				      \
+__i686.get_pc_thunk.reg:						      \
+  movl (%esp), %e##reg;							      \
+  ret;									      \
+  .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg;		      \
+  .previous;								      \
+  .endif;								      \
+  call __i686.get_pc_thunk.reg
+# endif
+
+# define LOAD_PIC_REG(reg) \
+  SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
+
 #else
 #define JUMPTARGET(name)	name
 #define SYSCALL_PIC_SETUP	/* Nothing.  */
diff --git a/sysdeps/ia64/backtrace.c b/sysdeps/ia64/backtrace.c
index efacccce15..3f2b75ec03 100644
--- a/sysdeps/ia64/backtrace.c
+++ b/sysdeps/ia64/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -90,3 +90,4 @@ __backtrace (array, size)
   return arg.cnt != -1 ? arg.cnt : 0;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/ia64/fpu/e_lgamma_r.c b/sysdeps/ia64/fpu/e_lgamma_r.c
index ebc90fc8f3..cb9efbfe02 100644
--- a/sysdeps/ia64/fpu/e_lgamma_r.c
+++ b/sysdeps/ia64/fpu/e_lgamma_r.c
@@ -60,12 +60,12 @@ double __ieee754_lgamma_r(double x, int* signgam)
 {
     return __libm_lgamma(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_lgamma_r, lgamma_r)
+weak_alias (__ieee754_lgamma_r, lgamma_r)
 
 #ifndef _LIBC
 double __ieee754_gamma_r(double x, int* signgam)
 {
     return __libm_lgamma(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_gamma_r, gamma_r)
+weak_alias (__ieee754_gamma_r, gamma_r)
 #endif
diff --git a/sysdeps/ia64/fpu/e_lgammaf_r.c b/sysdeps/ia64/fpu/e_lgammaf_r.c
index 4efa84064c..44911aeabd 100644
--- a/sysdeps/ia64/fpu/e_lgammaf_r.c
+++ b/sysdeps/ia64/fpu/e_lgammaf_r.c
@@ -60,12 +60,12 @@ float __ieee754_lgammaf_r(float x, int* signgam)
 {
     return __libm_lgammaf(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_lgammaf_r, lgammaf_r)
+weak_alias (__ieee754_lgammaf_r, lgammaf_r)
 
 #ifndef _LIBC
 float __ieee754_gammaf_r(float x, int* signgam)
 {
     return __libm_lgammaf(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_gammaf_r, gammaf_r)
+weak_alias (__ieee754_gammaf_r, gammaf_r)
 #endif
diff --git a/sysdeps/ia64/fpu/e_lgammal_r.c b/sysdeps/ia64/fpu/e_lgammal_r.c
index 3fbea703c8..4451201b77 100644
--- a/sysdeps/ia64/fpu/e_lgammal_r.c
+++ b/sysdeps/ia64/fpu/e_lgammal_r.c
@@ -59,12 +59,12 @@ long double __ieee754_lgammal_r(long double x, int* signgam)
 {
     return __libm_lgammal(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_lgammal_r, lgammal_r)
+weak_alias (__ieee754_lgammal_r, lgammal_r)
 
 #ifndef _LIBC
 long double __ieee754_gammal_r(long double x, int* signgam)
 {
     return __libm_lgammal(x, signgam, sizeof(*signgam));
 }
-weak_alias(__ieee754_gammal_r, gammal_r)
+weak_alias (__ieee754_gammal_r, gammal_r)
 #endif
diff --git a/sysdeps/ia64/fpu/w_lgamma.c b/sysdeps/ia64/fpu/w_lgamma.c
index f16256ee1b..2006d3e806 100644
--- a/sysdeps/ia64/fpu/w_lgamma.c
+++ b/sysdeps/ia64/fpu/w_lgamma.c
@@ -66,7 +66,7 @@ double __ieee754_lgamma(double x)
 #endif
     return __libm_lgamma(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_lgamma, lgamma)
+weak_alias (__ieee754_lgamma, lgamma)
 
 double __ieee754_gamma(double x)
 {
@@ -77,4 +77,4 @@ double __ieee754_gamma(double x)
 #endif
     return __libm_lgamma(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_gamma, gamma)
+weak_alias (__ieee754_gamma, gamma)
diff --git a/sysdeps/ia64/fpu/w_lgammaf.c b/sysdeps/ia64/fpu/w_lgammaf.c
index 5ac3b82278..cd0b4f6666 100644
--- a/sysdeps/ia64/fpu/w_lgammaf.c
+++ b/sysdeps/ia64/fpu/w_lgammaf.c
@@ -66,7 +66,7 @@ float __ieee754_lgammaf(float x)
 #endif
     return __libm_lgammaf(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_lgammaf, lgammaf)
+weak_alias (__ieee754_lgammaf, lgammaf)
 
 float __ieee754_gammaf(float x)
 {
@@ -77,4 +77,4 @@ float __ieee754_gammaf(float x)
 #endif
     return __libm_lgammaf(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_gammaf, gammaf)
+weak_alias (__ieee754_gammaf, gammaf)
diff --git a/sysdeps/ia64/fpu/w_lgammal.c b/sysdeps/ia64/fpu/w_lgammal.c
index 8ddbb749ce..e3885296eb 100644
--- a/sysdeps/ia64/fpu/w_lgammal.c
+++ b/sysdeps/ia64/fpu/w_lgammal.c
@@ -65,7 +65,7 @@ long double __ieee754_lgammal(long double x)
 #endif
     return __libm_lgammal(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_lgammal, lgammal)
+weak_alias (__ieee754_lgammal, lgammal)
 
 long double __ieee754_gammal(long double x)
 {
@@ -76,4 +76,4 @@ long double __ieee754_gammal(long double x)
 #endif
     return __libm_lgammal(x, &signgam, sizeof(signgam));
 }
-weak_alias(__ieee754_gammal, gammal)
+weak_alias (__ieee754_gammal, gammal)
diff --git a/sysdeps/ia64/strchr.S b/sysdeps/ia64/strchr.S
index 258562796a..63db7ff7e5 100644
--- a/sysdeps/ia64/strchr.S
+++ b/sysdeps/ia64/strchr.S
@@ -108,5 +108,5 @@ ENTRY(strchr)
 	br.cond.sptk	.back
 END(strchr)
 
-weak_alias(strchr, index)
+weak_alias (strchr, index)
 libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/mach/hurd/readdir64_r.c b/sysdeps/mach/hurd/readdir64_r.c
index c26b35bb70..5b5a7fe362 100644
--- a/sysdeps/mach/hurd/readdir64_r.c
+++ b/sysdeps/mach/hurd/readdir64_r.c
@@ -109,4 +109,4 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
   return dp ? 0 : err ? errno : 0;
 }
 
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/mach/hurd/sigaltstack.c b/sysdeps/mach/hurd/sigaltstack.c
index ea3e07d26b..5b2f06561b 100644
--- a/sysdeps/mach/hurd/sigaltstack.c
+++ b/sysdeps/mach/hurd/sigaltstack.c
@@ -60,4 +60,4 @@ __sigaltstack (argss, oss)
 
   return 0;
 }
-weak_alias(__sigaltstack, sigaltstack)
+weak_alias (__sigaltstack, sigaltstack)
diff --git a/sysdeps/mach/i386/syscall.S b/sysdeps/mach/i386/syscall.S
index 9e718f354d..ff50e971cc 100644
--- a/sysdeps/mach/i386/syscall.S
+++ b/sysdeps/mach/i386/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,3 +24,4 @@ ENTRY (syscall)
 	pushl %ecx		/* Push back return address.  */
 	.byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- gas bug */
 	ret
+END (syscall)
diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c
index 91e71b74ac..64ca9ae83d 100644
--- a/sysdeps/posix/posix_fallocate64.c
+++ b/sysdeps/posix/posix_fallocate64.c
@@ -76,7 +76,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
       if (offset < st.st_size)
 	{
 	  unsigned char c;
-	  ssize_t rsize = __pread64 (fd, &c, 1, offset);
+	  ssize_t rsize = __libc_pread64 (fd, &c, 1, offset);
 
 	  if (rsize < 0)
 	    return errno;
@@ -86,7 +86,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 	    continue;
 	}
 
-      if (__pwrite64 (fd, "", 1, offset) != 1)
+      if (__libc_pwrite64 (fd, "", 1, offset) != 1)
 	return errno;
     }
 
diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c
index 361a19e0dc..9787e8d234 100644
--- a/sysdeps/posix/sigignore.c
+++ b/sysdeps/posix/sigignore.c
@@ -1,5 +1,5 @@
 /* Set the disposition of SIG to SIG_IGN.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -22,6 +22,8 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 int
 sigignore (sig)
diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c
index 9a8efee043..9fc514c729 100644
--- a/sysdeps/posix/signal.c
+++ b/sysdeps/posix/signal.c
@@ -1,5 +1,6 @@
 /* BSD-like signal function.
-   Copyright (C) 1991,1992,1996,1997,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1996,1997,2000,2002,2005
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +20,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 873c1cb1e6..31e39d78b5 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 /* Set the disposition for SIG.  */
diff --git a/sysdeps/posix/sysv_signal.c b/sysdeps/posix/sysv_signal.c
index ca2e84f372..16fcd2c2ab 100644
--- a/sysdeps/posix/sysv_signal.c
+++ b/sysdeps/posix/sysv_signal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,8 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 /* Tolerate non-threads versions of Posix */
 #ifndef SA_ONESHOT
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 6dd3940d22..850a10746c 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -226,9 +226,9 @@ idouble: 2
 ifloat: 3
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
-float: 4
+float: 5
 idouble: 1
-ifloat: 4
+ifloat: 5
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
@@ -351,6 +351,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
 double: 2
 float: 1
@@ -382,6 +385,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
 double: 2
 float: 1
@@ -418,8 +424,8 @@ Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 float: 1
 ifloat: 1
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 3
-ifloat: 3
+float: 4
+ifloat: 4
 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
 double: 1
 float: 1
@@ -435,9 +441,9 @@ idouble: 3
 ifloat: 1
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 
 # lgamma
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
@@ -730,9 +736,9 @@ ifloat: 1
 
 Function: Real part of "cpow":
 double: 2
-float: 4
+float: 5
 idouble: 2
-ifloat: 4
+ifloat: 5
 
 Function: Imaginary part of "cpow":
 double: 2
@@ -800,9 +806,9 @@ ifloat: 1
 
 Function: "j0":
 double: 2
-float: 1
+float: 2
 idouble: 2
-ifloat: 1
+ifloat: 2
 
 Function: "j1":
 double: 1
@@ -812,9 +818,9 @@ ifloat: 2
 
 Function: "jn":
 double: 3
-float: 3
+float: 4
 idouble: 3
-ifloat: 3
+ifloat: 4
 
 Function: "lgamma":
 double: 1
diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S
index 157ef09507..ab9a3a99bb 100644
--- a/sysdeps/powerpc/fpu/s_fabs.S
+++ b/sysdeps/powerpc/fpu/s_fabs.S
@@ -25,13 +25,13 @@ ENTRY(__fabs)
 	blr
 END(__fabs)
 
-weak_alias(__fabs,fabs)
+weak_alias (__fabs,fabs)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fabs,__fabsf)
-weak_alias(__fabs,fabsf)
+weak_alias (__fabs,fabsf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fabs,__fabsl)
-weak_alias(__fabs,fabsl)
+weak_alias (__fabs,__fabsl)
+weak_alias (__fabs,fabsl)
 #endif
diff --git a/sysdeps/powerpc/fpu/s_fmax.S b/sysdeps/powerpc/fpu/s_fmax.S
index 5666cdd079..8502c863b2 100644
--- a/sysdeps/powerpc/fpu/s_fmax.S
+++ b/sysdeps/powerpc/fpu/s_fmax.S
@@ -31,13 +31,13 @@ ENTRY(__fmax)
 	blr
 END(__fmax)
 
-weak_alias(__fmax,fmax)
+weak_alias (__fmax,fmax)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fmax,__fmaxf)
-weak_alias(__fmax,fmaxf)
+weak_alias (__fmax,fmaxf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fmax,__fmaxl)
-weak_alias(__fmax,fmaxl)
+weak_alias (__fmax,__fmaxl)
+weak_alias (__fmax,fmaxl)
 #endif
diff --git a/sysdeps/powerpc/fpu/s_fmin.S b/sysdeps/powerpc/fpu/s_fmin.S
index 96387d9ae1..5f788d06f3 100644
--- a/sysdeps/powerpc/fpu/s_fmin.S
+++ b/sysdeps/powerpc/fpu/s_fmin.S
@@ -31,13 +31,13 @@ ENTRY(__fmin)
 	blr
 END(__fmin)
 
-weak_alias(__fmin,fmin)
+weak_alias (__fmin,fmin)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fmin,__fminf)
-weak_alias(__fmin,fminf)
+weak_alias (__fmin,fminf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fmin,__fminl)
-weak_alias(__fmin,fminl)
+weak_alias (__fmin,__fminl)
+weak_alias (__fmin,fminl)
 #endif
diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c
index 118f0d6175..e7e12544c5 100644
--- a/sysdeps/powerpc/powerpc32/backtrace.c
+++ b/sysdeps/powerpc/powerpc32/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -64,3 +64,4 @@ __backtrace (void **array, int size)
   return count;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/powerpc/powerpc32/configure b/sysdeps/powerpc/powerpc32/configure
new file mode 100644
index 0000000000..9ebac38b57
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/configure
@@ -0,0 +1,33 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/powerpc/powerpc32.
+
+# See whether gas has R_PPC_REL16 relocs.
+echo "$as_me:$LINENO: checking for R_PPC_REL16 gas support" >&5
+echo $ECHO_N "checking for R_PPC_REL16 gas support... $ECHO_C" >&6
+if test "${libc_cv_ppc_rel16+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.s <<\EOF
+	.text
+	addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha
+EOF
+if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_ppc_rel16=yes
+else
+  libc_cv_ppc_rel16=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ppc_rel16" >&5
+echo "${ECHO_T}$libc_cv_ppc_rel16" >&6
+if test $libc_cv_ppc_rel16 = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_ASM_PPC_REL16 1
+_ACEOF
+
+fi
diff --git a/sysdeps/powerpc/powerpc32/configure.in b/sysdeps/powerpc/powerpc32/configure.in
new file mode 100644
index 0000000000..6d2c41cb9a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/configure.in
@@ -0,0 +1,18 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/powerpc/powerpc32.
+
+# See whether gas has R_PPC_REL16 relocs.
+AC_CACHE_CHECK(for R_PPC_REL16 gas support, libc_cv_ppc_rel16, [dnl
+cat > conftest.s <<\EOF
+	.text
+	addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha
+EOF
+if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  libc_cv_ppc_rel16=yes
+else
+  libc_cv_ppc_rel16=no
+fi
+rm -f conftest*])
+if test $libc_cv_ppc_rel16 = yes; then
+  AC_DEFINE(HAVE_ASM_PPC_REL16)
+fi
diff --git a/sysdeps/powerpc/powerpc32/dl-dtprocnum.h b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
new file mode 100644
index 0000000000..7fe2be7939
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture.  By
+   default there are none.  */
+#define DT_THISPROCNUM	DT_PPC_NUM
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index 545c19b300..496fa71ecc 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -25,6 +25,10 @@
 #include <assert.h>
 #include <dl-tls.h>
 
+/* Translate a processor specific dynamic tag to the index
+   in l_info array.  */
+#define DT_PPC(x) (DT_PPC_##x - DT_LOPROC + DT_NUM)
+
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf32_Ehdr *ehdr)
@@ -32,24 +36,38 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
   return ehdr->e_machine == EM_PPC;
 }
 
+/* Return the value of the GOT pointer.  */
+static inline Elf32_Addr * __attribute__ ((const))
+ppc_got (void)
+{
+  Elf32_Addr *got;
+#ifdef HAVE_ASM_PPC_REL16
+  asm ("bcl 20,31,1f\n"
+       "1:	mflr %0\n"
+       "	addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n"
+       "	addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n"
+       : "=b" (got) : : "lr");
+#else
+  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
+       : "=l" (got));
+#endif
+  return got;
+}
 
 /* Return the link-time address of _DYNAMIC, stored as
    the first value in the GOT. */
-static inline Elf32_Addr
+static inline Elf32_Addr __attribute__ ((const))
 elf_machine_dynamic (void)
 {
-  Elf32_Addr *got;
-  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
-       : "=l"(got));
-  return *got;
+  return *ppc_got ();
 }
 
 /* Return the run-time load address of the shared object.  */
-static inline Elf32_Addr
+static inline Elf32_Addr __attribute__ ((const))
 elf_machine_load_address (void)
 {
-  unsigned int *got;
-  unsigned int *branchaddr;
+  Elf32_Addr *branchaddr;
+  Elf32_Addr runtime_dynamic;
 
   /* This is much harder than you'd expect.  Possibly I'm missing something.
      The 'obvious' way:
@@ -80,19 +98,17 @@ elf_machine_load_address (void)
      the address ourselves. That gives us the following code: */
 
   /* Get address of the 'b _DYNAMIC@local'...  */
-  asm ("bl 0f ;"
+  asm ("bcl 20,31,0f;"
        "b _DYNAMIC@local;"
        "0:"
-       : "=l"(branchaddr));
-
-  /* ... and the address of the GOT.  */
-  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
-       : "=l"(got));
+       : "=l" (branchaddr));
 
   /* So now work out the difference between where the branch actually points,
      and the offset of that location in memory from the start of the file.  */
-  return ((Elf32_Addr)branchaddr - *got
-	  + ((int)(*branchaddr << 6 & 0xffffff00) >> 6));
+  runtime_dynamic = ((Elf32_Addr) branchaddr
+		     + ((Elf32_Sword) (*branchaddr << 6 & 0xffffff00) >> 6));
+
+  return runtime_dynamic - elf_machine_dynamic ();
 }
 
 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) /* nothing */
@@ -144,13 +160,69 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
 /* The PowerPC never uses REL relocations.  */
 #define ELF_MACHINE_NO_REL 1
 
-/* Set up the loaded object described by L so its unrelocated PLT
+/* Set up the loaded object described by MAP so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.
    Also install a small trampoline to be used by entries that have
    been relocated to an address too far away for a single branch.  */
 extern int __elf_machine_runtime_setup (struct link_map *map,
 					int lazy, int profile);
-#define elf_machine_runtime_setup __elf_machine_runtime_setup
+
+static inline int
+elf_machine_runtime_setup (struct link_map *map,
+			   int lazy, int profile)
+{
+  if (map->l_info[DT_JMPREL] == 0)
+    return lazy;
+
+  if (map->l_info[DT_PPC(GOT)] == 0)
+    /* Handle old style PLT.  */
+    return __elf_machine_runtime_setup (map, lazy, profile);
+
+  /* New style non-exec PLT consisting of an array of addresses.  */
+  map->l_info[DT_PPC(GOT)]->d_un.d_ptr += map->l_addr;
+  if (lazy)
+    {
+      Elf32_Addr *plt, *got, glink;
+      Elf32_Word num_plt_entries;
+      void (*dlrr) (void);
+      extern void _dl_runtime_resolve (void);
+      extern void _dl_prof_resolve (void);
+
+      if (__builtin_expect (!profile, 1))
+	dlrr = _dl_runtime_resolve;
+      else
+	{
+	  if (GLRO(dl_profile) != NULL
+	      &&_dl_name_match_p (GLRO(dl_profile), map))
+	    GL(dl_profile_map) = map;
+	  dlrr = _dl_prof_resolve;
+	}
+      got = (Elf32_Addr *) map->l_info[DT_PPC(GOT)]->d_un.d_ptr;
+      glink = got[1];
+      got[1] = (Elf32_Addr) dlrr;
+      got[2] = (Elf32_Addr) map;
+
+      /* Relocate everything in .plt by the load address offset.  */
+      plt = (Elf32_Addr *) D_PTR (map, l_info[DT_PLTGOT]);
+      num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val
+			 / sizeof (Elf32_Rela));
+
+      /* If a library is prelinked but we have to relocate anyway,
+	 we have to be able to undo the prelinking of .plt section.
+	 The prelinker saved us at got[1] address of .glink
+	 section's start.  */
+      if (glink)
+	{
+	  glink += map->l_addr;
+	  while (num_plt_entries-- != 0)
+	    *plt++ = glink, glink += 4;
+	}
+      else
+	while (num_plt_entries-- != 0)
+	  *plt++ += map->l_addr;
+    }
+  return lazy;
+}
 
 /* Change the PLT entry whose reloc is 'reloc' to call the actual routine.  */
 extern Elf32_Addr __elf_machine_fixup_plt (struct link_map *map,
@@ -163,7 +235,12 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 		       const Elf32_Rela *reloc,
 		       Elf32_Addr *reloc_addr, Elf64_Addr finaladdr)
 {
-  return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+  if (map->l_info[DT_PPC(GOT)] == 0)
+    /* Handle old style PLT.  */
+    return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+
+  *reloc_addr = finaladdr;
+  return finaladdr;
 }
 
 /* Return the final value of a plt relocation.  */
@@ -286,11 +363,16 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       break;
 #endif /* USE_TLS etc. */
 
-#ifdef RESOLVE_CONFLICT_FIND_MAP
     case R_PPC_JMP_SLOT:
+#ifdef RESOLVE_CONFLICT_FIND_MAP
       RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
-      /* FALLTHROUGH */
 #endif
+      if (map->l_info[DT_PPC(GOT)] != 0)
+	{
+	  *reloc_addr = value;
+	  break;
+	}
+      /* FALLTHROUGH */
 
     default:
       __process_machine_rela (map, reloc, sym_map, sym, refsym,
diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
index d72202d4a4..e1f7f6e24a 100644
--- a/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/sysdeps/powerpc/powerpc32/dl-start.S
@@ -47,8 +47,15 @@ ENTRY(_dl_start_user)
    passed by value!).  */
 
 /*  Put our GOT pointer in r31, */
+#ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r31
+	addis	r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l
+#else
 	bl	_GLOBAL_OFFSET_TABLE_-4@local
 	mflr	r31
+#endif
 /*  the address of _start in r30, */
 	mr	r30,r3
 /*  &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28.  */
diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S
index 7827357a6c..bafd2ae001 100644
--- a/sysdeps/powerpc/powerpc32/elf/start.S
+++ b/sysdeps/powerpc/powerpc32/elf/start.S
@@ -52,7 +52,7 @@ L(start_addresses):
 	ASM_SIZE_DIRECTIVE(L(start_addresses))
 
 	.section ".text"
-#ifdef PIC
+#if defined PIC && !defined HAVE_ASM_PPC_REL16
 L(start_addressesp):
 	.long	L(start_addresses)-L(branch)
 #endif
@@ -73,11 +73,19 @@ L(branch):
 	mtlr	r0
 	stw	r0,0(r1)
  /* Set r13 to point at the 'small data area', and put the address of
-    start_addresses in r8...  */
+    start_addresses in r8.  Also load the GOT pointer so that new PLT
+    calls work, like the one to __libc_start_main.  */
 #ifdef PIC
+# ifdef HAVE_ASM_PPC_REL16
+	addis	r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha
+	addis	r8,r13,L(start_addresses)-L(branch)@ha
+	addi	r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l
+	lwzu	r13,L(start_addresses)-L(branch)@l(r8)
+# else
 	lwz	r8,L(start_addressesp)-L(branch)(r13)
 	add	r8,r13,r8
 	lwz	r13,0(r8)
+# endif
 #else
 	lis	r8,L(start_addresses)@ha
 	lwzu	r13,L(start_addresses)@l(r8)
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index a2415b9542..73cc8181f9 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -34,14 +34,21 @@ ENTRY (BP_SYM (__longjmp))
 #ifndef __NO_VMX__
 # ifdef PIC
 	mflr    r6
+#  ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+#  else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
+#  endif
 #  ifdef SHARED
 	lwz     r5,_rtld_global_ro@got(r5)
 	mtlr    r6
 	lwz     r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
 #  else
-	lwz     r5,_rtld_global_ro@got(r5)
+	lwz     r5,_dl_hwcap@got(r5)
 	mtlr    r6
 	lwz     r5,0(r5)
 #  endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
index 7924e34648..13afba88f0 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
@@ -29,11 +29,19 @@ ENTRY (__ceil)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
index 9315d8d2df..f8ca1de08c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
@@ -20,7 +20,7 @@
 #include <sysdep.h>
 
 	.section	.rodata.cst4,"aM",@progbits,4
-	.align 2
+	.align	2
 .LC0:	/* 2**23 */
 	.long 0x4b000000
 
@@ -29,11 +29,19 @@ ENTRY (__ceilf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
index 933435da3d..ee2c09cba8 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
@@ -38,13 +38,13 @@ L(0):	fnabs   fp1,fp1
 	blr
 	END (__copysign)
 
-weak_alias(__copysign,copysign)
+weak_alias (__copysign,copysign)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
-weak_alias(__copysign,copysignf)
+weak_alias (__copysign,copysignf)
 strong_alias(__copysign,__copysignf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__copysign,copysignl)
+weak_alias (__copysign,copysignl)
 strong_alias(__copysign,__copysignl)
 #endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
index c8f59c24a6..5dfe8f2d9a 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
@@ -29,11 +29,19 @@ ENTRY (__floor)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
index 8ee0644ac9..31b71ad229 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
@@ -20,7 +20,7 @@
 #include <sysdep.h>
 
 	.section	.rodata.cst4,"aM",@progbits,4
-	.align 2
+	.align	2
 .LC0:	/* 2**23 */
 	.long 0x4b000000
 
@@ -29,11 +29,19 @@ ENTRY (__floorf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index 72fd49ba46..a85743164c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -41,9 +41,16 @@
 ENTRY (__lround)
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
 	lfs	fp12,0(r9)
 #else
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
index 4abdcedfe8..1cfcd78b5c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
@@ -31,11 +31,19 @@
 ENTRY (__rint)
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
index d02bd066b8..93c02667fe 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
@@ -20,7 +20,7 @@
 #include <sysdep.h>
 
 	.section	.rodata.cst4,"aM",@progbits,4
-	.align 2
+	.align	2
 .LC0:	/* 2**23 */
 	.long 0x4b000000
 
@@ -28,11 +28,19 @@
 ENTRY (__rintf)
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
index 96fc2984fd..53b45916d1 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S
@@ -41,9 +41,16 @@ ENTRY (__round)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
 	lfs	fp13,0(r9)
 #else
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
index 87965dea80..39ba08655a 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
@@ -41,9 +41,16 @@ ENTRY (__roundf )
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
 	lfs	fp13,0(r9)
 #else
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
index 7a3e705a81..827e8cb940 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
@@ -36,11 +36,19 @@ ENTRY (__trunc)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
index 5275c69d29..55e7a74b41 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
@@ -20,7 +20,7 @@
 #include <sysdep.h>
 
 	.section	.rodata.cst4,"aM",@progbits,4
-	.align 2
+	.align	2
 .LC0:	/* 2**23 */
 	.long 0x4b000000
 
@@ -36,11 +36,19 @@ ENTRY (__truncf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	mtlr	r11
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
 	mtlr	r11
 	lfs	fp13,0(r9)
+# endif
 #else
 	lis	r9,.LC0@ha
 	lfs	fp13,.LC0@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index e0c0606da4..cf3f215f2d 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -74,20 +74,27 @@ ENTRY (BP_SYM (__sigsetjmp))
 	stw  r31,((JB_GPRS+17)*4)(3)
 	stfd fp31,((JB_FPRS+17*2)*4)(3)
 #ifndef __NO_VMX__
-#ifdef PIC
+# ifdef PIC
 	mflr    r6
+#  ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+#  else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
-#ifdef SHARED
+#  endif
+#  ifdef SHARED
 	lwz     r5,_rtld_global_ro@got(r5)
 	mtlr    r6
 	lwz     r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
-#else
-	lwz     r5,_rtld_global_ro@got(r5)
+#  else
+	lwz     r5,_dl_hwcap@got(r5)
 	mtlr    r6
 	lwz     r5,0(r5)
-#endif
-#else
+#  endif
+# else
 	lis	r5,_dl_hwcap@ha
 	lwz     r5,_dl_hwcap@l(r5)
 #endif
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index 4c0edc8e45..f09c294674 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -264,10 +264,17 @@ L(checklinesize):
 	beq	L(medium)
 /* Establishes GOT addressability so we can load __cache_line_size
    from static. This value was set from the aux vector during startup.  */
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	rGOT
+	addis	rGOT,rGOT,__cache_line_size-1b@ha
+	lwz	rCLS,__cache_line_size-1b@l(rGOT)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	rGOT
 	lwz	rGOT,__cache_line_size@got(rGOT)
 	lwz	rCLS,0(rGOT)
+# endif
 	mtlr	rTMP
 #else
 /* Load __cache_line_size from static. This value was set from the
diff --git a/sysdeps/powerpc/powerpc32/ppc-mcount.S b/sysdeps/powerpc/powerpc32/ppc-mcount.S
index 314c8ee703..c1a08d379c 100644
--- a/sysdeps/powerpc/powerpc32/ppc-mcount.S
+++ b/sysdeps/powerpc/powerpc32/ppc-mcount.S
@@ -1,5 +1,5 @@
 /* PowerPC-specific implementation of profiling support.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,25 +24,19 @@
 
 #include <sysdep.h>
 
-/* We do profiling as described in the SYSV ELF ABI, _mcount is called
-   with the address of a data word in r0 (that is different for every
-   routine, initialised to 0, and otherwise unused).  The caller has put
-   the address the caller will return to in the usual place on the stack,
-   4(r1).  _mcount is responsible for ensuring that when it returns no
-   argument-passing registers are disturbed, and that the LR is set back
-   to (what the caller sees as) 4(r1).
+/* We do profiling as described in the SYSV ELF ABI, except that glibc
+   _mcount manages its own counters.  The caller has put the address the
+   caller will return to in the usual place on the stack, 4(r1).  _mcount
+   is responsible for ensuring that when it returns no argument-passing
+   registers are disturbed, and that the LR is set back to (what the
+   caller sees as) 4(r1).
 
    This is intended so that the following code can be inserted at the
    front of any routine without changing the routine:
 
 	.data
-	.align	2
-   0:	.long	0
-	.previous
 	mflr	r0
-	lis	r11,0b@ha
 	stw	r0,4(r1)
-	addi	r0,r11,0b@l
 	bl	_mcount
 */
 
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index 775073f325..552f595a10 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -29,31 +29,10 @@
 /* The mcount code relies on a the return address being on the stack
    to locate our caller and so it can restore it; so store one just
    for its benefit.  */
-# ifdef PIC
-#  define CALL_MCOUNT							      \
-  .pushsection;								      \
-  .section ".data";    							      \
-  .align ALIGNARG(2);							      \
-0:.long 0;								      \
-  .previous;								      \
-  mflr  r0;								      \
-  stw   r0,4(r1);	       						      \
-  bl    _GLOBAL_OFFSET_TABLE_@local-4;					      \
-  mflr  r11;								      \
-  lwz   r0,0b@got(r11);							      \
-  bl    JUMPTARGET(_mcount);
-# else  /* PIC */
-#  define CALL_MCOUNT							      \
-  .section ".data";							      \
-  .align ALIGNARG(2);							      \
-0:.long 0;								      \
-  .previous;								      \
+# define CALL_MCOUNT							      \
   mflr  r0;								      \
-  lis   r11,0b@ha;		       					      \
   stw   r0,4(r1);	       						      \
-  addi  r0,r11,0b@l;							      \
   bl    JUMPTARGET(_mcount);
-# endif /* PIC */
 #else  /* PROF */
 # define CALL_MCOUNT		/* Do nothing.  */
 #endif /* PROF */
diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
index 8669b6a689..9c8ebbb18d 100644
--- a/sysdeps/powerpc/powerpc64/backtrace.c
+++ b/sysdeps/powerpc/powerpc64/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -67,3 +67,4 @@ __backtrace (void **array, int size)
   return count;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
index a43ed12cf0..f083d2b7ea 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
@@ -39,13 +39,13 @@ L(0):	fnabs   fp1,fp1
 	blr
 	END (__copysign)
 
-weak_alias(__copysign,copysign)
+weak_alias (__copysign,copysign)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
-weak_alias(__copysign,copysignf)
+weak_alias (__copysign,copysignf)
 strong_alias(__copysign,__copysignf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__copysign,copysignl)
+weak_alias (__copysign,copysignl)
 strong_alias(__copysign,__copysignl)
 #endif
diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c
index 7a632572b5..6adc3bc3d1 100644
--- a/sysdeps/s390/s390-32/backtrace.c
+++ b/sysdeps/s390/s390-32/backtrace.c
@@ -1,6 +1,6 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+   Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -142,3 +142,4 @@ __backtrace (void **array, int size)
 }
 
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S
index 8ecdd0edae..6d11f9bbdb 100644
--- a/sysdeps/s390/s390-32/s390-mcount.S
+++ b/sysdeps/s390/s390-32/s390-mcount.S
@@ -81,4 +81,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c
index 05321349ca..7ba195cb7a 100644
--- a/sysdeps/s390/s390-64/backtrace.c
+++ b/sysdeps/s390/s390-64/backtrace.c
@@ -1,6 +1,6 @@
 /* Return backtrace of current program state.  64 bit S/390 version.
-   Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -141,3 +141,4 @@ __backtrace (void **array, int size)
 }
 
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390-64/s390x-mcount.S
index 5e3890b4f6..0fa614cbf4 100644
--- a/sysdeps/s390/s390-64/s390x-mcount.S
+++ b/sysdeps/s390/s390-64/s390x-mcount.S
@@ -69,4 +69,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index 8e91e998bf..e6204e8ac9 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -152,4 +152,4 @@ ENTRY(memset)
 END(memset)
 libc_hidden_builtin_def (memset)
 
-weak_alias(__bzero, bzero)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/sparc/sparc32/stpcpy.S b/sysdeps/sparc/sparc32/stpcpy.S
index 937fed35f8..e6688a9b21 100644
--- a/sysdeps/sparc/sparc32/stpcpy.S
+++ b/sysdeps/sparc/sparc32/stpcpy.S
@@ -160,6 +160,6 @@ ENTRY(__stpcpy)
 	 nop
 END(__stpcpy)
 
-weak_alias(__stpcpy, stpcpy)
+weak_alias (__stpcpy, stpcpy)
 libc_hidden_def (__stpcpy)
 libc_hidden_builtin_def (stpcpy)
diff --git a/sysdeps/sparc/sparc32/strchr.S b/sysdeps/sparc/sparc32/strchr.S
index b5be3adf60..6120ecd6a3 100644
--- a/sysdeps/sparc/sparc32/strchr.S
+++ b/sysdeps/sparc/sparc32/strchr.S
@@ -278,7 +278,7 @@ ENTRY(strrchr)
 	 mov		%o5, %o0
 END(strrchr)
 
-weak_alias(strchr, index)
-weak_alias(strrchr, rindex)
+weak_alias (strchr, index)
+weak_alias (strrchr, rindex)
 libc_hidden_builtin_def (strchr)
 libc_hidden_builtin_def (strrchr)
diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
index 074767b983..f9502d63f5 100644
--- a/sysdeps/sparc/sparc64/memcmp.S
+++ b/sysdeps/sparc/sparc64/memcmp.S
@@ -139,5 +139,5 @@ ENTRY(memcmp)
 END(memcmp)
 
 #undef bcmp
-weak_alias(memcmp, bcmp)
+weak_alias (memcmp, bcmp)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/sparc/sparc64/memcpy.S b/sysdeps/sparc/sparc64/memcpy.S
index 3742573248..a3f7b96a91 100644
--- a/sysdeps/sparc/sparc64/memcpy.S
+++ b/sysdeps/sparc/sparc64/memcpy.S
@@ -914,8 +914,8 @@ ENTRY(memmove)
 END(memmove)
 
 #ifdef USE_BPR
-weak_alias(memcpy, __align_cpy_1)
-weak_alias(memcpy, __align_cpy_2)
+weak_alias (memcpy, __align_cpy_1)
+weak_alias (memcpy, __align_cpy_2)
 #endif
 libc_hidden_builtin_def (memcpy)
 libc_hidden_builtin_def (memmove)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index b34ccc8869..99624ba9d7 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -312,4 +312,4 @@ ENTRY(__bzero)
 	 mov		%o5, %o0
 END(__bzero)
 
-weak_alias(__bzero, bzero)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
index 8b70b0a932..760d526630 100644
--- a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
+++ b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
@@ -600,11 +600,11 @@ ENTRY(memmove)
 END(memmove)
 
 #ifdef USE_BPR
-weak_alias(memcpy, __align_cpy_1)
-weak_alias(memcpy, __align_cpy_2)
-weak_alias(memcpy, __align_cpy_4)
-weak_alias(memcpy, __align_cpy_8)
-weak_alias(memcpy, __align_cpy_16)
+weak_alias (memcpy, __align_cpy_1)
+weak_alias (memcpy, __align_cpy_2)
+weak_alias (memcpy, __align_cpy_4)
+weak_alias (memcpy, __align_cpy_8)
+weak_alias (memcpy, __align_cpy_16)
 #endif
 libc_hidden_builtin_def (memcpy)
 libc_hidden_builtin_def (memmove)
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 3a1717daf3..8f82ac848d 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -93,6 +93,7 @@ int
 clock_gettime (clockid_t clock_id, struct timespec *tp)
 {
   int retval = -1;
+  struct timeval tv;
 
   switch (clock_id)
     {
@@ -102,7 +103,9 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
 
 #ifndef HANDLED_REALTIME
     case CLOCK_REALTIME:
-      HANDLE_REALTIME;
+      retval = gettimeofday (&tv, NULL);
+      if (retval == 0)
+	TIMEVAL_TO_TIMESPEC (&tv, tp);
       break;
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index ce4a5da37f..c4a9b77e2e 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,9 +44,9 @@
 #define O_ASYNC		020000	/* fcntl, for BSD compatibility */
 
 #ifdef __USE_GNU
-# define O_DIRECT	040000	/* Direct disk access.  */
 # define O_DIRECTORY	0100000	/* Must be a directory.  */
 # define O_NOFOLLOW	0200000	/* Do not follow links.  */
+# define O_DIRECT	02000000 /* Direct disk access.  */
 # define O_NOATIME	04000000 /* Do not set atime.  */
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 54d6819412..8bbd301dd9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Alpha/Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index 1c450d1737..5e0b21ea15 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -146,4 +146,4 @@ thread_start:
 
 	.end thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/alpha/getcontext.S b/sysdeps/unix/sysv/linux/alpha/getcontext.S
index 3566890cf9..bf9820ac73 100644
--- a/sysdeps/unix/sysv/linux/alpha/getcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/getcontext.S
@@ -41,7 +41,7 @@ ENTRY (__getcontext)
 	ret
 
 END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
 
 
 /* An internal routine used by getcontext and setcontext.
diff --git a/sysdeps/unix/sysv/linux/alpha/getrusage.S b/sysdeps/unix/sysv/linux/alpha/getrusage.S
index 2c34e98ce6..46797aa83b 100644
--- a/sysdeps/unix/sysv/linux/alpha/getrusage.S
+++ b/sysdeps/unix/sysv/linux/alpha/getrusage.S
@@ -145,5 +145,5 @@ strong_alias(__getrusage_tv64, ____getrusage_tv64)
 default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1)
 default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1)
 #else
-weak_alias(__getrusage, getrusage)
+weak_alias (__getrusage, getrusage)
 #endif
diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.S
index 7d443d41c7..27abfd0c12 100644
--- a/sysdeps/unix/sysv/linux/alpha/setcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/setcontext.S
@@ -32,4 +32,4 @@
 PSEUDO(__setcontext, sigreturn, 1)
 	ret
 PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
index e5de55faeb..48c3f271c7 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
+++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
@@ -29,5 +29,5 @@ PSEUDO(__sigsuspend, sigsuspend, 1)
 	ret
 PSEUDO_END(__sigsuspend)
 libc_hidden_def (__sigsuspend)
-weak_alias(__sigsuspend, sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
index 5f6615e0b6..1221f67f78 100644
--- a/sysdeps/unix/sysv/linux/alpha/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
@@ -48,4 +48,4 @@ ENTRY(__swapcontext)
 #endif
 
 END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscall.S b/sysdeps/unix/sysv/linux/alpha/syscall.S
index 10a32d5dc8..0c4081363a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscall.S
+++ b/sysdeps/unix/sysv/linux/alpha/syscall.S
@@ -74,4 +74,4 @@ $error:
 
 END(__syscall)
 
-weak_alias(__syscall, syscall)
+weak_alias (__syscall, syscall)
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index c186a3a5d0..115739d439 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
index 4f3bb9e206..f497bca13d 100644
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ b/sysdeps/unix/sysv/linux/hppa/clone.S
@@ -96,4 +96,4 @@ thread_start:
 
 PSEUDO_END(__clone)
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S
index 76ba6047c1..fe28f1e0e1 100644
--- a/sysdeps/unix/sysv/linux/i386/getcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/getcontext.S
@@ -82,4 +82,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 03dc648c59..12ba4e2d67 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -114,4 +114,4 @@ L(exitcode):
 	cfi_startproc
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S
index c493cf9798..bf2d7d2bad 100644
--- a/sysdeps/unix/sysv/linux/i386/setcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/setcontext.S
@@ -94,4 +94,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S
index d909e659e4..27c16200b2 100644
--- a/sysdeps/unix/sysv/linux/i386/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S
@@ -109,4 +109,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index a9637be33d..99f9bf1edf 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -109,32 +109,6 @@
 # define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
 #else
 
-# ifndef HAVE_HIDDEN
-#  define SETUP_PIC_REG(reg) \
-  call 1f;								      \
-  .subsection 1;							      \
-1:movl (%esp), %e##reg;							      \
-  ret;									      \
-  .previous
-# else
-#  define SETUP_PIC_REG(reg) \
-  .ifndef __i686.get_pc_thunk.reg;					      \
-  .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits;	      \
-  .globl __i686.get_pc_thunk.reg;					      \
-  .hidden __i686.get_pc_thunk.reg;					      \
-  .type __i686.get_pc_thunk.reg,@function;				      \
-__i686.get_pc_thunk.reg:						      \
-  movl (%esp), %e##reg;							      \
-  ret;									      \
-  .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg;		      \
-  .previous;								      \
-  .endif;								      \
-  call __i686.get_pc_thunk.reg
-# endif
-
-# define LOAD_PIC_REG(reg) \
-  SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
-
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER						      \
 0:SETUP_PIC_REG(cx);							      \
diff --git a/sysdeps/unix/sysv/linux/ia64/getcontext.S b/sysdeps/unix/sysv/linux/ia64/getcontext.S
index 0f9cc5db19..4e18bace2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/getcontext.S
@@ -155,4 +155,4 @@ ENTRY(__getcontext)
 	ret
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/setcontext.S b/sysdeps/unix/sysv/linux/ia64/setcontext.S
index e18c40fa4c..ef0a93c0c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/setcontext.S
@@ -150,4 +150,4 @@ ENTRY(__setcontext)
 	ret
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 377ccf5199..66f0ac1317 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -188,12 +189,8 @@ if_nameindex_netlink (void)
 
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    goto exit_close;
-
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces.  Collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     goto exit_free;
 
   /* Count the interfaces.  */
@@ -290,7 +287,6 @@ if_nameindex_netlink (void)
 
  exit_free:
   __netlink_free_handle (&nh);
- exit_close:
   __netlink_close (&nh);
 
   return idx;
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 8a052e212d..f743f702f0 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
 /* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
@@ -24,6 +25,7 @@
 #include <netinet/in.h>
 #include <netpacket/packet.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -84,7 +86,7 @@ __netlink_free_handle (struct netlink_handle *h)
 }
 
 
-int
+static int
 __netlink_sendreq (struct netlink_handle *h, int type)
 {
   struct
@@ -114,15 +116,39 @@ __netlink_sendreq (struct netlink_handle *h, int type)
 
 
 int
-__netlink_receive (struct netlink_handle *h)
+__netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
+  struct netlink_res **new_nlm_list;
+  static volatile size_t buf_size = 4096;
+  char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
-  int read_len;
+  ssize_t read_len;
   bool done = false;
+  bool use_malloc = false;
+
+  if (__netlink_sendreq (h, type) < 0)
+    return -1;
+
+  size_t this_buf_size = buf_size;
+  if (__libc_use_alloca (this_buf_size))
+    buf = alloca (this_buf_size);
+  else
+    {
+      buf = malloc (this_buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, this_buf_size };
+
+  if (h->nlm_list != NULL)
+    new_nlm_list = &h->end_ptr->next;
+  else
+    new_nlm_list = &h->nlm_list;
 
   while (! done)
     {
@@ -136,33 +162,66 @@ __netlink_receive (struct netlink_handle *h)
 
       read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
-      if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+      if (nladdr.nl_pid != 0)
+	continue;
 
-      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
-						+ read_len);
-      if (nlm_next == NULL)
-	return -1;
-      nlm_next->next = NULL;
-      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
-      nlm_next->size = read_len;
-      nlm_next->seq = h->seq;
-      if (h->nlm_list == NULL)
-	h->nlm_list = nlm_next;
-      else
-	h->end_ptr->next = nlm_next;
-      h->end_ptr = nlm_next;
+      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+	{
+	  if (this_buf_size >= SIZE_MAX / 2)
+	    goto out_fail;
+
+	  nlm_next = *new_nlm_list;
+	  while (nlm_next != NULL)
+	    {
+	      struct netlink_res *tmpptr;
+
+	      tmpptr = nlm_next->next;
+	      free (nlm_next);
+	      nlm_next = tmpptr;
+	    }
+	  *new_nlm_list = NULL;
+
+	  if (__libc_use_alloca (2 * this_buf_size))
+	    buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size);
+	  else
+	    {
+	      this_buf_size *= 2;
+
+	      char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size);
+	      if (new_buf == NULL)
+		goto out_fail;
+	      new_buf = buf;
 
+	      use_malloc = true;
+	    }
+	  buf_size = this_buf_size;
+
+	  iov.iov_base = buf;
+	  iov.iov_len = this_buf_size;
+
+	  /* Increase sequence number, so that we can distinguish
+	     between old and new request messages.  */
+	  h->seq++;
+
+	  if (__netlink_sendreq (h, type) < 0)
+	    goto out_fail;
+
+	  continue;
+	}
+
+      size_t count = 0;
+      size_t remaining_len = read_len;
       for (nlmh = (struct nlmsghdr *) buf;
-	   NLMSG_OK (nlmh, (size_t) read_len);
-	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
+	   NLMSG_OK (nlmh, remaining_len);
+	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
 	{
-	  if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
+	  if ((pid_t) nlmh->nlmsg_pid != h->pid
 	      || nlmh->nlmsg_seq != h->seq)
 	    continue;
 
+	  ++count;
 	  if (nlmh->nlmsg_type == NLMSG_DONE)
 	    {
 	      /* We found the end, leave the loop.  */
@@ -176,11 +235,38 @@ __netlink_receive (struct netlink_handle *h)
 		errno = EIO;
 	      else
 		errno = -nlerr->error;
-	      return -1;
+	      goto out_fail;
 	    }
 	}
+
+      /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
+	 there is no point to record it.  */
+      if (count == 0)
+	continue;
+
+      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
+						+ read_len);
+      if (nlm_next == NULL)
+	goto out_fail;
+      nlm_next->next = NULL;
+      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
+      nlm_next->size = read_len;
+      nlm_next->seq = h->seq;
+      if (h->nlm_list == NULL)
+	h->nlm_list = nlm_next;
+      else
+	h->end_ptr->next = nlm_next;
+      h->end_ptr = nlm_next;
     }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -268,7 +354,7 @@ getifaddrs (struct ifaddrs **ifap)
   unsigned int i, newlink, newaddr, newaddr_idx;
   int *map_newlink_data;
   size_t ifa_data_size = 0;  /* Size to allocate for all ifa_data.  */
-  char *ifa_data_ptr;        /* Pointer to the unused part of memory for
+  char *ifa_data_ptr;	/* Pointer to the unused part of memory for
 				ifa_data.  */
   int result = 0;
 
@@ -288,28 +374,20 @@ getifaddrs (struct ifaddrs **ifap)
 #endif
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    {
-      result = -1;
-      goto exit_close;
-    }
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces, collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     {
       result = -1;
       goto exit_free;
     }
 
-
   /* Now ask the kernel for all addresses which are assigned
-     to an interface.  Since we store the addresses after the
-     interfaces in the list, we will later always find the
-     interface before the corresponding addresses.  */
+     to an interface and collect all data for every interface.
+     Since we store the addresses after the interfaces in the
+     list, we will later always find the interface before the
+     corresponding addresses.  */
   ++nh.seq;
-  if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
-      /* Collect all data for every interface.  */
-      || __netlink_receive (&nh) < 0)
+  if (__netlink_request (&nh, RTM_GETADDR) < 0)
     {
       result = -1;
       goto exit_free;
@@ -327,7 +405,7 @@ getifaddrs (struct ifaddrs **ifap)
 	continue;
 
       /* Walk through all entries we got from the kernel and look, which
-         message type they contain.  */
+	 message type they contain.  */
       for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
 	{
 	  /* Check if the message is what we want.  */
@@ -423,7 +501,7 @@ getifaddrs (struct ifaddrs **ifap)
 	      /* Interfaces are stored in the first "newlink" entries
 		 of our list, starting in the order as we got from the
 		 kernel.  */
-              ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
+	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
 	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
 
@@ -767,8 +845,6 @@ getifaddrs (struct ifaddrs **ifap)
 
  exit_free:
   __netlink_free_handle (&nh);
-
- exit_close:
   __netlink_close (&nh);
 
   return result;
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
index 2b6c887fd0..7e7152935b 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux/MIPS version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
index 8b8e0072f5..f521df1771 100644
--- a/sysdeps/unix/sysv/linux/mips/clone.S
+++ b/sysdeps/unix/sysv/linux/mips/clone.S
@@ -163,4 +163,4 @@ L(gotpid):
 
 	END(__thread_start)
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/mips/vfork.S b/sysdeps/unix/sysv/linux/mips/vfork.S
index 1383ddc6a7..38b6195282 100644
--- a/sysdeps/unix/sysv/linux/mips/vfork.S
+++ b/sysdeps/unix/sysv/linux/mips/vfork.S
@@ -95,4 +95,4 @@ L(error):
 	END(__vfork)
 
 libc_hidden_def(__vfork)
-weak_alias(__vfork, vfork)
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index 1a7bc68c98..45c39115f3 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,13 +21,83 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
-#include <asm/types.h>
 
-#include <linux/if_tr.h>
+/* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
+   and FCS/CRC (frame check sequence). */
+#define TR_ALEN		6		/* Octets in one token-ring addr */
+#define TR_HLEN 	(sizeof (struct trh_hdr) + sizeof (struct trllc))
+#define AC		0x10
+#define LLC_FRAME 	0x40
+
+/* LLC and SNAP constants */
+#define EXTENDED_SAP 	0xAA
+#define UI_CMD       	0x03
+
+/* This is an Token-Ring frame header. */
+struct trh_hdr
+{
+  u_int8_t  ac;			/* access control field */
+  u_int8_t  fc;			/* frame control field */
+  u_int8_t  daddr[TR_ALEN];	/* destination address */
+  u_int8_t  saddr[TR_ALEN];	/* source address */
+  u_int16_t rcf;		/* route control field */
+  u_int16_t rseg[8];		/* routing registers */
+};
+
+/* This is an Token-Ring LLC structure */
+struct trllc
+{
+  u_int8_t  dsap;		/* destination SAP */
+  u_int8_t  ssap;		/* source SAP */
+  u_int8_t  llc;		/* LLC control field */
+  u_int8_t  protid[3];		/* protocol id */
+  u_int16_t ethertype;		/* ether type field */
+};
+
+/* Token-Ring statistics collection data. */
+struct tr_statistics
+{
+  unsigned long rx_packets;     /* total packets received	*/
+  unsigned long tx_packets;	/* total packets transmitted	*/
+  unsigned long rx_bytes;	/* total bytes received   	*/
+  unsigned long tx_bytes;	/* total bytes transmitted	*/
+  unsigned long rx_errors;	/* bad packets received		*/
+  unsigned long tx_errors;	/* packet transmit problems	*/
+  unsigned long rx_dropped;	/* no space in linux buffers	*/
+  unsigned long tx_dropped;	/* no space available in linux	*/
+  unsigned long multicast;	/* multicast packets received	*/
+  unsigned long transmit_collision;
+
+  /* detailed Token-Ring errors. See IBM Token-Ring Network
+     Architecture for more info */
+
+  unsigned long line_errors;
+  unsigned long internal_errors;
+  unsigned long burst_errors;
+  unsigned long A_C_errors;
+  unsigned long abort_delimiters;
+  unsigned long lost_frames;
+  unsigned long recv_congest_count;
+  unsigned long frame_copied_errors;
+  unsigned long frequency_errors;
+  unsigned long token_errors;
+  unsigned long dummy1;
+};
+
+/* source routing stuff */
+#define TR_RII 			0x80
+#define TR_RCF_DIR_BIT 		0x80
+#define TR_RCF_LEN_MASK 	0x1f00
+#define TR_RCF_BROADCAST 	0x8000	/* all-routes broadcast */
+#define TR_RCF_LIMITED_BROADCAST 0xC000	/* single-route broadcast */
+#define TR_RCF_FRAME2K 		0x20
+#define TR_RCF_BROADCAST_MASK 	0xC000
+#define TR_MAXRIFLEN 		18
 
 #ifdef __USE_BSD
 
-struct trn_hdr {
+struct trn_hdr
+{
   u_int8_t trn_ac;                /* access control field */
   u_int8_t trn_fc;                /* field control field */
   u_int8_t trn_dhost[TR_ALEN];    /* destination host */
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 6672e714ff..6b2d858c9d 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
 extern int __netlink_open (struct netlink_handle *h);
 extern void __netlink_close (struct netlink_handle *h);
 extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_sendreq (struct netlink_handle *h, int type);
-extern int __netlink_receive (struct netlink_handle *h);
+extern int __netlink_request (struct netlink_handle *h, int type);
 
 
 #endif /* netlinkaccess.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index a737322e2a..21ad98e501 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -34,11 +34,19 @@ ENTRY (BP_SYM (__brk))
 	lwz     r6,8(r1)
 #ifdef PIC
 	mflr    r4
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,__curbrk-1b@ha
+	mtlr	r4
+	stw	r3,__curbrk-1b@l(r5)
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
 	lwz     r5,__curbrk@got(r5)
 	mtlr    r4
 	stw     r3,0(r5)
+# endif
 #else
 	lis     r4,__curbrk@ha
 	stw     r3,__curbrk@l(r4)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
index e79d74cb75..069f94bd9d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2005 Free Software 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,7 @@
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
 #endif
 
 
@@ -39,7 +39,7 @@ __ftruncate64 (fd, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -57,7 +57,7 @@ __ftruncate64 (fd, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
index 4e6cf4b352..10211458d5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
@@ -129,8 +129,15 @@ ENTRY(__getcontext)
 
 #ifdef PIC
 	mflr    r8
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r7
+# endif
 # ifdef SHARED
 	lwz     r7,_rtld_global_ro@got(r7)
 	mtlr    r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
index b7a82a0182..eff60f9bbf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
@@ -58,8 +58,15 @@ ENTRY(__setcontext)
 
 #ifdef PIC
 	mflr    r8
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r7
+# endif
 # ifdef SHARED
 	lwz     r7,_rtld_global_ro@got(r7)
 	mtlr    r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
index c52ad9babf..72170c95c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
@@ -39,6 +39,8 @@
 #define NARGS 3
 #endif
 
+/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used
+   for temp saves.  44(r1) is used to save r30.  */
 #define stackblock 20
 
 #ifndef __socket
@@ -69,12 +71,6 @@ ENTRY(__socket)
 	stw  r8,20+stackblock(r1)
 #endif
 #if NARGS >= 7
-	stw  r9,24+stackblock(r1)
-#endif
-#if NARGS >= 8
-	stw  r10,28+stackblock(r1)
-#endif
-#if NARGS >= 9
 #error too many arguments!
 #endif
 
@@ -94,6 +90,7 @@ ENTRY(__socket)
 	mflr	r9
 	stw	r9,52(r1)
 	cfi_offset (lr, 4)
+	CGOTSETUP
 	CENABLE
 	stw	r3,16(r1)
 	li	r3,P(SOCKOP_,socket)
@@ -107,6 +104,7 @@ ENTRY(__socket)
 	lwz	r4,52(r1)
 	lwz	r0,12(r1)
 	lwz	r3,8(r1)
+	CGOTRESTORE
 	mtlr	r4
 	mtcr	r0
 	addi	r1,r1,48
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
index 0c84d48d10..6e46abadb0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
@@ -130,8 +130,15 @@ ENTRY(__swapcontext)
 	stfd	fp0,_UC_FREGS+(32*8)(r3)
 #ifdef PIC
 	mflr    r8
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r7
+# endif
 # ifdef SHARED
 	lwz     r7,_rtld_global_ro@got(r7)
 	mtlr    r8
@@ -272,8 +279,15 @@ L(no_vec):
 
 #ifdef PIC
 	mflr    r8
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r7
+# endif
 # ifdef SHARED
 	lwz     r7,_rtld_global_ro@got(r7)
 	mtlr    r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
index ce8ebc2a97..ee1b50c04b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,7 @@
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-int have_no_truncate64;
+int __have_no_truncate64;
 #endif
 
 
@@ -40,7 +40,7 @@ truncate64 (path, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -58,7 +58,7 @@ truncate64 (path, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
@@ -68,7 +68,7 @@ truncate64 (path, length)
       __set_errno (EINVAL);
       return -1;
     }
-  return truncate (path, (off_t) length);
+  return __truncate (path, (off_t) length);
 #endif
 }
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 8034559200..cf71a6df19 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -180,4 +180,4 @@ L(gotexitcodeaddr):
 #endif
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index fa815e9581..e2c5002390 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir.c>
 
-weak_alias(__readdir64, readdir64)
+weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index d63680bf9a..bce56124ef 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir_r.c>
 
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
index 2578b3ddc0..3b38d19488 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 7ad360a3a0..cce8d29735 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
index d9abb62c0b..bf70f11cc7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 5a0d7eca5d..8889b5359e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index 268f36e713..7beca847c2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ef2a862c55..cb96fd3b6a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index d94e4f62fd..0e41a11338 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -1,5 +1,5 @@
 /* Implementation of the POSIX sleep function using nanosleep.
-   Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <time.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <unistd.h>
 #include <sys/param.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index ed31b0e89c..8e7b64f996 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux/SPARC version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 4d8fdb8200..95106d149f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -104,4 +104,4 @@ __thread_start:
 
 	.size	__thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index f6134599e2..0e1025ff6a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -114,4 +114,4 @@ __thread_start:
 	 nop
 	.size __thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
index ea18a9ae4e..e6f5b55d6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
@@ -62,4 +62,4 @@ ENTRY(__getcontext)
 
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
index 435bf99acb..88dc54e852 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
@@ -47,6 +47,6 @@ END(__libc_siglongjmp)
 strong_alias(__libc_siglongjmp, __longjmp)
 strong_alias(__libc_siglongjmp, __libc_longjmp)
 libc_hidden_def (__libc_longjmp)
-weak_alias(__libc_siglongjmp, longjmp)
-weak_alias(__libc_siglongjmp, _longjmp)
-weak_alias(__libc_siglongjmp, siglongjmp)
+weak_alias (__libc_siglongjmp, longjmp)
+weak_alias (__libc_siglongjmp, _longjmp)
+weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index a8baf40a91..be2810e0c7 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -41,6 +41,14 @@
 #include <sys/types.h>
 
 /*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later.  */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
+/*
  * Convert diskblocks to blocks and the other way around.
  * currently only to fool the BSD source. :-)
  */
@@ -94,21 +102,33 @@
 #define SUBCMDSHIFT 8
 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
 
-#define Q_QUOTAON  0x0100	/* enable quotas */
-#define Q_QUOTAOFF 0x0200	/* disable quotas */
-#define Q_GETQUOTA 0x0300	/* get limits and usage */
-#define Q_SETQUOTA 0x0400	/* set limits and usage */
-#define Q_SETUSE   0x0500	/* set usage */
-#define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM  0x0700	/* set limits */
-#define Q_GETSTATS 0x0800	/* get collected stats */
-#define Q_RSQUASH  0x1000	/* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON  0x0100	/* enable quotas */
+# define Q_QUOTAOFF 0x0200	/* disable quotas */
+# define Q_GETQUOTA 0x0300	/* get limits and usage */
+# define Q_SETQUOTA 0x0400	/* set limits and usage */
+# define Q_SETUSE   0x0500	/* set usage */
+# define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM  0x0700	/* set limits */
+# define Q_GETSTATS 0x0800	/* get collected stats */
+# define Q_RSQUASH  0x1000	/* set root_squash option */
+#else
+# define Q_SYNC     0x800001	/* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON  0x800002	/* turn quotas on */
+# define Q_QUOTAOFF 0x800003	/* turn quotas off */
+# define Q_GETFMT   0x800004	/* get quota format used on given filesystem */
+# define Q_GETINFO  0x800005	/* get information about quota files */
+# define Q_SETINFO  0x800006	/* set information about quota files */
+# define Q_GETQUOTA 0x800007	/* get user quota structure */
+# define Q_SETQUOTA 0x800008	/* set user quota structure */
+#endif
 
 /*
  * The following structure defines the format of the disk quota file
  * (as it appears on disk) - the file is an array of these structures
  * indexed by user or group number.
  */
+#if _LINUX_QUOTA_VERSION < 2
 struct dqblk
   {
     u_int32_t dqb_bhardlimit;	/* absolute limit on disk blks alloc */
@@ -120,13 +140,45 @@ struct dqblk
     time_t dqb_btime;		/* time limit for excessive disk use */
     time_t dqb_itime;		/* time limit for excessive files */
   };
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid.  */
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+  {
+    u_int64_t dqb_bhardlimit;	/* absolute limit on disk quota blocks alloc */
+    u_int64_t dqb_bsoftlimit;	/* preferred limit on disk quota blocks */
+    u_int64_t dqb_curspace;	/* current quota block count */
+    u_int64_t dqb_ihardlimit;	/* maximum # allocated inodes */
+    u_int64_t dqb_isoftlimit;	/* preferred inode limit */
+    u_int64_t dqb_curinodes;	/* current # allocated inodes */
+    u_int64_t dqb_btime;	/* time limit for excessive disk use */
+    u_int64_t dqb_itime;	/* time limit for excessive files */
+    u_int32_t dqb_valid;	/* bitmask of QIF_* constants */
+  };
+#endif
 
 /*
  * Shorthand notation.
  */
 #define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
 #define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
-#define	dq_curblocks	dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks	dq_dqb.dqb_curblocks
+#else
+# define dq_curspace	dq_dqb.dqb_curspace
+# define dq_valid	dq_dqb.dqb_valid
+#endif
 #define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
 #define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
 #define	dq_curinodes	dq_dqb.dqb_curinodes
@@ -135,6 +187,7 @@ struct dqblk
 
 #define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
 
+#if _LINUX_QUOTA_VERSION < 2
 struct dqstats
   {
     u_int32_t lookups;
@@ -147,6 +200,22 @@ struct dqstats
     u_int32_t free_dquots;
     u_int32_t syncs;
   };
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid.  */
+# define IIF_BGRACE	1
+# define IIF_IGRACE	2
+# define IIF_FLAGS	4
+# define IIF_ALL	(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+  {
+    u_int64_t dqi_bgrace;
+    u_int64_t dqi_igrace;
+    u_int32_t dqi_flags;
+    u_int32_t dqi_valid;
+  };
+#endif
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 7e601acf2c..637fca5968 100644
--- a/sysdeps/unix/sysv/linux/sysctl.c
+++ b/sysdeps/unix/sysv/linux/sysctl.c
@@ -1,5 +1,5 @@
 /* Read or write system information.  Linux version.
-   Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sys/sysctl.h>
 
 #include <sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c
index 3fdff04c22..c5b389ea29 100644
--- a/sysdeps/unix/sysv/linux/system.c
+++ b/sysdeps/unix/sysv/linux/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
 
 #include <sched.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/wait.h>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
index 491fa9dfb2..5ea4c572a3 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
@@ -1,4 +1,4 @@
 #define __getdents64 __no___getdents64_decl
 #include <sysdeps/unix/sysv/linux/getdents.c>
 #undef __getdents64
-weak_alias(__getdents, __getdents64);
+weak_alias (__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
index d19c9f0d09..4bbc7a4d2e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
@@ -85,4 +85,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index 6597d8980b..5deea7d1b2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -110,4 +110,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 }
 
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
index 51e4a50712..61fc07f44f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
@@ -102,4 +102,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
index 8d48d3bd5e..fc7996ccdc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
@@ -120,4 +120,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S
index 1cc4e3065b..c005932c0c 100644
--- a/sysdeps/x86_64/_mcount.S
+++ b/sysdeps/x86_64/_mcount.S
@@ -64,4 +64,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/time/mktime.c b/time/mktime.c
index 79221b8a74..258eec637b 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -38,10 +38,11 @@
 
 #include <limits.h>
 
+#include <string.h>		/* For the real memcpy prototype.  */
+
 #if DEBUG
 # include <stdio.h>
 # include <stdlib.h>
-# include <string.h>
 /* Make it work even if the system's libc has its own mktime routine.  */
 # define mktime my_mktime
 #endif /* DEBUG */