[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8722 - in /trunk: libc/ libc/elf/ libc/include/ libc/locale/ libc/locale/programs/ libc/malloc/ libc/nis/nss_nis/ libc/nis/...



Author: joseph
Date: Wed Jul 29 08:58:14 2009
New Revision: 8722

Log:
Merge changes between r8623 and r8721 from /fsf/trunk.

Added:
    trunk/libc/elf/dl-scope.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/dl-scope.c
    trunk/libc/elf/tst-audit3.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-audit3.c
    trunk/libc/elf/tst-audit4.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-audit4.c
    trunk/libc/elf/tst-audit5.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-audit5.c
    trunk/libc/elf/tst-auditmod3a.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod3a.c
    trunk/libc/elf/tst-auditmod3b.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod3b.c
    trunk/libc/elf/tst-auditmod4a.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod4a.c
    trunk/libc/elf/tst-auditmod4b.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod4b.c
    trunk/libc/elf/tst-auditmod5a.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod5a.c
    trunk/libc/elf/tst-auditmod5b.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-auditmod5b.c
    trunk/libc/elf/tst-unique1.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique1.c
    trunk/libc/elf/tst-unique1mod1.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique1mod1.c
    trunk/libc/elf/tst-unique1mod2.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique1mod2.c
    trunk/libc/elf/tst-unique2.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique2.c
    trunk/libc/elf/tst-unique2mod1.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique2mod1.c
    trunk/libc/elf/tst-unique2mod2.c
      - copied unchanged from r8721, fsf/trunk/libc/elf/tst-unique2mod2.c
    trunk/libc/nptl/sysdeps/x86_64/configure
      - copied, changed from r8721, fsf/trunk/libc/nptl/sysdeps/x86_64/configure
    trunk/libc/nptl/sysdeps/x86_64/configure.in
      - copied unchanged from r8721, fsf/trunk/libc/nptl/sysdeps/x86_64/configure.in
    trunk/libc/sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c
    trunk/libc/sysdeps/s390/s390-64/utf16-utf32-z9.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/s390/s390-64/utf16-utf32-z9.c
    trunk/libc/sysdeps/s390/s390-64/utf8-utf16-z9.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/s390/s390-64/utf8-utf16-z9.c
    trunk/libc/sysdeps/s390/s390-64/utf8-utf32-z9.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/s390/s390-64/utf8-utf32-z9.c
    trunk/libc/sysdeps/x86_64/link-defines.sym
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/link-defines.sym
    trunk/libc/sysdeps/x86_64/memcmp.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/memcmp.S
    trunk/libc/sysdeps/x86_64/multiarch/rtld-strlen.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/rtld-strlen.S
    trunk/libc/sysdeps/x86_64/multiarch/stpcpy.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/stpcpy.S
    trunk/libc/sysdeps/x86_64/multiarch/stpncpy-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/stpncpy-c.c
    trunk/libc/sysdeps/x86_64/multiarch/stpncpy.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/stpncpy.S
    trunk/libc/sysdeps/x86_64/multiarch/strcasestr-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strcasestr-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strcasestr.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strcasestr.c
    trunk/libc/sysdeps/x86_64/multiarch/strcpy.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strcpy.S
    trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strcspn.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strcspn.S
    trunk/libc/sysdeps/x86_64/multiarch/strncpy-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strncpy-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strncpy.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strncpy.S
    trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strpbrk.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk.S
    trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strspn.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strspn.S
    trunk/libc/sysdeps/x86_64/multiarch/strstr-c.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr-c.c
    trunk/libc/sysdeps/x86_64/multiarch/strstr.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/multiarch/strstr.c
    trunk/libc/sysdeps/x86_64/rtld-memcmp.c
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/rtld-memcmp.c
    trunk/libc/sysdeps/x86_64/rtld-strchr.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/rtld-strchr.S
    trunk/libc/sysdeps/x86_64/rtld-strlen.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/rtld-strlen.S
    trunk/libc/sysdeps/x86_64/strncmp.S
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/strncmp.S
    trunk/libc/sysdeps/x86_64/tst-xmmymm.sh
      - copied unchanged from r8721, fsf/trunk/libc/sysdeps/x86_64/tst-xmmymm.sh
Removed:
    trunk/libc/elf/do-lookup.h
    trunk/libc/sysdeps/x86_64/multiarch/strncmp-c.c
    trunk/ports/sysdeps/mips/do-lookup.h
Modified:
    trunk/libc/ChangeLog
    trunk/libc/NEWS
    trunk/libc/config.h.in
    trunk/libc/config.make.in
    trunk/libc/configure
    trunk/libc/configure.in
    trunk/libc/elf/Makefile
    trunk/libc/elf/dl-lookup.c
    trunk/libc/elf/dl-misc.c
    trunk/libc/elf/dl-open.c
    trunk/libc/elf/elf.h
    trunk/libc/elf/rtld.c
    trunk/libc/include/atomic.h
    trunk/libc/include/inline-hashtab.h
    trunk/libc/include/unistd.h
    trunk/libc/locale/C-ctype.c
    trunk/libc/locale/langinfo.h
    trunk/libc/locale/localeinfo.h
    trunk/libc/locale/programs/ld-ctype.c
    trunk/libc/malloc/malloc.c
    trunk/libc/nis/nss_nis/nis-network.c
    trunk/libc/nis/nss_nisplus/nisplus-network.c
    trunk/libc/nptl/ChangeLog
    trunk/libc/nptl/Makefile
    trunk/libc/nptl/pthreadP.h
    trunk/libc/nptl/pthread_mutex_lock.c
    trunk/libc/nptl/pthread_mutex_unlock.c
    trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
    trunk/libc/nptl/tst-cond11.c
    trunk/libc/nptl/tst-sem5.c
    trunk/libc/nscd/cache.c
    trunk/libc/nss/getent.c
    trunk/libc/nss/nss_files/files-network.c
    trunk/libc/posix/tst-rfc3484-2.c
    trunk/libc/posix/tst-rfc3484-3.c
    trunk/libc/posix/tst-rfc3484.c
    trunk/libc/resolv/res_debug.c
    trunk/libc/resolv/res_mkquery.c
    trunk/libc/resolv/res_query.c
    trunk/libc/resolv/res_send.c
    trunk/libc/resolv/resolv.h
    trunk/libc/string/stpncpy.c
    trunk/libc/string/strcasestr.c
    trunk/libc/string/strncpy.c
    trunk/libc/string/strstr.c
    trunk/libc/sysdeps/generic/ldsodefs.h
    trunk/libc/sysdeps/generic/sysdep.h
    trunk/libc/sysdeps/i386/configure
    trunk/libc/sysdeps/i386/configure.in
    trunk/libc/sysdeps/posix/getaddrinfo.c
    trunk/libc/sysdeps/powerpc/sysdep.h
    trunk/libc/sysdeps/s390/dl-procinfo.c
    trunk/libc/sysdeps/s390/dl-procinfo.h
    trunk/libc/sysdeps/s390/s390-64/Makefile
    trunk/libc/sysdeps/unix/sysv/linux/configure
    trunk/libc/sysdeps/unix/sysv/linux/configure.in
    trunk/libc/sysdeps/unix/sysv/linux/eventfd.c
    trunk/libc/sysdeps/unix/sysv/linux/i386/makecontext.S
    trunk/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
    trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    trunk/libc/sysdeps/unix/sysv/linux/signalfd.c
    trunk/libc/sysdeps/unix/sysv/linux/sys/epoll.h
    trunk/libc/sysdeps/x86_64/Makefile
    trunk/libc/sysdeps/x86_64/bits/link.h
    trunk/libc/sysdeps/x86_64/cacheinfo.c
    trunk/libc/sysdeps/x86_64/dl-trampoline.S
    trunk/libc/sysdeps/x86_64/elf/configure
    trunk/libc/sysdeps/x86_64/elf/configure.in
    trunk/libc/sysdeps/x86_64/multiarch/Makefile
    trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
    trunk/libc/sysdeps/x86_64/multiarch/rawmemchr.S
    trunk/libc/sysdeps/x86_64/multiarch/strcmp.S
    trunk/libc/sysdeps/x86_64/multiarch/strlen.S
    trunk/libc/sysdeps/x86_64/strcmp.S
    trunk/ports/ChangeLog.alpha
    trunk/ports/ChangeLog.arm
    trunk/ports/ChangeLog.mips
    trunk/ports/sysdeps/mips/dl-lookup.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c
    trunk/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
    trunk/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c
    trunk/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
    trunk/ports/sysdeps/unix/sysv/linux/mips/kernel-features.h

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Wed Jul 29 08:58:14 2009
@@ -1,3 +1,410 @@
+2009-07-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/tst-xmmymm.sh: Refine testing.  The script now
+	determines which files are used in runtime lookups and only checks
+	those for SSE use.
+	* sysdeps/x86_64/rtld-memchr.c: Removed.  Not needed with refined
+	testing.
+	* sysdeps/x86_64/rtld-rawmemchr.c: Removed.
+	* sysdeps/x86_64/multiarch/rtld-rawmemchr.c: Removed
+	* sysdeps/x86_64/Makefile: Emit warning that tst-xmmymm.sh might
+	take a while.
+
+	* elf/dl-open.c: Move _dl_scope_free to...
+	* elf/dl-scope.c: ...here.  New file.
+	* elf/Makefile (dl-routines): Add scope.
+
+	* resolv/resolv.h (RES_USE_DNSSEC): Define.
+	* resolv/res_debug.c (p_option): Handle RES_USE_EDNS0 and
+	RES_USE_DNSSEC.
+	* resolv/res_mkquery.c (__res_nopt): Set flags for RES_USE_DNSSEC.
+	* resolv/res_query.c (__libc_res_nquery): Handle RES_USE_DNSSEC in
+	all the places we handled RES_USE_EDNS0 only before.
+	Patch by Adam Tkac <atkac@xxxxxxxxxx>.
+
+2009-07-27  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-lookup.c (do_lookup_x): Fix check for table more than
+	3/4 full.  Pass size + 1 rather than size to _dl_higher_prime_number.
+	Update size when reallocating.
+
+2009-07-26  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/tst-xmmymm.sh: New file.  Check whether any of the
+	functions used in ld.so modify xmm/ymm registers.
+	* sysdeps/x86_64/Makefile:  Hook new test up.
+	* sysdeps/x86_64/rtld-memchr.c: New file.
+	* sysdeps/x86_64/rtld-memcmp.c: New file.
+	* sysdeps/x86_64/rtld-rawmemchr.c: New file.
+	* sysdeps/x86_64/rtld-strchr.S: New file.
+	* sysdeps/x86_64/rtld-strlen.S: New file.
+	* sysdeps/x86_64/multiarch/rtld-rawmemchr.c: New file.
+	* sysdeps/x86_64/multiarch/rtld-strlen.S: New file.
+
+2009-07-26  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Remove
+	strncmp-c.
+	* sysdeps/x86_64/multiarch/strcmp.S (aftertail): Removed.
+	(exit): Likewise.
+	(Byte1): Likewise.
+	(Byte2): Likewise.
+	(Byte3): Likewise.
+	(Byte4): Likewise.
+	(Byte5): Likewise.
+	(Byte6): Likewise.
+	(next_8_bytes): Likewise.
+	(Byte0): Remove commented out codes.
+	(unaligned_table): Align jump table at 8 bytes.
+	Add _sse4_2 to all labels.  Always include "../strcmp.S".
+	* sysdeps/x86_64/multiarch/strncmp-c.c: Removed.
+	* sysdeps/x86_64/strcmp.S: Add SSE2 support.
+	* sysdeps/x86_64/strncmp.S: New file.
+
+2009-07-26  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10422]
+	* sysdeps/unix/sysv/linux/eventfd.c: Add compatibility for old
+	kernels, dropped when eventfd2 support was added.
+	* sysdeps/unix/sysv/linux/signalfd.c: Add compatibility for old
+	kernels, dropped when signalfd4 support was added.
+	* sysdeps/unix/sysv/linux/kernel-features.h: More CLOEXEC syscalls
+	added, name them.
+
+	[BZ #10452]
+	* resolv/res_send.c (send_dg): Pass full SERVFAIL, NOTIMP, REFUSED
+	replies up.
+
+	* elf/elf.h: Define NT_GNU_GOLD_VERSION.
+
+2009-07-25  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strcmp.S: Some more optimizations for
+	modern processor versions.  Patch by H.J. Lu <hongjiu.lu@xxxxxxxxx>.
+
+	[BZ #10448]
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): If NSS module contains no
+	callback we must touch the status to avoid using stale value.
+
+	* sysdeps/x86_64/multiarch/strcmp.S: Exclude unused code from being
+	compiled in.
+
+2009-07-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/configure.in: Don't automatically include
+	/lib/modules/* headers anymore.  We have sane headers in the standard
+	place now.
+
+2009-06-16  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): "hpage",
+	"etf3enh" and "highgprs" added.
+	(_dl_s390_platforms): "z10" added.
+	* sysdeps/s390/dl-procinfo.h (_DL_HWCAP_COUNT, _DL_PLATFORMS_COUNT):
+	Increased for the new entries.
+	(HWCAP enum): HWCAP_S390_HPAGE, HWCAP_S390_ETF3EH and
+	HWCAP_S390_HIGH_GPRS added.
+
+	* sysdeps/s390/s390-64/Makefile: Adjusted to build the new modules.
+	* sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: New file.
+	* sysdeps/s390/s390-64/utf16-utf32-z9.c: New file.
+	* sysdeps/s390/s390-64/utf8-utf16-z9.c: New file.
+	* sysdeps/s390/s390-64/utf8-utf32-z9.c: New file.
+
+2009-07-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/cacheinfo.c [USE_MULTIARCH]: Rearrange code to
+	avoid additional cpuid instructions.  Most of the information is
+	stored somewhere.
+
+	* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_02_known): Add more
+	cache descriptors.
+	* sysdeps/x86_64/cacheinfo.c (intel_02_known): Likewise.
+
+	* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): Reset
+	SSSE3 bit for Atoms.
+	* sysdeps/x86_64/multiarch/strcpy.S: New need to perform Atom test
+	here anymore.
+
+	* posix/tst-rfc3484.c (do_test): Initialize entire sockaddr_in
+	structure before copying it to avoid warning.
+	* posix/tst-rfc3484-2.c (do_test): Likewise.
+	* posix/tst-rfc3484-3.c (do_test): Likewise.
+
+	[BZ #10416]
+	* include/unistd.h: Make header file suitable for C++ test cases.
+	Patch by Duncan Simpson <dps@xxxxxxxxxxxxxxxxxxx>.
+
+	* sysdeps/unix/sysv/linux/i386/makecontext.S: Ensure we preserve the
+	stack alignment in the exit code.
+
+	* elf/dl-lookup.c (dl_lookup_x): The hashval for unique symbol can
+	potentially be zero.
+
+	* elf/tst-unique1.c: Extend test to check for unloading DSO with
+	unique symbol definition.
+	Patch by Jakub Jelinek.
+	* elf/dl-lookup.c (do_lookup_x): When entering a new unique symbol,
+	make sure the object with the definition cannot be unloaded.  Adjust
+	a few types.
+	* sysdeps/generic/ldsodefs.h (struct rtld_global): The map element in
+	the unique symbol hash table should not be const.
+
+2009-07-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strstr.c: Minor cleanups.  Remove
+	unnecesary variables.  Comment fixes.
+
+2009-07-20  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strstr.c [USE_AS_STRCASESTR] (STRSTR_SSE42):
+	Use NONASCII_CASE information provided by the locale to determine
+	whether optimized string load function can be used.  Minor cleanups.
+
+2009-07-20  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* string/strcasestr.c (STRCASESTR): New macro.
+	(__strcasestr): Renamed to ..
+	(STRCASESTR): ...this.
+	* string/strstr.c (STRSTR): New macro.
+	(strstr): Renamed to ..
+	(STRSTR): ...this.
+	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+	strstr-c strcasestr-c
+	(CFLAGS-strstr.c): New.
+	(CFLAGS-strcasestr.c): Likewise.
+	* sysdeps/x86_64/multiarch/strcasestr-c.c: New file.
+	* sysdeps/x86_64/multiarch/strcasestr.c: New file.
+	* sysdeps/x86_64/multiarch/strstr-c.c: New file.
+	* sysdeps/x86_64/multiarch/strstr.c: New file.
+
+2009-07-20  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* locale/localeinfo.h (LIMAGIC): Update value for LC_CTYPE.
+	* locale/langinfo.h: Define _NL_CTYPE_NONASCII_CASE.
+	* locale/C-ctype.c (_nl_C_LC_CTYPE): Add initializer for
+	_NL_CTYPE_NONASCII_CASE.
+	* locale/programs/ld-ctype.c (locale_ctype_t): Add nonascii_case
+	field.
+	(ctype_finish): Check whether there are any 8-bit characters outside
+	the range ASCII has or whether the mapping isn't the same as for
+	ASCII (±0x20).  Set nonascii_case appropriately.
+	(ctype_output): Add output handler for nonascii_case.
+
+2009-07-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/generic/sysdep.h: Define cfi_personality, cfi_lsda,
+	CFI_PERSONALITY, CFI_LSDA, and DW_EH_PE_* constants.
+
+2009-07-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10360]
+	* resolv/res-mkquery.c (__res_nopt): If anslen is > 0xffff store
+	0xffff in the EDNS0 record.
+
+2009-07-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/cache.c (cache_add): Use atomic_compare_and_exchange_bool_rel
+	instead of atomic_compare_and_exchange_bool_acq to ensure pointer
+	is written before the list head update.
+	Patch by Andreas Schwab <aschwab@xxxxxxxxxx>.
+
+2009-07-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* malloc/malloc.c [ATOMIC_FASTBINS] (_int_free): Make check for
+	corruption thread-safe.
+
+2009-07-13  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* include/atomic.h (catomic_compare_and_exchange_val_rel): If arch
+	overrides atomic_compare_and_exchange_val_rel, define to
+	atomic_compare_and_exchange_val_rel by default, otherwise default
+	to catomic_compare_and_exchange_val_acq.
+	(catomic_compare_and_exchange_bool_rel): If arch overrides
+	atomic_compare_and_exchange_bool_rel, define to
+	atomic_compare_and_exchange_bool_rel by default.
+	* malloc/malloc.c (_int_free): Revert 2009-07-02 change.
+	Use catomic_compare_and_exchange_val_rel instead of
+	catomic_compare_and_exchange_val_acq.
+
+2009-07-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/generic/ldsodefs.h: Add prototype for
+	_dl_higher_prime_number.
+	* elf/dl-misc.c (_dl_higher_prime_number): Mark with internal_function.
+
+	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Optimize
+	restoring of ymm registers a bit.
+
+2009-07-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/memcmp.S: New file.
+
+2009-07-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86-64/dl-trampoline.h: Remove after integrating code into...
+	* sysdeps/x86-64/dl-trampoline.S: ...here.  Rewrite to avoid function
+	pointers in writable memory.
+
+2009-07-07  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* config.h.in: Add HAVE_AVX_SUPPORT entry.
+	* config.make.in: Add config-cflags-avx entry.
+	* configure.in: Substitute libc_cv_cc_avx.
+	* elf/Makefile: Add rules to build and run tst-audit4 and tst-audit5.
+	* elf/tst-audit4.c: New file.
+	* elf/tst-audit5.c: New file.
+	* elf/tst-auditmod4a.c: New file.
+	* elf/tst-auditmod4b.c: New file.
+	* elf/tst-auditmod5a.c: New file.
+	* elf/tst-auditmod5b.c: New file.
+	* sysdeps/x86_64/Makefile (gen-as-const-headers): Add
+	link-defines.sym.
+	* sysdeps/x86_64/bits/link.h (La_x86_64_ymm): New.
+	(La_x86_64_vector): Likewise.
+	(La_x86_64_regs): Append lr_vector.
+	(La_x86_64_retval): Append lr_vector0/lrv_vector1.
+	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Move
+	saving and restoring SSE registers to ...
+	* sysdeps/x86_64/dl-trampoline.h: This.  New file.
+	* sysdeps/x86_64/dl-trampoline.S: Include <config.h> and
+	<link-defines.h>.
+	(_dl_runtime_profile): Use LR_SIZE to allocate space for
+	La_x86_64_regs.  Allocate extra space and jump to memory at
+	save_and_restore_vector if HAVE_AVX_SUPPORT is defined.
+	(save_and_restore_vector_sse): New.
+	(save_and_restore_vector_avx): Likewise.
+	(check_avx): Likewise.
+	(save_and_restore_vector): Likewise.
+	* sysdeps/x86_64/elf/configure.in: Set libc_cv_cc_avx and
+	HAVE_AVX_SUPPORT.
+	* sysdeps/x86_64/link-defines.sym: New file.
+
+2009-07-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/do-lookup.h: Removed after folding content into...
+	* elf/dl-lookup.c: ...here.
+
+	* sysdeps/unix/sysv/linux/sys/epoll.h: Fix comment.
+
+2009-07-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* configure.in: Check for gnu_unique_symbol symbol type.
+	* config.h.in: Add HAVE_ASM_UNIQUE_OBJECT entry.
+	* elf/do-lookup.h (do_lookup_x): Take new parameter with link map of
+	the undefined symbol.  Handle STB_GNU_UNIQUE binding of found symbol.
+	* elf/dl-lookup.c (_dl_lookup_symbol_x): Adjust callers for do_lookup_x
+	change.
+	* sysdeps/generic/ldsodefs.h (struct rtld_global): Add definitions for
+	unique symbol table.
+	* elf/rtld.c (rtld_global): Initialize lock of unique symbol hash table
+	for first namespace.
+	* elf/dl-open.c (_dl_open): For new namespace, initialize lock for
+	unique symbol hash table.
+	* elf/Makefile: Add rules to build and run tst-unique1 and tst-unique2.
+	* elf/tst-unique1.c: New file.
+	* elf/tst-unique1mod1.c: New file.
+	* elf/tst-unique1mod2.c: New file.
+	* elf/tst-unique2.c: New file.
+	* elf/tst-unique2mod1.c: New file.
+	* elf/tst-unique2mod2.c: New file.
+
+2009-07-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/elf.h (STB_GNU_UNIQUE): Define.
+
+	* elf/dl-misc.c (_dl_higher_prime_number): New function.  Moved here
+	from...
+	* include/inline-hashtab.h: ...here.
+	(htab_expand): Adjust for renamed function.  Correct memory handling.
+
+2009-07-06  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/do-lookup.h (do_lookup_x): Optimize test for valid symbol types.
+
+2009-07-03  Andreas Schwab  <aschwab@xxxxxxxxxx>
+
+	* sysdeps/powerpc/sysdep.h (PPC_FEATURE_ARCH_2_06): Fix value.
+	(PPC_FEATURE_HAS_VSX): Likewise.
+
+2009-07-03  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strcspn-c.c: Minor cleanups.
+	* sysdeps/x86_64/multiarch/strspn-c.c: Likewise.
+
+	* sysdeps/x86_64/multiarch/strcmp.S: Make sure functions are all
+	aligned to 16 byte boundaries.
+	* sysdeps/x86_64/multiarch/strcpy.S: Likewise.
+	* sysdeps/x86_64/multiarch/strlen.S: Likewise.
+	* sysdeps/x86_64/multiarch/rawmemchr.S: Likewise.
+
+2009-07-02  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* config.h.in (HAVE_SSE4_SUPPORT): New macro.
+	* config.make.in (config-cflags-sse4): New variable.
+	* configure.in: Substitute libc_cv_cc_sse4.
+	* sysdeps/i386/configure.in: Set libc_cv_cc_sse4 and
+	HAVE_SSE4_SUPPORT.
+	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+	strcspn-c, strpbrk-c, strspn-c for string if gcc supports SSE4.
+	* sysdeps/x86_64/multiarch/strcspn-c.c: New file.
+	* sysdeps/x86_64/multiarch/strcspn.S: New file.
+	* sysdeps/x86_64/multiarch/strpbrk-c.c: New file.
+	* sysdeps/x86_64/multiarch/strpbrk.S: New file.
+	* sysdeps/x86_64/multiarch/strspn-c.c: New file.
+	* sysdeps/x86_64/multiarch/strspn.S: New file.
+
+2009-06-30  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* elf/Makefile (distribute): Remove tst-audit.sh.  Add
+	tst-audit2.c, tst-audit3.c, tst-auditmod3a.c, tst-auditmod3b.c.
+	(tests): Add tst-audit3 for x86_64.
+	(modules-names): Add tst-auditmod3a, tst-auditmod3b.
+	($(objpfx)tst-audit3): Define.
+	($(objpfx)tst-audit3.out): Define.
+	(tst-audit3-ENV): Define.
+	* elf/tst-audit3.c: New file.
+	* elf/tst-auditmod3a.c: New file.
+	* elf/tst-auditmod3b.c: New file.
+	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Save
+	and restore xmm6.
+
+	* string/stpncpy.c (STPNCPY): New.  Defined if not defined.
+	(__stpncpy): Renamed to ...
+	(STPNCPY): This.
+	(stpncpy): Create alias only if STPNCPY is not defined.
+	* string/strncpy.c (STRNCPY): New.  Defined to strncpy if not
+	defined.
+	(strncpy): Renamed to ...
+	(STRNCPY): This.
+	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+	 stpncpy-c strncpy-c for string.
+	* sysdeps/x86_64/multiarch/stpcpy.S: New file.
+	* sysdeps/x86_64/multiarch/stpncpy-c.c: New file.
+	* sysdeps/x86_64/multiarch/stpncpy.S: New file.
+	* sysdeps/x86_64/multiarch/strcpy.S: New file.
+	* sysdeps/x86_64/multiarch/strncpy-c.c: New file.
+	* sysdeps/x86_64/multiarch/strncpy.S: New file.
+
+2009-07-02  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* malloc/malloc.c [ATOMIC_FASTBINS] (_int_free): Add full barrier when
+	adding to fast bin list.
+
+2009-07-01  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nis/nss_nis/nis-network.c (_nss_nis_getnetbyaddr_r): Don't use
+	inet_makeaddr.  This worked only with class-based networks.
+	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r):
+	Likewise.
+
+	* nss/nss_files/files-network.c (netbyaddr): If type is AF_UNSPEC,
+	recognize all types.
+	* nss/getent.c (networks_keys): Pass AF_UNSPEC instead of AF_UNIX
+	to getnetbyaddr.  Fix network parameter to getnetbyaddr.  It must
+	be in host byte order.
+
 2009-06-26  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	* sysdeps/x86_64/multiarch/ifunc-defines.sym (FAMILIY_OFFSET): Define.

Modified: trunk/libc/NEWS
==============================================================================
--- trunk/libc/NEWS (original)
+++ trunk/libc/NEWS Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2009-6-1
+GNU C Library NEWS -- history of user-visible changes.  2009-7-21
 Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -15,6 +15,27 @@
 
 * STT_GNU_IFUNC is now supported in static executables.
   Implemented by H.J. Lu.
+
+* New optimized string functions for x86-64: strstr, strcasestr, memcmp,
+  strcspn, strpbrk, strspn, strcpy, stpcpy, strncpy, strcmp, strncmp.
+  Contributed by H.J. Lu.
+
+  strlen, rawmemchr.
+  Implemented by Ulrich Drepper.
+
+* AVX support in x86-64 auditing support in ld.so.
+  Implemented by H.J. Lu.
+
+* STB_GNU_UNIQUE support added.
+  Implemented by Ulrich Drepper.
+
+* Implement second fallback mode for optimized DNS lookup for even more
+  broken environments.  If two requests from the same port are not
+  handled correctly close the socket and open a new one before sending
+  the second request.  The 'single-request-reopen' option in /etc/resolv.conf
+  can be used to select this mode right away, instead of rediscovering the
+  necessity is every process again.
+  Implemented by Ulrich Drepper.
 
 
 Version 2.10

Modified: trunk/libc/config.h.in
==============================================================================
--- trunk/libc/config.h.in (original)
+++ trunk/libc/config.h.in Wed Jul 29 08:58:14 2009
@@ -59,6 +59,9 @@
    assembler's `.type' directive, if it has one.  */
 #undef	ASM_TYPE_DIRECTIVE_PREFIX
 
+/* Define if the assembler supports the gnu_unique_object symbol type.  */
+#undef	HAVE_ASM_UNIQUE_OBJECT
+
 /* Define a symbol_name as a global .symbol_name for ld.  */
 #undef	HAVE_ASM_GLOBAL_DOT_NAME
 
@@ -128,6 +131,12 @@
 
 /* Define if binutils support TLS handling.  */
 #undef	HAVE_TLS_SUPPORT
+
+/* Define if gcc supports SSE4.  */
+#undef	HAVE_SSE4_SUPPORT
+
+/* Define if gcc supports AVX.  */
+#undef	HAVE_AVX_SUPPORT
 
 /* Define if the compiler's exception support is based on libunwind.  */
 #undef	HAVE_CC_WITH_LIBUNWIND

Modified: trunk/libc/config.make.in
==============================================================================
--- trunk/libc/config.make.in (original)
+++ trunk/libc/config.make.in Wed Jul 29 08:58:14 2009
@@ -33,6 +33,9 @@
 config-sysdirs = @sysnames@
 cflags-cpu = @libc_cv_cc_submachine@
 asflags-cpu = @libc_cv_cc_submachine@
+
+config-cflags-sse4 = @libc_cv_cc_sse4@
+config-cflags-avx = @libc_cv_cc_avx@
 
 defines = @DEFINES@
 sysincludes = @SYSINCLUDES@

Modified: trunk/libc/configure
==============================================================================
--- trunk/libc/configure (original)
+++ trunk/libc/configure Wed Jul 29 08:58:14 2009
@@ -313,7 +313,7 @@
 # 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI multi_arch experimental_malloc libc_cv_nss_crypt subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL 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 libc_cv_cc_submachine 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 libc_cv_cpp_asm_debuginfo use_ldconfig ldd_rewrite_script elf xcoff static shared libc_cv_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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI multi_arch experimental_malloc libc_cv_nss_crypt subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S AR NM OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH_SHELL 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 libc_cv_cc_submachine 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 libc_cv_cpp_asm_debuginfo libc_cv_cc_sse4 libc_cv_cc_avx use_ldconfig ldd_rewrite_script elf xcoff static shared libc_cv_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.
@@ -5390,6 +5390,32 @@
 
 fi
 
+echo "$as_me:$LINENO: checking for assembler gnu_unique_object symbol type" >&5
+echo $ECHO_N "checking for assembler gnu_unique_object symbol type... $ECHO_C" >&6
+if test "${libc_cv_asm_unique_object+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.s <<EOF
+${libc_cv_dot_text}
+_sym:
+.type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
+EOF
+if ${CC-cc} -c $ASFLAGS conftest.s 1>&5 2>&5; then
+  libc_cv_asm_unique_object=yes
+else
+  libc_cv_asm_unique_object=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_asm_unique_object" >&5
+echo "${ECHO_T}$libc_cv_asm_unique_object" >&6
+if test $libc_cv_asm_unique_object = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_ASM_UNIQUE_OBJECT 1
+_ACEOF
+
+fi
+
 # For the multi-arch option we need support in the assembler.
 if test "$multi_arch" = yes; then
   if test "x$libc_cv_asm_type_prefix" != xno; then
@@ -8029,6 +8055,8 @@
   { echo "$as_me:$LINENO: WARNING: *** be removed." >&5
 echo "$as_me: WARNING: *** be removed." >&2;}
 fi
+
+
 
 
 
@@ -8835,6 +8863,8 @@
 s,@libc_cv_rootsbindir@,$libc_cv_rootsbindir,;t t
 s,@libc_cv_forced_unwind@,$libc_cv_forced_unwind,;t t
 s,@libc_cv_cpp_asm_debuginfo@,$libc_cv_cpp_asm_debuginfo,;t t
+s,@libc_cv_cc_sse4@,$libc_cv_cc_sse4,;t t
+s,@libc_cv_cc_avx@,$libc_cv_cc_avx,;t t
 s,@use_ldconfig@,$use_ldconfig,;t t
 s,@ldd_rewrite_script@,$ldd_rewrite_script,;t t
 s,@elf@,$elf,;t t

Modified: trunk/libc/configure.in
==============================================================================
--- trunk/libc/configure.in (original)
+++ trunk/libc/configure.in Wed Jul 29 08:58:14 2009
@@ -1219,6 +1219,23 @@
   AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
 fi
 
+AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
+	       libc_cv_asm_unique_object, [dnl
+cat > conftest.s <<EOF
+${libc_cv_dot_text}
+_sym:
+.type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
+EOF
+if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+  libc_cv_asm_unique_object=yes
+else
+  libc_cv_asm_unique_object=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_unique_object = yes; then
+  AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
+fi
+
 # For the multi-arch option we need support in the assembler.
 if test "$multi_arch" = yes; then
   if test "x$libc_cv_asm_type_prefix" != xno; then
@@ -2258,6 +2275,8 @@
 
 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
 AC_SUBST(libc_cv_cpp_asm_debuginfo)
+AC_SUBST(libc_cv_cc_sse4)
+AC_SUBST(libc_cv_cc_avx)
 
 AC_SUBST(use_ldconfig)
 AC_SUBST(ldd_rewrite_script)

Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Wed Jul 29 08:58:14 2009
@@ -29,7 +29,7 @@
 # profiled libraries.
 dl-routines	= $(addprefix dl-,load cache lookup object reloc deps \
 			          runtime error init fini debug misc \
-				  version profile conflict tls origin \
+				  version profile conflict tls origin scope \
 				  execstack caller open close trampoline)
 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
 # But they are absent from the shared libc, because that code is in ld.so.
@@ -47,7 +47,7 @@
 		   dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
 		   genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
 		   dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \
-		   do-lookup.h dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
+		   dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
 		   testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \
 		   testobj6.c testobj1_1.c failobj.c unloadmod.c \
 		   ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \
@@ -89,7 +89,10 @@
 		   unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
 		   unload6mod1.c unload6mod2.c unload6mod3.c \
 		   unload7mod1.c unload7mod2.c \
-		   tst-auditmod1.c tst-audit.sh \
+		   tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
+		   tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
+		   tst-auditmod4a.c tst-auditmod4b.c \
+		   tst-audit5.c tst-auditmod5a.c tst-auditmod5b.c \
 		   order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
 		   tst-stackguard1.c tst-stackguard1-static.c \
 		   tst-array5.c tst-array5-static.c tst-array5dep.c \
@@ -110,7 +113,9 @@
 		   ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
 		   ifuncmain6pie.c ifuncmod6.c \
 		   ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
-		   ifuncmain7pie.c ifuncmain7static.c
+		   ifuncmain7pie.c ifuncmain7static.c \
+		   tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
+		   tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -190,10 +195,14 @@
 	 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
 	 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
 	 tst-audit1 tst-audit2 \
-	 tst-stackguard1 tst-addr1 tst-thrlock
+	 tst-stackguard1 tst-addr1 tst-thrlock \
+	 tst-unique1 tst-unique2
 #	 reldep9
 test-srcs = tst-pathopt
 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
+ifeq (x86_64,$(config-machine))
+tests += tst-audit3 tst-audit4 tst-audit5
+endif
 endif
 ifeq (yesyes,$(have-fpie)$(build-shared))
 tests: $(objpfx)tst-pie1.out
@@ -235,12 +244,19 @@
 		unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
 		unload6mod1 unload6mod2 unload6mod3 \
 		unload7mod1 unload7mod2 \
-		order2mod1 order2mod2 order2mod3 order2mod4
+		order2mod1 order2mod2 order2mod3 order2mod4 \
+		tst-unique1mod1 tst-unique1mod2 \
+		tst-unique2mod1 tst-unique2mod2
 ifeq (yes,$(have-initfini-array))
 modules-names += tst-array2dep tst-array5dep
 endif
 ifeq (yesyes,$(have-fpie)$(build-shared))
 modules-names += tst-piemod1
+endif
+ifeq (x86_64,$(config-machine))
+modules-names += tst-auditmod3a tst-auditmod3b \
+		tst-auditmod4a tst-auditmod4b \
+		tst-auditmod5a tst-auditmod5b
 endif
 modules-execstack-yes = tst-execstack-mod
 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
@@ -969,6 +985,18 @@
 tst-audit2-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
 tst-audit2-WRAPPER = $(..)scripts/run-with-env.sh
 
+$(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
+$(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
+tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
+
+$(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
+$(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
+tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
+
+$(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
+$(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
+tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
+
 $(objpfx)tst-global1: $(libdl)
 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
 
@@ -1105,3 +1133,16 @@
 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
+
+$(objpfx)tst-unique1: $(libdl)
+$(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
+			  $(objpfx)tst-unique1mod2.so
+
+$(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
+$(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
+
+ifeq (yes,$(config-cflags-avx))
+CFLAGS-tst-audit4.c += -mavx
+CFLAGS-tst-auditmod4a.c += -mavx
+CFLAGS-tst-auditmod4b.c += -mavx
+endif

Modified: trunk/libc/elf/dl-lookup.c
==============================================================================
--- trunk/libc/elf/dl-lookup.c (original)
+++ trunk/libc/elf/dl-lookup.c Wed Jul 29 08:58:14 2009
@@ -69,8 +69,378 @@
 #endif
 
 
-/* The actual lookup code.  */
-#include "do-lookup.h"
+/* Inner part of the lookup functions.  We return a value > 0 if we
+   found the symbol, the value 0 if nothing is found and < 0 if
+   something bad happened.  */
+static int
+__attribute_noinline__
+do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
+	     unsigned long int *old_hash, const ElfW(Sym) *ref,
+	     struct sym_val *result, struct r_scope_elem *scope, size_t i,
+	     const struct r_found_version *const version, int flags,
+	     struct link_map *skip, int type_class, struct link_map *undef_map)
+{
+  size_t n = scope->r_nlist;
+  /* Make sure we read the value before proceeding.  Otherwise we
+     might use r_list pointing to the initial scope and r_nlist being
+     the value after a resize.  That is the only path in dl-open.c not
+     protected by GSCOPE.  A read barrier here might be to expensive.  */
+  __asm volatile ("" : "+r" (n), "+m" (scope->r_list));
+  struct link_map **list = scope->r_list;
+
+  do
+    {
+      /* These variables are used in the nested function.  */
+      Elf_Symndx symidx;
+      int num_versions = 0;
+      const ElfW(Sym) *versioned_sym = NULL;
+
+      const struct link_map *map = list[i]->l_real;
+
+      /* Here come the extra test needed for `_dl_lookup_symbol_skip'.  */
+      if (map == skip)
+	continue;
+
+      /* Don't search the executable when resolving a copy reloc.  */
+      if ((type_class & ELF_RTYPE_CLASS_COPY) && map->l_type == lt_executable)
+	continue;
+
+      /* Do not look into objects which are going to be removed.  */
+      if (map->l_removed)
+	continue;
+
+      /* Print some debugging info if wanted.  */
+      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
+	_dl_debug_printf ("symbol=%s;  lookup in file=%s [%lu]\n",
+			  undef_name,
+			  map->l_name[0] ? map->l_name : rtld_progname,
+			  map->l_ns);
+
+      /* If the hash table is empty there is nothing to do here.  */
+      if (map->l_nbuckets == 0)
+	continue;
+
+      /* The tables for this map.  */
+      const ElfW(Sym) *symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
+      const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+
+
+      /* Nested routine to check whether the symbol matches.  */
+      const ElfW(Sym) *
+      __attribute_noinline__
+      check_match (const ElfW(Sym) *sym)
+      {
+	unsigned int stt = ELFW(ST_TYPE) (sym->st_info);
+	assert (ELF_RTYPE_CLASS_PLT == 1);
+	if (__builtin_expect ((sym->st_value == 0 /* No value.  */
+			       && stt != STT_TLS)
+			      || (type_class & (sym->st_shndx == SHN_UNDEF)),
+			      0))
+	  return NULL;
+
+	/* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC,
+	   STT_COMMON, STT_TLS, and STT_GNU_IFUNC since these are no
+	   code/data definitions.  */
+#define ALLOWED_STT \
+	((1 << STT_NOTYPE) | (1 << STT_OBJECT) | (1 << STT_FUNC) \
+	 | (1 << STT_COMMON) | (1 << STT_TLS) | (1 << STT_GNU_IFUNC))
+	if (__builtin_expect (((1 << stt) & ALLOWED_STT) == 0, 0))
+	  return NULL;
+
+	if (sym != ref && strcmp (strtab + sym->st_name, undef_name))
+	  /* Not the symbol we are looking for.  */
+	  return NULL;
+
+	const ElfW(Half) *verstab = map->l_versyms;
+	if (version != NULL)
+	  {
+	    if (__builtin_expect (verstab == NULL, 0))
+	      {
+		/* We need a versioned symbol but haven't found any.  If
+		   this is the object which is referenced in the verneed
+		   entry it is a bug in the library since a symbol must
+		   not simply disappear.
+
+		   It would also be a bug in the object since it means that
+		   the list of required versions is incomplete and so the
+		   tests in dl-version.c haven't found a problem.*/
+		assert (version->filename == NULL
+			|| ! _dl_name_match_p (version->filename, map));
+
+		/* Otherwise we accept the symbol.  */
+	      }
+	    else
+	      {
+		/* We can match the version information or use the
+		   default one if it is not hidden.  */
+		ElfW(Half) ndx = verstab[symidx] & 0x7fff;
+		if ((map->l_versions[ndx].hash != version->hash
+		     || strcmp (map->l_versions[ndx].name, version->name))
+		    && (version->hidden || map->l_versions[ndx].hash
+			|| (verstab[symidx] & 0x8000)))
+		  /* It's not the version we want.  */
+		  return NULL;
+	      }
+	  }
+	else
+	  {
+	    /* No specific version is selected.  There are two ways we
+	       can got here:
+
+	       - a binary which does not include versioning information
+	       is loaded
+
+	       - dlsym() instead of dlvsym() is used to get a symbol which
+	       might exist in more than one form
+
+	       If the library does not provide symbol version information
+	       there is no problem at at: we simply use the symbol if it
+	       is defined.
+
+	       These two lookups need to be handled differently if the
+	       library defines versions.  In the case of the old
+	       unversioned application the oldest (default) version
+	       should be used.  In case of a dlsym() call the latest and
+	       public interface should be returned.  */
+	    if (verstab != NULL)
+	      {
+		if ((verstab[symidx] & 0x7fff)
+		    >= ((flags & DL_LOOKUP_RETURN_NEWEST) ? 2 : 3))
+		  {
+		    /* Don't accept hidden symbols.  */
+		    if ((verstab[symidx] & 0x8000) == 0
+			&& num_versions++ == 0)
+		      /* No version so far.  */
+		      versioned_sym = sym;
+
+		    return NULL;
+		  }
+	      }
+	  }
+
+	/* There cannot be another entry for this symbol so stop here.  */
+	return sym;
+      }
+
+      const ElfW(Sym) *sym;
+      const ElfW(Addr) *bitmask = map->l_gnu_bitmask;
+      if (__builtin_expect (bitmask != NULL, 1))
+	{
+	  ElfW(Addr) bitmask_word
+	    = bitmask[(new_hash / __ELF_NATIVE_CLASS)
+		      & map->l_gnu_bitmask_idxbits];
+
+	  unsigned int hashbit1 = new_hash & (__ELF_NATIVE_CLASS - 1);
+	  unsigned int hashbit2 = ((new_hash >> map->l_gnu_shift)
+				   & (__ELF_NATIVE_CLASS - 1));
+
+	  if (__builtin_expect ((bitmask_word >> hashbit1)
+				& (bitmask_word >> hashbit2) & 1, 0))
+	    {
+	      Elf32_Word bucket = map->l_gnu_buckets[new_hash
+						     % map->l_nbuckets];
+	      if (bucket != 0)
+		{
+		  const Elf32_Word *hasharr = &map->l_gnu_chain_zero[bucket];
+
+		  do
+		    if (((*hasharr ^ new_hash) >> 1) == 0)
+		      {
+			symidx = hasharr - map->l_gnu_chain_zero;
+			sym = check_match (&symtab[symidx]);
+			if (sym != NULL)
+			  goto found_it;
+		      }
+		  while ((*hasharr++ & 1u) == 0);
+		}
+	    }
+	  /* No symbol found.  */
+	  symidx = SHN_UNDEF;
+	}
+      else
+	{
+	  if (*old_hash == 0xffffffff)
+	    *old_hash = _dl_elf_hash (undef_name);
+
+	  /* Use the old SysV-style hash table.  Search the appropriate
+	     hash bucket in this object's symbol table for a definition
+	     for the same symbol name.  */
+	  for (symidx = map->l_buckets[*old_hash % map->l_nbuckets];
+	       symidx != STN_UNDEF;
+	       symidx = map->l_chain[symidx])
+	    {
+	      sym = check_match (&symtab[symidx]);
+	      if (sym != NULL)
+		goto found_it;
+	    }
+	}
+
+      /* If we have seen exactly one versioned symbol while we are
+	 looking for an unversioned symbol and the version is not the
+	 default version we still accept this symbol since there are
+	 no possible ambiguities.  */
+      sym = num_versions == 1 ? versioned_sym : NULL;
+
+      if (sym != NULL)
+	{
+	found_it:
+	  switch (__builtin_expect (ELFW(ST_BIND) (sym->st_info), STB_GLOBAL))
+	    {
+	    case STB_WEAK:
+	      /* Weak definition.  Use this value if we don't find another.  */
+	      if (__builtin_expect (GLRO(dl_dynamic_weak), 0))
+		{
+		  if (! result->s)
+		    {
+		      result->s = sym;
+		      result->m = (struct link_map *) map;
+		    }
+		  break;
+		}
+	      /* FALLTHROUGH */
+	    case STB_GLOBAL:
+	    success:
+	      /* Global definition.  Just what we need.  */
+	      result->s = sym;
+	      result->m = (struct link_map *) map;
+	      return 1;
+
+	    case STB_GNU_UNIQUE:;
+	      /* We have to determine whether we already found a
+		 symbol with this name before.  If not then we have to
+		 add it to the search table.  If we already found a
+		 definition we have to use it.  */
+	      void enter (struct unique_sym *table, size_t size,
+			  unsigned int hash, const char *name,
+			  const ElfW(Sym) *sym, struct link_map *map)
+	      {
+		size_t idx = hash % size;
+		size_t hash2 = 1 + hash % (size - 2);
+		while (1)
+		  {
+		    if (table[idx].name == NULL)
+		      {
+			table[idx].hashval = hash;
+			table[idx].name = strtab + sym->st_name;
+			if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+			  {
+			    table[idx].sym = ref;
+			    table[idx].map = undef_map;
+			  }
+			else
+			  {
+			    table[idx].sym = sym;
+			    table[idx].map = map;
+
+			    if (map->l_type == lt_loaded)
+			      /* Make sure we don't unload this object by
+				 setting the appropriate flag.  */
+			      map->l_flags_1 |= DF_1_NODELETE;
+			  }
+
+			return;
+		      }
+
+		    idx += hash2;
+		    if (idx >= size)
+		      idx -= size;
+		  }
+	      }
+
+	      struct unique_sym_table *tab
+		= &GL(dl_ns)[map->l_ns]._ns_unique_sym_table;
+
+	      __rtld_lock_lock_recursive (tab->lock);
+
+	      struct unique_sym *entries = tab->entries;
+	      size_t size = tab->size;
+	      if (entries != NULL)
+		{
+		  size_t idx = new_hash % size;
+		  size_t hash2 = 1 + new_hash % (size - 2);
+		  while (1)
+		    {
+		      if (entries[idx].hashval == new_hash
+			  && strcmp (entries[idx].name, undef_name) == 0)
+			{
+			  result->s = entries[idx].sym;
+			  result->m = (struct link_map *) entries[idx].map;
+			  __rtld_lock_unlock_recursive (tab->lock);
+			  return 1;
+			}
+
+		      if (entries[idx].name == NULL)
+			break;
+
+		      idx += hash2;
+		      if (idx >= size)
+			idx -= size;
+		    }
+
+		  if (size * 3 <= tab->n_elements * 4)
+		    {
+		      /* Expand the table.  */
+		      size_t newsize = _dl_higher_prime_number (size + 1);
+		      struct unique_sym *newentries
+			= calloc (sizeof (struct unique_sym), newsize);
+		      if (newentries == NULL)
+			{
+			nomem:
+			  __rtld_lock_unlock_recursive (tab->lock);
+			  _dl_fatal_printf ("out of memory\n");
+			}
+
+		      for (idx = 0; idx < size; ++idx)
+			if (entries[idx].name != NULL)
+			  enter (newentries, newsize, entries[idx].hashval,
+				 entries[idx].name, entries[idx].sym,
+				 entries[idx].map);
+
+		      tab->free (entries);
+		      tab->size = newsize;
+		      size = newsize;
+		      entries = tab->entries = newentries;
+		      tab->free = free;
+		    }
+		}
+	      else
+		{
+#define INITIAL_NUNIQUE_SYM_TABLE 31
+		  size = INITIAL_NUNIQUE_SYM_TABLE;
+		  entries = calloc (sizeof (struct unique_sym), size);
+		  if (entries == NULL)
+		    goto nomem;
+
+		  tab->entries = entries;
+		  tab->size = size;
+		  tab->free = free;
+		}
+
+	      enter (entries, size, new_hash, strtab + sym->st_name, sym,
+		     (struct link_map *) map);
+	      ++tab->n_elements;
+
+	      __rtld_lock_unlock_recursive (tab->lock);
+
+	      goto success;
+
+	    default:
+	      /* Local symbols are ignored.  */
+	      break;
+	    }
+	}
+
+      /* If this current map is the one mentioned in the verneed entry
+	 and we have not found a weak entry, it is a bug.  */
+      if (symidx == STN_UNDEF && version != NULL && version->filename != NULL
+	  && __builtin_expect (_dl_name_match_p (version->filename, map), 0))
+	return -1;
+    }
+  while (++i < n);
+
+  /* We have not found anything until now.  */
+  return 0;
+}
 
 
 static uint_fast32_t
@@ -337,7 +707,7 @@
     {
       int res = do_lookup_x (undef_name, new_hash, &old_hash, *ref,
 			     &current_value, *scope, start, version, flags,
-			     skip_map, type_class);
+			     skip_map, type_class, undef_map);
       if (res > 0)
 	break;
 
@@ -410,7 +780,7 @@
 	  for (scope = symbol_scope; *scope != NULL; i = 0, ++scope)
 	    if (do_lookup_x (undef_name, new_hash, &old_hash, *ref,
 			     &protected_value, *scope, i, version, flags,
-			     skip_map, ELF_RTYPE_CLASS_PLT) != 0)
+			     skip_map, ELF_RTYPE_CLASS_PLT, NULL) != 0)
 	      break;
 
 	  if (protected_value.s != NULL && protected_value.m != undef_map)
@@ -536,7 +906,7 @@
 
 	  do_lookup_x (undef_name, new_hash, &old_hash, *ref, &val,
 		       undef_map->l_local_scope[0], 0, version, 0, NULL,
-		       type_class);
+		       type_class, undef_map);
 
 	  if (val.s != value->s || val.m != value->m)
 	    conflict = 1;

Modified: trunk/libc/elf/dl-misc.c
==============================================================================
--- trunk/libc/elf/dl-misc.c (original)
+++ trunk/libc/elf/dl-misc.c Wed Jul 29 08:58:14 2009
@@ -312,3 +312,68 @@
 
   return 0;
 }
+
+
+unsigned long int
+internal_function
+_dl_higher_prime_number (unsigned long int n)
+{
+  /* These are primes that are near, but slightly smaller than, a
+     power of two.  */
+  static const uint32_t primes[] = {
+    UINT32_C (7),
+    UINT32_C (13),
+    UINT32_C (31),
+    UINT32_C (61),
+    UINT32_C (127),
+    UINT32_C (251),
+    UINT32_C (509),
+    UINT32_C (1021),
+    UINT32_C (2039),
+    UINT32_C (4093),
+    UINT32_C (8191),
+    UINT32_C (16381),
+    UINT32_C (32749),
+    UINT32_C (65521),
+    UINT32_C (131071),
+    UINT32_C (262139),
+    UINT32_C (524287),
+    UINT32_C (1048573),
+    UINT32_C (2097143),
+    UINT32_C (4194301),
+    UINT32_C (8388593),
+    UINT32_C (16777213),
+    UINT32_C (33554393),
+    UINT32_C (67108859),
+    UINT32_C (134217689),
+    UINT32_C (268435399),
+    UINT32_C (536870909),
+    UINT32_C (1073741789),
+    UINT32_C (2147483647),
+                                       /* 4294967291L */
+    UINT32_C (2147483647) + UINT32_C (2147483644)
+  };
+
+  const uint32_t *low = &primes[0];
+  const uint32_t *high = &primes[sizeof (primes) / sizeof (primes[0])];
+
+  while (low != high)
+    {
+      const uint32_t *mid = low + (high - low) / 2;
+      if (n > *mid)
+       low = mid + 1;
+      else
+       high = mid;
+    }
+
+#if 0
+  /* If we've run out of primes, abort.  */
+  if (n > *low)
+    {
+      fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
+      abort ();
+    }
+#endif
+
+  return *low;
+}

Modified: trunk/libc/elf/dl-open.c
==============================================================================
--- trunk/libc/elf/dl-open.c (original)
+++ trunk/libc/elf/dl-open.c Wed Jul 29 08:58:14 2009
@@ -165,41 +165,6 @@
   return 0;
 }
 
-int
-_dl_scope_free (void *old)
-{
-  struct dl_scope_free_list *fsl;
-#define DL_SCOPE_FREE_LIST_SIZE (sizeof (fsl->list) / sizeof (fsl->list[0]))
-
-  if (RTLD_SINGLE_THREAD_P)
-    free (old);
-  else if ((fsl = GL(dl_scope_free_list)) == NULL)
-    {
-      GL(dl_scope_free_list) = fsl = malloc (sizeof (*fsl));
-      if (fsl == NULL)
-	{
-	  THREAD_GSCOPE_WAIT ();
-	  free (old);
-	  return 1;
-	}
-      else
-	{
-	  fsl->list[0] = old;
-	  fsl->count = 1;
-	}
-    }
-  else if (fsl->count < DL_SCOPE_FREE_LIST_SIZE)
-    fsl->list[fsl->count++] = old;
-  else
-    {
-      THREAD_GSCOPE_WAIT ();
-      while (fsl->count > 0)
-	free (fsl->list[--fsl->count]);
-      return 1;
-    }
-  return 0;
-}
-
 static void
 dl_open_worker (void *a)
 {
@@ -569,7 +534,7 @@
 	if (GL(dl_ns)[nsid]._ns_loaded == NULL)
 	  break;
 
-      if (nsid == DL_NNS)
+      if (__builtin_expect (nsid == DL_NNS, 0))
 	{
 	  /* No more namespace available.  */
 	  __rtld_lock_unlock_recursive (GL(dl_load_lock));
@@ -579,7 +544,10 @@
 	}
 
       if (nsid == GL(dl_nns))
-	++GL(dl_nns);
+	{
+	  __rtld_lock_initialize (GL(dl_ns)[nsid]._ns_unique_sym_table.lock);
+	  ++GL(dl_nns);
+	}
 
       _dl_debug_initialize (0, nsid)->r_state = RT_CONSISTENT;
     }

Modified: trunk/libc/elf/elf.h
==============================================================================
--- trunk/libc/elf/elf.h (original)
+++ trunk/libc/elf/elf.h Wed Jul 29 08:58:14 2009
@@ -444,6 +444,7 @@
 #define STB_WEAK	2		/* Weak symbol */
 #define	STB_NUM		3		/* Number of defined types.  */
 #define STB_LOOS	10		/* Start of OS-specific */
+#define STB_GNU_UNIQUE	10		/* Unique symbol.  */
 #define STB_HIOS	12		/* End of OS-specific */
 #define STB_LOPROC	13		/* Start of processor-specific */
 #define STB_HIPROC	15		/* End of processor-specific */
@@ -1052,6 +1053,9 @@
 /* Build ID bits as generated by ld --build-id.
    The descriptor consists of any nonzero number of bytes.  */
 #define NT_GNU_BUILD_ID	3
+
+/* Version note generated by GNU gold containing a version string.  */
+#define NT_GNU_GOLD_VERSION	4
 
 
 /* Move records.  */

Modified: trunk/libc/elf/rtld.c
==============================================================================
--- trunk/libc/elf/rtld.c (original)
+++ trunk/libc/elf/rtld.c Wed Jul 29 08:58:14 2009
@@ -127,7 +127,12 @@
 #ifdef _LIBC_REENTRANT
     ._dl_load_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
 #endif
-    ._dl_nns = 1
+    ._dl_nns = 1,
+    ._dl_ns =
+    {
+      [LM_ID_BASE] = { ._ns_unique_sym_table
+		       = { .lock = _RTLD_LOCK_RECURSIVE_INITIALIZER } }
+    }
   };
 /* If we would use strong_alias here the compiler would see a
    non-hidden definition.  This would undo the effect of the previous

Modified: trunk/libc/include/atomic.h
==============================================================================
--- trunk/libc/include/atomic.h (original)
+++ trunk/libc/include/atomic.h Wed Jul 29 08:58:14 2009
@@ -107,14 +107,19 @@
 #endif
 
 
+#ifndef catomic_compare_and_exchange_val_rel
+# ifndef atomic_compare_and_exchange_val_rel
+#  define catomic_compare_and_exchange_val_rel(mem, newval, oldval)	      \
+  catomic_compare_and_exchange_val_acq (mem, newval, oldval)
+# else
+#  define catomic_compare_and_exchange_val_rel(mem, newval, oldval)	      \
+  atomic_compare_and_exchange_val_rel (mem, newval, oldval)
+# endif
+#endif
+
+
 #ifndef atomic_compare_and_exchange_val_rel
 # define atomic_compare_and_exchange_val_rel(mem, newval, oldval)	      \
-  atomic_compare_and_exchange_val_acq (mem, newval, oldval)
-#endif
-
-
-#ifndef catomic_compare_and_exchange_val_rel
-# define catomic_compare_and_exchange_val_rel(mem, newval, oldval)	      \
   atomic_compare_and_exchange_val_acq (mem, newval, oldval)
 #endif
 
@@ -155,15 +160,20 @@
 #endif
 
 
+#ifndef catomic_compare_and_exchange_bool_rel
+# ifndef atomic_compare_and_exchange_bool_rel
+#  define catomic_compare_and_exchange_bool_rel(mem, newval, oldval)	      \
+  catomic_compare_and_exchange_bool_acq (mem, newval, oldval)
+# else
+#  define catomic_compare_and_exchange_bool_rel(mem, newval, oldval)	      \
+  atomic_compare_and_exchange_bool_rel (mem, newval, oldval)
+# endif
+#endif
+
+
 #ifndef atomic_compare_and_exchange_bool_rel
 # define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
   atomic_compare_and_exchange_bool_acq (mem, newval, oldval)
-#endif
-
-
-#ifndef catomic_compare_and_exchange_bool_rel
-# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
-  catomic_compare_and_exchange_bool_acq (mem, newval, oldval)
 #endif
 
 

Modified: trunk/libc/include/inline-hashtab.h
==============================================================================
--- trunk/libc/include/inline-hashtab.h (original)
+++ trunk/libc/include/inline-hashtab.h Wed Jul 29 08:58:14 2009
@@ -1,7 +1,5 @@
 /* Fully-inline hash table, used mainly for managing TLS descriptors.
-
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2008
-     Free Software Foundation, Inc.
+   Copyright (C) 1999-2003, 2005, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Alexandre Oliva  <aoliva@xxxxxxxxxx>
 
@@ -29,69 +27,6 @@
 # define INLINE_HASHTAB_H 1
 
 extern void weak_function free (void *ptr);
-
-inline static unsigned long
-higher_prime_number (unsigned long n)
-{
-  /* These are primes that are near, but slightly smaller than, a
-     power of two.  */
-  static const uint32_t primes[] = {
-    UINT32_C (7),
-    UINT32_C (13),
-    UINT32_C (31),
-    UINT32_C (61),
-    UINT32_C (127),
-    UINT32_C (251),
-    UINT32_C (509),
-    UINT32_C (1021),
-    UINT32_C (2039),
-    UINT32_C (4093),
-    UINT32_C (8191),
-    UINT32_C (16381),
-    UINT32_C (32749),
-    UINT32_C (65521),
-    UINT32_C (131071),
-    UINT32_C (262139),
-    UINT32_C (524287),
-    UINT32_C (1048573),
-    UINT32_C (2097143),
-    UINT32_C (4194301),
-    UINT32_C (8388593),
-    UINT32_C (16777213),
-    UINT32_C (33554393),
-    UINT32_C (67108859),
-    UINT32_C (134217689),
-    UINT32_C (268435399),
-    UINT32_C (536870909),
-    UINT32_C (1073741789),
-    UINT32_C (2147483647),
-					/* 4294967291L */
-    UINT32_C (2147483647) + UINT32_C (2147483644)
-  };
-
-  const uint32_t *low = &primes[0];
-  const uint32_t *high = &primes[sizeof (primes) / sizeof (primes[0])];
-
-  while (low != high)
-    {
-      const uint32_t *mid = low + (high - low) / 2;
-      if (n > *mid)
-	low = mid + 1;
-      else
-	high = mid;
-    }
-
-#if 0
-  /* If we've run out of primes, abort.  */
-  if (n > *low)
-    {
-      fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
-      abort ();
-    }
-#endif
-
-  return *low;
-}
 
 struct hashtab
 {
@@ -203,12 +138,11 @@
   /* Resize only when table after removal of unused elements is either
      too full or too empty.  */
   if (htab->n_elements * 2 > htab->size)
-    nsize = higher_prime_number (htab->n_elements * 2);
+    nsize = _dl_higher_prime_number (htab->n_elements * 2);
   else
     nsize = htab->size;
 
-  nentries = malloc (sizeof (void *) * nsize);
-  memset (nentries, 0, sizeof (void *) * nsize);
+  nentries = calloc (sizeof (void *), nsize);
   if (nentries == NULL)
     return 0;
   htab->entries = nentries;

Modified: trunk/libc/include/unistd.h
==============================================================================
--- trunk/libc/include/unistd.h (original)
+++ trunk/libc/include/unistd.h Wed Jul 29 08:58:14 2009
@@ -1,5 +1,7 @@
 #ifndef _UNISTD_H
 # include <posix/unistd.h>
+
+__BEGIN_DECLS
 
 libc_hidden_proto (_exit, __noreturn__)
 libc_hidden_proto (alarm)
@@ -174,4 +176,6 @@
    unless it is really necessary.  */
 #define __have_pipe2 __have_sock_cloexec
 
+__END_DECLS
+
 #endif

Modified: trunk/libc/locale/C-ctype.c
==============================================================================
--- trunk/libc/locale/C-ctype.c (original)
+++ trunk/libc/locale/C-ctype.c Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1995.
 
@@ -531,7 +531,7 @@
 };
 
 /* Number of fields with fixed meanings, starting at 0.  */
-#define NR_FIXED 71
+#define NR_FIXED 72
 /* Number of class fields, starting at CLASS_OFFSET.  */
 #define NR_CLASSES 12
 /* Number of map fields, starting at MAP_OFFSET.  */
@@ -687,6 +687,8 @@
     { .wstr = NULL },
     /* _NL_CTYPE_MAP_TO_NONASCII */
     { .word = 0 },
+    /* _NL_CTYPE_NONASCII_CASE */
+    { .word = 0 },
     /* NR_CLASSES wctype_tables */
     { .string = (const char *) _nl_C_LC_CTYPE_class_upper.header },
     { .string = (const char *) _nl_C_LC_CTYPE_class_lower.header },

Modified: trunk/libc/locale/langinfo.h
==============================================================================
--- trunk/libc/locale/langinfo.h (original)
+++ trunk/libc/locale/langinfo.h Wed Jul 29 08:58:14 2009
@@ -334,6 +334,7 @@
   _NL_CTYPE_TRANSLIT_IGNORE_LEN,
   _NL_CTYPE_TRANSLIT_IGNORE,
   _NL_CTYPE_MAP_TO_NONASCII,
+  _NL_CTYPE_NONASCII_CASE,
   _NL_CTYPE_EXTRA_MAP_1,
   _NL_CTYPE_EXTRA_MAP_2,
   _NL_CTYPE_EXTRA_MAP_3,

Modified: trunk/libc/locale/localeinfo.h
==============================================================================
--- trunk/libc/locale/localeinfo.h (original)
+++ trunk/libc/locale/localeinfo.h Wed Jul 29 08:58:14 2009
@@ -1,5 +1,5 @@
 /* Declarations for internal libc locale interfaces
-   Copyright (C) 1995-2003, 2005, 2006, 2007, 2008
+   Copyright (C) 1995-2003, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -35,6 +35,8 @@
 #define	LIMAGIC(category) \
   (category == LC_COLLATE						\
    ? ((unsigned int) (0x20051014 ^ (category)))				\
+   : category == LC_CTYPE						\
+   ? ((unsigned int) (0x20090720 ^ (category)))				\
    : ((unsigned int) (0x20031115 ^ (category))))
 
 /* Two special weight constants for the collation data.  */

Modified: trunk/libc/locale/programs/ld-ctype.c
==============================================================================
--- trunk/libc/locale/programs/ld-ctype.c (original)
+++ trunk/libc/locale/programs/ld-ctype.c Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxx>, 1995.
 
@@ -223,6 +223,7 @@
   size_t default_missing_lineno;
 
   uint32_t to_nonascii;
+  uint32_t nonascii_case;
 
   /* The arrays for the binary representation.  */
   char_class_t *ctype_b;
@@ -666,6 +667,27 @@
   else
     ctype->class256_collection[space_seq->bytes[0]] |= BIT (tok_print);
 
+  /* Check whether all single-byte characters make to their upper/lowercase
+     equivalent according to the ASCII rules.  */
+  for (cnt = 'A'; cnt <= 'Z'; ++cnt)
+    {
+      uint32_t uppval = ctype->map256_collection[0][cnt];
+      uint32_t lowval = ctype->map256_collection[1][cnt];
+      uint32_t lowuppval = ctype->map256_collection[0][lowval];
+      uint32_t lowlowval = ctype->map256_collection[1][lowval];
+
+      if (uppval != cnt
+	  || lowval != cnt + 0x20
+	  || lowuppval != cnt
+	  || lowlowval != cnt + 0x20)
+	ctype->nonascii_case = 1;
+    }
+  for (cnt = 0; cnt < 256; ++cnt)
+    if (cnt < 'A' || (cnt > 'Z' && cnt < 'a') || cnt > 'z')
+      if (ctype->map256_collection[0][cnt] != cnt
+	  || ctype->map256_collection[1][cnt] != cnt)
+	ctype->nonascii_case = 1;
+
   /* Now that the tests are done make sure the name array contains all
      characters which are handled in the WIDTH section of the
      character set definition file.  */
@@ -1035,6 +1057,9 @@
 	    break;
 
 	  CTYPE_UINT32 (_NL_CTYPE_MAP_TO_NONASCII, ctype->to_nonascii);
+
+	  CTYPE_DATA (_NL_CTYPE_NONASCII_CASE,
+		      &ctype->nonascii_case, sizeof (uint32_t));
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN):
 	    add_locale_uint32 (&file, ctype->mbdigits_act / 10);

Modified: trunk/libc/malloc/malloc.c
==============================================================================
--- trunk/libc/malloc/malloc.c (original)
+++ trunk/libc/malloc/malloc.c Wed Jul 29 08:58:14 2009
@@ -4799,8 +4799,29 @@
 	|| __builtin_expect (chunksize (chunk_at_offset (p, size))
 			     >= av->system_mem, 0))
       {
-	errstr = "free(): invalid next size (fast)";
-	goto errout;
+#ifdef ATOMIC_FASTBINS
+	/* We might not have a lock at this point and concurrent modifications
+	   of system_mem might have let to a false positive.  Redo the test
+	   after getting the lock.  */
+	if (have_lock
+	    || ({ assert (locked == 0);
+		  mutex_lock(&av->mutex);
+		  locked = 1;
+		  chunk_at_offset (p, size)->size <= 2 * SIZE_SZ
+		    || chunksize (chunk_at_offset (p, size)) >= av->system_mem;
+	      }))
+#endif
+	  {
+	    errstr = "free(): invalid next size (fast)";
+	    goto errout;
+	  }
+#ifdef ATOMIC_FASTBINS
+	if (! have_lock)
+	  {
+	    (void)mutex_unlock(&av->mutex);
+	    locked = 0;
+	  }
+#endif
       }
 
     if (__builtin_expect (perturb_byte, 0))
@@ -4823,7 +4844,7 @@
 	  }
 	p->fd = fd = old;
       }
