about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-03-17 21:53:01 +0000
committerJakub Jelinek <jakub@redhat.com>2007-03-17 21:53:01 +0000
commit6ce38a95a4c8318df75cf91fbd90101601b3fa7f (patch)
tree044df11ca5f10f967644dffe5b0f621d6ac36188
parentb428b742cf54d423e5a7a68fcbec9473303eeafa (diff)
downloadglibc-6ce38a95a4c8318df75cf91fbd90101601b3fa7f.tar.gz
glibc-6ce38a95a4c8318df75cf91fbd90101601b3fa7f.tar.xz
glibc-6ce38a95a4c8318df75cf91fbd90101601b3fa7f.zip
Updated to fedora-glibc-20070317T2130 cvs/fedora-glibc-2_5_90-19
-rw-r--r--ChangeLog240
-rw-r--r--Makeconfig4
-rw-r--r--argp/Makefile4
-rw-r--r--argp/argp-help.c9
-rw-r--r--argp/argp.h5
-rw-r--r--argp/tst-argp2.c101
-rw-r--r--bits/mathinline.h2
-rw-r--r--bits/sigset.h5
-rw-r--r--bits/string.h2
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure39
-rw-r--r--configure.in24
-rw-r--r--ctype/ctype.h6
-rw-r--r--elf/dl-dst.h9
-rw-r--r--elf/dl-open.c5
-rw-r--r--elf/dl-support.c3
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in9
-rw-r--r--hurd/hurd.h5
-rw-r--r--hurd/hurd/fd.h4
-rw-r--r--hurd/hurd/port.h5
-rw-r--r--hurd/hurd/signal.h4
-rw-r--r--hurd/hurd/threadvar.h4
-rw-r--r--hurd/hurd/userlink.h4
-rw-r--r--include/dlfcn.h2
-rw-r--r--inet/Makefile2
-rw-r--r--inet/getnameinfo.c3
-rw-r--r--inet/inet6_opt.c36
-rw-r--r--inet/test-inet6_opt.c207
-rw-r--r--io/sys/stat.h23
-rw-r--r--libio/bits/stdio.h4
-rw-r--r--libio/bits/stdio2.h8
-rw-r--r--locale/programs/ld-ctype.c5
-rw-r--r--localedata/ChangeLog5
-rw-r--r--localedata/Makefile2
-rw-r--r--localedata/tst-sscanf.c2
-rw-r--r--login/utmp_file.c8
-rw-r--r--mach/lock-intern.h4
-rw-r--r--mach/mach/mig_support.h6
-rw-r--r--math/bits/cmathcalls.h8
-rw-r--r--math/libm-test.inc16
-rw-r--r--misc/sys/cdefs.h13
-rw-r--r--nptl/ChangeLog17
-rw-r--r--nptl/sysdeps/pthread/bits/libc-lock.h2
-rw-r--r--nptl/sysdeps/pthread/pthread.h7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/fork.c9
-rw-r--r--posix/bits/unistd.h30
-rw-r--r--powerpc-cpu/ChangeLog11
-rw-r--r--powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S6
-rw-r--r--powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S6
-rw-r--r--powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S6
-rw-r--r--powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S6
-rw-r--r--powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S6
-rw-r--r--socket/bits/socket2.h6
-rw-r--r--stdio-common/vfprintf.c3
-rw-r--r--stdlib/bits/stdlib.h12
-rw-r--r--stdlib/gmp.h6
-rw-r--r--stdlib/stdlib.h28
-rw-r--r--stdlib/strtod_l.c57
-rw-r--r--string/argz.h6
-rw-r--r--string/bits/string2.h4
-rw-r--r--string/bits/string3.h4
-rw-r--r--string/strerror_l.c1
-rw-r--r--sysdeps/alpha/Makefile7
-rw-r--r--sysdeps/alpha/fpu/bits/mathinline.h108
-rw-r--r--sysdeps/alpha/fpu/libm-test-ulps503
-rw-r--r--sysdeps/alpha/fpu/s_ceil.c29
-rw-r--r--sysdeps/alpha/fpu/s_ceilf.c34
-rw-r--r--sysdeps/alpha/fpu/s_floor.c34
-rw-r--r--sysdeps/alpha/fpu/s_floorf.c39
-rw-r--r--sysdeps/alpha/fpu/s_fmax.S58
-rw-r--r--sysdeps/alpha/fpu/s_fmaxf.S1
-rw-r--r--sysdeps/alpha/fpu/s_fmin.S58
-rw-r--r--sysdeps/alpha/fpu/s_fminf.S1
-rw-r--r--sysdeps/alpha/fpu/s_isnan.c58
-rw-r--r--sysdeps/alpha/fpu/s_isnanf.c1
-rw-r--r--sysdeps/alpha/fpu/s_llrint.c1
-rw-r--r--sysdeps/alpha/fpu/s_llrintf.c1
-rw-r--r--sysdeps/alpha/fpu/s_llround.c1
-rw-r--r--sysdeps/alpha/fpu/s_llroundf.c1
-rw-r--r--sysdeps/alpha/fpu/s_lrint.c48
-rw-r--r--sysdeps/alpha/fpu/s_lrintf.c39
-rw-r--r--sysdeps/alpha/fpu/s_lround.c48
-rw-r--r--sysdeps/alpha/fpu/s_lroundf.c38
-rw-r--r--sysdeps/alpha/fpu/s_nearbyint.c48
-rw-r--r--sysdeps/alpha/fpu/s_nearbyintf.c40
-rw-r--r--sysdeps/alpha/fpu/s_rint.c29
-rw-r--r--sysdeps/alpha/fpu/s_rintf.c35
-rw-r--r--sysdeps/alpha/fpu/s_round.c49
-rw-r--r--sysdeps/alpha/fpu/s_roundf.c44
-rw-r--r--sysdeps/alpha/fpu/s_trunc.c53
-rw-r--r--sysdeps/alpha/fpu/s_truncf.c45
-rw-r--r--sysdeps/generic/inttypes.h18
-rw-r--r--sysdeps/generic/machine-lock.h4
-rw-r--r--sysdeps/generic/machine-sp.h4
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/i386/fpu/e_fmod.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodf.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodl.c2
-rw-r--r--sysdeps/i386/fpu/e_log.S11
-rw-r--r--sysdeps/i386/fpu/e_logf.S11
-rw-r--r--sysdeps/i386/fpu/e_logl.S11
-rw-r--r--sysdeps/i386/fpu/e_pow.S18
-rw-r--r--sysdeps/i386/fpu/e_powf.S18
-rw-r--r--sysdeps/i386/fpu/e_powl.S18
-rw-r--r--sysdeps/i386/i486/bits/string.h4
-rw-r--r--sysdeps/ia64/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c22
-rw-r--r--sysdeps/ieee754/ldbl-128/Makefile1
-rw-r--r--sysdeps/mach/alpha/machine-lock.h4
-rw-r--r--sysdeps/mach/alpha/machine-sp.h4
-rw-r--r--sysdeps/mach/i386/machine-lock.h4
-rw-r--r--sysdeps/mach/powerpc/machine-lock.h4
-rw-r--r--sysdeps/mach/powerpc/machine-sp.h4
-rw-r--r--sysdeps/posix/getaddrinfo.c2
-rw-r--r--sysdeps/powerpc/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/s390/bits/string.h4
-rw-r--r--sysdeps/s390/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/sparc/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/socket.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/dl-auxv.h36
-rw-r--r--sysdeps/unix/sysv/linux/alpha/dl-support.c2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/dl-sysdep.c59
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigsuspend.S13
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sysconf.c2
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigset.h5
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h5
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c42
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c75
-rw-r--r--sysdeps/unix/sysv/linux/posix_madvise.c38
-rw-r--r--sysdeps/unix/sysv/linux/sh/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sys/sysmacros.h15
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
-rw-r--r--sysdeps/x86_64/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S12
-rw-r--r--sysdeps/x86_64/fpu/e_powl.S19
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S5
-rw-r--r--time/tst-mktime2.c5
-rw-r--r--time/tzfile.c53
-rw-r--r--wcsmbs/bits/wchar2.h36
-rw-r--r--wcsmbs/wchar.h20
147 files changed, 2470 insertions, 733 deletions
diff --git a/ChangeLog b/ChangeLog
index bc5d102f76..44efc91d07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,243 @@
+2007-03-16  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/dl-open.c (dl_open_worker): Declare l in 2 different
+	smaller scopes.
+	* elf/dl-dst.h (DL_DST_REQ_STATIC): Add l as macro argument.
+	(DL_DST_REQUIRED): Adjust user.
+
+	* include/dlfcn.h (struct link_map): New forward decl.
+
+	* inet/getnameinfo.c: Include stddef.h.
+	(getnameinfo): Use offsetof.
+
+	* time/tst-mktime2.c (do_test): Don't rely on signed wrap.
+
+	* stdio-common/vfprintf.c (_itoa): Undef before redefining.
+
+	* string/strerror_l.c: Include stdlib.h.
+
+	* configure.in (libc_cv_gnu89_inline): Test for -fgnu89-inline.
+	* config.make.in (gnu89-inline-CFLAGS): New variable.
+	* Makeconfig (CFLAGS): Use $(gnu89-inline-CFLAGS) together with
+	-std=gnu99.
+	* misc/sys/cdefs.h (__extern_inline, __extern_always_inline): Define.
+	* argp/argp.h: Use it.
+	* bits/mathinline.h: Likewise.
+	* bits/sigset.h: Likewise.
+	* bits/string.h: Likewise.
+	* ctype/ctype.h: Likewise.
+	* hurd/hurd.h: Likewise.
+	* hurd/hurd/fd.h: Likewise.
+	* hurd/hurd/port.h: Likewise.
+	* hurd/hurd/signal.h: Likewise.
+	* hurd/hurd/threadvar.h: Likewise.
+	* hurd/hurd/userlink.h: Likewise.
+	* io/sys/stat.h: Likewise.
+	* libio/bits/stdio.h: Likewise.
+	* libio/bits/stdio2.h: Likewise.
+	* mach/lock-intern.h: Likewise.
+	* mach/mach/mig_support.h: Likewise.
+	* math/bits/cmathcalls.h: Likewise.
+	* posix/bits/unistd.h: Likewise.
+	* socket/bits/socket2.h: Likewise.
+	* stdlib/bits/stdlib.h: Likewise.
+	* stdlib/stdlib.h: Likewise.
+	* string/argz.h: Likewise.
+	* string/bits/string2.h: Likewise.
+	* string/bits/string3.h: Likewise.
+	* sysdeps/alpha/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/generic/inttypes.h: Likewise.
+	* sysdeps/generic/machine-lock.h: Likewise.
+	* sysdeps/generic/machine-sp.h: Likewise.
+	* sysdeps/i386/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/i386/i486/bits/string.h: Likewise.
+	* sysdeps/ia64/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/mach/alpha/machine-lock.h: Likewise.
+	* sysdeps/mach/alpha/machine-sp.h: Likewise.
+	* sysdeps/mach/i386/machine-lock.h: Likewise.
+	* sysdeps/mach/powerpc/machine-lock.h: Likewise.
+	* sysdeps/mach/powerpc/machine-sp.h: Likewise.
+	* sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/s390/bits/string.h: Likewise.
+	* sysdeps/s390/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/bits/socket.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sigset.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
+	* sysdeps/unix/sysv/linux/sys/sysmacros.h: Likewise.
+	* sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
+	* wcsmbs/bits/wchar2.h: Likewise.
+	* wcsmbs/wchar.h: Likewise.
+	* stdlib/gmp.h: Likewise.  Include <features.h> to get
+	__extern_inline definition.
+
+2007-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+	* locale/programs/ld-ctype.c (find_translit): Return NULL if ctype is
+	NULL.
+
+	[BZ #3919]
+	* math/libm-test.inc (log_test): Test -Inf and NaN.
+	(log10_test, log1p_test, log2_test): Test -Inf.
+	* sysdeps/i386/fpu/e_log.S (__ieee754_log): Don't raise
+	FE_INVALID when argument is qNaN.
+	* sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise.
+	* sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Replace
+	andb $1, %ah with testb $1, %ah, don't test for parity, instead
+	testb $4, %ah and jump if non-zero.
+	* sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
+	* sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise.
+
+	[BZ #4101]
+	* argp/argp-help.c (hol_cluster_cmp): Fix comparisons used to find
+	ancestors with the same depths.
+	Patch by Niels Moeller <nisse@lysator.liu.se>.
+	(filter_doc): Don't crash if argp is NULL.
+	* argp/Makefile (tests): Add tst-argp2.
+	* argp/tst-argp2.c: New test.
+
+	[BZ #4130]
+	* login/utmp_file.c (setutent_file): Use O_LARGEFILE for
+	open_not_cancel_2.
+	(updwtmp_file): Likewise.
+
+	[BZ #4181]
+	* inet/inet6_opt.c (add_padding): Only insert padding if npad > 0.
+	(inet6_opt_append): Don't check extlen is big enough if extbuf
+	is NULL.
+	(inet6_opt_finish): Likewise.
+	* inet/Makefile (tests): Add test-inet6_opt.
+	* inet/test-inet6_opt.c: New test.
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Never
+	reallocate the buffer, instead fail for MSG_TRUNC or for EBUSY
+	NLMSG_ERR.  Instead use a page sized buffer.
+	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Use page sized
+	buffer.
+
+2007-03-14  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/alpha/fpu/s_llround.c: New file.
+	* sysdeps/alpha/fpu/s_llroundf.c: New file.
+	* sysdeps/alpha/fpu/s_lround.c: New file.
+	* sysdeps/alpha/fpu/s_lroundf.c: New file.
+	* sysdeps/alpha/fpu/s_round.c: New file.
+	* sysdeps/alpha/fpu/s_roundf.c: New file.
+	* sysdeps/alpha/fpu/s_trunc.c: New file.
+	* sysdeps/alpha/fpu/s_truncf.c: New file.
+
+	* sysdeps/alpha/fpu/s_ceil.c: Rewrite without branches.
+	* sysdeps/alpha/fpu/s_ceilf.c: Likewise.
+	* sysdeps/alpha/fpu/s_floor.c: Likewise.
+	* sysdeps/alpha/fpu/s_floorf.c: Likewise.
+	* sysdeps/alpha/fpu/s_rint.c: Likewise.
+	* sysdeps/alpha/fpu/s_rintf.c: Likewise.
+
+	* sysdeps/alpha/fpu/s_fmax.S: New file.
+	* sysdeps/alpha/fpu/s_fmaxf.S: New file.
+	* sysdeps/alpha/fpu/s_fmin.S: New file.
+	* sysdeps/alpha/fpu/s_fminf.S: New file.
+	* sysdeps/alpha/fpu/s_isnan.c: New file.
+	* sysdeps/alpha/fpu/s_isnanf.c: New file.
+	* sysdeps/alpha/fpu/s_llrint.c: New file.
+	* sysdeps/alpha/fpu/s_llrintf.c: New file.
+	* sysdeps/alpha/fpu/s_lrint.c: New file.
+	* sysdeps/alpha/fpu/s_lrintf.c: New file.
+	* sysdeps/alpha/fpu/s_nearbyint.c: New file.
+	* sysdeps/alpha/fpu/s_nearbyintf.c: New file.
+
+	* sysdeps/alpha/fpu/bits/mathinline.h (__floorf, __floor): Remove.
+	(__fdimf, fdimf, __fdim, fdim): Remove.
+	(__signbitf, __signbit, __signbitl): Use gcc builtin if available.
+	(__isnanf, __isnan, __isnanl): New.
+
+2007-03-13  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/ieee754/ldbl-128/Makefile: New file.
+
+2007-03-13  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/alpha/Makefile (sysdep-CFLAGS): Force dynamic rounding.
+	* sysdeps/alpha/fpu/bits/mathinline.h (__signbitl): New.
+	* sysdeps/alpha/fpu/libm-test-ulps: Regenerate.
+	* sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies: New file.
+	* sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies: New file.
+	* sysdeps/unix/sysv/linux/alpha/fpu/Implies: New file.
+
+2007-03-13  Richard Henderson  <rth@redhat.com>
+
+        * elf/dl-support.c (_dl_aux_init): Honor DL_PLATFORM_AUXV.
+	* sysdeps/unix/sysv/linux/alpha/dl-auxv.h: New file.
+	* sysdeps/unix/sysv/linux/alpha/dl-support.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/dl-sysdep.c (__libc_alpha_cache_shape):
+	Move to dl-auxv.h; initialize instead of extern weak.
+	(DL_PLATFORM_AUXV): Move to dl-auxv.h; don't test for undef
+	weak symbol.
+	* sysdeps/unix/sysv/linux/alpha/sysconf.c (__libc_alpha_cache_shape):
+	Extern instead of initialized.
+
+2007-03-13  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Add support for
+	__sigsuspend_nocancel.
+
+2007-03-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (get_scope): Correct test for
+	172.16/12 address range.
+
+2007-03-02  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Retry with
+	a new netlink socket if NLMSG_ERR -EBUSY is seen after some MSG_TRUNC
+	message.
+
+2007-03-01  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #4069]
+	* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Check for NaN
+	earlier.
+	* math/libm-test.inc (pow_test): Add more tests involving NaNs.
+
+	* sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Avoid invalid exception
+	for x qNaN and y either +-inf or non-integer value.
+	* sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Likewise.
+	* sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise.
+	* sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise.
+
+2007-02-10  Mike Frysinger  <vapier@gentoo.org>
+
+	* sysdeps/unix/sysv/linux/sh/Makefile: Remove sys/io.h
+	from sysdep_headers.
+
+2007-02-28  Jakub Jelinek  <jakub@redhat.com>
+
+	* time/tzfile.c (find_transition): Instead of a linear search try to
+	guess the transition index, use a linear search if the result is at
+	most 10 transitions away from the guess or binary search otherwise.
+
+2007-02-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Fix
+	memory reallocation.
+
 2007-02-21  Ulrich Drepper  <drepper@redhat.com>
 
+	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Add branch predictions
+	and fix some typos.
+	Optimize use of TOLOWER.
+
+	[BZ #3325]
+	* sysdeps/i386/fpu/e_fmodf.S: Revert last changes, keep using fprem.
+	* sysdeps/i386/fpu/e_fmodl.c: Likewise.
+	* sysdeps/i386/fpu/e_fmod.S: Likewise.
+
+	[BZ #3458]
+	* sysdeps/unix/sysv/linux/posix_madvise.c: New file.
+	* sysdeps/unix/sysv/linux/syscalls.list: Remove posix_madvise entry.
+
 	[BZ #4076]
 	* io/ftw.c (ftw_startup): Handle special case of FTW_CHDIR in /.
 	(open_dir_stream): Likewise.
@@ -18,8 +256,8 @@
 
 	[BZ #4070]
 	* stdio-common/printf_fp.c (___printf_fp): Handle a few more
-	* stdio-common/tfformat.c (sprint_doubles): Some more tests.
 	special cases.
+	* stdio-common/tfformat.c (sprint_doubles): Some more tests.
 
 2007-02-19  Ulrich Drepper  <drepper@redhat.com>
 
diff --git a/Makeconfig b/Makeconfig
index 349f94d9ac..049e4ca83a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 1991-2003,2004,2005,2006,2007 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -672,7 +672,7 @@ CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
 	   $(foreach lib,$(libof-$(basename $(@F))) \
 		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
-override CFLAGS	= -std=gnu99 \
+override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
 		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
 		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
 		  $(CFLAGS-$(@F))
diff --git a/argp/Makefile b/argp/Makefile
index 5ade517476..b8c9fca0fb 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,7 @@ distribute	= argp-fmtstream.h argp-namefrob.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
-tests		= argp-test tst-argp1 bug-argp1
+tests		= argp-test tst-argp1 bug-argp1 tst-argp2
 
 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 13c0820710..c12b10e235 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,6 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -672,9 +673,9 @@ hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
 {
   /* If one cluster is deeper than the other, use its ancestor at the same
      level, so that finding the common ancestor is straightforward.  */
-  while (cl1->depth < cl2->depth)
+  while (cl1->depth > cl2->depth)
     cl1 = cl1->parent;
-  while (cl2->depth < cl1->depth)
+  while (cl2->depth > cl1->depth)
     cl2 = cl2->parent;
 
   /* Now reduce both clusters to their ancestors at the point where both have
@@ -987,7 +988,7 @@ static const char *
 filter_doc (const char *doc, int key, const struct argp *argp,
 	    const struct argp_state *state)
 {
-  if (argp->help_filter)
+  if (argp && argp->help_filter)
     /* We must apply a user filter to this output.  */
     {
       void *input = __argp_input (argp, state);
diff --git a/argp/argp.h b/argp/argp.h
index 3a5cb01fd8..baf3afd826 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -1,5 +1,6 @@
 /* Hierarchial argument parsing, layered over getopt.
-   Copyright (C) 1995-1999,2003,2004,2005,2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -558,7 +559,7 @@ extern void *__argp_input (__const struct argp *__restrict __argp,
 # endif
 
 # ifndef ARGP_EI
-#  define ARGP_EI extern __inline__
+#  define ARGP_EI __extern_inline
 # endif
 
 ARGP_EI void
diff --git a/argp/tst-argp2.c b/argp/tst-argp2.c
new file mode 100644
index 0000000000..926614fbc8
--- /dev/null
+++ b/argp/tst-argp2.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <argp.h>
+
+static const struct argp_option opt1[] =
+  {
+    { "opt1", '1', "NUMBER", 0, "Option 1" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt2[] =
+  {
+    { "opt2", '2', "NUMBER", 0, "Option 2" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt3[] =
+  {
+    { "opt3", '3', "NUMBER", 0, "Option 3" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt4[] =
+  {
+    { "opt4", '4', "NUMBER", 0, "Option 4" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt5[] =
+  {
+    { "opt5", '5', "NUMBER", 0, "Option 5" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static struct argp argp5 =
+  {
+    opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
+  };
+
+static struct argp argp4 =
+  {
+    opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
+  };
+
+static struct argp argp3 =
+  {
+    opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
+  };
+
+static struct argp_child children2[] =
+  {
+    { &argp4, 0, "child3", 3 },
+    { &argp5, 0, "child4", 4 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp2 =
+  {
+    opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
+  };
+
+static struct argp_child children1[] =
+  {
+    { &argp2, 0, "child1", 1 },
+    { &argp3, 0, "child2", 2 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp1 =
+  {
+    opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
+  };
+
+
+static int
+do_test (void)
+{
+  argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/bits/mathinline.h b/bits/mathinline.h
index 5498af6b63..02ec21b438 100644
--- a/bits/mathinline.h
+++ b/bits/mathinline.h
@@ -1,6 +1,6 @@
 /* This file should provide inline versions of math functions.
 
-   Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+   Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'.
 
    This file should define __MATH_INLINES if functions are actually defined as
    inlines.  */
diff --git a/bits/sigset.h b/bits/sigset.h
index 5fc8692df0..d6f9311e71 100644
--- a/bits/sigset.h
+++ b/bits/sigset.h
@@ -1,5 +1,6 @@
 /* __sig_atomic_t, __sigset_t, and related definitions.  Generic/BSD version.
-   Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +39,7 @@ typedef unsigned long int __sigset_t;
 #define _SIGSET_H_fns 1
 
 #ifndef _EXTERN_INLINE
-# define _EXTERN_INLINE extern __inline
+# define _EXTERN_INLINE __extern_inline
 #endif
 
 /* Return a mask that includes SIG only.  The cast to `sigset_t' avoids
diff --git a/bits/string.h b/bits/string.h
index ad68b038b6..f8630d2c52 100644
--- a/bits/string.h
+++ b/bits/string.h
@@ -1,6 +1,6 @@
 /* This file should provide inline versions of string functions.
 
-   Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+   Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'.
 
    This file should define __STRING_INLINES if functions are actually defined
    as inlines.  */
diff --git a/config.make.in b/config.make.in
index 7aa9c1c12d..35597f808d 100644
--- a/config.make.in
+++ b/config.make.in
@@ -53,6 +53,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
 enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
+gnu89-inline-CFLAGS = @libc_cv_gnu89_inline@
 have-ssp = @libc_cv_ssp@
 have-selinux = @have_selinux@
 have-libaudit = @have_libaudit@
diff --git a/configure b/configure
index 0f00394f03..dbdf0d5d67 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 add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind 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 libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind 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 libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_gnu89_inline libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -5959,6 +5959,42 @@ echo "$as_me:$LINENO: result: $libc_cv_ssp" >&5
 echo "${ECHO_T}$libc_cv_ssp" >&6
 
 
+echo "$as_me:$LINENO: checking for -fgnu89-inline" >&5
+echo $ECHO_N "checking for -fgnu89-inline... $ECHO_C" >&6
+if test "${libc_cv_gnu89_inline+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.c <<EOF
+int foo;
+#ifdef __GNUC_GNU_INLINE__
+main () { return 0;}
+#else
+#error
+#endif
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -std=gnu99 -fgnu89-inline
+			    -o conftest conftest.c 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_gnu89_inline=yes
+else
+  libc_cv_gnu89_inline=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_gnu89_inline" >&5
+echo "${ECHO_T}$libc_cv_gnu89_inline" >&6
+if test $libc_cv_gnu89_inline = yes; then
+  libc_cv_gnu89_inline=-fgnu89-inline
+else
+  libc_cv_gnu89_inline=
+fi
+
+
 if test $elf != yes; then
   echo "$as_me:$LINENO: checking for .init and .fini sections" >&5
 echo $ECHO_N "checking for .init and .fini sections... $ECHO_C" >&6
@@ -8517,6 +8553,7 @@ s,@libc_cv_fpie@,$libc_cv_fpie,;t t
 s,@libc_cv_hashstyle@,$libc_cv_hashstyle,;t t
 s,@fno_unit_at_a_time@,$fno_unit_at_a_time,;t t
 s,@libc_cv_ssp@,$libc_cv_ssp,;t t
+s,@libc_cv_gnu89_inline@,$libc_cv_gnu89_inline,;t t
 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
diff --git a/configure.in b/configure.in
index 71ceb04b33..baf37598b2 100644
--- a/configure.in
+++ b/configure.in
@@ -1641,6 +1641,30 @@ fi
 rm -f conftest*])
 AC_SUBST(libc_cv_ssp)
 
+AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
+cat > conftest.c <<EOF
+int foo;
+#ifdef __GNUC_GNU_INLINE__
+main () { return 0;}
+#else
+#error
+#endif
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -std=gnu99 -fgnu89-inline
+			    -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_gnu89_inline=yes
+else
+  libc_cv_gnu89_inline=no
+fi
+rm -f conftest*])
+if test $libc_cv_gnu89_inline = yes; then
+  libc_cv_gnu89_inline=-fgnu89-inline
+else
+  libc_cv_gnu89_inline=
+fi
+AC_SUBST(libc_cv_gnu89_inline)
+
 if test $elf != yes; then
   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
 		 [AC_TRY_COMPILE(, [asm (".section .init");
diff --git a/ctype/ctype.h b/ctype/ctype.h
index e08545359d..9ae7fb6088 100644
--- a/ctype/ctype.h
+++ b/ctype/ctype.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,2002,2004
+/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,2002,2004,2007
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -187,13 +187,13 @@ __exctype (_tolower);
 # endif
 
 # ifdef __USE_EXTERN_INLINES
-extern __inline int
+__extern_inline int
 __NTH (tolower (int __c))
 {
   return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
 }
 
-extern __inline int
+__extern_inline int
 __NTH (toupper (int __c))
 {
   return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index 83d16bdb0e..175b7cd195 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -1,5 +1,6 @@
 /* Handling of dynamic sring tokens.
-   Copyright (C) 1999,2001,2002,2003,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1999,2001,2002,2003,2004,2006,2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -50,7 +51,7 @@
 									      \
 	   First get the origin string if it is not available yet.	      \
 	   This can only happen for the map of the executable.  */	      \
-	DL_DST_REQ_STATIC						      \
+	DL_DST_REQ_STATIC (l)						      \
 	if ((l)->l_origin == NULL)					      \
 	  {								      \
 	    assert ((l)->l_name[0] == '\0');				      \
@@ -68,9 +69,9 @@
     __len; })
 
 #ifdef SHARED
-# define DL_DST_REQ_STATIC /* nothing */
+# define DL_DST_REQ_STATIC(l) /* nothing */
 #else
-# define DL_DST_REQ_STATIC \
+# define DL_DST_REQ_STATIC(l) \
   if ((l) == NULL)							      \
     {									      \
       const char *origin = _dl_get_origin ();				      \
diff --git a/elf/dl-open.c b/elf/dl-open.c
index c997521126..259372178b 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -161,7 +161,7 @@ dl_open_worker (void *a)
   struct dl_open_args *args = a;
   const char *file = args->file;
   int mode = args->mode;
-  struct link_map *new, *l;
+  struct link_map *new;
   int lazy;
   unsigned int i;
   bool any_tls = false;
@@ -186,6 +186,7 @@ dl_open_worker (void *a)
 	 By default we assume this is the main application.  */
       call_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
 
+      struct link_map *l;
       for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
 	for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
 	  if (caller_dlopen >= (const void *) l->l_map_start
@@ -325,7 +326,7 @@ dl_open_worker (void *a)
   /* Relocate the objects loaded.  We do this in reverse order so that copy
      relocs of earlier objects overwrite the data written by later objects.  */
 
-  l = new;
+  struct link_map *l = new;
   while (l->l_next)
     l = l->l_next;
   while (1)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index c1cfc0df41..c7479dc639 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -211,6 +211,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
 	__libc_enable_secure = av->a_un.a_val;
 	__libc_enable_secure_decided = 1;
 	break;
+# ifdef DL_PLATFORM_AUXV
+      DL_PLATFORM_AUXV
+# endif
       }
   if (seen == 0xf)
     {
diff --git a/fedora/branch.mk b/fedora/branch.mk
index f852668404..00dde6b7c7 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc7
-fedora-sync-date := 2007-02-21 10:11 UTC
-fedora-sync-tag := fedora-glibc-20070221T1011
+fedora-sync-date := 2007-03-17 21:30 UTC
+fedora-sync-tag := fedora-glibc-20070317T2130
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index b2ac153017..80d71e4d8d 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 18
+%define glibcrelease 19
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define xenarches i686 athlon
 %ifarch %{xenarches}
@@ -1546,6 +1546,13 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Sat Mar 17 2007 Jakub Jelinek <jakub@redhat.com> 2.5.90-19
+- fix power6 libm compat symbols on ppc32 (#232633)
+- fix child refcntr in NPTL fork (#230198)
+- fix ifaddrs with many net devices on > 4KB page size arches (#230151)
+- fix pthread_mutex_timedlock on x86_64 (#228103)
+- various fixes (BZ#3919, BZ#4101, BZ#4130, BZ#4181, BZ#4069, BZ#3458)
+
 * Wed Feb 21 2007 Jakub Jelinek <jakub@redhat.com> 2.5.90-18
 - fix nftw with FTW_CHDIR on / (BZ#4076)
 - nscd fixes (BZ#4074)
diff --git a/hurd/hurd.h b/hurd/hurd.h
index 0dc9f2158b..642ea43b7b 100644
--- a/hurd/hurd.h
+++ b/hurd/hurd.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,94,95,96,97,98,99,2001,02 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,96,97,98,99,2001,2002,2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,7 +45,7 @@
 #include <errno.h>
 
 #ifndef _HURD_H_EXTERN_INLINE
-#define _HURD_H_EXTERN_INLINE extern __inline
+#define _HURD_H_EXTERN_INLINE __extern_inline
 #endif
 
 _HURD_H_EXTERN_INLINE int
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index ad11367f3b..08d4407e88 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -1,5 +1,5 @@
 /* File descriptors.
-   Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
+   Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006,2007
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -52,7 +52,7 @@ extern struct mutex _hurd_dtable_lock; /* Locks those two variables.  */
 #include <hurd/signal.h>
 
 #ifndef _HURD_FD_H_EXTERN_INLINE
-#define _HURD_FD_H_EXTERN_INLINE extern __inline
+#define _HURD_FD_H_EXTERN_INLINE __extern_inline
 #endif
 
 /* Returns the descriptor cell for FD.  If FD is invalid or unused, return
diff --git a/hurd/hurd/port.h b/hurd/hurd/port.h
index 4e7bbebc18..a1803c36a5 100644
--- a/hurd/hurd/port.h
+++ b/hurd/hurd/port.h
@@ -1,5 +1,6 @@
 /* Lightweight user references for ports.
-   Copyright (C) 1993, 1994, 1995, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -55,7 +56,7 @@ struct hurd_port
 
 
 #ifndef _HURD_PORT_H_EXTERN_INLINE
-#define _HURD_PORT_H_EXTERN_INLINE extern __inline
+#define _HURD_PORT_H_EXTERN_INLINE __extern_inline
 #endif
 
 
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index 238a73f19c..c5b04f434c 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -1,5 +1,5 @@
 /* Implementing POSIX.1 signals under the Hurd.
-   Copyright (C) 1993,94,95,96,98,99,2002 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,96,98,99,2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -126,7 +126,7 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
      __attribute__ ((__const__));
 
 #ifndef _HURD_SIGNAL_H_EXTERN_INLINE
-#define _HURD_SIGNAL_H_EXTERN_INLINE extern __inline
+#define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
 #endif
 
 _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
diff --git a/hurd/hurd/threadvar.h b/hurd/hurd/threadvar.h
index 5e7441f921..a0535f7596 100644
--- a/hurd/hurd/threadvar.h
+++ b/hurd/hurd/threadvar.h
@@ -1,5 +1,5 @@
 /* Internal per-thread variables for the Hurd.
-   Copyright (C) 1994,95,97,98,99,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,97,98,99,2001,02,06,07 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -74,7 +74,7 @@ enum __hurd_threadvar_index
 
 
 #ifndef _HURD_THREADVAR_H_EXTERN_INLINE
-#define _HURD_THREADVAR_H_EXTERN_INLINE extern __inline
+#define _HURD_THREADVAR_H_EXTERN_INLINE __extern_inline
 #endif
 
 /* Return the location of the value for the per-thread variable with index
diff --git a/hurd/hurd/userlink.h b/hurd/hurd/userlink.h
index 65179acac6..34457e7a0f 100644
--- a/hurd/hurd/userlink.h
+++ b/hurd/hurd/userlink.h
@@ -1,5 +1,5 @@
 /* Support for chains recording users of a resource; `struct hurd_userlink'.
-   Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1997, 1999, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -71,7 +71,7 @@ struct hurd_userlink
 
 
 #ifndef _HURD_USERLINK_H_EXTERN_INLINE
-#define _HURD_USERLINK_H_EXTERN_INLINE extern __inline
+#define _HURD_USERLINK_H_EXTERN_INLINE __extern_inline
 #endif
 
 
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 79c8f7d31b..a67426df3a 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -45,6 +45,8 @@ extern int _dl_addr (const void *address, Dl_info *info,
 libc_hidden_proto (_dl_addr)
 #endif
 
+struct link_map;
+
 /* Close an object previously opened by _dl_open.  */
 extern void _dl_close (void *map) attribute_hidden;
 /* Same as above, but without locking and safety checks for user
diff --git a/inet/Makefile b/inet/Makefile
index ad90b06199..5823b69e9c 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -52,7 +52,7 @@ routines := htonl htons		\
 aux := check_pf ifreq
 
 tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
-	 tst-gethnm test-ifaddrs bug-if1
+	 tst-gethnm test-ifaddrs bug-if1 test-inet6_opt
 
 include ../Rules
 
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index b7b2b151b2..50240383f3 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <alloca.h>
 #include <errno.h>
 #include <netdb.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -180,7 +181,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
   switch (sa->sa_family)
     {
     case AF_LOCAL:
-      if (addrlen < (socklen_t) (((struct sockaddr_un *) NULL)->sun_path))
+      if (addrlen < (socklen_t) offsetof (struct sockaddr_un, sun_path))
 	return EAI_FAMILY;
       break;
     case AF_INET:
diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c
index bddb85182b..17d3fee213 100644
--- a/inet/inet6_opt.c
+++ b/inet/inet6_opt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
 
@@ -51,7 +51,7 @@ add_padding (uint8_t *extbuf, int offset, int npad)
 {
   if (npad == 1)
     extbuf[offset] = IP6OPT_PAD1;
-  else
+  else if (npad > 0)
     {
       struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset);
 
@@ -102,21 +102,17 @@ inet6_opt_append (void *extbuf, socklen_t extlen, int offset, uint8_t type,
   int data_offset = offset + sizeof (struct ip6_opt);
   int npad = (align - data_offset % align) & (align - 1);
 
-  /* Now we can check whether the buffer is large enough.  */
-  if (data_offset + npad + len > extlen)
-    return -1;
-
-  if (npad != 0)
+  if (extbuf != NULL)
     {
-      if (extbuf != NULL)
-	add_padding (extbuf, offset, npad);
+      /* Now we can check whether the buffer is large enough.  */
+      if (data_offset + npad + len > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
 
       offset += npad;
-    }
 
-  /* Now prepare the option itself.  */
-  if (extbuf != NULL)
-    {
+      /* Now prepare the option itself.  */
       struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset);
 
       opt->ip6o_type = type;
@@ -124,6 +120,8 @@ inet6_opt_append (void *extbuf, socklen_t extlen, int offset, uint8_t type,
 
       *databufp = opt + 1;
     }
+  else
+    offset += npad;
 
   return offset + sizeof (struct ip6_opt) + len;
 }
@@ -145,12 +143,14 @@ inet6_opt_finish (void *extbuf, socklen_t extlen, int offset)
   /* Required padding at the end.  */
   int npad = (8 - (offset & 7)) & 7;
 
-  /* Make sure the buffer is large enough.  */
-  if (offset + npad > extlen)
-    return -1;
-
   if (extbuf != NULL)
-    add_padding (extbuf, offset, npad);
+    {
+      /* Make sure the buffer is large enough.  */
+      if (offset + npad > extlen)
+	return -1;
+
+      add_padding (extbuf, offset, npad);
+    }
 
   return offset + npad;
 }
diff --git a/inet/test-inet6_opt.c b/inet/test-inet6_opt.c
new file mode 100644
index 0000000000..4db9b59389
--- /dev/null
+++ b/inet/test-inet6_opt.c
@@ -0,0 +1,207 @@
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define OPT_X	42
+#define OPT_Y	43
+#define OPT_Z	44
+
+static void *
+encode_inet6_opt (socklen_t *elp)
+{
+  void *eb = NULL;
+  socklen_t el;
+  int cl;
+  void *db;
+  int offset;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+
+  *elp = 0;
+#define CHECK() \
+  if (cl == -1)						\
+    {							\
+      printf ("cl == -1 on line %d\n", __LINE__);	\
+      free (eb);					\
+      return NULL;					\
+    }
+
+  /* Estimate the length */
+  cl = inet6_opt_init (NULL, 0);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_X, 12, 8, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Y, 7, 4, NULL);
+  CHECK ();
+  cl = inet6_opt_append (NULL, 0, cl, OPT_Z, 7, 1, NULL);
+  CHECK ();
+  cl = inet6_opt_finish (NULL, 0, cl);
+  CHECK ();
+  el = cl;
+
+  eb = malloc (el + 8);
+  if (eb == NULL)
+    {
+      puts ("malloc failed");
+      return NULL;
+    }
+  /* Canary.  */
+  memcpy (eb + el, "deadbeef", 8);
+
+  cl = inet6_opt_init (eb, el);
+  CHECK ();
+
+  cl = inet6_opt_append (eb, el, cl, OPT_X, 12, 8, &db);
+  CHECK ();
+  val4 = 0x12345678;
+  offset = inet6_opt_set_val (db, 0, &val4, sizeof  (val4));
+  val8 = 0x0102030405060708LL;
+  inet6_opt_set_val (db, offset, &val8, sizeof  (val8));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Y, 7, 4, &db);
+  CHECK ();
+  val1 = 0x01;
+  offset = inet6_opt_set_val (db, 0, &val1, sizeof  (val1));
+  val2 = 0x1331;
+  offset = inet6_opt_set_val (db, offset, &val2, sizeof  (val2));
+  val4 = 0x01020304;
+  inet6_opt_set_val (db, offset, &val4, sizeof  (val4));
+
+  cl = inet6_opt_append (eb, el, cl, OPT_Z, 7, 1, &db);
+  CHECK ();
+  inet6_opt_set_val (db, 0, (void *) "abcdefg", 7);
+
+  cl = inet6_opt_finish (eb, el, cl);
+  CHECK ();
+
+  if (memcmp (eb + el, "deadbeef", 8) != 0)
+    {
+      puts ("Canary corrupted");
+      free (eb);
+      return NULL;
+    }
+  *elp = el;
+  return eb;
+}
+
+int
+decode_inet6_opt (void *eb, socklen_t el)
+{
+  int ret = 0;
+  int seq = 0;
+  int cl = 0;
+  int offset;
+  uint8_t type;
+  socklen_t len;
+  uint8_t val1;
+  uint16_t val2;
+  uint32_t val4;
+  uint64_t val8;
+  void *db;
+  char buf[8];
+
+  while ((cl = inet6_opt_next (eb, el, cl, &type, &len, &db)) != -1)
+    switch (type)
+      {
+      case OPT_X:
+	if (seq++ != 0)
+	  {
+	    puts ("OPT_X is not first");
+	    ret = 1;
+	  }
+	if (len != 12)
+	  {
+	    printf ("OPT_X's length %d != 12\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val4, sizeof (val4));
+	if (val4 != 0x12345678)
+	  {
+	    printf ("OPT_X's val4 %x != 0x12345678\n", val4);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val8, sizeof (val8));
+	if (offset != len || val8 != 0x0102030405060708LL)
+	  {
+	    printf ("OPT_X's val8 %llx != 0x0102030405060708\n",
+		    (long long) val8);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Y:
+	if (seq++ != 1)
+	  {
+	    puts ("OPT_Y is not second");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Y's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, &val1, sizeof (val1));
+	if (val1 != 0x01)
+	  {
+	    printf ("OPT_Y's val1 %x != 0x01\n", val1);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val2, sizeof (val2));
+	if (val2 != 0x1331)
+	  {
+	    printf ("OPT_Y's val2 %x != 0x1331\n", val2);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, offset, &val4, sizeof (val4));
+	if (offset != len || val4 != 0x01020304)
+	  {
+	    printf ("OPT_Y's val4 %x != 0x01020304\n", val4);
+	    ret = 1;
+	  }
+	break;
+      case OPT_Z:
+	if (seq++ != 2)
+	  {
+	    puts ("OPT_Z is not third");
+	    ret = 1;
+	  }
+	if (len != 7)
+	  {
+	    printf ("OPT_Z's length %d != 7\n", len);
+	    ret = 1;
+	  }
+	offset = inet6_opt_get_val (db, 0, buf, 7);
+	if (offset != len || memcmp (buf, "abcdefg", 7) != 0)
+	  {
+	    buf[7] = '\0';
+	    printf ("OPT_Z's buf \"%s\" != \"abcdefg\"\n", buf);
+	    ret = 1;
+	  }
+	break;
+      default:
+	printf ("Unknown option %d\n", type);
+	ret = 1;
+	break;
+      }
+  if (seq != 3)
+    {
+      puts ("Didn't see all of OPT_X, OPT_Y and OPT_Z");
+      ret = 1;
+    }
+  return ret;
+}
+
+int
+main (void)
+{
+  void *eb;
+  socklen_t el;
+  eb = encode_inet6_opt (&el);
+  if (eb == NULL)
+    return 1;
+  if (decode_inet6_opt (eb, el))
+    return 1;
+  return 0;
+}
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 4cc0b429a2..d1f4484185 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -430,28 +431,28 @@ extern int __xmknodat (int __ver, int __fd, __const char *__path,
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Inlined versions of the real stat and mknod functions.  */
 
-extern __inline__ int
+__extern_inline int
 __NTH (stat (__const char *__path, struct stat *__statbuf))
 {
   return __xstat (_STAT_VER, __path, __statbuf);
 }
 
 # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-extern __inline__ int
+__extern_inline int
 __NTH (lstat (__const char *__path, struct stat *__statbuf))
 {
   return __lxstat (_STAT_VER, __path, __statbuf);
 }
 # endif
 
-extern __inline__ int
+__extern_inline int
 __NTH (fstat (int __fd, struct stat *__statbuf))
 {
   return __fxstat (_STAT_VER, __fd, __statbuf);
 }
 
 # ifdef __USE_ATFILE
-extern __inline__ int
+__extern_inline int
 __NTH (fstatat (int __fd, __const char *__filename, struct stat *__statbuf,
 		int __flag))
 {
@@ -460,7 +461,7 @@ __NTH (fstatat (int __fd, __const char *__filename, struct stat *__statbuf,
 # endif
 
 # if defined __USE_MISC || defined __USE_BSD
-extern __inline__ int
+__extern_inline int
 __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev))
 {
   return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
@@ -468,7 +469,7 @@ __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev))
 # endif
 
 # ifdef __USE_ATFILE
-extern __inline__ int
+__extern_inline int
 __NTH (mknodat (int __fd, __const char *__path, __mode_t __mode,
 		__dev_t __dev))
 {
@@ -479,28 +480,28 @@ __NTH (mknodat (int __fd, __const char *__path, __mode_t __mode,
 # if defined __USE_LARGEFILE64 \
   && (! defined __USE_FILE_OFFSET64 \
       || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
-extern __inline__ int
+__extern_inline int
 __NTH (stat64 (__const char *__path, struct stat64 *__statbuf))
 {
   return __xstat64 (_STAT_VER, __path, __statbuf);
 }
 
 #  if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-extern __inline__ int
+__extern_inline int
 __NTH (lstat64 (__const char *__path, struct stat64 *__statbuf))
 {
   return __lxstat64 (_STAT_VER, __path, __statbuf);
 }
 #  endif
 
-extern __inline__ int
+__extern_inline int
 __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
 {
   return __fxstat64 (_STAT_VER, __fd, __statbuf);
 }
 
 #  ifdef __USE_GNU
-extern __inline__ int
+__extern_inline int
 __NTH (fstatat64 (int __fd, __const char *__filename, struct stat64 *__statbuf,
 		  int __flag))
 {
diff --git a/libio/bits/stdio.h b/libio/bits/stdio.h
index 9e951ad8e4..2731162c7f 100644
--- a/libio/bits/stdio.h
+++ b/libio/bits/stdio.h
@@ -1,5 +1,5 @@
 /* Optimizing macros and inline functions for stdio functions.
-   Copyright (C) 1998, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
 #ifdef __cplusplus
 # define __STDIO_INLINE inline
 #else
-# define __STDIO_INLINE extern __inline
+# define __STDIO_INLINE __extern_inline
 #endif
 
 
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index f1d745c699..8fd4a16076 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -1,5 +1,5 @@
 /* Checking macros for stdio functions.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,7 +86,7 @@ extern int __vprintf_chk (int __flag, __const char *__restrict __format,
 extern char *__gets_chk (char *__str, size_t) __wur;
 extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur;
 
-extern __always_inline __wur char *
+__extern_always_inline __wur char *
 gets (char *__str)
 {
   if (__bos (__str) != (size_t) -1)
@@ -100,7 +100,7 @@ extern char *__REDIRECT (__fgets_alias,
 			 (char *__restrict __s, int __n,
 			  FILE *__restrict __stream), fgets) __wur;
 
-extern __always_inline __wur char *
+__extern_always_inline __wur char *
 fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
@@ -116,7 +116,7 @@ extern char *__REDIRECT (__fgets_unlocked_alias,
 			 (char *__restrict __s, int __n,
 			  FILE *__restrict __stream), fgets_unlocked) __wur;
 
-extern __always_inline __wur char *
+__extern_always_inline __wur char *
 fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 69fc05f4ee..0e4b96d12f 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -1866,6 +1866,9 @@ find_translit (struct localedef_t *locale, const struct charmap_t *charmap,
   assert (locale != NULL);
   ctype = locale->categories[LC_CTYPE].ctype;
 
+  if (ctype == NULL)
+    return NULL;
+
   if (ctype->translit != NULL)
     result = find_translit2 (ctype, charmap, wch);
 
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index e1bc145ec3..789b58d4f7 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-07  Steven Munroe  <sjmunroe@us.ibm.com>
+
+	* Makefile: Define tst-sscanf-ENV.
+	* tst-sscanf.c: Use fa_IR.UTF-8 which exists internally.
+
 2007-02-18  Ulrich Drepper  <drepper@redhat.com>
 
 	* Makefile (tests): Add tst-sscanf.
diff --git a/localedata/Makefile b/localedata/Makefile
index f7a6a6c658..6b9ce6531a 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -290,6 +290,8 @@ tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
 
 bug-iconv-trans-ENV = LOCPATH=$(common-objpfx)localedata
 
+tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
+
 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
 		LOCPATH=$(common-objpfx)localedata
 $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
diff --git a/localedata/tst-sscanf.c b/localedata/tst-sscanf.c
index 89a77a14f8..32c13285a9 100644
--- a/localedata/tst-sscanf.c
+++ b/localedata/tst-sscanf.c
@@ -36,7 +36,7 @@ check_sscanf (const char *s, const char *format, const float n)
 static int
 do_test (void)
 {
-  if (setlocale (LC_ALL, "fa_IR") == NULL)
+  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL)
     {
       puts ("cannot set fa_IR locale");
       return 1;
diff --git a/login/utmp_file.c b/login/utmp_file.c
index e7743bfac8..871c856071 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>
    and Paul Janzen <pcj@primenet.com>, 1996.
@@ -140,11 +140,11 @@ setutent_file (void)
 
       file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
 
-      file_fd = open_not_cancel_2 (file_name, O_RDWR);
+      file_fd = open_not_cancel_2 (file_name, O_RDWR | O_LARGEFILE);
       if (file_fd == -1)
 	{
 	  /* Hhm, read-write access did not work.  Try read-only.  */
-	  file_fd = open_not_cancel_2 (file_name, O_RDONLY);
+	  file_fd = open_not_cancel_2 (file_name, O_RDONLY | O_LARGEFILE);
 	  if (file_fd == -1)
 	    return 0;
 	}
@@ -459,7 +459,7 @@ updwtmp_file (const char *file, const struct utmp *utmp)
   int fd;
 
   /* Open WTMP file.  */
-  fd = open_not_cancel_2 (file, O_WRONLY);
+  fd = open_not_cancel_2 (file, O_WRONLY | O_LARGEFILE);
   if (fd < 0)
     return -1;
 
diff --git a/mach/lock-intern.h b/mach/lock-intern.h
index 5aabc4a11f..d42a378f4d 100644
--- a/mach/lock-intern.h
+++ b/mach/lock-intern.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1996, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
 #include <machine-lock.h>
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 
diff --git a/mach/mach/mig_support.h b/mach/mach/mig_support.h
index 4cc3e987a9..f02e8d4f83 100644
--- a/mach/mach/mig_support.h
+++ b/mach/mach/mig_support.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,94,97,99,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,97,99,2001,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -67,12 +67,12 @@ extern void mig_reply_setup (const mach_msg_header_t *__request,
 /* Idiocy support function.  */
 extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len);
 extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t);
-extern __inline vm_size_t
+__extern_inline vm_size_t
 __mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
 {
   return __stpncpy (__dst, __src, __len) - __dst;
 }
-extern __inline vm_size_t
+__extern_inline vm_size_t
 mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
 {
   return __mig_strncpy (__dst, __src, __len);
diff --git a/math/bits/cmathcalls.h b/math/bits/cmathcalls.h
index c680c6d8e4..db7f69c72e 100644
--- a/math/bits/cmathcalls.h
+++ b/math/bits/cmathcalls.h
@@ -1,6 +1,6 @@
 /* Prototype declarations for complex math functions;
    helper file for <complex.h>.
-   Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2001, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -135,21 +135,21 @@ __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
 #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
 
 /* Imaginary part of Z.  */
-extern __inline _Mdouble_
+__extern_inline _Mdouble_
 __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
 {
   return __imag__ __z;
 }
 
 /* Real part of Z.  */
-extern __inline _Mdouble_
+__extern_inline _Mdouble_
 __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
 {
   return __real__ __z;
 }
 
 /* Complex conjugate of Z.  */
-extern __inline _Mdouble_complex_
+__extern_inline _Mdouble_complex_
 __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
 {
   return __extension__ ~__z;
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 23ee6beaa8..81dd364f77 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -4127,7 +4127,9 @@ log_test (void)
   TEST_f_f (log, 1, 0);
 
   TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
   TEST_f_f (log, plus_infty, plus_infty);
+  TEST_f_f (log, nan_value, nan_value);
 
   TEST_f_f (log, M_El, 1);
   TEST_f_f (log, 1.0 / M_El, -1);
@@ -4157,6 +4159,7 @@ log10_test (void)
 
   /* log10 (x) == NaN plus invalid exception if x < 0.  */
   TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log10, plus_infty, plus_infty);
   TEST_f_f (log10, nan_value, nan_value);
@@ -4188,6 +4191,7 @@ log1p_test (void)
 
   TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
   TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log1p, plus_infty, plus_infty);
   TEST_f_f (log1p, nan_value, nan_value);
@@ -4218,6 +4222,7 @@ log2_test (void)
   TEST_f_f (log2, 1, 0);
 
   TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (log2, plus_infty, plus_infty);
   TEST_f_f (log2, nan_value, nan_value);
@@ -4614,6 +4619,17 @@ pow_test (void)
 
   /* pow (x, NaN) == NaN.  */
   TEST_ff_f (pow, 3.0, nan_value, nan_value);
+  TEST_ff_f (pow, minus_zero, nan_value, nan_value);
+  TEST_ff_f (pow, plus_infty, nan_value, nan_value);
+  TEST_ff_f (pow, -3.0, nan_value, nan_value);
+  TEST_ff_f (pow, minus_infty, nan_value, nan_value);
+
+  TEST_ff_f (pow, nan_value, 3.0, nan_value);
+  TEST_ff_f (pow, nan_value, -3.0, nan_value);
+  TEST_ff_f (pow, nan_value, plus_infty, nan_value);
+  TEST_ff_f (pow, nan_value, minus_infty, nan_value);
+  TEST_ff_f (pow, nan_value, 2.5, nan_value);
+  TEST_ff_f (pow, nan_value, -2.5, nan_value);
 
   TEST_ff_f (pow, 1, plus_infty, 1);
   TEST_ff_f (pow, -1, plus_infty, 1);
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index ce5e83d571..ab7d327c59 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006
+/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -279,6 +279,17 @@
 # define __always_inline __inline
 #endif
 
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+   inline semantics, unless -fgnu89-inline is used.  */
+#ifdef __GNUC_STDC_INLINE__
+# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+# define __extern_always_inline \
+  extern __always_inline __attribute__ ((__gnu_inline__))
+#else
+# define __extern_inline extern __inline
+# define __extern_always_inline extern __always_inline
+#endif
+
 /* It is possible to compile containing GCC extensions even if GCC is
    run in pedantic mode if the uses are carefully marked using the
    `__extension__' keyword.  But this is not generally available before
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index aadec5ad38..38dd8d0510 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,20 @@
+2007-03-16  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/pthread/bits/libc-lock.h: Use __extern_inline and
+	__extern_always_inline where appropriate.
+	* sysdeps/pthread/pthread.h: Likewise.
+
+2007-03-13  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Use two
+	separate cfi regions for the two subsections.
+
+2007-02-25  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Reset refcntr in
+	new thread, don't just decrement it.
+	Patch by Suzuki K P <suzuki@in.ibm.com>.
+
 2007-02-21  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/pthread/pthread-functions.h: Correct last patch, correct
diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h
index c4c67ea4d3..0c8c0ada88 100644
--- a/nptl/sysdeps/pthread/bits/libc-lock.h
+++ b/nptl/sysdeps/pthread/bits/libc-lock.h
@@ -414,7 +414,7 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer
 
 
 /* Normal cleanup handling, based on C cleanup attribute.  */
-extern __inline void
+__extern_inline void
 __libc_cleanup_routine (struct __pthread_cleanup_frame *f)
 {
   if (f->__do_it)
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index f60ecdee18..4dc0b2272b 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -572,7 +573,7 @@ class __pthread_cleanup_class
    function the compiler is free to decide inlining the change when
    needed or fall back on the copy which must exist somewhere
    else.  */
-extern __inline void
+__extern_inline void
 __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
 {
   if (__frame->__do_it)
@@ -1103,7 +1104,7 @@ extern int pthread_atfork (void (*__prepare) (void),
 
 #ifdef __USE_EXTERN_INLINES
 /* Optimizations.  */
-extern __inline int
+__extern_inline int
 __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2))
 {
   return __thread1 == __thread2;
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
index aa42768f70..1db847c9eb 100644
--- a/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
@@ -55,6 +55,7 @@ __LABEL(name)							\
 	bne	a3, SYSCALL_ERROR_LABEL;			\
 __LABEL($pseudo_ret)						\
 	.subsection 2;						\
+	cfi_startproc;						\
 __LABEL($pseudo_cancel)						\
 	subq	sp, 64, sp;					\
 	cfi_def_cfa_offset(64);					\
@@ -90,12 +91,13 @@ __LABEL($multi_error)						\
 	cfi_def_cfa_offset(0);					\
 __LABEL($syscall_error)						\
 	SYSCALL_ERROR_HANDLER;					\
+	cfi_endproc;						\
 	.previous
 
 # undef PSEUDO_END
 # define PSEUDO_END(sym)					\
-	.subsection 2;						\
 	cfi_endproc;						\
+	.subsection 2;						\
 	.size sym, .-sym
 
 # define SAVE_ARGS_0	/* Nothing.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
index 840974401b..98bb237c06 100644
--- a/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -167,8 +167,11 @@ __libc_fork (void)
 	    allp->handler->child_handler ();
 
 	  /* Note that we do not have to wake any possible waiter.
-	     This is the only thread in the new process.  */
-	  --allp->handler->refcntr;
+ 	     This is the only thread in the new process.  The count
+ 	     may have been bumped up by other threads doing a fork.
+ 	     We reset it to 1, to avoid waiting for non-existing
+ 	     thread(s) to release the count.  */
+	  allp->handler->refcntr = 1;
 
 	  /* XXX We could at this point look through the object pool
 	     and mark all objects not on the __fork_handlers list as
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index b08aef2f6c..331e8ea3b9 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -1,5 +1,5 @@
 /* Checking macros for unistd functions.
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,7 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
 extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
 					  size_t __nbytes), read) __wur;
 
-extern __always_inline __wur ssize_t
+__extern_always_inline __wur ssize_t
 read (int __fd, void *__buf, size_t __nbytes)
 {
   if (__bos0 (__buf) != (size_t) -1
@@ -48,7 +48,7 @@ extern ssize_t __REDIRECT (__pread64_alias,
 			    __off64_t __offset), pread64) __wur;
 
 # ifndef __USE_FILE_OFFSET64
-extern __always_inline __wur ssize_t
+__extern_always_inline __wur ssize_t
 pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
 {
   if (__bos0 (__buf) != (size_t) -1
@@ -57,7 +57,7 @@ pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
   return __pread_alias (__fd, __buf, __nbytes, __offset);
 }
 # else
-extern __always_inline __wur ssize_t
+__extern_always_inline __wur ssize_t
 pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 {
   if (__bos0 (__buf) != (size_t) -1
@@ -68,7 +68,7 @@ pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 # endif
 
 # ifdef __USE_LARGEFILE64
-extern __always_inline __wur ssize_t
+__extern_always_inline __wur ssize_t
 pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 {
   if (__bos0 (__buf) != (size_t) -1
@@ -89,7 +89,7 @@ extern ssize_t __REDIRECT_NTH (__readlink_alias,
 				char *__restrict __buf, size_t __len), readlink)
      __nonnull ((1, 2)) __wur;
 
-extern __always_inline __nonnull ((1, 2)) __wur ssize_t
+__extern_always_inline __nonnull ((1, 2)) __wur ssize_t
 __NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
 		 size_t __len))
 {
@@ -111,7 +111,7 @@ extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
 			       readlinkat)
      __nonnull ((2, 3)) __wur;
 
-extern __always_inline __nonnull ((2, 3)) __wur ssize_t
+__extern_always_inline __nonnull ((2, 3)) __wur ssize_t
 __NTH (readlinkat (int __fd, __const char *__restrict __path,
 		   char *__restrict __buf, size_t __len))
 {
@@ -127,7 +127,7 @@ extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
 extern char *__REDIRECT_NTH (__getcwd_alias,
 			     (char *__buf, size_t __size), getcwd) __wur;
 
-extern __always_inline __wur char *
+__extern_always_inline __wur char *
 __NTH (getcwd (char *__buf, size_t __size))
 {
   if (__bos (__buf) != (size_t) -1
@@ -142,7 +142,7 @@ extern char *__getwd_chk (char *__buf, size_t buflen)
 extern char *__REDIRECT_NTH (__getwd_alias, (char *__buf), getwd)
      __nonnull ((1)) __wur;
 
-extern __always_inline __nonnull ((1)) __attribute_deprecated__ __wur char *
+__extern_always_inline __nonnull ((1)) __attribute_deprecated__ __wur char *
 __NTH (getwd (char *__buf))
 {
   if (__bos (__buf) != (size_t) -1)
@@ -156,7 +156,7 @@ extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
 extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
 						size_t __len), confstr);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (confstr (int __name, char *__buf, size_t __len))
 {
   if (__bos (__buf) != (size_t) -1
@@ -171,7 +171,7 @@ extern int __getgroups_chk (int __size, __gid_t __list[], size_t listlen)
 extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
 			   getgroups) __wur;
 
-extern __always_inline int
+__extern_always_inline int
 __NTH (getgroups (int __size, __gid_t __list[]))
 {
   if (__bos (__list) != (size_t) -1
@@ -188,7 +188,7 @@ extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
 					       size_t __buflen), ttyname_r)
      __nonnull ((2));
 
-extern __always_inline int
+__extern_always_inline int
 __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen))
 {
   if (__bos (__buf) != (size_t) -1
@@ -204,7 +204,7 @@ extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
 extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
 		       getlogin_r) __nonnull ((1));
 
-extern __always_inline int
+__extern_always_inline int
 getlogin_r (char *__buf, size_t __buflen)
 {
   if (__bos (__buf) != (size_t) -1
@@ -221,7 +221,7 @@ extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
 extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
 			   gethostname) __nonnull ((1));
 
-extern __always_inline int
+__extern_always_inline int
 __NTH (gethostname (char *__buf, size_t __buflen))
 {
   if (__bos (__buf) != (size_t) -1
@@ -239,7 +239,7 @@ extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
 						   size_t __buflen),
 			   getdomainname) __nonnull ((1)) __wur;
 
-extern __always_inline int
+__extern_always_inline int
 __NTH (getdomainname (char *__buf, size_t __buflen))
 {
   if (__bos (__buf) != (size_t) -1
diff --git a/powerpc-cpu/ChangeLog b/powerpc-cpu/ChangeLog
index 79f9dc6b1f..b136e196c4 100644
--- a/powerpc-cpu/ChangeLog
+++ b/powerpc-cpu/ChangeLog
@@ -1,3 +1,14 @@
+2007-03-17  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Use GLIBC_2_1
+	instead of GLIBC_2_0.
+	* sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Likewise.
+	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
+	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
+	* sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S: Include
+	math_ldbl_opt.h.
+	(llrintl): Add @GLIBC_2.1 compat symbol.
+
 2006-10-20  Steven Munroe  <sjmunroe@us.ibm.com>
 
 	* sysdeps/powerpc/powerpc32/power4/fpu/slowpow.c: New file.
diff --git a/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
index a122a86834..705b634766 100644
--- a/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
+++ b/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
@@ -1,5 +1,5 @@
 /* round function.  PowerPC32/power5+ version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,6 +32,6 @@ weak_alias (__round, round)
 weak_alias (__round, roundl)
 strong_alias (__round, __roundl)
 #endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __round, roundl, GLIBC_2_0)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
 #endif
diff --git a/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
index 588420ac1e..891285eafe 100644
--- a/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
+++ b/powerpc-cpu/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
@@ -1,5 +1,5 @@
 /* trunc function.  PowerPC32/power5+ version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,6 +32,6 @@ weak_alias (__trunc, trunc)
 weak_alias (__trunc, truncl)
 strong_alias (__trunc, __truncl)
 #endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __trunc, truncl, GLIBC_2_0)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
 #endif
diff --git a/powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S b/powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S
index fde4b3aa81..1ccbf644d6 100644
--- a/powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S
+++ b/powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S
@@ -1,5 +1,5 @@
 /* Round double to long int.  PowerPC32 on PowerPC64 version.
-   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
    02110-1301 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 /* long long int[r3, r4] __llrint (double x[fp1])  */
 ENTRY (__llrint)	
@@ -41,3 +42,6 @@ weak_alias (__llrint, llrint)
 strong_alias (__llrint, __llrintl)
 weak_alias (__llrint, llrintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
+#endif
diff --git a/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S b/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
index 4e25d701a4..99ae4f9346 100644
--- a/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
+++ b/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
@@ -1,5 +1,5 @@
 /* round function.  PowerPC64/power5+ version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +33,6 @@ weak_alias (__round, round)
 weak_alias (__round, roundl)
 strong_alias (__round, __roundl)
 #endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __round, roundl, GLIBC_2_0)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
 #endif
diff --git a/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S b/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
index 01eccbdf07..be4d7a8b1d 100644
--- a/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
+++ b/powerpc-cpu/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
@@ -1,5 +1,5 @@
 /* trunc function.  PowerPC64/power5+ version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +33,6 @@ weak_alias (__trunc, trunc)
 weak_alias (__trunc, truncl)
 strong_alias (__trunc, __truncl)
 #endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __trunc, truncl, GLIBC_2_0)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
 #endif
diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h
index 2543ea37d4..9fac75669c 100644
--- a/socket/bits/socket2.h
+++ b/socket/bits/socket2.h
@@ -1,5 +1,5 @@
 /* Checking macros for socket functions.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,7 @@ extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
 extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
 					  int __flags), recv);
 
-extern __always_inline ssize_t
+__extern_always_inline ssize_t
 recv (int __fd, void *__buf, size_t __n, int __flags)
 {
   if (__bos0 (__buf) != (size_t) -1
@@ -44,7 +44,7 @@ extern ssize_t __REDIRECT (__recvfrom_alias,
 			    int __flags, __SOCKADDR_ARG __addr,
 			    socklen_t *__restrict __addr_len), recvfrom);
 
-extern __always_inline ssize_t
+__extern_always_inline ssize_t
 recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
 	  __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
 {
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 53339f3078..946551f2d6 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -99,6 +99,7 @@
 # define PUTC(C, F)	_IO_putwc_unlocked (C, F)
 # define ORIENT		if (_IO_fwide (s, 1) != 1) return -1
 
+# undef _itoa
 # define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case)
 # define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case)
 # undef EOF
diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
index 4bacb09a09..7ee7bf5587 100644
--- a/stdlib/bits/stdlib.h
+++ b/stdlib/bits/stdlib.h
@@ -1,5 +1,5 @@
 /* Checking macros for stdlib functions.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@ extern char *__REDIRECT_NTH (__realpath_alias,
 			     (__const char *__restrict __name,
 			      char *__restrict __resolved), realpath) __wur;
 
-extern __always_inline __wur char *
+__extern_always_inline __wur char *
 __NTH (realpath (__const char *__restrict __name, char *__restrict __resolved))
 {
   if (__bos (__resolved) != (size_t) -1)
@@ -44,7 +44,7 @@ extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
 					       size_t __buflen), ptsname_r)
      __nonnull ((2));
 
-extern __always_inline int
+__extern_always_inline int
 __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen))
 {
   if (__bos (__buf) != (size_t) -1
@@ -59,7 +59,7 @@ extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
 extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar),
 			   wctomb) __wur;
 
-extern __always_inline __wur int
+__extern_always_inline __wur int
 __NTH (wctomb (char *__s, wchar_t __wchar))
 {
   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
@@ -83,7 +83,7 @@ extern size_t __REDIRECT_NTH (__mbstowcs_alias,
 			       __const char *__restrict __src,
 			       size_t __len), mbstowcs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src,
 		 size_t __len))
 {
@@ -104,7 +104,7 @@ extern size_t __REDIRECT_NTH (__wcstombs_alias,
 			       __const wchar_t *__restrict __src,
 			       size_t __len), wcstombs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src,
 		 size_t __len))
 {
diff --git a/stdlib/gmp.h b/stdlib/gmp.h
index 0ecc6d1024..cace8be230 100644
--- a/stdlib/gmp.h
+++ b/stdlib/gmp.h
@@ -1,6 +1,6 @@
 /* gmp.h -- Definitions for GNU multiple precision functions.
 
-Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+Copyright (C) 1991, 1993, 1994, 1995, 1996, 2007 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -21,6 +21,8 @@ MA 02111-1307, USA. */
 
 #ifndef __GMP_H__
 
+#include <features.h>
+
 #ifndef __GNU_MP__
 #define __GNU_MP__ 2
 #define __need_size_t
@@ -41,7 +43,7 @@ MA 02111-1307, USA. */
 
 #ifndef _EXTERN_INLINE
 #ifdef __GNUC__
-#define _EXTERN_INLINE extern __inline__
+#define _EXTERN_INLINE __extern_inline
 #else
 #define _EXTERN_INLINE static
 #endif
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 7b39bc018a..af27d09e3a 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003,2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003,2004,2005,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -324,18 +324,18 @@ extern unsigned long long int __strtoull_internal (__const char *
 /* Define inline functions which call the internal entry points.  */
 
 __BEGIN_NAMESPACE_STD
-extern __inline double
+__extern_inline double
 __NTH (strtod (__const char *__restrict __nptr, char **__restrict __endptr))
 {
   return __strtod_internal (__nptr, __endptr, 0);
 }
-extern __inline long int
+__extern_inline long int
 __NTH (strtol (__const char *__restrict __nptr, char **__restrict __endptr,
 	       int __base))
 {
   return __strtol_internal (__nptr, __endptr, __base, 0);
 }
-extern __inline unsigned long int
+__extern_inline unsigned long int
 __NTH (strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
 		int __base))
 {
@@ -345,13 +345,13 @@ __END_NAMESPACE_STD
 
 # ifdef __USE_ISOC99
 __BEGIN_NAMESPACE_C99
-extern __inline float
+__extern_inline float
 __NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr))
 {
   return __strtof_internal (__nptr, __endptr, 0);
 }
 #  ifndef __LDBL_COMPAT
-extern __inline long double
+__extern_inline long double
 __NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr))
 {
   return __strtold_internal (__nptr, __endptr, 0);
@@ -361,13 +361,13 @@ __END_NAMESPACE_C99
 # endif
 
 # ifdef __USE_BSD
-__extension__ extern __inline long long int
+__extension__ __extern_inline long long int
 __NTH (strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
 	       int __base))
 {
   return __strtoll_internal (__nptr, __endptr, __base, 0);
 }
-__extension__ extern __inline unsigned long long int
+__extension__ __extern_inline unsigned long long int
 __NTH (strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
 		int __base))
 {
@@ -377,13 +377,13 @@ __NTH (strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
 
 # if defined __USE_MISC || defined __USE_ISOC99
 __BEGIN_NAMESPACE_C99
-__extension__ extern __inline long long int
+__extension__ __extern_inline long long int
 __NTH (strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
 		int __base))
 {
   return __strtoll_internal (__nptr, __endptr, __base, 0);
 }
-__extension__ extern __inline unsigned long long int
+__extension__ __extern_inline unsigned long long int
 __NTH (strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
 		 int __base))
 {
@@ -393,17 +393,17 @@ __END_NAMESPACE_C99
 # endif
 
 __BEGIN_NAMESPACE_STD
-extern __inline double
+__extern_inline double
 __NTH (atof (__const char *__nptr))
 {
   return strtod (__nptr, (char **) NULL);
 }
-extern __inline int
+__extern_inline int
 __NTH (atoi (__const char *__nptr))
 {
   return (int) strtol (__nptr, (char **) NULL, 10);
 }
-extern __inline long int
+__extern_inline long int
 __NTH (atol (__const char *__nptr))
 {
   return strtol (__nptr, (char **) NULL, 10);
@@ -412,7 +412,7 @@ __END_NAMESPACE_STD
 
 # if defined __USE_MISC || defined __USE_ISOC99
 __BEGIN_NAMESPACE_C99
-__extension__ extern __inline long long int
+__extension__ __extern_inline long long int
 __NTH (atoll (__const char *__nptr))
 {
   return strtoll (__nptr, (char **) NULL, 10);
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index bb7493bff0..4033e3bef8 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -482,7 +482,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
   struct locale_data *current = loc->__locales[LC_NUMERIC];
 
-  if (group)
+  if (__builtin_expect (group, 0))
     {
       grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
       if (*grouping <= 0 || *grouping == CHAR_MAX)
@@ -548,7 +548,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
       && (wint_t) cp[1] >= L'0' && (wint_t) cp[1] <= L'9')
     {
       /* We accept it.  This funny construct is here only to indent
-	 the code directly.  */
+	 the code correctly.  */
     }
 #else
   for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
@@ -557,13 +557,15 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
   if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9')
     {
       /* We accept it.  This funny construct is here only to indent
-	 the code directly.  */
+	 the code correctly.  */
     }
 #endif
   else if (c < L_('0') || c > L_('9'))
     {
       /* Check for `INF' or `INFINITY'.  */
-      if (TOLOWER_C (c) == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
+      CHAR_TYPE lowc = TOLOWER_C (c);
+
+      if (lowc == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
 	{
 	  /* Return +/- infinity.  */
 	  if (endptr != NULL)
@@ -574,7 +576,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	  return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
 	}
 
-      if (TOLOWER_C (c) == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
+      if (lowc == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
 	{
 	  /* Return NaN.  */
 	  FLOAT retval = NAN;
@@ -588,7 +590,8 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	      do
 		++cp;
 	      while ((*cp >= L_('0') && *cp <= L_('9'))
-		     || (TOLOWER (*cp) >= L_('a') && TOLOWER (*cp) <= L_('z'))
+		     || ({ CHAR_TYPE lo = TOLOWER (*cp);
+			   lo >= L_('a') && lo <= L_('z'); })
 		     || *cp == L_('_'));
 
 	      if (*cp != L_(')'))
@@ -640,7 +643,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
   while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands))
     c = *++cp;
 #else
-  if (thousands == NULL)
+  if (__builtin_expect (thousands == NULL, 1))
     while (c == '0')
       c = *++cp;
   else
@@ -664,9 +667,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
   /* If no other digit but a '0' is found the result is 0.0.
      Return current read pointer.  */
+  CHAR_TYPE lowc = TOLOWER (c);
   if (!((c >= L_('0') && c <= L_('9'))
-	|| (base == 16 && ((CHAR_TYPE) TOLOWER (c) >= L_('a')
-			   && (CHAR_TYPE) TOLOWER (c) <= L_('f')))
+	|| (base == 16 && lowc >= L_('a') && lowc <= L_('f'))
 	|| (
 #ifdef USE_WIDE_CHAR
 	    c == (wint_t) decimal
@@ -682,11 +685,11 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	    && (base != 16
 		|| cp != start_of_digits
 		|| (cp[decimal_len] >= L_('0') && cp[decimal_len] <= L_('9'))
-		|| ((CHAR_TYPE) TOLOWER (cp[decimal_len]) >= L_('a')
-		    && (CHAR_TYPE) TOLOWER (cp[decimal_len]) <= L_('f'))))
+		|| ({ CHAR_TYPE lo = TOLOWER (cp[decimal_len]);
+		      lo >= L_('a') && lo <= L_('f'); })))
 	|| (base == 16 && (cp != start_of_digits
-			   && (CHAR_TYPE) TOLOWER (c) == L_('p')))
-	|| (base != 16 && (CHAR_TYPE) TOLOWER (c) == L_('e'))))
+			   && lowc == L_('p')))
+	|| (base != 16 && lowc == L_('e'))))
     {
 #ifdef USE_WIDE_CHAR
       tp = __correctly_grouped_prefixwc (start_of_digits, cp, thousands,
@@ -707,17 +710,19 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
   while (1)
     {
       if ((c >= L_('0') && c <= L_('9'))
-	  || (base == 16 && (wint_t) TOLOWER (c) >= L_('a')
-	      && (wint_t) TOLOWER (c) <= L_('f')))
+	  || (base == 16
+	      && ({ CHAR_TYPE lo = TOLOWER (c);
+		    lo >= L_('a') && lo <= L_('f'); })))
 	++dig_no;
       else
 	{
 #ifdef USE_WIDE_CHAR
-	  if ((wint_t) thousands == L'\0' || c != (wint_t) thousands)
+	  if (__builtin_expect ((wint_t) thousands == L'\0', 1)
+	      || c != (wint_t) thousands)
 	    /* Not a digit or separator: end of the integer part.  */
 	    break;
 #else
-	  if (thousands == NULL)
+	  if (__builtin_expect (thousands == NULL, 1))
 	    break;
 	  else
 	    {
@@ -733,7 +738,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
       c = *++cp;
     }
 
-  if (grouping && cp > start_of_digits)
+  if (__builtin_expect (grouping != NULL, 0) && cp > start_of_digits)
     {
       /* Check the grouping of the digits.  */
 #ifdef USE_WIDE_CHAR
@@ -794,7 +799,8 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
       cp += decimal_len;
       c = *cp;
       while ((c >= L_('0') && c <= L_('9')) ||
-	     (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
+	     (base == 16 && ({ CHAR_TYPE lo = TOLOWER (c);
+			       lo >= L_('a') && lo <= L_('f'); })))
 	{
 	  if (c != L_('0') && lead_zero == -1)
 	    lead_zero = dig_no - int_no;
@@ -807,8 +813,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
   expp = cp;
 
   /* Read exponent.  */
-  if ((base == 16 && TOLOWER (c) == L_('p'))
-      || (base != 16 && TOLOWER (c) == L_('e')))
+  lowc = TOLOWER (c);
+  if ((base == 16 && lowc == L_('p'))
+      || (base != 16 && lowc == L_('e')))
     {
       int exp_negative = 0;
 
@@ -840,7 +847,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	      exponent *= 10;
 	      exponent += c - L_('0');
 
-	      if (exponent > exp_limit)
+	      if (__builtin_expect (exponent > exp_limit, 0))
 		/* The exponent is too large/small to represent a valid
 		   number.  */
 		{
@@ -1024,13 +1031,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
     exponent -= incr;
   }
 
-  if (int_no + exponent > MAX_10_EXP + 1)
+  if (__builtin_expect (int_no + exponent > MAX_10_EXP + 1, 0))
     {
       __set_errno (ERANGE);
       return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
     }
 
-  if (exponent < MIN_10_EXP - (DIG + 1))
+  if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0))
     {
       __set_errno (ERANGE);
       return 0.0;
@@ -1094,7 +1101,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
       /* Now we know the exponent of the number in base two.
 	 Check it against the maximum possible exponent.  */
-      if (bits > MAX_EXP)
+      if (__builtin_expect (bits > MAX_EXP, 0))
 	{
 	  __set_errno (ERANGE);
 	  return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
diff --git a/string/argz.h b/string/argz.h
index dd7e4706c7..4141d998f9 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -1,5 +1,5 @@
 /* Routines for dealing with '\0' separated arg vectors.
-   Copyright (C) 1995,96,97,98,99,2000,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,2004,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -160,7 +160,7 @@ extern char *argz_next (__const char *__restrict __argz, size_t __argz_len,
 			__const char *__restrict __entry) __THROW;
 
 #ifdef __USE_EXTERN_INLINES
-extern inline char *
+__extern_inline char *
 __NTH (__argz_next (__const char *__argz, size_t __argz_len,
 		    __const char *__entry))
 {
@@ -174,7 +174,7 @@ __NTH (__argz_next (__const char *__argz, size_t __argz_len,
   else
     return __argz_len > 0 ? (char *) __argz : 0;
 }
-extern inline char *
+__extern_inline char *
 __NTH (argz_next (__const char *__argz, size_t __argz_len,
 		  __const char *__entry))
 {
diff --git a/string/bits/string2.h b/string/bits/string2.h
index ba84da2346..1e4d736a17 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -1,5 +1,5 @@
 /* Machine-independant string function optimizations.
-   Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997-2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -43,7 +43,7 @@
 # ifdef __cplusplus
 #  define __STRING_INLINE inline
 # else
-#  define __STRING_INLINE extern __inline
+#  define __STRING_INLINE __extern_inline
 # endif
 #endif
 
diff --git a/string/bits/string3.h b/string/bits/string3.h
index 041ac11259..f68ce5899f 100644
--- a/string/bits/string3.h
+++ b/string/bits/string3.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -151,7 +151,7 @@ extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest,
 					       __const char *__src,
 					       size_t __n), stpncpy);
 
-extern __always_inline char *
+__extern_always_inline char *
 __NTH (stpncpy (char *__dest, __const char *__src, size_t __n))
 {
   if (__bos (__dest) != (size_t) -1
diff --git a/string/strerror_l.c b/string/strerror_l.c
index 348a3c50ec..32a004ee75 100644
--- a/string/strerror_l.c
+++ b/string/strerror_l.c
@@ -19,6 +19,7 @@
 #include <libintl.h>
 #include <locale.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/param.h>
 
diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile
index 1e74d82f58..725ae43584 100644
--- a/sysdeps/alpha/Makefile
+++ b/sysdeps/alpha/Makefile
@@ -38,9 +38,10 @@ ifeq ($(subdir),elf)
 CFLAGS-rtld.c = -mbuild-constants
 endif
 
-# For now, build everything with full IEEE math support.
-# TODO: build separate libm and libm-ieee.
-sysdep-CFLAGS += -mieee
+# Build everything with full IEEE math support, and with dynamic rounding;
+# there are a number of math routines that are defined to work with the
+# "current" rounding mode, and it's easiest to set this with all of them.
+sysdep-CFLAGS += -mieee -mfp-rounding-mode=d
 
 # libc.so requires about 16k for the small data area, which is well
 # below the 64k maximum.
diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h
index 87d40058c3..a126dcf056 100644
--- a/sysdeps/alpha/fpu/bits/mathinline.h
+++ b/sysdeps/alpha/fpu/bits/mathinline.h
@@ -1,5 +1,6 @@
 /* Inline math functions for Alpha.
-   Copyright (C) 1996, 1997, 1999-2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999-2001, 2004, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang.
 
@@ -25,7 +26,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif
 
 #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0)
@@ -83,101 +84,64 @@ __inline_fabs (fabs, double)
 # undef __inline_fabs
 #endif
 
+#ifdef __USE_ISOC99
 
-/* Use the -inf rounding mode conversion instructions to implement
-   floor.  We note when the exponent is large enough that the value
-   must be integral, as this avoids unpleasant integer overflows.  */
-
-__MATH_INLINE float
-__NTH (__floorf (float __x))
+/* Test for negative number.  Used in the signbit() macro.  */
+__MATH_INLINE int
+__NTH (__signbitf (float __x))
 {
-  /* Check not zero since floor(-0) == -0.  */
-  if (__x != 0 && fabsf (__x) < 16777216.0f)  /* 1 << FLT_MANT_DIG */
-    {
-      /* Note that Alpha S_Floating is stored in registers in a
-	 restricted T_Floating format, so we don't even need to
-	 convert back to S_Floating in the end.  The initial
-	 conversion to T_Floating is needed to handle denormals.  */
-
-      float __tmp1, __tmp2;
-
-      __asm ("cvtst/s %3,%2\n\t"
-#ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+#if !__GNUC_PREREQ (4, 0)
+  __extension__ union { float __f; int __i; } __u = { __f: __x };
+  return __u.__i < 0;
 #else
-	     "cvttq/svm %2,%1\n\t"
+  return __builtin_signbitf (__x);
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(__x), "=&f"(__tmp1), "=&f"(__tmp2)
-	     : "f"(__x));
-    }
-  return __x;
 }
 
-__MATH_INLINE double
-__NTH (__floor (double __x))
+__MATH_INLINE int
+__NTH (__signbit (double __x))
 {
-  if (__x != 0 && fabs (__x) < 9007199254740992.0)  /* 1 << DBL_MANT_DIG */
-    {
-      double __tmp1;
-      __asm (
-#ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+#if !__GNUC_PREREQ (4, 0)
+  __extension__ union { double __d; long __i; } __u = { __d: __x };
+  return __u.__i < 0;
 #else
-	     "cvttq/svm %2,%1\n\t"
+  return __builtin_signbit (__x);
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(__x), "=&f"(__tmp1)
-	     : "f"(__x));
-    }
-  return __x;
 }
 
-__MATH_INLINE float __NTH (floorf (float __x)) { return __floorf(__x); }
-__MATH_INLINE double __NTH (floor (double __x)) { return __floor(__x); }
-
-
-#ifdef __USE_ISOC99
-
-__MATH_INLINE float
-__NTH (__fdimf (float __x, float __y))
-{
-  return __x <= __y ? 0.0f : __x - __y;
-}
-
-__MATH_INLINE float
-__NTH (fdimf (float __x, float __y))
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
 {
-  return __x <= __y ? 0.0f : __x - __y;
+#if !__GNUC_PREREQ (4, 0)
+  __extension__ union {
+    long double __d;
+    long __i[sizeof(long double)/sizeof(long)];
+  } __u = { __d: __x };
+  return __u.__i[sizeof(long double)/sizeof(long) - 1] < 0;
+#else
+  return __builtin_signbitl (__x);
+#endif
 }
 
-__MATH_INLINE double
-__NTH (__fdim (double __x, double __y))
-{
-  return __x <= __y ? 0.0 : __x - __y;
-}
+/* Test for NaN.  Used in the isnan() macro.  */
 
-__MATH_INLINE double
-__NTH (fdim (double __x, double __y))
+__MATH_INLINE int
+__NTH (__isnanf (float __x))
 {
-  return __x <= __y ? 0.0 : __x - __y;
+  return isunordered (__x, __x);
 }
 
-/* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
-__NTH (__signbitf (float __x))
+__NTH (__isnan (double __x))
 {
-  __extension__ union { float __f; int __i; } __u = { __f: __x };
-  return __u.__i < 0;
+  return isunordered (__x, __x);
 }
 
 __MATH_INLINE int
-__NTH (__signbit (double __x))
+__NTH (__isnanl (long double __x))
 {
-  __extension__ union { double __d; long __i; } __u = { __d: __x };
-  return __u.__i < 0;
+  return isunordered (__x, __x);
 }
-
 #endif /* C99 */
 
 #endif /* __NO_MATH_INLINES */
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 6b882e388a..d9df631d7c 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -2,34 +2,40 @@
 
 # atan2
 Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
+ildouble: 1
+ldouble: 1
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 float: 1
 ifloat: 1
 
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
 Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # casin
 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
@@ -37,6 +43,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
 
 # casinh
 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
@@ -44,48 +53,55 @@ double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # catan
-Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
 Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-float: 4
-ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
 
 # catanh
 Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
 double: 4
 idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
 Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-float: 6
-ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
 Test "cbrt (-27.0) == -3.0":
 double: 1
 idouble: 1
@@ -97,9 +113,14 @@ double: 1
 idouble: 1
 
 # ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
 double: 1
 float: 1
@@ -113,9 +134,13 @@ ifloat: 1
 Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
 double: 1
 float: 1
@@ -126,89 +151,130 @@ float: 1
 ifloat: 1
 
 # cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
 
 # clog
-Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-float: 3
-ifloat: 3
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
-float: 5
 idouble: 1
-ifloat: 5
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # cos
 Test "cos (M_PI_6l * 2.0) == 0.5":
 double: 1
-float: 1
 idouble: 1
-ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (M_PI_6l * 4.0) == -0.5":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # cpow
 Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
@@ -222,16 +288,31 @@ double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
 double: 2
 float: 3
 idouble: 2
 ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 3
+ldouble: 3
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
@@ -240,8 +321,21 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
 
 # csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
 double: 1
 idouble: 1
@@ -256,14 +350,29 @@ ifloat: 1
 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
 
 # ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 # ctanh
 Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
@@ -271,6 +380,11 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
 float: 1
 ifloat: 1
@@ -287,6 +401,9 @@ idouble: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
 Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
 double: 1
 idouble: 1
@@ -307,14 +424,30 @@ double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
 
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
 idouble: 1
 Test "expm1 (1) == M_El - 1.0":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 
 # hypot
 Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
@@ -356,9 +489,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "j0 (2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -367,17 +504,32 @@ ifloat: 1
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
 
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
@@ -393,9 +545,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -404,30 +560,57 @@ ifloat: 1
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 double: 4
 float: 3
 idouble: 4
 ifloat: 3
+ildouble: 2
+ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
 float: 4
 ifloat: 4
@@ -446,6 +629,8 @@ double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
 float: 2
@@ -453,16 +638,23 @@ idouble: 1
 ifloat: 2
 
 # lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # log10
 Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -473,36 +665,54 @@ ifloat: 2
 Test "log10 (e) == log10(e)":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # log1p
 Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
 float: 1
 ifloat: 1
 
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
+
 # sincos
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
 double: 1
-float: 1
 idouble: 1
-ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
 float: 1
 ifloat: 1
 
-# tan
-Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
 
 # tgamma
 Test "tgamma (-0.5) == -2 sqrt (pi)":
@@ -510,6 +720,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "tgamma (0.5) == sqrt (pi)":
 float: 1
 ifloat: 1
@@ -518,6 +730,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
 
 # y0
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
@@ -533,19 +748,28 @@ ifloat: 1
 Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "y0 (8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -556,11 +780,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # yn
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
@@ -576,17 +804,26 @@ ifloat: 1
 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -597,30 +834,44 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 5
+ldouble: 5
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 2
 idouble: 2
+ildouble: 2
+ldouble: 2
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 double: 1
 idouble: 1
@@ -629,35 +880,39 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 idouble: 1
 
 # Maximal error of functions:
 Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 float: 1
 ifloat: 1
 
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "casin":
 double: 1
@@ -665,107 +920,147 @@ float: 1
 idouble: 1
 ifloat: 1
 
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "casinh":
 double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 
 Function: Imaginary part of "casinh":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
-
-Function: Real part of "catan":
-float: 4
-ifloat: 4
+ildouble: 2
+ldouble: 2
 
 Function: Imaginary part of "catan":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catanh":
 double: 4
 idouble: 4
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "catanh":
-float: 6
-ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "cbrt":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccos":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccosh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog":
 float: 1
 ifloat: 1
-
-Function: Imaginary part of "clog":
-float: 3
-ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog10":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog10":
 double: 1
-float: 5
+float: 1
 idouble: 1
-ifloat: 5
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "cos":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cpow":
 double: 2
 float: 4
 idouble: 2
 ifloat: 4
+ildouble: 10
+ldouble: 10
 
 Function: Imaginary part of "cpow":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csinh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
@@ -776,20 +1071,36 @@ ifloat: 1
 Function: Real part of "csqrt":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan":
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "ctanh":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctanh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erf":
 double: 1
@@ -798,18 +1109,32 @@ idouble: 1
 Function: "erfc":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: "exp10":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
 
 Function: "expm1":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
 
 Function: "hypot":
 float: 1
@@ -820,67 +1145,101 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 Function: "j1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 4
+ldouble: 4
 
 Function: "jn":
 double: 4
 float: 4
 idouble: 4
 ifloat: 4
+ildouble: 4
+ldouble: 4
 
 Function: "lgamma":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log10":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log1p":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
 
 Function: "sincos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
 
 Function: "tan":
 double: 1
 idouble: 1
 
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
 Function: "tgamma":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y0":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 Function: "y1":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "yn":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 5
+ldouble: 5
 
 # end of automatic generation
diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c
index ec58fd9486..40c2379286 100644
--- a/sysdeps/alpha/fpu/s_ceil.c
+++ b/sysdeps/alpha/fpu/s_ceil.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -27,25 +27,20 @@
 double
 __ceil (double x)
 {
-  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
-    {
-      double tmp1, new_x;
-
-      new_x = -x;
-      __asm (
+  double two52 = copysign (0x1.0p52, x);
+  double r, tmp;
+  
+  __asm (
 #ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
 #else
-	     "cvttq/svm %2,%1\n\t"
+	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1)
-	     : "f"(new_x));
-
-      /* Fix up the negation we did above, as well as handling -0 properly. */
-      x = copysign(new_x, x);
-    }
-  return x;
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(-x), "f"(-two52));
+
+  /* Fix up the negation we did above, as well as handling -0 properly. */
+  return copysign (r, x);
 }
 
 weak_alias (__ceil, ceil)
diff --git a/sysdeps/alpha/fpu/s_ceilf.c b/sysdeps/alpha/fpu/s_ceilf.c
index aba1697a55..0df651f405 100644
--- a/sysdeps/alpha/fpu/s_ceilf.c
+++ b/sysdeps/alpha/fpu/s_ceilf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -26,30 +26,20 @@
 float
 __ceilf (float x)
 {
-  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
-    {
-      /* Note that Alpha S_Floating is stored in registers in a
-	 restricted T_Floating format, so we don't even need to
-	 convert back to S_Floating in the end.  The initial
-	 conversion to T_Floating is needed to handle denormals.  */
-
-      float tmp1, tmp2, new_x;
-
-      new_x = -x;
-      __asm ("cvtst/s %3,%2\n\t"
+  float two23 = copysignf (0x1.0p23, x);
+  float r, tmp;
+  
+  __asm (
 #ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
 #else
-	     "cvttq/svm %2,%1\n\t"
+	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
-	     : "f"(new_x));
-
-      /* Fix up the negation we did above, as well as handling -0 properly. */
-      x = copysignf(new_x, x);
-    }
-  return x;
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(-x), "f"(-two23));
+
+  /* Fix up the negation we did above, as well as handling -0 properly. */
+  return copysignf (r, x);
 }
 
 weak_alias (__ceilf, ceilf)
diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c
index b22c52303d..5af6386155 100644
--- a/sysdeps/alpha/fpu/s_floor.c
+++ b/sysdeps/alpha/fpu/s_floor.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -21,32 +21,26 @@
 #include <math_ldbl_opt.h>
 
 
-/* Use the -inf rounding mode conversion instructions to implement
-   floor.  We note when the exponent is large enough that the value
-   must be integral, as this avoids unpleasant integer overflows.  */
+/* Use the -inf rounding mode conversion instructions to implement floor.  */
 
 double
 __floor (double x)
 {
-  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
-    {
-      double tmp1, new_x;
-
-      __asm (
+  double two52 = copysign (0x1.0p52, x);
+  double r, tmp;
+  
+  __asm (
 #ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
 #else
-	     "cvttq/svm %2,%1\n\t"
+	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1)
-	     : "f"(x));
-
-      /* floor(-0) == -0, and in general we'll always have the same
-	 sign as our input.  */
-      x = copysign(new_x, x);
-    }
-  return x;
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(x), "f"(two52));
+
+  /* floor(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysign (r, x);
 }
 
 weak_alias (__floor, floor)
diff --git a/sysdeps/alpha/fpu/s_floorf.c b/sysdeps/alpha/fpu/s_floorf.c
index fd1ddab6be..8b421705cd 100644
--- a/sysdeps/alpha/fpu/s_floorf.c
+++ b/sysdeps/alpha/fpu/s_floorf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -20,37 +20,26 @@
 #include <math.h>
 
 
-/* Use the -inf rounding mode conversion instructions to implement
-   floor.  We note when the exponent is large enough that the value
-   must be integral, as this avoids unpleasant integer overflows.  */
+/* Use the -inf rounding mode conversion instructions to implement floor.  */
 
 float
 __floorf (float x)
 {
-  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
-    {
-      /* Note that Alpha S_Floating is stored in registers in a
-	 restricted T_Floating format, so we don't even need to
-	 convert back to S_Floating in the end.  The initial
-	 conversion to T_Floating is needed to handle denormals.  */
-
-      float tmp1, tmp2, new_x;
-
-      __asm ("cvtst/s %3,%2\n\t"
+  float two23 = copysignf (0x1.0p23, x);
+  float r, tmp;
+  
+  __asm (
 #ifdef _IEEE_FP_INEXACT
-	     "cvttq/svim %2,%1\n\t"
+	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
 #else
-	     "cvttq/svm %2,%1\n\t"
+	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
 #endif
-	     "cvtqt/m %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
-	     : "f"(x));
-
-      /* floor(-0) == -0, and in general we'll always have the same
-	 sign as our input.  */
-      x = copysignf(new_x, x);
-    }
-  return x;
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(x), "f"(two23));
+
+  /* floor(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysignf (r, x);
 }
 
 weak_alias (__floorf, floorf)
diff --git a/sysdeps/alpha/fpu/s_fmax.S b/sysdeps/alpha/fpu/s_fmax.S
new file mode 100644
index 0000000000..4f2ace7d11
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_fmax.S
@@ -0,0 +1,58 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+        .set noat
+	.set noreorder
+
+	.text
+ENTRY (__fmax)
+	.prologue 0
+
+	cmptun/su	$f16, $f16, $f10
+	cmptun/su	$f17, $f17, $f11
+	fmov		$f17, $f0
+	unop
+
+	trapb
+	fbne		$f10, $ret
+	fmov		$f16, $f0
+	fbne		$f11, $ret
+
+	cmptlt/su	$f16, $f17, $f11
+	trapb
+	fcmovne		$f11, $f17, $f0
+$ret:	ret
+
+END (__fmax)
+
+/* Given the in-register format of single-precision, this works there too.  */
+strong_alias (__fmax, __fmaxf)
+weak_alias (__fmaxf, fmaxf)
+
+weak_alias (__fmax, fmax)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmax, __fmaxl)
+weak_alias (__fmaxl, fmaxl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_fmaxf.S b/sysdeps/alpha/fpu/s_fmaxf.S
new file mode 100644
index 0000000000..3c2d62bb81
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_fmaxf.S
@@ -0,0 +1 @@
+/* __fmaxf is in s_fmax.c  */
diff --git a/sysdeps/alpha/fpu/s_fmin.S b/sysdeps/alpha/fpu/s_fmin.S
new file mode 100644
index 0000000000..10de52940e
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_fmin.S
@@ -0,0 +1,58 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+        .set noat
+	.set noreorder
+
+	.text
+ENTRY (__fmin)
+	.prologue 0
+
+	cmptun/su	$f16, $f16, $f10
+	cmptun/su	$f17, $f17, $f11
+	fmov		$f17, $f0
+	unop
+
+	trapb
+	fbne		$f10, $ret
+	fmov		$f16, $f0
+	fbne		$f11, $ret
+
+	cmptlt/su	$f17, $f16, $f11
+	trapb
+	fcmovne		$f11, $f17, $f0
+$ret:	ret
+
+END (__fmin)
+
+/* Given the in-register format of single-precision, this works there too.  */
+strong_alias (__fmin, __fminf)
+weak_alias (__fminf, fminf)
+
+weak_alias (__fmin, fmin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmin, __fminl)
+weak_alias (__fminl, fminl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_fminf.S b/sysdeps/alpha/fpu/s_fminf.S
new file mode 100644
index 0000000000..10ab7fe53c
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_fminf.S
@@ -0,0 +1 @@
+/* __fminf is in s_fmin.c  */
diff --git a/sysdeps/alpha/fpu/s_isnan.c b/sysdeps/alpha/fpu/s_isnan.c
new file mode 100644
index 0000000000..4403a50bb0
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_isnan.c
@@ -0,0 +1,58 @@
+/* Return 1 if argument is a NaN, else 0.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Ugly kludge to avoid declarations.  */
+#define __isnanf	not___isnanf
+#define isnanf		not_isnanf
+#define __GI___isnanf	not__GI___isnanf
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#undef __isnanf
+#undef isnanf
+#undef __GI___isnanf
+
+/* The hidden_proto in include/math.h was obscured by the macro hackery.  */
+__typeof (__isnan) __isnanf;
+hidden_proto (__isnanf)
+
+
+int
+__isnan (double x)
+{
+  return isunordered (x, x);
+}
+
+hidden_def (__isnan)
+weak_alias (__isnan, isnan)
+
+/* It turns out that the 'double' version will also always work for
+   single-precision.  */
+strong_alias (__isnan, __isnanf)
+hidden_def (__isnanf)
+weak_alias (__isnanf, isnanf)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__isnan, __isnanl)
+weak_alias (__isnan, isnanl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __isnan, isnanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_isnanf.c b/sysdeps/alpha/fpu/s_isnanf.c
new file mode 100644
index 0000000000..af41e43850
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_isnanf.c
@@ -0,0 +1 @@
+/* In s_isnan.c */
diff --git a/sysdeps/alpha/fpu/s_llrint.c b/sysdeps/alpha/fpu/s_llrint.c
new file mode 100644
index 0000000000..5db97be037
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_llrint.c
@@ -0,0 +1 @@
+/* In s_lrint.c */
diff --git a/sysdeps/alpha/fpu/s_llrintf.c b/sysdeps/alpha/fpu/s_llrintf.c
new file mode 100644
index 0000000000..18f2885ef7
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_llrintf.c
@@ -0,0 +1 @@
+/* In s_lrintf.c */
diff --git a/sysdeps/alpha/fpu/s_llround.c b/sysdeps/alpha/fpu/s_llround.c
new file mode 100644
index 0000000000..b212fbd8e5
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_llround.c
@@ -0,0 +1 @@
+/* In s_lround.c.  */
diff --git a/sysdeps/alpha/fpu/s_llroundf.c b/sysdeps/alpha/fpu/s_llroundf.c
new file mode 100644
index 0000000000..73bdf3103f
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_llroundf.c
@@ -0,0 +1 @@
+/* In s_lroundf.c.  */
diff --git a/sysdeps/alpha/fpu/s_lrint.c b/sysdeps/alpha/fpu/s_lrint.c
new file mode 100644
index 0000000000..4c32f61093
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_lrint.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __llrint	not___llrint
+#define llrint		not_llrint
+#include <math.h>
+#include <math_ldbl_opt.h>
+#undef __llrint
+#undef llrint
+
+long int
+__lrint (double x)
+{
+  long ret;
+
+  __asm ("cvttq/svd %1,%0" : "=&f"(ret) : "f"(x));
+
+  return ret;
+}
+
+strong_alias (__lrint, __llrint)
+weak_alias (__lrint, lrint)
+weak_alias (__llrint, llrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lrint, __lrintl)
+strong_alias (__lrint, __llrintl)
+weak_alias (__lrintl, lrintl)
+weak_alias (__llrintl, llrintl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_0);
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_lrintf.c b/sysdeps/alpha/fpu/s_lrintf.c
new file mode 100644
index 0000000000..20a6a6cf82
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_lrintf.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __llrintf	not___llrintf
+#define llrintf		not_llrintf
+#include <math.h>
+#undef __llrintf
+#undef llrintf
+
+long int
+__lrintf (float x)
+{
+  double tmp;
+  long ret;
+
+  __asm ("cvtst/s %2,%1\n\tcvttq/svd %1,%0"
+	 : "=&f"(ret), "=&f"(tmp) : "f"(x));
+
+  return ret;
+}
+
+strong_alias (__lrintf, __llrintf)
+weak_alias (__lrintf, lrintf)
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/alpha/fpu/s_lround.c b/sysdeps/alpha/fpu/s_lround.c
new file mode 100644
index 0000000000..bc5cb88ed2
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_lround.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __llround	not___llround
+#define llround		not_llround
+#include <math.h>
+#include <math_ldbl_opt.h>
+#undef __llround
+#undef llround
+
+long int
+__lround (double x)
+{
+  double adj;
+
+  adj = 0x1.fffffffffffffp-2;	/* nextafter (0.5, 0.0) */
+  adj = copysign (adj, x);
+  return x + adj;
+}
+
+strong_alias (__lround, __llround)
+weak_alias (__lround, lround)
+weak_alias (__llround, llround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+strong_alias (__lround, __llroundl)
+weak_alias (__lroundl, lroundl)
+weak_alias (__llroundl, llroundl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_0);
+compat_symbol (libm, __llround, llroundl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_lroundf.c b/sysdeps/alpha/fpu/s_lroundf.c
new file mode 100644
index 0000000000..16ff348b21
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_lroundf.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __llroundf	not___llroundf
+#define llroundf	not_llroundf
+#include <math.h>
+#undef __llroundf
+#undef llroundf
+
+
+long int
+__lroundf (float x)
+{
+  float adj;
+
+  adj = 0x1.fffffep-2;		/* nextafterf (0.5f, 0.0f) */
+  adj = copysignf (adj, x);
+  return x + adj;
+}
+
+strong_alias (__lroundf, __llroundf)
+weak_alias (__lroundf, lroundf)
+weak_alias (__llroundf, llroundf)
diff --git a/sysdeps/alpha/fpu/s_nearbyint.c b/sysdeps/alpha/fpu/s_nearbyint.c
new file mode 100644
index 0000000000..7a91bd115b
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_nearbyint.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#ifdef _IEEE_FP_INEXACT
+#error "Don't compile with -mieee-with-inexact"
+#endif
+
+double
+__nearbyint (double x)
+{
+  double two52 = copysign (0x1.0p52, x);
+  double r;
+  
+  r = x + two52;
+  r = r - two52;
+
+  /* nearbyint(-0.1) == -0, and in general we'll always have the same sign
+     as our input.  */
+  return copysign (r, x);
+}
+
+weak_alias (__nearbyint, nearbyint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nearbyint, __nearbyintl)
+weak_alias (__nearbyint, nearbyintl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_nearbyintf.c b/sysdeps/alpha/fpu/s_nearbyintf.c
new file mode 100644
index 0000000000..ee637982df
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_nearbyintf.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#ifdef _IEEE_FP_INEXACT
+#error "Don't compile with -mieee-with-inexact"
+#endif
+
+float
+__nearbyintf (float x)
+{
+  float two23 = copysignf (0x1.0p23, x);
+  float r;
+
+  r = x + two23;
+  r = r - two23;
+
+  /* nearbyint(-0.1) == -0, and in general we'll always have the same sign
+     as our input.  */
+  return copysign (r, x);
+}
+
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c
index be09651b35..e9aa028822 100644
--- a/sysdeps/alpha/fpu/s_rint.c
+++ b/sysdeps/alpha/fpu/s_rint.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -24,24 +24,15 @@
 double
 __rint (double x)
 {
-  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
-    {
-      double tmp1, new_x;
-      __asm (
-#ifdef _IEEE_FP_INEXACT
-	     "cvttq/svid %2,%1\n\t"
-#else
-	     "cvttq/svd %2,%1\n\t"
-#endif
-	     "cvtqt/d %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1)
-	     : "f"(x));
-
-      /* rint(-0.1) == -0, and in general we'll always have the same
-	 sign as our input.  */
-      x = copysign(new_x, x);
-    }
-  return x;
+  double two52 = copysign (0x1.0p52, x);
+  double r;
+  
+  r = x + two52;
+  r = r - two52;
+
+  /* rint(-0.1) == -0, and in general we'll always have the same sign
+     as our input.  */
+  return copysign (r, x);
 }
 
 weak_alias (__rint, rint)
diff --git a/sysdeps/alpha/fpu/s_rintf.c b/sysdeps/alpha/fpu/s_rintf.c
index d5d019d709..9e4cbd1ffd 100644
--- a/sysdeps/alpha/fpu/s_rintf.c
+++ b/sysdeps/alpha/fpu/s_rintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -23,30 +23,15 @@
 float
 __rintf (float x)
 {
-  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
-    {
-      /* Note that Alpha S_Floating is stored in registers in a
-	 restricted T_Floating format, so we don't even need to
-	 convert back to S_Floating in the end.  The initial
-	 conversion to T_Floating is needed to handle denormals.  */
-
-      float tmp1, tmp2, new_x;
-
-      __asm ("cvtst/s %3,%2\n\t"
-#ifdef _IEEE_FP_INEXACT
-	     "cvttq/svid %2,%1\n\t"
-#else
-	     "cvttq/svd %2,%1\n\t"
-#endif
-	     "cvtqt/d %1,%0\n\t"
-	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
-	     : "f"(x));
-
-      /* rint(-0.1) == -0, and in general we'll always have the same
-	 sign as our input.  */
-      x = copysignf(new_x, x);
-    }
-  return x;
+  float two23 = copysignf (0x1.0p23, x);
+  float r;
+
+  r = x + two23;
+  r = r - two23;
+
+  /* rint(-0.1) == -0, and in general we'll always have the same sign
+     as our input.  */
+  return copysign (r, x);
 }
 
 weak_alias (__rintf, rintf)
diff --git a/sysdeps/alpha/fpu/s_round.c b/sysdeps/alpha/fpu/s_round.c
new file mode 100644
index 0000000000..3999e6110a
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_round.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+
+double
+__round (double x)
+{
+  const double almost_half = 0x1.fffffffffffffp-2;
+  const double two52 = 0x1.0p52;
+  double tmp, r;
+
+  __asm (
+#ifdef _IEEE_FP_INEXACT
+	 "addt/suic %2, %3, %1\n\tsubt/suic %1, %3, %0"
+#else
+	 "addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0"
+#endif
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(fabs (x) + almost_half), "f"(two52));
+
+  return copysign (r, x);
+}
+
+weak_alias (__round, round)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__round, __roundl)
+weak_alias (__roundl, roundl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __round, roundl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_roundf.c b/sysdeps/alpha/fpu/s_roundf.c
new file mode 100644
index 0000000000..89584f062b
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_roundf.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+
+float
+__roundf (float x)
+{
+  const float almost_half = 0x1.fffffep-2;
+  const float two23 = 0x1.0p23;
+  float r, tmp;
+  
+  __asm (
+#ifdef _IEEE_FP_INEXACT
+	 "adds/suic %2, %3, %1\n\tsubs/suic %1, %3, %0"
+#else
+	 "adds/suc %2, %3, %1\n\tsubs/suc %1, %3, %0"
+#endif
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(fabsf (x) + almost_half), "f"(two23));
+
+  /* round(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysignf (r, x);
+}
+
+weak_alias (__roundf, roundf)
diff --git a/sysdeps/alpha/fpu/s_trunc.c b/sysdeps/alpha/fpu/s_trunc.c
new file mode 100644
index 0000000000..1c1a66673f
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_trunc.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+
+/* Use the chopped rounding mode conversion instructions to implement trunc. */
+
+double
+__trunc (double x)
+{
+  double two52 = copysign (0x1.0p52, x);
+  double r, tmp;
+  
+  __asm (
+#ifdef _IEEE_FP_INEXACT
+	 "addt/suic %2, %3, %1\n\tsubt/suic %1, %3, %0"
+#else
+	 "addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0"
+#endif
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(x), "f"(two52));
+
+  /* trunc(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysign (r, x);
+}
+
+weak_alias (__trunc, trunc)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__trunc, __truncl)
+weak_alias (__trunc, truncl)
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_truncf.c b/sysdeps/alpha/fpu/s_truncf.c
new file mode 100644
index 0000000000..094997b433
--- /dev/null
+++ b/sysdeps/alpha/fpu/s_truncf.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+
+/* Use the chopped rounding mode conversion instructions to implement trunc. */
+
+float
+__truncf (float x)
+{
+  float two23 = copysignf (0x1.0p23, x);
+  float r, tmp;
+  
+  __asm (
+#ifdef _IEEE_FP_INEXACT
+	 "adds/suic %2, %3, %1\n\tsubs/suic %1, %3, %0"
+#else
+	 "adds/suc %2, %3, %1\n\tsubs/suc %1, %3, %0"
+#endif
+	 : "=&f"(r), "=&f"(tmp)
+	 : "f"(x), "f"(two23));
+
+  /* trunc(-0) == -0, and in general we'll always have the same
+     sign as our input.  */
+  return copysignf (r, x);
+}
+
+weak_alias (__truncf, truncf)
diff --git a/sysdeps/generic/inttypes.h b/sysdeps/generic/inttypes.h
index 87f532f1d4..3f1b316c09 100644
--- a/sysdeps/generic/inttypes.h
+++ b/sysdeps/generic/inttypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -330,7 +330,7 @@ extern long int __strtol_internal (__const char *__restrict __nptr,
 				   int __base, int __group) __THROW;
 #   define __strtol_internal_defined	1
 #  endif
-extern __inline intmax_t
+__extern_inline intmax_t
 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
 {
@@ -345,7 +345,7 @@ extern unsigned long int __strtoul_internal (__const char *
 					     int __base, int __group) __THROW;
 #   define __strtoul_internal_defined	1
 #  endif
-extern __inline uintmax_t
+__extern_inline uintmax_t
 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
 {
@@ -359,7 +359,7 @@ extern long int __wcstol_internal (__const __gwchar_t * __restrict __nptr,
 				   int __base, int __group) __THROW;
 #   define __wcstol_internal_defined	1
 #  endif
-extern __inline intmax_t
+__extern_inline intmax_t
 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
 {
@@ -376,7 +376,7 @@ extern unsigned long int __wcstoul_internal (__const __gwchar_t *
 					     int __base, int __group) __THROW;
 #   define __wcstoul_internal_defined	1
 #  endif
-extern __inline uintmax_t
+__extern_inline uintmax_t
 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
 {
@@ -393,7 +393,7 @@ extern long long int __strtoll_internal (__const char *__restrict __nptr,
 					 int __base, int __group) __THROW;
 #   define __strtoll_internal_defined	1
 #  endif
-extern __inline intmax_t
+__extern_inline intmax_t
 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
 {
@@ -411,7 +411,7 @@ extern unsigned long long int __strtoull_internal (__const char *
 						   int __group) __THROW;
 #   define __strtoull_internal_defined	1
 #  endif
-extern __inline uintmax_t
+__extern_inline uintmax_t
 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
 {
@@ -427,7 +427,7 @@ extern long long int __wcstoll_internal (__const __gwchar_t *
 					 int __base, int __group) __THROW;
 #   define __wcstoll_internal_defined	1
 #  endif
-extern __inline intmax_t
+__extern_inline intmax_t
 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
 {
@@ -446,7 +446,7 @@ extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
 						   int __group) __THROW;
 #   define __wcstoull_internal_defined	1
 #  endif
-extern __inline uintmax_t
+__extern_inline uintmax_t
 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
 {
diff --git a/sysdeps/generic/machine-lock.h b/sysdeps/generic/machine-lock.h
index c7cadf5128..db9f444891 100644
--- a/sysdeps/generic/machine-lock.h
+++ b/sysdeps/generic/machine-lock.h
@@ -1,5 +1,5 @@
 /* Machine-specific definition for spin locks.  Stub version.
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ typedef volatile int __spin_lock_t;
 
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 /* Unlock LOCK.  */
diff --git a/sysdeps/generic/machine-sp.h b/sysdeps/generic/machine-sp.h
index a8be7c0f69..25e423efa5 100644
--- a/sysdeps/generic/machine-sp.h
+++ b/sysdeps/generic/machine-sp.h
@@ -1,5 +1,5 @@
 /* Machine-specific function to return the stack pointer.  Stub version.
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
 /* Return the current stack pointer.  */
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 _EXTERN_INLINE void *
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 28547d44b8..a0f630e240 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for i387.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -26,7 +26,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif
 
 
diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S
index e801286a9b..4cf6e92054 100644
--- a/sysdeps/i386/fpu/e_fmod.S
+++ b/sysdeps/i386/fpu/e_fmod.S
@@ -10,7 +10,7 @@ RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $")
 ENTRY(__ieee754_fmod)
 	fldl	12(%esp)
 	fldl	4(%esp)
-1:	fprem1
+1:	fprem
 	fstsw	%ax
 	sahf
 	jp	1b
diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S
index 1850af098e..bbce40976d 100644
--- a/sysdeps/i386/fpu/e_fmodf.S
+++ b/sysdeps/i386/fpu/e_fmodf.S
@@ -11,7 +11,7 @@ RCSID("$NetBSD: $")
 ENTRY(__ieee754_fmodf)
 	flds	8(%esp)
 	flds	4(%esp)
-1:	fprem1
+1:	fprem
 	fstsw	%ax
 	sahf
 	jp	1b
diff --git a/sysdeps/i386/fpu/e_fmodl.c b/sysdeps/i386/fpu/e_fmodl.c
index 97a06d0016..c7c9a60456 100644
--- a/sysdeps/i386/fpu/e_fmodl.c
+++ b/sysdeps/i386/fpu/e_fmodl.c
@@ -12,7 +12,7 @@ __ieee754_fmodl (long double x, long double y)
 {
   long double res;
 
-  asm ("1:\tfprem1\n"
+  asm ("1:\tfprem\n"
        "fstsw   %%ax\n"
        "sahf\n"
        "jp      1b\n"
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index 5604e638f5..ce55b72292 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -36,11 +36,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_log)
 	fldln2			// log(2)
 	fldl	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -54,4 +58,9 @@ ENTRY(__ieee754_log)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_log)
diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S
index 128bb2754c..cd4538b594 100644
--- a/sysdeps/i386/fpu/e_logf.S
+++ b/sysdeps/i386/fpu/e_logf.S
@@ -37,11 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logf)
 	fldln2			// log(2)
 	flds	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logf)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logf)
diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S
index 5023d3012f..551dcf1e46 100644
--- a/sysdeps/i386/fpu/e_logl.S
+++ b/sysdeps/i386/fpu/e_logl.S
@@ -37,11 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logl)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)
diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S
index c554ca4ecb..792f926902 100644
--- a/sysdeps/i386/fpu/e_pow.S
+++ b/sysdeps/i386/fpu/e_pow.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -161,10 +161,11 @@ ENTRY(__ieee754_pow)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -197,9 +198,10 @@ ENTRY(__ieee754_pow)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldl	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldl	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index c835b978b9..c91545418d 100644
--- a/sysdeps/i386/fpu/e_powf.S
+++ b/sysdeps/i386/fpu/e_powf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005
+   Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -155,10 +155,11 @@ ENTRY(__ieee754_powf)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -191,9 +192,10 @@ ENTRY(__ieee754_powf)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	flds	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	flds	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
index 74f422816a..6215496207 100644
--- a/sysdeps/i386/fpu/e_powl.S
+++ b/sysdeps/i386/fpu/e_powl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -161,10 +161,11 @@ ENTRY(__ieee754_powl)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -210,9 +211,10 @@ ENTRY(__ieee754_powl)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldt	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldt	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 203907b146..2db9abc9e4 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -1,5 +1,5 @@
 /* Optimized, inlined string functions.  i486 version.
-   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -35,7 +35,7 @@
 # ifdef __cplusplus
 #  define __STRING_INLINE inline
 # else
-#  define __STRING_INLINE extern __inline
+#  define __STRING_INLINE __extern_inline
 # endif
 #endif
 
diff --git a/sysdeps/ia64/fpu/bits/mathinline.h b/sysdeps/ia64/fpu/bits/mathinline.h
index 9bb5f1a710..1e90257182 100644
--- a/sysdeps/ia64/fpu/bits/mathinline.h
+++ b/sysdeps/ia64/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for ia64.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif
 
 #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index d9bd8b479f..1e159f2c0b 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -106,20 +106,28 @@ double __ieee754_pow(double x, double y) {
     else
       return y < 0 ? 1.0/ABS(x) : 0.0;                               /* return 0 */
   }
+
+  qx = u.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
+  qy = v.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
+
+  if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) return NaNQ.x;
+  if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0))
+    return x == 1.0 ? 1.0 : NaNQ.x;
+
   /* if x<0 */
   if (u.i[HIGH_HALF] < 0) {
     k = checkint(y);
     if (k==0) {
-      if ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) {
+      if (qy == 0x7ff00000) {
 	if (x == -1.0) return 1.0;
 	else if (x > -1.0) return v.i[HIGH_HALF] < 0 ? INF.x : 0.0;
 	else return v.i[HIGH_HALF] < 0 ? 0.0 : INF.x;
       }
-      else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+      else if (qx == 0x7ff00000)
 	return y < 0 ? 0.0 : INF.x;
       return NaNQ.x;                              /* y not integer and x<0 */
     }
-    else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+    else if (qx == 0x7ff00000)
       {
 	if (k < 0)
 	  return y < 0 ? nZERO.x : nINF.x;
@@ -129,14 +137,6 @@ double __ieee754_pow(double x, double y) {
     return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */
   }
   /* x>0 */
-  qx = u.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
-  qy = v.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
-
-  if (qx > 0x7ff00000 || (qx == 0x7ff00000 && u.i[LOW_HALF] != 0)) return NaNQ.x;
-                                                                 /*  if 0<x<2^-0x7fe */
-  if (qy > 0x7ff00000 || (qy == 0x7ff00000 && v.i[LOW_HALF] != 0))
-    return x == 1.0 ? 1.0 : NaNQ.x;
-                                                                 /*  if y<2^-0x7fe   */
 
   if (qx == 0x7ff00000)                              /* x= 2^-0x3ff */
     {if (y == 0) return NaNQ.x;
diff --git a/sysdeps/ieee754/ldbl-128/Makefile b/sysdeps/ieee754/ldbl-128/Makefile
new file mode 100644
index 0000000000..8fd6dad343
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128/Makefile
@@ -0,0 +1 @@
+long-double-fcts = yes
diff --git a/sysdeps/mach/alpha/machine-lock.h b/sysdeps/mach/alpha/machine-lock.h
index 80f8750c87..bd27d2a51f 100644
--- a/sysdeps/mach/alpha/machine-lock.h
+++ b/sysdeps/mach/alpha/machine-lock.h
@@ -1,5 +1,5 @@
 /* Machine-specific definition for spin locks.  Alpha version.
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ typedef __volatile long int __spin_lock_t;
 
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 /* Unlock LOCK.  */
diff --git a/sysdeps/mach/alpha/machine-sp.h b/sysdeps/mach/alpha/machine-sp.h
index b737525574..e6df63c9ac 100644
--- a/sysdeps/mach/alpha/machine-sp.h
+++ b/sysdeps/mach/alpha/machine-sp.h
@@ -1,5 +1,5 @@
 /* Machine-specific function to return the stack pointer.  Alpha version.
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
 /* Return the current stack pointer.  */
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 _EXTERN_INLINE void *
diff --git a/sysdeps/mach/i386/machine-lock.h b/sysdeps/mach/i386/machine-lock.h
index 7c23fba8c5..d786628170 100644
--- a/sysdeps/mach/i386/machine-lock.h
+++ b/sysdeps/mach/i386/machine-lock.h
@@ -1,5 +1,5 @@
 /* Machine-specific definition for spin locks.  i386 version.
-   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ typedef __volatile int __spin_lock_t;
 
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 /* Unlock LOCK.  */
diff --git a/sysdeps/mach/powerpc/machine-lock.h b/sysdeps/mach/powerpc/machine-lock.h
index cba6b0a6e2..96af2219be 100644
--- a/sysdeps/mach/powerpc/machine-lock.h
+++ b/sysdeps/mach/powerpc/machine-lock.h
@@ -1,5 +1,5 @@
 /* Machine-specific definition for spin locks.  PowerPC version.
-   Copyright (C) 1994,97,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994,97,2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ typedef __volatile long int __spin_lock_t;
 
 
 #ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#define _EXTERN_INLINE __extern_inline
 #endif
 
 /* Unlock LOCK.  */
diff --git a/sysdeps/mach/powerpc/machine-sp.h b/sysdeps/mach/powerpc/machine-sp.h
index cf5341cb9b..267707bce0 100644
--- a/sysdeps/mach/powerpc/machine-sp.h
+++ b/sysdeps/mach/powerpc/machine-sp.h
@@ -1,5 +1,5 @@
 /* Machine-specific function to return the stack pointer.  PowerPC version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@
 # ifdef _HURD_THREADVAR_H_EXTERN_INLINE
 #  define _EXTERN_INLINE _HURD_THREADVAR_H_EXTERN_INLINE
 # else
-#  define _EXTERN_INLINE extern __inline
+#  define _EXTERN_INLINE __extern_inline
 # endif
 #endif
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index b4966852a7..da48d46afe 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1157,7 +1157,7 @@ get_scope (const struct sockaddr_storage *ss)
 	 169.254/16 and 127/8 are link-local.  */
       if ((addr[0] == 169 && addr[1] == 254) || addr[0] == 127)
 	scope = 2;
-      else if (addr[0] == 10 || (addr[0] == 172 && addr[1] == 16)
+      else if (addr[0] == 10 || (addr[0] == 172 && (addr[1] & 0xf0) == 16)
 	       || (addr[0] == 192 && addr[1] == 168))
 	scope = 5;
       else
diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h
index 04478309d9..6c01fa436c 100644
--- a/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for powerpc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -25,7 +25,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif  /* __cplusplus */
 
 #if defined __GNUC__ && !defined _SOFT_FLOAT
diff --git a/sysdeps/s390/bits/string.h b/sysdeps/s390/bits/string.h
index d83df39bb2..e16c7cb829 100644
--- a/sysdeps/s390/bits/string.h
+++ b/sysdeps/s390/bits/string.h
@@ -1,5 +1,5 @@
 /* Optimized, inlined string functions.  S/390 version.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -34,7 +34,7 @@
 # ifdef __cplusplus
 #  define __STRING_INLINE inline
 # else
-#  define __STRING_INLINE extern __inline
+#  define __STRING_INLINE __extern_inline
 # endif
 #endif
 
diff --git a/sysdeps/s390/fpu/bits/mathinline.h b/sysdeps/s390/fpu/bits/mathinline.h
index 5c6b83ad06..06a6368450 100644
--- a/sysdeps/s390/fpu/bits/mathinline.h
+++ b/sysdeps/s390/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for s390.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif
 
 #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h
index 9dd784d122..16ad22e666 100644
--- a/sysdeps/sparc/fpu/bits/mathinline.h
+++ b/sysdeps/sparc/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for SPARC.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006
+   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
@@ -131,7 +131,7 @@
 # ifdef __cplusplus
 #  define __MATH_INLINE __inline
 # else
-#  define __MATH_INLINE extern __inline
+#  define __MATH_INLINE __extern_inline
 # endif  /* __cplusplus */
 
 /* The gcc, version 2.7 or below, has problems with all this inlining
diff --git a/sysdeps/unix/bsd/bsd4.4/bits/socket.h b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
index b2227f10d2..f74603f948 100644
--- a/sysdeps/unix/bsd/bsd4.4/bits/socket.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  4.4 BSD version.
-   Copyright (C) 1991,92,1994-2002,2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,1994-2002,2004,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -227,7 +227,7 @@ extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
 				      struct cmsghdr *__cmsg) __THROW;
 #ifdef __USE_EXTERN_INLINES
 # ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
+#  define _EXTERN_INLINE __extern_inline
 # endif
 _EXTERN_INLINE struct cmsghdr *
 __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
diff --git a/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies
new file mode 100644
index 0000000000..0d7000dc2d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with alpha specific routines.
+alpha/alphaev6/fpu
diff --git a/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies
new file mode 100644
index 0000000000..617c388d2d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with alpha specific routines.
+alpha/alphaev67/fpu
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-auxv.h b/sysdeps/unix/sysv/linux/alpha/dl-auxv.h
new file mode 100644
index 0000000000..8afc4dba3b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/dl-auxv.h
@@ -0,0 +1,36 @@
+/* Auxiliary vector processing for Linux/Alpha.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Scan the Aux Vector for the cache shape entries.  */
+
+long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 };
+
+#define DL_PLATFORM_AUXV				\
+      case AT_L1I_CACHESHAPE:				\
+	__libc_alpha_cache_shape[0] = av->a_un.a_val;	\
+	break;						\
+      case AT_L1D_CACHESHAPE:				\
+	__libc_alpha_cache_shape[1] = av->a_un.a_val;	\
+	break;						\
+      case AT_L2_CACHESHAPE:				\
+	__libc_alpha_cache_shape[2] = av->a_un.a_val;	\
+	break;						\
+      case AT_L3_CACHESHAPE:				\
+	__libc_alpha_cache_shape[3] = av->a_un.a_val;	\
+	break;
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-support.c b/sysdeps/unix/sysv/linux/alpha/dl-support.c
new file mode 100644
index 0000000000..290217671c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/dl-support.c
@@ -0,0 +1,2 @@
+#include "dl-auxv.h"
+#include <elf/dl-support.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
index d95e46f6f1..4034820f4d 100644
--- a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
@@ -1,59 +1,2 @@
-/* Operating system support for run-time dynamic linker.  Linux/Alpha version.
-   Copyright (C) 1997, 1998, 2001, 2003, 2006 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <config.h>
-#include <kernel-features.h>
-#include <ldsodefs.h>
-
-extern long __libc_alpha_cache_shape[4];
-weak_extern (__libc_alpha_cache_shape);
-
-
-/* Scan the Aux Vector for the cache shape entries.  */
-#define DL_PLATFORM_AUXV				\
-      case AT_L1I_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[0] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L1D_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[1] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L2_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[2] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L3_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[3] = av->a_un.a_val;			\
-	  break;					\
-	}
-
+#include "dl-auxv.h"
 #include <sysdeps/unix/sysv/linux/dl-sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/fpu/Implies
new file mode 100644
index 0000000000..d76f511c2e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with alpha specific routines.
+alpha/fpu
diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
index 48c3f271c7..6863c07ec1 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
+++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
@@ -20,6 +20,19 @@
 /* sigsuspend is a special syscall since it needs to dereference the
    sigset.  This will have to change when we have more than 64 signals.  */
 
+#ifndef NO_CANCELLATION
+#include <sysdep.h>
+
+#undef PSEUDO_PREPARE_ARGS
+#define PSEUDO_PREPARE_ARGS	ldq	a0, 0(a0);
+
+PSEUDO(__sigsuspend_nocancel, sigsuspend, 1)
+	ret
+/* Use END, not PSEUDO_END, so that we don't issue two $syscall_error
+   symbols; we'll jump into __sigsuspend for the error case.  */
+END(__sigsuspend_nocancel)
+#endif /* NO_CANCELLATION */
+
 #include <sysdep-cancel.h>
 
 #undef PSEUDO_PREPARE_ARGS
diff --git a/sysdeps/unix/sysv/linux/alpha/sysconf.c b/sysdeps/unix/sysv/linux/alpha/sysconf.c
index 2bbaf1f364..3e5b4ee85f 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysconf.c
+++ b/sysdeps/unix/sysv/linux/alpha/sysconf.c
@@ -27,7 +27,7 @@ static long int linux_sysconf (int name);
 #define CSHAPE(totalsize, linesize, assoc) \
   ((totalsize & ~0xff) | (linesize << 4) | assoc)
 
-long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 };
+extern long __libc_alpha_cache_shape[4];
 
 static inline unsigned long
 implver (void)
diff --git a/sysdeps/unix/sysv/linux/bits/sigset.h b/sysdeps/unix/sysv/linux/bits/sigset.h
index 7ccadda456..daec8ac494 100644
--- a/sysdeps/unix/sysv/linux/bits/sigset.h
+++ b/sysdeps/unix/sysv/linux/bits/sigset.h
@@ -1,5 +1,6 @@
 /* __sig_atomic_t, __sigset_t, and related definitions.  Linux version.
-   Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +44,7 @@ typedef struct
 # define _SIGSET_H_fns 1
 
 # ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
+#  define _EXTERN_INLINE __extern_inline
 # endif
 
 /* Return a mask that includes the bit for SIG only.  */
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 356a2ece74..377f589bbd 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -1,5 +1,6 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -264,7 +265,7 @@ extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
 				      struct cmsghdr *__cmsg) __THROW;
 #ifdef __USE_EXTERN_INLINES
 # ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
+#  define _EXTERN_INLINE __extern_inline
 # endif
 _EXTERN_INLINE struct cmsghdr *
 __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index ebe4d699b1..2b6c158226 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -68,17 +68,38 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
   if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0,
 				    (struct sockaddr *) &nladdr,
 				    sizeof (nladdr))) < 0)
-    return -1;
+    goto out_fail;
 
   *seen_ipv4 = false;
   *seen_ipv6 = false;
 
   bool done = false;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
   struct in6ailist
   {
     struct in6addrinfo info;
@@ -98,10 +119,10 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
 
       ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
       if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+	goto out_fail;
 
       struct nlmsghdr *nlmh;
       for (nlmh = (struct nlmsghdr *) buf;
@@ -183,7 +204,7 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
     {
       *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
       if (*in6ai == NULL)
-	return -1;
+	goto out_fail;
 
       *in6ailen = in6ailistlen;
 
@@ -195,6 +216,13 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
       while (in6ailist != NULL);
     }
 
+  if (use_malloc)
+    free (buf);
+  return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
   return 0;
 }
 
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 82495de03e..02e6935538 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
 /* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -122,36 +122,36 @@ int
 __netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  struct netlink_res **new_nlm_list;
-  static volatile size_t buf_size = 4096;
-  char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
   ssize_t read_len;
   bool done = false;
-  bool use_malloc = false;
 
-  if (__netlink_sendreq (h, type) < 0)
-    return -1;
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
 
-  size_t this_buf_size = buf_size;
-  if (__libc_use_alloca (this_buf_size))
-    buf = alloca (this_buf_size);
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
   else
     {
-      buf = malloc (this_buf_size);
+      buf = malloc (buf_size);
       if (buf != NULL)
 	use_malloc = true;
       else
 	goto out_fail;
     }
 
-  struct iovec iov = { buf, this_buf_size };
+  struct iovec iov = { buf, buf_size };
 
-  if (h->nlm_list != NULL)
-    new_nlm_list = &h->end_ptr->next;
-  else
-    new_nlm_list = &h->nlm_list;
+  if (__netlink_sendreq (h, type) < 0)
+    goto out_fail;
 
   while (! done)
     {
@@ -171,48 +171,7 @@ __netlink_request (struct netlink_handle *h, int type)
 	continue;
 
       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;
-	}
+	goto out_fail;
 
       size_t count = 0;
       size_t remaining_len = read_len;
diff --git a/sysdeps/unix/sysv/linux/posix_madvise.c b/sysdeps/unix/sysv/linux/posix_madvise.c
new file mode 100644
index 0000000000..880b17ef31
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/posix_madvise.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <sys/mman.h>
+
+
+int
+posix_madvise (void *addr, size_t len, int advice)
+{
+  /* We have one problem: the kernel's MADV_DONTNEED does not
+     correspond to POSIX's POSIX_MADV_DONTNEED.  The former simply
+     discards changes made to the memory without writing it back to
+     disk, if this would be necessary.  The POSIX behavior does not
+     allow this.  There is no functionality mapping the POSIX behavior
+     so far so we ignore that advice for now.  */
+  if (advice == POSIX_MADV_DONTNEED)
+    return 0;
+
+  INTERNAL_SYSCALL_DECL (err);
+  int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
+  return INTERNAL_SYSCALL_ERRNO (result, err);
+}
diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile
index 6d72cb0294..c1b436a6fb 100644
--- a/sysdeps/unix/sysv/linux/sh/Makefile
+++ b/sysdeps/unix/sysv/linux/sh/Makefile
@@ -2,10 +2,6 @@ ifeq ($(subdir),io)
 sysdep_routines += pipe
 endif
 
-ifeq ($(subdir),misc)
-sysdep_headers += sys/io.h
-endif
-
 ifeq ($(subdir),stdlib)
 gen-as-const-headers += ucontext_i.sym
 endif
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
index 179642ff40..e59672980e 100644
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -1,5 +1,6 @@
 /* Definitions of macros to access `dev_t' values.
-   Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2003, 2004, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,30 +28,30 @@
    they need.  */
 #ifdef __GLIBC_HAVE_LONG_LONG
 __extension__
-extern __inline unsigned int gnu_dev_major (unsigned long long int __dev)
+__extern_inline unsigned int gnu_dev_major (unsigned long long int __dev)
      __THROW;
 __extension__
-extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
+__extern_inline unsigned int gnu_dev_minor (unsigned long long int __dev)
      __THROW;
 __extension__
-extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
+__extern_inline unsigned long long int gnu_dev_makedev (unsigned int __major,
 							unsigned int __minor)
      __THROW;
 
 # if defined __GNUC__ && __GNUC__ >= 2
-__extension__ extern __inline unsigned int
+__extension__ __extern_inline unsigned int
 __NTH (gnu_dev_major (unsigned long long int __dev))
 {
   return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
 }
 
-__extension__ extern __inline unsigned int
+__extension__ __extern_inline unsigned int
 __NTH (gnu_dev_minor (unsigned long long int __dev))
 {
   return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
 }
 
-__extension__ extern __inline unsigned long long int
+__extension__ __extern_inline unsigned long long int
 __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
 {
   return ((__minor & 0xff) | ((__major & 0xfff) << 8)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 5776673733..38103f0c68 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -32,7 +32,6 @@ ioperm		-	ioperm		i:iii	ioperm
 iopl		-	iopl		i:i	iopl
 klogctl		EXTRA	syslog		i:isi	klogctl
 lchown		-	lchown		i:sii	__lchown	lchown
-posix_madvise	-	madvise		Vi:pii	posix_madvise
 madvise		-	madvise		i:pii	madvise
 mincore		-	mincore		i:anV	mincore
 mlock		-	mlock		i:bn	mlock
diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h
index 39d11b678d..d08a9b033b 100644
--- a/sysdeps/x86_64/fpu/bits/mathinline.h
+++ b/sysdeps/x86_64/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for x86-64.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -25,7 +25,7 @@
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
 #endif
 
 
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
index b4343bef45..633234b744 100644
--- a/sysdeps/x86_64/fpu/e_log10l.S
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l)
 	fxam
 	fnstsw
 	fld	%st		// x : x : log10(2)
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:	fsubl	MO(one)		// x-1 : x : log10(2)
 	fld	%st		// x-1 : x-1 : x : log10(2)
@@ -59,7 +59,8 @@ ENTRY(__ieee754_log10l)
 	fyl2x			// log10(x)
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index 7a89b94d9f..f04d30a05a 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l)
 	fxam
 	fnstsw
 	fld	%st		// x : x : 1
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:	fsub	%st(2), %st	// x-1 : x : 1
 	fld	%st		// x-1 : x-1 : x : 1
@@ -56,7 +56,8 @@ ENTRY(__ieee754_log2l)
 	fyl2x			// log(x)
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
index a0bed663c8..2ba91eedfd 100644
--- a/sysdeps/x86_64/fpu/e_logl.S
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -38,8 +38,12 @@ limit:	.double 0.29
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	8(%rsp)		// x : log(2)
+	fxam
+	fnstsw
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	testb	$1, %ah
+	jnz	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -53,4 +57,10 @@ ENTRY(__ieee754_logl)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	testb	$4, %ah
+	jnz	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)
diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S
index 85f4deb3c7..4959bea7ac 100644
--- a/sysdeps/x86_64/fpu/e_powl.S
+++ b/sysdeps/x86_64/fpu/e_powl.S
@@ -1,5 +1,6 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -146,10 +147,11 @@ ENTRY(__ieee754_powl)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	test	$4500,%eax
@@ -190,9 +192,10 @@ ENTRY(__ieee754_powl)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldt	8(%rsp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldt	8(%rsp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
index 7fbd0e5aaa..ac2bd22a4f 100644
--- a/sysdeps/x86_64/fpu/s_log1pl.S
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -45,7 +45,7 @@ ENTRY(__log1pl)
 	fxam
 	fnstsw
 	fld	%st
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:
 	fabs
@@ -62,7 +62,8 @@ ENTRY(__log1pl)
 2:	fyl2xp1
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/time/tst-mktime2.c b/time/tst-mktime2.c
index 6279218cba..0e4fd1e786 100644
--- a/time/tst-mktime2.c
+++ b/time/tst-mktime2.c
@@ -102,7 +102,8 @@ static int
 do_test (void)
 {
   time_t t, delta;
-  int i, j;
+  int i;
+  unsigned int j;
 
   setenv ("TZ", "America/Sao_Paulo", 1);
   /* This test makes some buggy mktime implementations loop.
@@ -128,7 +129,7 @@ do_test (void)
       mktime_test ((time_t) (60 * 60));
       mktime_test ((time_t) (60 * 60 * 24));
 
-      for (j = 1; 0 < j; j *= 2)
+      for (j = 1; j <= INT_MAX; j *= 2)
 	bigtime_test (j);
       bigtime_test (j - 1);
     }
diff --git a/time/tzfile.c b/time/tzfile.c
index ea2d7cae4c..0d48c8ca0c 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -548,13 +548,60 @@ find_transition (time_t timer)
       if (i == num_types)
 	i = 0;
     }
+  else if (timer >= transitions[num_transitions - 1])
+    i = type_idxs[num_transitions - 1];
   else
     {
       /* Find the first transition after TIMER, and
 	 then pick the type of the transition before it.  */
-      for (i = 1; i < num_transitions; ++i)
-	if (timer < transitions[i])
-	  break;
+      size_t lo = 0;
+      size_t hi = num_transitions - 1;
+      /* Assume that DST is changing twice a year and guess initial
+	 search spot from it.
+	 Half of a gregorian year has on average 365.2425 * 86400 / 2
+	 = 15778476 seconds.  */
+      i = (transitions[num_transitions - 1] - timer) / 15778476;
+      if (i < num_transitions)
+	{
+	  i = num_transitions - 1 - i;
+	  if (timer < transitions[i])
+	    {
+	      if (i < 10 || timer >= transitions[i - 10])
+		{
+		  /* Linear search.  */
+		  while (timer < transitions[i - 1])
+		    --i;
+		  goto found;
+		}
+	      hi = i - 10;
+	    }
+	  else
+	    {
+	      if (i + 10 >= num_transitions || timer < transitions[i + 10])
+		{
+		  /* Linear search.  */
+		  while (timer >= transitions[i])
+		    ++i;
+		  goto found;
+		}
+	      lo = i + 10;
+	    }
+	}
+
+      /* Binary search.  */
+      /* assert (timer >= transitions[lo] && timer < transitions[hi]); */
+      while (lo + 1 < hi)
+	{
+	  i = (lo + hi) / 2;
+	  if (timer < transitions[i])
+	    hi = i;
+	  else
+	    lo = i;
+	}
+      i = hi;
+
+    found:
+      /* assert (timer >= transitions[i - 1] && timer < transitions[i]); */
       i = type_idxs[i - 1];
     }
 
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 00216ec059..697b9f2cd8 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -1,5 +1,5 @@
 /* Checking macros for wchar functions.
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
 				 __const wchar_t *__restrict __s2, size_t __n),
 				wmemcpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
 		size_t __n))
 {
@@ -46,7 +46,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
 						   __const wchar_t *__s2,
 						   size_t __n), wmemmove);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
 		 size_t __n))
 {
@@ -65,7 +65,7 @@ extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
 				 __const wchar_t *__restrict __s2,
 				 size_t __n), wmempcpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
 		 size_t __n))
 {
@@ -81,7 +81,7 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
 extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
 						  size_t __n), wmemset);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n))
 {
   if (__bos0 (__s) != (size_t) -1)
@@ -97,7 +97,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
 				(wchar_t *__restrict __dest,
 				 __const wchar_t *__restrict __src), wcscpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src))
 {
   if (__bos (__dest) != (size_t) -1)
@@ -112,7 +112,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest,
 						 __const wchar_t *__src),
 				wcpcpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src))
 {
   if (__bos (__dest) != (size_t) -1)
@@ -129,7 +129,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
 				 __const wchar_t *__restrict __src,
 				 size_t __n), wcsncpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
 {
   if (__bos (__dest) != (size_t) -1
@@ -148,7 +148,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
 				 __const wchar_t *__restrict __src,
 				 size_t __n), wcpncpy);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
 {
   if (__bos (__dest) != (size_t) -1
@@ -166,7 +166,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
 				(wchar_t *__restrict __dest,
 				 __const wchar_t *__restrict __src), wcscat);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcscat (wchar_t *__dest, __const wchar_t *__src))
 {
   if (__bos (__dest) != (size_t) -1)
@@ -183,7 +183,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
 				 __const wchar_t *__restrict __src,
 				 size_t __n), wcsncat);
 
-extern __always_inline wchar_t *
+__extern_always_inline wchar_t *
 __NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n))
 {
   if (__bos (__dest) != (size_t) -1)
@@ -246,7 +246,7 @@ extern wchar_t *__REDIRECT (__fgetws_alias,
 			    (wchar_t *__restrict __s, int __n,
 			     __FILE *__restrict __stream), fgetws) __wur;
 
-extern __always_inline __wur wchar_t *
+__extern_always_inline __wur wchar_t *
 fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
@@ -264,7 +264,7 @@ extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
 			     __FILE *__restrict __stream), fgetws_unlocked)
   __wur;
 
-extern __always_inline __wur wchar_t *
+__extern_always_inline __wur wchar_t *
 fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
@@ -281,7 +281,7 @@ extern size_t __REDIRECT_NTH (__wcrtomb_alias,
 			      (char *__restrict __s, wchar_t __wchar,
 			       mbstate_t *__restrict __ps), wcrtomb) __wur;
 
-extern __always_inline __wur size_t
+__extern_always_inline __wur size_t
 __NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps))
 {
   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
@@ -307,7 +307,7 @@ extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
 			       size_t __len, mbstate_t *__restrict __ps),
 			      mbsrtowcs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
 		  size_t __len, mbstate_t *__restrict __ps))
 {
@@ -330,7 +330,7 @@ extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
 			       size_t __len, mbstate_t *__restrict __ps),
 			      wcsrtombs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
 		  size_t __len, mbstate_t *__restrict __ps))
 {
@@ -352,7 +352,7 @@ extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
 			       size_t __len, mbstate_t *__restrict __ps),
 			      mbsnrtowcs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
 		   size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
 {
@@ -376,7 +376,7 @@ extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
 			       size_t __nwc, size_t __len,
 			       mbstate_t *__restrict __ps), wcsnrtombs);
 
-extern __always_inline size_t
+__extern_always_inline size_t
 __NTH (wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
 		   size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
 {
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 2965a7baf9..5ef4b1a98f 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -326,19 +326,19 @@ __END_NAMESPACE_C99
    locales must use ASCII encoding for the values in the ASCII range
    and because the wchar_t encoding is always ISO 10646.  */
 extern wint_t __btowc_alias (int __c) __asm ("btowc");
-extern __inline wint_t
+__extern_inline wint_t
 __NTH (btowc (int __c))
 { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
 	  ? (wint_t) __c : __btowc_alias (__c)); }
 
 extern int __wctob_alias (wint_t __c) __asm ("wctob");
-extern __inline int
+__extern_inline int
 __NTH (wctob (wint_t __wc))
 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
 	  ? (int) __wc : __wctob_alias (__wc)); }
 # endif
 
-extern __inline size_t
+__extern_inline size_t
 __NTH (mbrlen (__const char *__restrict __s, size_t __n,
 	       mbstate_t *__restrict __ps))
 { return (__ps != NULL
@@ -548,38 +548,38 @@ extern unsigned long long int __wcstoull_internal (__const wchar_t *
 /* Define inline functions which call the internal entry points.  */
 __BEGIN_NAMESPACE_C99
 
-extern __inline double
+__extern_inline double
 __NTH (wcstod (__const wchar_t *__restrict __nptr,
 	       wchar_t **__restrict __endptr))
 { return __wcstod_internal (__nptr, __endptr, 0); }
-extern __inline long int
+__extern_inline long int
 __NTH (wcstol (__const wchar_t *__restrict __nptr,
 	       wchar_t **__restrict __endptr, int __base))
 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long int
+__extern_inline unsigned long int
 __NTH (wcstoul (__const wchar_t *__restrict __nptr,
 		wchar_t **__restrict __endptr, int __base))
 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
 __END_NAMESPACE_C99
 
 # ifdef __USE_GNU
-extern __inline float
+__extern_inline float
 __NTH (wcstof (__const wchar_t *__restrict __nptr,
 	       wchar_t **__restrict __endptr))
 { return __wcstof_internal (__nptr, __endptr, 0); }
 #  ifndef __LDBL_COMPAT
-extern __inline long double
+__extern_inline long double
 __NTH (wcstold (__const wchar_t *__restrict __nptr,
 		wchar_t **__restrict __endptr))
 { return __wcstold_internal (__nptr, __endptr, 0); }
 #  endif
 __extension__
-extern __inline long long int
+__extern_inline long long int
 __NTH (wcstoq (__const wchar_t *__restrict __nptr,
 	       wchar_t **__restrict __endptr, int __base))
 { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
 __extension__
-extern __inline unsigned long long int
+__extern_inline unsigned long long int
 __NTH (wcstouq (__const wchar_t *__restrict __nptr,
 		wchar_t **__restrict __endptr, int __base))
 { return __wcstoull_internal (__nptr, __endptr, __base, 0); }