-    while ((old = catomic_compare_and_exchange_val_acq (fb, p, fd)) != fd);
+    while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
 #else
     /* Another simple check: make sure the top of the bin is not the
        record we are going to add (i.e., double free).  */

Modified: trunk/libc/nis/nss_nis/nis-network.c
==============================================================================
--- trunk/libc/nis/nss_nis/nis-network.c (original)
+++ trunk/libc/nis/nss_nis/nis-network.c Wed Jul 29 08:58:14 2009
@@ -241,7 +241,7 @@
   if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  struct in_addr in = inet_makeaddr (addr, 0);
+  struct in_addr in = { .s_addr = htonl (addr) };
   char *buf = inet_ntoa (in);
   size_t blen = strlen (buf);
 

Modified: trunk/libc/nis/nss_nisplus/nisplus-network.c
==============================================================================
--- trunk/libc/nis/nss_nisplus/nisplus-network.c (original)
+++ trunk/libc/nis/nss_nisplus/nisplus-network.c Wed Jul 29 08:58:14 2009
@@ -433,7 +433,7 @@
     char buf2[18];
     int olderr = errno;
 
-    struct in_addr in = inet_makeaddr (addr, 0);
+    struct in_addr in = { .s_addr = htonl (addr) };
     strcpy (buf2, inet_ntoa (in));
     size_t b2len = strlen (buf2);
 

Modified: trunk/libc/nptl/ChangeLog
==============================================================================
--- trunk/libc/nptl/ChangeLog (original)
+++ trunk/libc/nptl/ChangeLog Wed Jul 29 08:58:14 2009
@@ -1,3 +1,99 @@
+2009-07-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* pthread_mutex_lock.c [NO_INCR] (__pthread_mutex_cond_lock_adjust):
+	New function.
+	* pthreadP.h: Declare __pthread_mutex_cond_lock_adjust.
+	* sysdeps/unix/sysv/linux/pthread-pi-defines.sym: Add ROBUST_BIT.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Don't use
+	requeue_pi for robust mutexes.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+	Don't only skip __pthread_mutex_cond_lock.  Call instead
+	__pthread_mutex_cond_lock_adjust.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+
+	* pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Minor
+	optimization of PI mutex handling.
+
+2009-07-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10418]
+	* pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Use _rel
+	instead of of _acq variants of cmpxchg.
+
+2009-07-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/configure.in: New file.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Fix error
+	path when not using absolute timeout futex.
+
+2009-07-20  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Minor
+	optimizations of last changes.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+
+2009-07-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Define
+	FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: If mutex
+	is a PI mutex, then use FUTEX_CMP_REQUEUE_PI.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: If mutex
+	is a PI mutex, then use FUTEX_WAIT_REQUEUE_PI.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+	(__pthread_cond_timedwait): Make more robust.
+
+2009-07-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
+	(__lll_robust_timedlock_wait): If possible use FUTEX_WAIT_BITSET to
+	directly use absolute timeout.
+
+	* tst-sem5.c (do_test): Add test for premature timeout.
+	* Makefile: Linu tst-sem5 with librt.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
+	(pthread_rwlock_timedwrlock): If possible use FUTEX_WAIT_BITSET to
+	directly use absolute timeout.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
+	(pthread_rwlock_timedrdlock): Likewise.
+
+	* tst-cond11.c (run_test): Add test to check that the timeout is
+	long enough.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+	(__pthread_cond_timedwait): If possible use FUTEX_WAIT_BITSET to
+	directly use absolute timeout.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+	(__pthread_cond_wait): Convert to using exception handler instead of
+	registered unwind buffer.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+	(__pthread_cond_timedwait): Likewise.
+
+2009-07-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait):
+	If possible use FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME to directly
+	use absolute timeout.
+
+	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S (sem_wait): Optimize
+	handling of uncontested semaphore.
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+	(__condvar_cleanup): Rewrite to use cfi directives instead of
+	hand-coded unwind tables.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_once.S (__pthread_once):
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S (sem_wait): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait):
+	Likewise.
+
 2009-06-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* Makefile (libpthread-routines): Add pthread_sigqueue.

Modified: trunk/libc/nptl/Makefile
==============================================================================
--- trunk/libc/nptl/Makefile (original)
+++ trunk/libc/nptl/Makefile Wed Jul 29 08:58:14 2009
@@ -499,6 +499,7 @@
 ifeq (yes,$(build-shared))
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
+$(objpfx)tst-sem5: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancel17: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancel18: $(common-objpfx)rt/librt.so
@@ -512,6 +513,7 @@
 else
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
+$(objpfx)tst-sem5: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancel17: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancel18: $(common-objpfx)rt/librt.a

Modified: trunk/libc/nptl/pthreadP.h
==============================================================================
--- trunk/libc/nptl/pthreadP.h (original)
+++ trunk/libc/nptl/pthreadP.h Wed Jul 29 08:58:14 2009
@@ -417,6 +417,8 @@
 extern int __pthread_mutex_lock_internal (pthread_mutex_t *__mutex)
      attribute_hidden;
 extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex)
+     attribute_hidden internal_function;
+extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex)
      attribute_hidden internal_function;
 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_unlock_internal (pthread_mutex_t *__mutex)

Modified: trunk/libc/nptl/pthread_mutex_lock.c
==============================================================================
--- trunk/libc/nptl/pthread_mutex_lock.c (original)
+++ trunk/libc/nptl/pthread_mutex_lock.c Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -473,3 +473,22 @@
 strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
 strong_alias (__pthread_mutex_lock, __pthread_mutex_lock_internal)
 #endif
+
+
+#ifdef NO_INCR
+void
+__pthread_mutex_cond_lock_adjust (mutex)
+     pthread_mutex_t *mutex;
+{
+  assert ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_INHERIT_NP) != 0);
+  assert ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0);
+  assert ((mutex->__data.__kind & PTHREAD_MUTEX_PSHARED_BIT) == 0);
+
+  /* Record the ownership.  */
+  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+  mutex->__data.__owner = id;
+
+  if (mutex->__data.__kind == PTHREAD_MUTEX_PI_RECURSIVE_NP)
+    ++mutex->__data.__count;
+}
+#endif

Modified: trunk/libc/nptl/pthread_mutex_unlock.c
==============================================================================
--- trunk/libc/nptl/pthread_mutex_unlock.c (original)
+++ trunk/libc/nptl/pthread_mutex_unlock.c Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005-2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -150,7 +150,7 @@
       if (--mutex->__data.__count != 0)
 	/* We still hold the mutex.  */
 	return 0;
-      goto continue_pi;
+      goto continue_pi_non_robust;
 
     case PTHREAD_MUTEX_PI_ROBUST_RECURSIVE_NP:
       /* Recursive mutex.  */
@@ -173,7 +173,7 @@
 	/* We still hold the mutex.  */
 	return 0;
 
-      goto continue_pi;
+      goto continue_pi_robust;
 
     case PTHREAD_MUTEX_PI_ERRORCHECK_NP:
     case PTHREAD_MUTEX_PI_NORMAL_NP:
@@ -195,9 +195,9 @@
       pi_notrecoverable:
        newowner = PTHREAD_MUTEX_NOTRECOVERABLE;
 
-    continue_pi:
       if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0)
 	{
+	continue_pi_robust:
 	  /* Remove mutex from the list.
 	     Note: robust PI futexes are signaled by setting bit 0.  */
 	  THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
@@ -206,6 +206,7 @@
 	  DEQUEUE_MUTEX (mutex);
 	}
 
+    continue_pi_non_robust:
       mutex->__data.__owner = newowner;
       if (decr)
 	/* One less user.  */
@@ -213,7 +214,7 @@
 
       /* Unlock.  */
       if ((mutex->__data.__lock & FUTEX_WAITERS) != 0
-	  || atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock, 0,
+	  || atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock, 0,
 						   THREAD_GETMEM (THREAD_SELF,
 								  tid)))
 	{
@@ -263,7 +264,7 @@
 	  oldval = mutex->__data.__lock;
 	  newval = oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK;
 	}
-      while (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
+      while (atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock,
 						   newval, oldval));
 
       if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym Wed Jul 29 08:58:14 2009
@@ -3,5 +3,6 @@
 -- These PI macros are used by assembly code.
 
 MUTEX_KIND	offsetof (pthread_mutex_t, __data.__kind)
+ROBUST_BIT	PTHREAD_MUTEX_ROBUST_NORMAL_NP
 PI_BIT		PTHREAD_MUTEX_PRIO_INHERIT_NP
 PS_BIT		PTHREAD_MUTEX_PSHARED_BIT

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h Wed Jul 29 08:58:14 2009
@@ -54,6 +54,8 @@
 #define FUTEX_TRYLOCK_PI	8
 #define FUTEX_WAIT_BITSET	9
 #define FUTEX_WAKE_BITSET	10
+#define FUTEX_WAIT_REQUEUE_PI	11
+#define FUTEX_CMP_REQUEUE_PI	12
 #define FUTEX_PRIVATE_FLAG	128
 #define FUTEX_CLOCK_REALTIME	256
 

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -32,6 +32,8 @@
 #ifdef __ASSUME_PRIVATE_FUTEX
 # define LOAD_FUTEX_WAIT(reg) \
 	xorl	$(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
+# define LOAD_FUTEX_WAIT_ABS(reg) \
+	xorl	$(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME), reg
 #else
 # if FUTEX_WAIT == 0
 #  define LOAD_FUTEX_WAIT(reg) \
@@ -43,6 +45,10 @@
 	andl	%fs:PRIVATE_FUTEX, reg ; \
 	orl	$FUTEX_WAIT, reg
 # endif
+# define LOAD_FUTEX_WAIT_ABS(reg) \
+	xorl	$FUTEX_PRIVATE_FLAG, reg ; \
+	andl	%fs:PRIVATE_FUTEX, reg ; \
+	orl	$FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg
 #endif
 
 /* For the calculation see asm/vsyscall.h.  */
@@ -110,6 +116,73 @@
 	.align	16
 __lll_robust_timedlock_wait:
 	cfi_startproc
+# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+#  ifdef PIC
+	cmpl	$0, __have_futex_clock_realtime(%rip)
+#  else
+	cmpl	$0, __have_futex_clock_realtime
+#  endif
+	je	.Lreltmo
+# endif
+
+	pushq	%r9
+	cfi_adjust_cfa_offset(8)
+	cfi_rel_offset(%r9, 0)
+	movq	%rdx, %r10
+	movl	$0xffffffff, %r9d
+	LOAD_FUTEX_WAIT_ABS (%esi)
+
+1:	testl	$FUTEX_OWNER_DIED, %eax
+	jnz	3f
+
+	movl	%eax, %edx
+	orl	$FUTEX_WAITERS, %edx
+
+	cmpl	%eax, %edx
+	je	5f
+
+	LOCK
+	cmpxchgl %edx, (%rdi)
+	movq	$0, %rcx	/* Must use mov to avoid changing cc.  */
+	jnz	6f
+
+5:	movl	$SYS_futex, %eax
+	syscall
+	movl	%eax, %ecx
+
+	movl	(%rdi), %eax
+
+6:	testl	%eax, %eax
+	jne	2f
+
+	movl	%fs:TID, %edx
+	orl	$FUTEX_WAITERS, %edx
+	LOCK
+	cmpxchgl %edx, (%rdi)
+	jnz	2f
+
+3:	popq	%r9
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r9)
+	retq
+
+	cfi_adjust_cfa_offset(8)
+	cfi_rel_offset(%r9, 0)
+	/* Check whether the time expired.  */
+2:	cmpl	$-ETIMEDOUT, %ecx
+	je	4f
+	cmpl	$-EINVAL, %ecx
+	jne	1b
+
+4:	movl	%ecx, %eax
+	negl	%eax
+	jmp	3b
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r9)
+
+
+# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+.Lreltmo:
 	/* Check for a valid timeout value.  */
 	cmpq	$1000000000, 8(%rdx)
 	jae	3f
@@ -223,10 +296,11 @@
 	cfi_offset(%r12, -32)
 	cfi_offset(%r13, -40)
 	/* Check whether the time expired.  */
-7:	cmpq	$-ETIMEDOUT, %rcx
+7:	cmpl	$-ETIMEDOUT, %ecx
 	jne	1b
 
 8:	movl	$ETIMEDOUT, %eax
 	jmp	6b
+#endif
 	cfi_endproc
 	.size	__lll_robust_timedlock_wait,.-__lll_robust_timedlock_wait

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -70,11 +70,15 @@
 8:	cmpq	$-1, %r8
 	je	9f
 
-	/* XXX: The kernel so far doesn't support requeue to PI futex.  */
-	/* XXX: The kernel only supports FUTEX_CMP_REQUEUE to the same
-	   type of futex (private resp. shared).  */
-	testl	$(PI_BIT | PS_BIT), MUTEX_KIND(%r8)
+	/* Do not use requeue for pshared condvars.  */
+	testl	$PS_BIT, MUTEX_KIND(%r8)
 	jne	9f
+
+	/* Requeue to a PI mutex if the PI bit is set.  */
+	movl	MUTEX_KIND(%r8), %eax
+	andl	$(ROBUST_BIT|PI_BIT), %eax
+	cmpl	$PI_BIT, %eax
+	je	81f
 
 	/* Wake up all threads.  */
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -96,6 +100,20 @@
 
 10:	xorl	%eax, %eax
 	retq
+
+	/* Wake up all threads.  */
+81:	movl	$(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
+	movl	$SYS_futex, %eax
+	movl	$1, %edx
+	movl	$0x7fffffff, %r10d
+	syscall
+
+	/* For any kind of error, which mainly is EAGAIN, we try again
+	   with WAKE.  The general test also covers running on old
+	   kernels.  */
+	cmpq	$-4095, %rax
+	jb	10b
+	jmp	9f
 
 	.align	16
 	/* Unlock.  */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S Wed Jul 29 08:58:14 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2005, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -21,6 +21,7 @@
 #include <shlib-compat.h>
 #include <lowlevellock.h>
 #include <lowlevelcond.h>
+#include <pthread-pi-defines.h>
 #include <kernel-features.h>
 #include <pthread-errnos.h>
 
@@ -56,19 +57,25 @@
 
 	/* Wake up one thread.  */
 	cmpq	$-1, dep_mutex(%r8)
+	movl	$FUTEX_WAKE_OP, %esi
 	movl	$1, %edx
+	movl	$SYS_futex, %eax
+	je	8f
+
+	/* Get the address of the mutex used.  */
+	movq    dep_mutex(%r8), %rcx
+	movl	MUTEX_KIND(%rcx), %eax
+	andl	$(ROBUST_BIT|PI_BIT), %eax
+	cmpl	$PI_BIT, %eax
+	je	9f
+
 #ifdef __ASSUME_PRIVATE_FUTEX
-	movl	$FUTEX_WAKE_OP, %eax
 	movl	$(FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG), %esi
-	cmove	%eax, %esi
 #else
-	movl	$0, %eax
-	movl	%fs:PRIVATE_FUTEX, %esi
-	cmove	%eax, %esi
-	orl	$FUTEX_WAKE_OP, %esi
+	orl	%fs:PRIVATE_FUTEX, %esi
 #endif
-	movl	$1, %r10d
-	movl	$SYS_futex, %eax
+
+8:	movl	$1, %r10d
 #if cond_lock != 0
 	addq	$cond_lock, %r8
 #endif
@@ -85,9 +92,27 @@
 	xorl	%eax, %eax
 	retq
 
-7:	/* %esi should be either FUTEX_WAKE_OP or
-	   FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG from the previous syscall.  */
-	xorl	$(FUTEX_WAKE ^ FUTEX_WAKE_OP), %esi
+	/* Wake up one thread and requeue none in the PI Mutex case.  */
+9:	movl	$(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
+	movq	%rcx, %r8
+	xorq	%r10, %r10
+	movl	(%rdi), %r9d	// XXX Can this be right?
+	syscall
+
+	leaq	-cond_futex(%rdi), %r8
+
+	/* For any kind of error, we try again with WAKE.
+	   The general test also covers running on old kernels.  */
+	cmpq	$-4095, %rax
+	jb	4f
+
+7:
+#ifdef __ASSUME_PRIVATE_FUTEX
+	andl	$FUTEX_PRIVATE_FLAG, %esi
+#else
+	andl	%fs:PRIVATE_FUTEX, %esi
+#endif
+	orl	$FUTEX_WAKE, %esi
 	movl	$SYS_futex, %eax
 	/* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
 	movl	$1, %edx  */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S Wed Jul 29 08:58:14 2009
@@ -21,6 +21,7 @@
 #include <shlib-compat.h>
 #include <lowlevellock.h>
 #include <lowlevelcond.h>
+#include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
 
 #include <kernel-features.h>
@@ -30,6 +31,7 @@
 
 
 	.text
+
 
 /* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
 			       const struct timespec *abstime)  */
@@ -37,7 +39,17 @@
 	.type	__pthread_cond_timedwait, @function
 	.align	16
 __pthread_cond_timedwait:
+.LSTARTCODE:
 	cfi_startproc
+#ifdef SHARED
+	cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
+			DW.ref.__gcc_personality_v0)
+	cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
+#else
+	cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
+	cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
+#endif
+
 	pushq	%r12
 	cfi_adjust_cfa_offset(8)
 	cfi_rel_offset(%r12, 0)
@@ -47,23 +59,28 @@
 	pushq	%r14
 	cfi_adjust_cfa_offset(8)
 	cfi_rel_offset(%r14, 0)
-#define FRAME_SIZE 80
+	pushq	%r15
+	cfi_adjust_cfa_offset(8)
+	cfi_rel_offset(%r15, 0)
+#ifdef __ASSUME_FUTEX_CLOCK_REALTIME
+# define FRAME_SIZE 32
+#else
+# define FRAME_SIZE 48
+#endif
 	subq	$FRAME_SIZE, %rsp
 	cfi_adjust_cfa_offset(FRAME_SIZE)
 
 	cmpq	$1000000000, 8(%rdx)
 	movl	$EINVAL, %eax
-	jae	18f
+	jae	48f
 
 	/* Stack frame:
 
-	   rsp + 80
-	            +--------------------------+
-	   rsp + 48 | cleanup buffer           |
-	            +--------------------------+
-	   rsp + 40 | old wake_seq value       |
-	            +--------------------------+
-	   rsp + 24 | timeout value            |
+	   rsp + 48
+	            +--------------------------+
+	   rsp + 32 | timeout value            |
+	            +--------------------------+
+	   rsp + 24 | old wake_seq value       |
 	            +--------------------------+
 	   rsp + 16 | mutex pointer            |
 	            +--------------------------+
@@ -85,145 +102,17 @@
 	je	22f
 	movq	%rsi, dep_mutex(%rdi)
 
+22:
+#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+#  ifdef PIC
+	cmpl	$0, __have_futex_clock_realtime(%rip)
+#  else
+	cmpl	$0, __have_futex_clock_realtime
+#  endif
+	je	.Lreltmo
+#endif
+
 	/* Get internal lock.  */
-22:	movl	$1, %esi
-	xorl	%eax, %eax
-	LOCK
-#if cond_lock == 0
-	cmpxchgl %esi, (%rdi)
-#else
-	cmpxchgl %esi, cond_lock(%rdi)
-#endif
-	jnz	1f
-
-	/* Unlock the mutex.  */
-2:	movq	16(%rsp), %rdi
-	xorl	%esi, %esi
-	callq	__pthread_mutex_unlock_usercnt
-
-	testl	%eax, %eax
-	jne	16f
-
-	movq	8(%rsp), %rdi
-	incq	total_seq(%rdi)
-	incl	cond_futex(%rdi)
-	addl	$(1 << nwaiters_shift), cond_nwaiters(%rdi)
-
-	/* Install cancellation handler.  */
-#ifdef PIC
-	leaq	__condvar_cleanup(%rip), %rsi
-#else
-	leaq	__condvar_cleanup, %rsi
-#endif
-	leaq	48(%rsp), %rdi
-	movq	%rsp, %rdx
-	callq	__pthread_cleanup_push
-
-	/* Get and store current wakeup_seq value.  */
-	movq	8(%rsp), %rdi
-	movq	wakeup_seq(%rdi), %r9
-	movl	broadcast_seq(%rdi), %edx
-	movq	%r9, 40(%rsp)
-	movl	%edx, 4(%rsp)
-
-	/* Get the current time.  */
-8:
-#ifdef __NR_clock_gettime
-	/* Get the clock number.  Note that the field in the condvar
-	   structure stores the number minus 1.  */
-	movq	8(%rsp), %rdi
-	movl	cond_nwaiters(%rdi), %edi
-	andl	$((1 << nwaiters_shift) - 1), %edi
-	/* Only clocks 0 and 1 are allowed so far.  Both are handled in the
-	   kernel.  */
-	leaq	24(%rsp), %rsi
-# ifdef SHARED
-	movq	__vdso_clock_gettime@GOTPCREL(%rip), %rax
-	movq	(%rax), %rax
-	PTR_DEMANGLE (%rax)
-	jz	26f
-	call	*%rax
-	jmp	27f
-# endif
-26:	movl	$__NR_clock_gettime, %eax
-	syscall
-27:
-# ifndef __ASSUME_POSIX_TIMERS
-	cmpq	$-ENOSYS, %rax
-	je	19f
-# endif
-
-	/* Compute relative timeout.  */
-	movq	(%r13), %rcx
-	movq	8(%r13), %rdx
-	subq	24(%rsp), %rcx
-	subq	32(%rsp), %rdx
-#else
-	leaq	24(%rsp), %rdi
-	xorl	%esi, %esi
-	movq	$VSYSCALL_ADDR_vgettimeofday, %rax
-	callq	*%rax
-
-	/* Compute relative timeout.  */
-	movq	32(%rsp), %rax
-	movl	$1000, %edx
-	mul	%rdx		/* Milli seconds to nano seconds.  */
-	movq	(%r13), %rcx
-	movq	8(%r13), %rdx
-	subq	24(%rsp), %rcx
-	subq	%rax, %rdx
-#endif
-	jns	12f
-	addq	$1000000000, %rdx
-	decq	%rcx
-12:	testq	%rcx, %rcx
-	movq	8(%rsp), %rdi
-	movq	$-ETIMEDOUT, %r14
-	js	6f
-
-	/* Store relative timeout.  */
-21:	movq	%rcx, 24(%rsp)
-	movq	%rdx, 32(%rsp)
-
-	movl	cond_futex(%rdi), %r12d
-
-	/* Unlock.  */
-	LOCK
-#if cond_lock == 0
-	decl	(%rdi)
-#else
-	decl	cond_lock(%rdi)
-#endif
-	jne	3f
-
-4:	callq	__pthread_enable_asynccancel
-	movl	%eax, (%rsp)
-
-	leaq	24(%rsp), %r10
-	cmpq	$-1, dep_mutex(%rdi)
-	movq	%r12, %rdx
-#ifdef __ASSUME_PRIVATE_FUTEX
-	movl	$FUTEX_WAIT, %eax
-	movl	$(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), %esi
-	cmove	%eax, %esi
-#else
-	movl	$0, %eax
-	movl	%fs:PRIVATE_FUTEX, %esi
-	cmove	%eax, %esi
-# if FUTEX_WAIT != 0
-	orl	$FUTEX_WAIT, %esi
-# endif
-#endif
-	addq	$cond_futex, %rdi
-	movl	$SYS_futex, %eax
-	syscall
-	movq	%rax, %r14
-
-	movl	(%rsp), %edi
-	callq	__pthread_disable_asynccancel
-
-	/* Lock.  */
-	movq	8(%rsp), %rdi
 	movl	$1, %esi
 	xorl	%eax, %eax
 	LOCK
@@ -232,45 +121,149 @@
 #else
 	cmpxchgl %esi, cond_lock(%rdi)
 #endif
-	jne	5f
-
-6:	movl	broadcast_seq(%rdi), %edx
+	jnz	31f
+
+	/* Unlock the mutex.  */
+32:	movq	16(%rsp), %rdi
+	xorl	%esi, %esi
+	callq	__pthread_mutex_unlock_usercnt
+
+	testl	%eax, %eax
+	jne	46f
+
+	movq	8(%rsp), %rdi
+	incq	total_seq(%rdi)
+	incl	cond_futex(%rdi)
+	addl	$(1 << nwaiters_shift), cond_nwaiters(%rdi)
+
+	/* Get and store current wakeup_seq value.  */
+	movq	8(%rsp), %rdi
+	movq	wakeup_seq(%rdi), %r9
+	movl	broadcast_seq(%rdi), %edx
+	movq	%r9, 24(%rsp)
+	movl	%edx, 4(%rsp)
+
+38:	movl	cond_futex(%rdi), %r12d
+
+	/* Unlock.  */
+	LOCK
+#if cond_lock == 0
+	decl	(%rdi)
+#else
+	decl	cond_lock(%rdi)
+#endif
+	jne	33f
+
+.LcleanupSTART1:
+34:	callq	__pthread_enable_asynccancel
+	movl	%eax, (%rsp)
+	movq	8(%rsp), %rdi
+
+	movq	%r13, %r10
+	movl	$FUTEX_WAIT_BITSET, %esi
+	cmpq	$-1, dep_mutex(%rdi)
+	je	60f
+
+	movq	dep_mutex(%rdi), %r8
+	/* Requeue to a non-robust PI mutex if the PI bit is set and
+	the robust bit is not set.  */
+	movl	MUTEX_KIND(%r8), %eax
+	andl	$(ROBUST_BIT|PI_BIT), %eax
+	cmpl	$PI_BIT, %eax
+	jne	61f
+
+	movl	$(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
+	xorl	%eax, %eax
+	/* The following only works like this because we only support
+	   two clocks, represented using a single bit.  */
+	testl	$1, cond_nwaiters(%rdi)
+	movl	$FUTEX_CLOCK_REALTIME, %edx
+	cmove	%edx, %eax
+	orl	%eax, %esi
+	movq	%r12, %rdx
+	addq	$cond_futex, %rdi
+	movl	$SYS_futex, %eax
+	syscall
+
+	movl	$1, %r15d
+#ifdef __ASSUME_REQUEUE_PI
+	jmp	62f
+#else
+	cmpq	$-4095, %rax
+	jnae	62f
+
+	subq	$cond_futex, %rdi
+#endif
+
+61:	movl	$(FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG), %esi
+60:	xorl	%r15d, %r15d
+	xorl	%eax, %eax
+	/* The following only works like this because we only support
+	   two clocks, represented using a single bit.  */
+	testl	$1, cond_nwaiters(%rdi)
+	movl	$FUTEX_CLOCK_REALTIME, %edx
+	movl	$0xffffffff, %r9d
+	cmove	%edx, %eax
+	orl	%eax, %esi
+	movq	%r12, %rdx
+	addq	$cond_futex, %rdi
+	movl	$SYS_futex, %eax
+	syscall
+62:	movq	%rax, %r14
+
+	movl	(%rsp), %edi
+	callq	__pthread_disable_asynccancel
+.LcleanupEND1:
+
+	/* Lock.  */
+	movq	8(%rsp), %rdi
+	movl	$1, %esi
+	xorl	%eax, %eax
+	LOCK
+#if cond_lock == 0
+	cmpxchgl %esi, (%rdi)
+#else
+	cmpxchgl %esi, cond_lock(%rdi)
+#endif
+	jne	35f
+
+36:	movl	broadcast_seq(%rdi), %edx
 
 	movq	woken_seq(%rdi), %rax
 
 	movq	wakeup_seq(%rdi), %r9
 
 	cmpl	4(%rsp), %edx
-	jne	23f
-
-	cmpq	40(%rsp), %r9
-	jbe	15f
+	jne	53f
+
+	cmpq	24(%rsp), %r9
+	jbe	45f
 
 	cmpq	%rax, %r9
-	ja	9f
-
-15:	cmpq	$-ETIMEDOUT, %r14
-	jne	8b
-
-13:	incq	wakeup_seq(%rdi)
+	ja	39f
+
+45:	cmpq	$-ETIMEDOUT, %r14
+	jne	38b
+
+99:	incq	wakeup_seq(%rdi)
 	incl	cond_futex(%rdi)
 	movl	$ETIMEDOUT, %r14d
-	jmp	14f
-
-23:	xorq	%r14, %r14
-	jmp	24f
-
-9:	xorq	%r14, %r14
-14:	incq	woken_seq(%rdi)
-
-24:	subl	$(1 << nwaiters_shift), cond_nwaiters(%rdi)
+	jmp	44f
+
+53:	xorq	%r14, %r14
+	jmp	54f
+
+39:	xorq	%r14, %r14
+44:	incq	woken_seq(%rdi)
+
+54:	subl	$(1 << nwaiters_shift), cond_nwaiters(%rdi)
 
 	/* Wake up a thread which wants to destroy the condvar object.  */
 	cmpq	$0xffffffffffffffff, total_seq(%rdi)
-	jne	25f
+	jne	55f
 	movl	cond_nwaiters(%rdi), %eax
 	andl	$~((1 << nwaiters_shift) - 1), %eax
-	jne	25f
+	jne	55f
 
 	addq	$cond_nwaiters, %rdi
 	cmpq	$-1, dep_mutex-cond_nwaiters(%rdi)
@@ -289,26 +282,30 @@
 	syscall
 	subq	$cond_nwaiters, %rdi
 
-25:	LOCK
+55:	LOCK
 #if cond_lock == 0
 	decl	(%rdi)
 #else
 	decl	cond_lock(%rdi)
 #endif
-	jne	10f
-
-	/* Remove cancellation handler.  */
-11:	movq	48+CLEANUP_PREV(%rsp), %rdx
-	movq	%rdx, %fs:CLEANUP
-
-	movq	16(%rsp), %rdi
+	jne	40f
+
+	/* If requeue_pi is used the kernel performs the locking of the
+	   mutex. */
+41:	movq	16(%rsp), %rdi
+	testl	%r15d, %r15d
+	jnz	64f
+
 	callq	__pthread_mutex_cond_lock
 
-	testq	%rax, %rax
+63:	testq	%rax, %rax
 	cmoveq	%r14, %rax
 
-18:	addq	$FRAME_SIZE, %rsp
+48:	addq	$FRAME_SIZE, %rsp
 	cfi_adjust_cfa_offset(-FRAME_SIZE)
+	popq	%r15
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r15)
 	popq	%r14
 	cfi_adjust_cfa_offset(-8)
 	cfi_restore(%r14)
@@ -321,12 +318,18 @@
 
 	retq
 
+	cfi_adjust_cfa_offset(4 * 8 + FRAME_SIZE)
+	cfi_rel_offset(%r12, FRAME_SIZE + 24)
+	cfi_rel_offset(%r13, FRAME_SIZE + 16)
+	cfi_rel_offset(%r14, FRAME_SIZE + 8)
+	cfi_rel_offset(%r15, FRAME_SIZE)
+
+64:	callq	__pthread_mutex_cond_lock_adjust
+	movq	%r14, %rax
+	jmp	48b
+
 	/* Initial locking failed.  */
-1:
-	cfi_adjust_cfa_offset(3 * 8 + FRAME_SIZE)
-	cfi_rel_offset(%r12, FRAME_SIZE + 16)
-	cfi_rel_offset(%r13, FRAME_SIZE + 8)
-	cfi_rel_offset(%r14, FRAME_SIZE)
+31:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
@@ -335,10 +338,10 @@
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
 	callq	__lll_lock_wait
-	jmp	2b
+	jmp	32b
 
 	/* Unlock in loop requires wakeup.  */
-3:
+33:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
@@ -347,10 +350,10 @@
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
 	callq	__lll_unlock_wake
-	jmp	4b
+	jmp	34b
 
 	/* Locking in loop failed.  */
-5:
+35:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
@@ -362,10 +365,10 @@
 #if cond_lock != 0
 	subq	$cond_lock, %rdi
 #endif
-	jmp	6b
+	jmp	36b
 
 	/* Unlock after loop requires wakeup.  */
-10:
+40:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
@@ -374,10 +377,10 @@
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
 	callq	__lll_unlock_wake
-	jmp	11b
+	jmp	41b
 
 	/* The initial unlocking of the mutex failed.  */
-16:	movq	8(%rsp), %rdi
+46:	movq	8(%rsp), %rdi
 	movq	%rax, (%rsp)
 	LOCK
 #if cond_lock == 0
@@ -385,7 +388,7 @@
 #else
 	decl	cond_lock(%rdi)
 #endif
-	jne	17f
+	jne	47f
 
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
@@ -396,23 +399,229 @@
 	cmovne	%eax, %esi
 	callq	__lll_unlock_wake
 
-17:	movq	(%rsp), %rax
-	jmp	18b
-
-#if defined __NR_clock_gettime && !defined __ASSUME_POSIX_TIMERS
-	/* clock_gettime not available.  */
-19:	leaq	24(%rsp), %rdi
+47:	movq	(%rsp), %rax
+	jmp	48b
+
+
+#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+.Lreltmo:
+	xorl	%r15d, %r15d
+
+	/* Get internal lock.  */
+	movl	$1, %esi
+	xorl	%eax, %eax
+	LOCK
+# if cond_lock == 0
+	cmpxchgl %esi, (%rdi)
+# else
+	cmpxchgl %esi, cond_lock(%rdi)
+# endif
+	jnz	1f
+
+	/* Unlock the mutex.  */
+2:	movq	16(%rsp), %rdi
+	xorl	%esi, %esi
+	callq	__pthread_mutex_unlock_usercnt
+
+	testl	%eax, %eax
+	jne	46b
+
+	movq	8(%rsp), %rdi
+	incq	total_seq(%rdi)
+	incl	cond_futex(%rdi)
+	addl	$(1 << nwaiters_shift), cond_nwaiters(%rdi)
+
+	/* Get and store current wakeup_seq value.  */
+	movq	8(%rsp), %rdi
+	movq	wakeup_seq(%rdi), %r9
+	movl	broadcast_seq(%rdi), %edx
+	movq	%r9, 24(%rsp)
+	movl	%edx, 4(%rsp)
+
+	/* Get the current time.  */
+8:
+# ifdef __NR_clock_gettime
+	/* Get the clock number.  Note that the field in the condvar
+	   structure stores the number minus 1.  */
+	movq	8(%rsp), %rdi
+	movl	cond_nwaiters(%rdi), %edi
+	andl	$((1 << nwaiters_shift) - 1), %edi
+	/* Only clocks 0 and 1 are allowed so far.  Both are handled in the
+	   kernel.  */
+	leaq	32(%rsp), %rsi
+#  ifdef SHARED
+	movq	__vdso_clock_gettime@GOTPCREL(%rip), %rax
+	movq	(%rax), %rax
+	PTR_DEMANGLE (%rax)
+	jz	26f
+	call	*%rax
+	jmp	27f
+#  endif
+26:	movl	$__NR_clock_gettime, %eax
+	syscall
+27:
+#  ifndef __ASSUME_POSIX_TIMERS
+	cmpq	$-ENOSYS, %rax
+	je	19f
+#  endif
+
+	/* Compute relative timeout.  */
+	movq	(%r13), %rcx
+	movq	8(%r13), %rdx
+	subq	32(%rsp), %rcx
+	subq	40(%rsp), %rdx
+# else
+	leaq	24(%rsp), %rdi
 	xorl	%esi, %esi
 	movq	$VSYSCALL_ADDR_vgettimeofday, %rax
 	callq	*%rax
 
 	/* Compute relative timeout.  */
-	movq	32(%rsp), %rax
+	movq	40(%rsp), %rax
 	movl	$1000, %edx

[... 7531 lines stripped ...]