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

[Commits] r20917 - in /fsf/trunk/libc: ./ elf/ io/ libio/ nss/ ports/ ports/sysdeps/arm/ ports/sysdeps/mips/ ports/sysdeps/unix/alpha/...



Author: eglibc
Date: Sat Sep 29 00:01:41 2012
New Revision: 20917

Log:
Import glibc-mainline for 2012-09-29

Added:
    fsf/trunk/libc/libio/tst-fseek.c
    fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-niagara4.S
    fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/_G_config.h
Removed:
    fsf/trunk/libc/sysdeps/gnu/_G_config.h
    fsf/trunk/libc/sysdeps/mach/hurd/_G_config.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makeconfig
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/elf/dl-runtime.c
    fsf/trunk/libc/elf/dl-sysdep.c
    fsf/trunk/libc/elf/dl-version.c
    fsf/trunk/libc/elf/do-rel.h
    fsf/trunk/libc/elf/dynamic-link.h
    fsf/trunk/libc/elf/rtld.c
    fsf/trunk/libc/io/open.c
    fsf/trunk/libc/io/tst-mknodat.c
    fsf/trunk/libc/libio/Makefile
    fsf/trunk/libc/libio/fileops.c
    fsf/trunk/libc/libio/wfileops.c
    fsf/trunk/libc/nss/Makefile
    fsf/trunk/libc/nss/nsswitch.c
    fsf/trunk/libc/ports/ChangeLog.alpha
    fsf/trunk/libc/ports/ChangeLog.arm
    fsf/trunk/libc/ports/ChangeLog.mips
    fsf/trunk/libc/ports/sysdeps/arm/dl-tlsdesc.h
    fsf/trunk/libc/ports/sysdeps/mips/dl-trampoline.c
    fsf/trunk/libc/ports/sysdeps/unix/alpha/sysdep.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/clone.S
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/syscall.S
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/posix/gai.conf
    fsf/trunk/libc/posix/tst-rfc3484.c
    fsf/trunk/libc/stdio-common/Makefile
    fsf/trunk/libc/stdio-common/tst-sprintf.c
    fsf/trunk/libc/stdio-common/vfprintf.c
    fsf/trunk/libc/sysdeps/generic/_G_config.h
    fsf/trunk/libc/sysdeps/generic/ldsodefs.h
    fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
    fsf/trunk/libc/sysdeps/posix/sleep.c
    fsf/trunk/libc/sysdeps/pthread/aio_fsync.c
    fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/sparc/sparc32/dl-machine.h
    fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
    fsf/trunk/libc/sysdeps/sparc/sparc64/dl-machine.h
    fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/Makefile
    fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S
    fsf/trunk/libc/sysdeps/x86_64/dl-tlsdesc.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Sep 29 00:01:41 2012
@@ -1,3 +1,113 @@
+2012-09-28  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* sysdeps/posix/sleep.c (__sleep): Rewritten using __nanosleep
+	instead of SIGALRM.
+
+	* sysdeps/gnu/_G_config.h: Moved to ...
+	* sysdeps/unix/sysv/linux/_G_config.h: ... here.
+	* sysdeps/mach/hurd/_G_config.h: Moved to ...
+	* sysdeps/generic/_G_config.h: ... here.
+
+	* io/open.c (__open): Renamed to __libc_open.  Make __open an alias.
+
+	* posix/Makefile ($(objpfx)config-name.h): Do $(make-target-directory).
+
+	* nss/Makefile ($(objpfx)/libnss_test1.so$(libnss_test1.so-version)):
+	Conditionalize target on [libnss_test1.so-version].
+
+	* elf/dl-sysdep.c: Conditionalize whole contents on [SHARED].
+
+	* Makeconfig (nssobjdir, resolvobjdir): Remove variables.
+	(elfobjdir): Move out of conditionals.
+
+	* nss/nsswitch.c (nss_new_service): Conditionalize definition and
+	declaration on [!DO_STATIC_NSS || SHARED], matching its only caller.
+	(__nss_lookup_function): Conditionalize label remove_from_tree on
+	[!DO_STATIC_NSS || SHARED], matching its only use.
+
+2012-09-28  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S: New file.
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-niagara4.S: New
+	file.
+	* sysdeps/sparc/sparc64/multiarch/Makefile: Add to
+	sysdep_routines.
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/memcpy.S: Use Niagara-4 memcpy
+	when HWCAP_SPARC_CRYPTO is present.
+
+2012-09-28  Pino Toscano  <toscano.pino@xxxxxxxxxx>
+
+	* io/tst-mknodat.c: Create a FIFO instead of a socket.
+
+2012-09-28  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
+
+	[BZ #6530]
+	* stdio-common/vfprintf.c (process_string_arg): Revert
+	2000-07-22 change.
+
+2011-09-28  Jonathan Nieder  <jrnieder@xxxxxxxxx>
+
+	* stdio-common/Makefile (tst-sprintf-ENV): Set environment
+	for testcase.
+	* stdio-common/tst-sprintf.c: Include <locale.h>
+	(main): Test sprintf's handling of incomplete multibyte
+	characters.
+
+2012-09-28  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* elf/dl-runtime.c (VERSYMIDX): Removed.
+	* elf/dl-version.c (VERSYMIDX): Likewise.
+	* elf/do-rel.h (VERSYMIDX): Likewise.
+	(VALIDX): Likewise.
+	* elf/dynamic-link.h (VERSYMIDX): Likewise.
+	* elf/rtld.c (VALIDX): Likewise.
+	(ADDRIDX): Likewise.
+	* sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Likewise.
+	* sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Likewise.
+	* sysdeps/x86_64/dl-tlsdesc.h (ADDRIDX): Likewise.
+	* sysdeps/generic/ldsodefs.h (VERSYMIDX): New macro.
+	(VALIDX): Likewise.
+	(ADDRIDX): Likewise.
+
+2012-09-28  Pino Toscano  <toscano.pino@xxxxxxxxxx>
+
+	* sysdeps/pthread/aio_fsync.c: Fix the file mode checking.
+
+2012-09-28  Dmitry V. Levin  <ldv@xxxxxxxxxxxx>
+
+	[BZ #11438]
+	* sysdeps/posix/getaddrinfo.c (default_scopes): Map RFC 1918 addresses
+	to global scope.
+	* posix/tst-rfc3484.c: Verify 10/8, 172.16/12 and 196.128/16
+	addresses are in the same scope as 192.0.2/24.
+	* posix/gai.conf: Document new scope table defaults.
+
+2012-09-28  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	[BZ #5298]
+	* libio/fileops.c (_IO_new_file_seekoff): Don't flush buffer
+	for ftell.  Compute offsets from write pointers instead.
+	* libio/wfileops.c (_IO_wfile_seekoff): Likewise.
+
+2012-09-28  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	[BZ #14543]
+	* libio/Makefile (tests): New test case tst-fseek.
+	* libio/tst-fseek.c: New test case to verify that fseek/ftell
+	combination works in wide mode.
+	* libio/wfileops.c (_IO_wfile_seekoff): Adjust internal buffer
+	state when the external buffer state changes.
+
+2012-09-27  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	[BZ #14376]
+	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Do not
+	pass reloc->r_addend in as the 'high' argument to
+	sparc64_fixup_plt when handling R_SPARC_JMP_IREL relocations.
+
+	* sysdeps/sparc/fpu/libm-test-ulps: Update.
+
 2012-09-28  Pino Toscano  <toscano.pino@xxxxxxxxxx>
 
 	* rt/tst-aio2.c: Include <pthread.h>.
@@ -9,8 +119,8 @@
 
 2012-09-27  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
-	* sysdeps/x86_64/multiarch/strncmp-ssse3.S: Empty if not in
-	libc.a.
+	* sysdeps/x86_64/multiarch/strncmp-ssse3.S: Conditionalize
+	contents on [SHARED].
 
 2012-09-26  Marek Polacek  <polacek@xxxxxxxxxx>
 

Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Sat Sep 29 00:01:41 2012
@@ -494,14 +494,13 @@
 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
 rpath-link = \
 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
-elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
-else
-nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
-resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
+else
 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
 link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
 endif
 endif
+
+elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
 
 # Differences in the linkers on the various platforms.
 LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat Sep 29 00:01:41 2012
@@ -9,12 +9,13 @@
 
 * The following bugs are resolved with this release:
 
-  1349, 3479, 5044, 5400, 6778, 6808, 9685, 9914, 10014, 10038, 11607,
-  13412, 13542, 13629, 13679, 13696, 13717, 13741, 13939, 13966, 14042,
-  14090, 14150, 14151, 14154, 14157, 14166, 14173, 14195, 14237, 14252,
-  14283, 14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349,
-  14459, 14476, 14505, 14510, 14516, 14518, 14519, 14530, 14532, 14538,
-  14544, 14545, 14562, 14576, 14579, 14583, 14587, 14621.
+  1349, 3479, 5044, 5298, 5400, 6530, 6778, 6808, 9685, 9914, 10014,
+  10038, 11438, 11607, 13412, 13542, 13629, 13679, 13696, 13717, 13741,
+  13939, 13966, 14042, 14090, 14150, 14151, 14154, 14157, 14166, 14173,
+  14195, 14237, 14252, 14283, 14298, 14303, 14307, 14328, 14331, 14336,
+  14337, 14347, 14349, 14376, 14459, 14476, 14505, 14510, 14516, 14518,
+  14519, 14530, 14532, 14538, 14543, 14544, 14545, 14562, 14576, 14579,
+  14583, 14587, 14621.
 
 * Support for STT_GNU_IFUNC symbols added for s390 and s390x.
   Optimized versions of memcpy, memset, and memcmp added for System z10 and

Modified: fsf/trunk/libc/elf/dl-runtime.c
==============================================================================
--- fsf/trunk/libc/elf/dl-runtime.c (original)
+++ fsf/trunk/libc/elf/dl-runtime.c Sat Sep 29 00:01:41 2012
@@ -34,10 +34,6 @@
 # define PLTREL  ElfW(Rela)
 #else
 # define PLTREL  ElfW(Rel)
-#endif
-
-#ifndef VERSYMIDX
-# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
 #endif
 
 /* The fixup functions might have need special attributes.  If none

Modified: fsf/trunk/libc/elf/dl-sysdep.c
==============================================================================
--- fsf/trunk/libc/elf/dl-sysdep.c (original)
+++ fsf/trunk/libc/elf/dl-sysdep.c Sat Sep 29 00:01:41 2012
@@ -1,6 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Generic Unix version.
-   Copyright (C) 1995-1998,2000-2010,2012
-	Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +15,12 @@
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
+
+/* We conditionalize the whole of this file rather than simply eliding it
+   from the static build, because other sysdeps/ versions of this file
+   might define things needed by a static build.  */
+
+#ifdef SHARED
 
 #include <assert.h>
 #include <elf.h>
@@ -592,3 +597,5 @@
 
   return result;
 }
+
+#endif

Modified: fsf/trunk/libc/elf/dl-version.c
==============================================================================
--- fsf/trunk/libc/elf/dl-version.c (original)
+++ fsf/trunk/libc/elf/dl-version.c Sat Sep 29 00:01:41 2012
@@ -26,11 +26,6 @@
 #include <_itoa.h>
 
 #include <assert.h>
-
-
-#ifndef VERSYMIDX
-# define VERSYMIDX(tag)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag))
-#endif
 
 
 #define make_string(string, rest...) \

Modified: fsf/trunk/libc/elf/do-rel.h
==============================================================================
--- fsf/trunk/libc/elf/do-rel.h (original)
+++ fsf/trunk/libc/elf/do-rel.h Sat Sep 29 00:01:41 2012
@@ -30,14 +30,6 @@
 # define DO_ELF_MACHINE_REL_RELATIVE(map, l_addr, relative) \
   elf_machine_rel_relative (l_addr, relative,				      \
 			    (void *) (l_addr + relative->r_offset))
-#endif
-
-#ifndef VERSYMIDX
-# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
-#endif
-#ifndef VALIDX
-# define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		      + DT_EXTRANUM + DT_VALTAGIDX (tag))
 #endif
 
 /* Perform the relocations in MAP on the running program image as specified

Modified: fsf/trunk/libc/elf/dynamic-link.h
==============================================================================
--- fsf/trunk/libc/elf/dynamic-link.h (original)
+++ fsf/trunk/libc/elf/dynamic-link.h Sat Sep 29 00:01:41 2012
@@ -87,10 +87,6 @@
 #endif
 
 #include <dl-machine.h>
-
-#ifndef VERSYMIDX
-# define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
-#endif
 
 
 /* Read the dynamic section at DYN and fill in INFO with indices DT_*.  */

Modified: fsf/trunk/libc/elf/rtld.c
==============================================================================
--- fsf/trunk/libc/elf/rtld.c (original)
+++ fsf/trunk/libc/elf/rtld.c Sat Sep 29 00:01:41 2012
@@ -252,15 +252,6 @@
 RTLD_START
 #else
 # error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START"
-#endif
-
-#ifndef VALIDX
-# define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		      + DT_EXTRANUM + DT_VALTAGIDX (tag))
-#endif
-#ifndef ADDRIDX
-# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		       + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
 #endif
 
 /* This is the second half of _dl_start (below).  It can be inlined safely

Modified: fsf/trunk/libc/io/open.c
==============================================================================
--- fsf/trunk/libc/io/open.c (original)
+++ fsf/trunk/libc/io/open.c Sat Sep 29 00:01:41 2012
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1995,1996,1997,2002,2007 Free Software Foundation, Inc.
+/* Open a file by name.  Stub version.
+   Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +27,7 @@
 /* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
    a third argument is the file protection.  */
 int
-__open (file, oflag)
+__libc_open (file, oflag)
      const char *file;
      int oflag;
 {
@@ -49,10 +50,12 @@
   __set_errno (ENOSYS);
   return -1;
 }
-libc_hidden_def (__open)
+libc_hidden_def (__libc_open)
+weak_alias (__libc_open, __open)
+libc_hidden_weak (__open)
+weak_alias (__libc_open, open)
+
 stub_warning (open)
-
-weak_alias (__open, open)
 
 
 int

Modified: fsf/trunk/libc/io/tst-mknodat.c
==============================================================================
--- fsf/trunk/libc/io/tst-mknodat.c (original)
+++ fsf/trunk/libc/io/tst-mknodat.c Sat Sep 29 00:01:41 2012
@@ -80,8 +80,8 @@
       }
   closedir (dir);
 
-  /* Create a new directory.  */
-  int e = mknodat (dir_fd, "some-sock", 0777 | S_IFSOCK, 0);
+  /* Create a new fifo.  */
+  int e = mknodat (dir_fd, "some-fifo", 0777 | S_IFIFO, 0);
   if (e == -1)
     {
       if (errno == ENOSYS)
@@ -90,19 +90,19 @@
 	  return 0;
 	}
 
-      puts ("socket creation failed");
+      puts ("fifo creation failed");
       return 1;
     }
 
   struct stat64 st1;
-  if (fstatat64 (dir_fd, "some-sock", &st1, 0) != 0)
+  if (fstatat64 (dir_fd, "some-fifo", &st1, 0) != 0)
     {
       puts ("fstat64 failed");
       return 1;
     }
-  if (!S_ISSOCK (st1.st_mode))
+  if (!S_ISFIFO (st1.st_mode))
     {
-      puts ("mknodat did not create a Unix domain socket");
+      puts ("mknodat did not create a fifo");
       return 1;
     }
 
@@ -124,15 +124,15 @@
       puts ("2nd fdopendir failed");
       return 1;
     }
-  bool has_some_sock = false;
+  bool has_some_fifo = false;
   while ((d = readdir64 (dir)) != NULL)
-    if (strcmp (d->d_name, "some-sock") == 0)
+    if (strcmp (d->d_name, "some-fifo") == 0)
       {
-	has_some_sock = true;
+	has_some_fifo = true;
 #ifdef _DIRENT_HAVE_D_TYPE
-	if (d->d_type != DT_UNKNOWN && d->d_type != DT_SOCK)
+	if (d->d_type != DT_UNKNOWN && d->d_type != DT_FIFO)
 	  {
-	    puts ("d_type for some-sock wrong");
+	    puts ("d_type for some-fifo wrong");
 	    return 1;
 	  }
 #endif
@@ -144,13 +144,13 @@
       }
   closedir (dir);
 
-  if (!has_some_sock)
+  if (!has_some_fifo)
     {
-      puts ("some-sock not in directory list");
+      puts ("some-fifo not in directory list");
       return 1;
     }
 
-  if (unlinkat (dir_fd, "some-sock", 0) != 0)
+  if (unlinkat (dir_fd, "some-fifo", 0) != 0)
     {
       puts ("unlinkat failed");
       return 1;

Modified: fsf/trunk/libc/libio/Makefile
==============================================================================
--- fsf/trunk/libc/libio/Makefile (original)
+++ fsf/trunk/libc/libio/Makefile Sat Sep 29 00:01:41 2012
@@ -59,7 +59,7 @@
 	tst-memstream1 tst-memstream2 \
 	tst-wmemstream1 tst-wmemstream2 \
 	bug-memstream1 bug-wmemstream1 \
-	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1
+	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1 tst-fseek
 ifeq (yes,$(build-shared))
 # Add test-fopenloc only if shared library is enabled since it depends on
 # shared localedata objects.
@@ -158,6 +158,7 @@
 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
 bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
 tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
+tst-fseek-ENV = LOCPATH=$(common-objpfx)localedata
 
 generated = tst-fopenloc.mtrace tst-fopenloc.check
 

Modified: fsf/trunk/libc/libio/fileops.c
==============================================================================
--- fsf/trunk/libc/libio/fileops.c (original)
+++ fsf/trunk/libc/libio/fileops.c Sat Sep 29 00:01:41 2012
@@ -978,6 +978,9 @@
   int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end
 		       && fp->_IO_write_base == fp->_IO_write_ptr);
 
+  bool was_writing = (fp->_IO_write_ptr > fp->_IO_write_base
+		      || _IO_in_put_mode (fp));
+
   if (mode == 0)
     dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
 
@@ -988,10 +991,8 @@
      which assumes file_ptr() is eGptr.  Anyway, since we probably
      end up flushing when we close(), it doesn't make much difference.)
      FIXME: simulate mem-mapped files. */
-
-  if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
-    if (_IO_switch_to_get_mode (fp))
-      return EOF;
+  else if (was_writing && _IO_switch_to_get_mode (fp))
+    return EOF;
 
   if (fp->_IO_buf_base == NULL)
     {
@@ -1010,7 +1011,17 @@
     {
     case _IO_seek_cur:
       /* Adjust for read-ahead (bytes is buffer). */
-      offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+      if (mode != 0 || !was_writing)
+	offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+      else
+	{
+	  /* _IO_read_end coincides with fp._offset, so the actual file position
+	     is fp._offset - (_IO_read_end - new_write_ptr).  This is fine
+	     even if fp._offset is not set, since fp->_IO_read_end is then at
+	     _IO_buf_base and this adjustment is for unbuffered output.  */
+	  offset -= fp->_IO_read_end - fp->_IO_write_ptr;
+	}
+
       if (fp->_offset == _IO_pos_BAD)
 	{
 	  if (mode != 0)

Added: fsf/trunk/libc/libio/tst-fseek.c
==============================================================================
--- fsf/trunk/libc/libio/tst-fseek.c (added)
+++ fsf/trunk/libc/libio/tst-fseek.c Sat Sep 29 00:01:41 2012
@@ -1,0 +1,173 @@
+/* Verify that fseek/ftell combination works for wide chars.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <errno.h>
+#include <wchar.h>
+#include <unistd.h>
+#include <string.h>
+
+/* Defined in test-skeleton.c.  */
+static int create_temp_file (const char *base, char **filename);
+
+
+static int
+do_seek_end (FILE *fp)
+{
+  long save;
+
+  if (fputws (L"abc\n", fp) == -1)
+    {
+      printf ("do_seek_end: fputws: %s\n", strerror (errno));
+      return 1;
+    }
+
+  save = ftell (fp);
+  rewind (fp);
+
+  if (fseek (fp, 0, SEEK_END) == -1)
+    {
+      printf ("do_seek_end: fseek: %s\n", strerror (errno));
+      return 1;
+    }
+
+  if (save != ftell (fp))
+    {
+      printf ("save = %ld, ftell = %ld\n", save, ftell (fp));
+      return 1;
+    }
+
+  return 0;
+}
+
+int
+do_seek_set (FILE *fp)
+{
+  long save1, save2;
+
+  if (fputws (L"ÃÂÂÃÂÂ\n", fp) == -1)
+    {
+      printf ("seek_set: fputws(1): %s\n", strerror (errno));
+      return 1;
+    }
+
+  save1 = ftell (fp);
+
+  if (fputws (L"ÃÂÂÃÂÂ\n", fp) == -1)
+    {
+      printf ("seek_set: fputws(2): %s\n", strerror (errno));
+      return 1;
+    }
+
+  save2 = ftell (fp);
+
+  if (fputws (L"ÃÂÂÃÂÂ\n", fp) == -1)
+    {
+      printf ("seek_set: fputws(3): %s\n", strerror (errno));
+      return 1;
+    }
+
+  if (fseek (fp, save1, SEEK_SET) == -1)
+    {
+      printf ("seek_set: fseek(1): %s\n", strerror (errno));
+      return 1;
+    }
+
+  if (save1 != ftell (fp))
+    {
+      printf ("save1 = %ld, ftell = %ld\n", save1, ftell (fp));
+      return 1;
+    }
+
+  if (fseek (fp, save2, SEEK_SET) == -1)
+    {
+      printf ("seek_set: fseek(2): %s\n", strerror (errno));
+      return 1;
+    }
+
+  if (save2 != ftell (fp))
+    {
+      printf ("save2 = %ld, ftell = %ld\n", save2, ftell (fp));
+      return 1;
+    }
+
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  if (setlocale (LC_ALL, "ja_JP.UTF-8") == NULL)
+    {
+      printf ("Cannot set ja_JP.UTF-8 locale.\n");
+      exit (1);
+    }
+
+  /* Retain messages in English.  */
+  if (setlocale (LC_MESSAGES, "en_US.ISO-8859-1") == NULL)
+    {
+      printf ("Cannot set LC_MESSAGES to en_US.ISO-8859-1 locale.\n");
+      exit (1);
+    }
+
+  int ret = 0;
+  char *filename;
+  int fd = create_temp_file ("tst-fseek.out", &filename);
+
+  if (fd == -1)
+    return 1;
+
+  FILE *fp = fdopen (fd, "w+");
+  if (fp == NULL)
+    {
+      printf ("seek_set: fopen: %s\n", strerror (errno));
+      close (fd);
+      return 1;
+    }
+
+  if (do_seek_set (fp))
+    {
+      printf ("SEEK_SET test failed\n");
+      ret = 1;
+    }
+
+  /* Reopen the file.  */
+  fclose (fp);
+  fp = fopen (filename, "w+");
+  if (fp == NULL)
+    {
+      printf ("seek_end: fopen: %s\n", strerror (errno));
+      return 1;
+    }
+
+  if (do_seek_end (fp))
+    {
+      printf ("SEEK_END test failed\n");
+      ret = 1;
+    }
+
+  fclose (fp);
+
+  return ret;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/libio/wfileops.c
==============================================================================
--- fsf/trunk/libc/libio/wfileops.c (original)
+++ fsf/trunk/libc/libio/wfileops.c Sat Sep 29 00:01:41 2012
@@ -545,6 +545,57 @@
 }
 libc_hidden_def (_IO_wfile_sync)
 
+/* Adjust the internal buffer pointers to reflect the state in the external
+   buffer.  The content between fp->_IO_read_base and fp->_IO_read_ptr is
+   assumed to be converted and available in the range
+   fp->_wide_data->_IO_read_base and fp->_wide_data->_IO_read_end.
+
+   Returns 0 on success and -1 on error with the _IO_ERR_SEEN flag set.  */
+static inline int
+adjust_wide_data (_IO_FILE *fp, bool do_convert)
+{
+  struct _IO_codecvt *cv = fp->_codecvt;
+
+  int clen = (*cv->__codecvt_do_encoding) (cv);
+
+  /* Take the easy way out for constant length encodings if we don't need to
+     convert.  */
+  if (!do_convert && clen > 0)
+    {
+      fp->_wide_data->_IO_read_end += ((fp->_IO_read_ptr - fp->_IO_read_base)
+				       / clen);
+      goto done;
+    }
+
+  enum __codecvt_result status;
+  const char *read_stop = (const char *) fp->_IO_read_base;
+  do
+    {
+
+      fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
+      status = (*cv->__codecvt_do_in) (cv, &fp->_wide_data->_IO_state,
+				       fp->_IO_read_base, fp->_IO_read_ptr,
+				       &read_stop,
+				       fp->_wide_data->_IO_read_base,
+				       fp->_wide_data->_IO_buf_end,
+				       &fp->_wide_data->_IO_read_end);
+
+      /* Should we return EILSEQ?  */
+      if (__builtin_expect (status == __codecvt_error, 0))
+	{
+	  fp->_flags |= _IO_ERR_SEEN;
+	  return -1;
+	}
+    }
+  while (__builtin_expect (status == __codecvt_partial, 0));
+
+done:
+  /* Now seek to _IO_read_end to behave as if we have read it all in.  */
+  fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
+
+  return 0;
+}
+
 _IO_off64_t
 _IO_wfile_seekoff (fp, offset, dir, mode)
      _IO_FILE *fp;
@@ -562,6 +613,10 @@
 		       && (fp->_wide_data->_IO_write_base
 			   == fp->_wide_data->_IO_write_ptr));
 
+  bool was_writing = ((fp->_wide_data->_IO_write_ptr
+		       > fp->_wide_data->_IO_write_base)
+		      || _IO_in_put_mode (fp));
+
   if (mode == 0)
     {
       /* XXX For wide stream with backup store it is not very
@@ -593,11 +648,8 @@
      which assumes file_ptr() is eGptr.  Anyway, since we probably
      end up flushing when we close(), it doesn't make much difference.)
      FIXME: simulate mem-mapped files. */
-
-  if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base
-      || _IO_in_put_mode (fp))
-    if (_IO_switch_to_wget_mode (fp))
-      return WEOF;
+  else if (was_writing && _IO_switch_to_wget_mode (fp))
+    return WEOF;
 
   if (fp->_wide_data->_IO_buf_base == NULL)
     {
@@ -628,29 +680,104 @@
       cv = fp->_codecvt;
       clen = (*cv->__codecvt_do_encoding) (cv);
 
-      if (clen > 0)
-	{
-	  offset -= (fp->_wide_data->_IO_read_end
-		     - fp->_wide_data->_IO_read_ptr) * clen;
-	  /* Adjust by readahead in external buffer.  */
-	  offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+      if (mode != 0 || !was_writing)
+	{
+	  if (clen > 0)
+	    {
+	      offset -= (fp->_wide_data->_IO_read_end
+			 - fp->_wide_data->_IO_read_ptr) * clen;
+	      /* Adjust by readahead in external buffer.  */
+	      offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+	    }
+	  else
+	    {
+	      int nread;
+
+	    flushed:
+	      delta = (fp->_wide_data->_IO_read_ptr
+		       - fp->_wide_data->_IO_read_base);
+	      fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
+	      nread = (*cv->__codecvt_do_length) (cv,
+						  &fp->_wide_data->_IO_state,
+						  fp->_IO_read_base,
+						  fp->_IO_read_end, delta);
+	      fp->_IO_read_ptr = fp->_IO_read_base + nread;
+	      fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
+	      offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
+	    }
 	}
       else
 	{
-	  int nread;
-
-	  delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_base;
-	  fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
-	  nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
-					      fp->_IO_read_base,
-					      fp->_IO_read_end, delta);
-	  fp->_IO_read_ptr = fp->_IO_read_base + nread;
-	  fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
-	  offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
+	  char *new_write_ptr = fp->_IO_write_ptr;
+
+	  if (clen > 0)
+	    offset += (fp->_wide_data->_IO_write_ptr
+		       - fp->_wide_data->_IO_write_base) / clen;
+	  else
+	    {
+	      enum __codecvt_result status;
+	      delta = (fp->_wide_data->_IO_write_ptr
+		       - fp->_wide_data->_IO_write_base);
+	      const wchar_t *write_base = fp->_wide_data->_IO_write_base;
+
+	      /* FIXME: This actually ends up in two iterations of conversion,
+		 one here and the next when the buffer actually gets flushed.
+		 It may be possible to optimize this in future so that
+		 wdo_write identifies already converted content and does not
+		 redo it.  In any case, this is much better than having to
+		 flush buffers for every ftell.  */
+	      do
+		{
+		  /* Ugh, no point trying to avoid the flush.  Just do it
+		     and go back to how it was with the read mode.  */
+		  if (delta > 0 && new_write_ptr == fp->_IO_buf_end)
+		    {
+		      if (_IO_switch_to_wget_mode (fp))
+			return WEOF;
+		      goto flushed;
+		    }
+
+		  const wchar_t *new_wbase = fp->_wide_data->_IO_write_base;
+		  fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
+		  status = (*cv->__codecvt_do_out) (cv,
+						    &fp->_wide_data->_IO_state,
+						    write_base,
+						    write_base + delta,
+						    &new_wbase,
+						    new_write_ptr,
+						    fp->_IO_buf_end,
+						    &new_write_ptr);
+
+		  delta -= new_wbase - write_base;
+
+		  /* If there was an error, then return WEOF.
+		     TODO: set buffer state.  */
+		  if (__builtin_expect (status == __codecvt_error, 0))
+		      return WEOF;
+		}
+	      while (delta > 0);
+	    }
+
+	  /* _IO_read_end coincides with fp._offset, so the actual file position
+	     is fp._offset - (_IO_read_end - new_write_ptr).  This is fine
+	     even if fp._offset is not set, since fp->_IO_read_end is then at
+	     _IO_buf_base and this adjustment is for unbuffered output.  */
+	  offset -= fp->_IO_read_end - new_write_ptr;
 	}
 
       if (fp->_offset == _IO_pos_BAD)
-	goto dumb;
+	{
+	  if (mode != 0)
+	    goto dumb;
+	  else
+	    {
+	      result = _IO_SYSSEEK (fp, 0, dir);
+	      if (result == EOF)
+		return result;
+	      fp->_offset = result;
+	    }
+	}
+
       /* Make offset absolute, assuming current pointer is file_ptr(). */
       offset += fp->_offset;
 
@@ -693,6 +820,10 @@
 		     fp->_wide_data->_IO_buf_base);
 	  _IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
 		     fp->_wide_data->_IO_buf_base);
+
+	  if (adjust_wide_data (fp, false))
+	    goto dumb;
+
 	  _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
 	  goto resync;
 	}
@@ -733,6 +864,10 @@
   _IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
 	     fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
   _IO_wsetp (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
+
+  if (adjust_wide_data (fp, true))
+    goto dumb;
+
   fp->_offset = result + count;
   _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
   return offset;

Modified: fsf/trunk/libc/nss/Makefile
==============================================================================
--- fsf/trunk/libc/nss/Makefile (original)
+++ fsf/trunk/libc/nss/Makefile Sat Sep 29 00:01:41 2012
@@ -111,6 +111,8 @@
 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \
 			   $(common-objpfx)libc_nonshared.a
 	$(build-module)
+ifdef libnss_test1.so-version
 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
 	$(make-link)
+endif
 $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)

Modified: fsf/trunk/libc/nss/nsswitch.c
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.c (original)
+++ fsf/trunk/libc/nss/nsswitch.c Sat Sep 29 00:01:41 2012
@@ -46,8 +46,10 @@
 static name_database_entry *nss_getline (char *line) internal_function;
 static service_user *nss_parse_service_list (const char *line)
      internal_function;
+#if !defined DO_STATIC_NSS || defined SHARED
 static service_library *nss_new_service (name_database *database,
 					 const char *name) internal_function;
+#endif
 
 
 /* Declare external database variables.  */
@@ -433,7 +435,9 @@
       known_function *known = malloc (sizeof *known);
       if (! known)
 	{
+#if !defined DO_STATIC_NSS || defined SHARED
 	remove_from_tree:
+#endif
 	  /* Oops.  We can't instantiate this node properly.
 	     Remove it from the tree.  */
 	  __tdelete (&fct_name, &ni->known, &known_compare);
@@ -786,6 +790,7 @@
 }
 
 
+#if !defined DO_STATIC_NSS || defined SHARED
 static service_library *
 internal_function
 nss_new_service (name_database *database, const char *name)
@@ -810,6 +815,7 @@
 
   return *currentp;
 }
+#endif
 
 
 #if defined SHARED && defined USE_NSCD

Modified: fsf/trunk/libc/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.alpha (original)
+++ fsf/trunk/libc/ports/ChangeLog.alpha Sat Sep 29 00:01:41 2012
@@ -1,4 +1,21 @@
-2012-12-13  Richard Henderson  <rth@xxxxxxxxxx>
+2012-09-28  Richard Henderson  <rth@xxxxxxxxxx>
+
+	* sysdeps/unix/alpha/sysdep.h (PSEUDO_END): Merge versions and
+	move $syscall_error label...
+	(SYSCALL_ERROR_HANDLER): ... here.
+	(SYSCALL_ERROR_FALLTHRU): New.
+	(PSEUDO_PROF): Split out of ...
+	(PSEUDO_PROLOGUE): ... here.
+	* sysdeps/unix/sysv/linux/alpha/syscall.S (__syscall): Use
+	SYSCALL_ERROR_LABEL and PSEUDO_END.
+	* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise.
+	Use USEPV_PROF and cfi markup.
+	(thread_start): Use cfi markup and cfi_undefined on ra.
+	* sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h
+	(PSEUDO_PROF): Remove.
+	(PSEUDO): Use SYSCALL_ERROR_FALLTHRU.
+
+2012-09-13  Richard Henderson  <rth@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/alpha/setfpucw.c (__setfpucw): Rewrite
 	with the assumption of being used at program startup only.

Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Sat Sep 29 00:01:41 2012
@@ -1,3 +1,7 @@
+2012-09-28  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/arm/dl-tlsdesc.h (ADDRIDX): Removed.
+
 2012-09-21  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/arm/bits/atomic.h [!__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]

Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Sat Sep 29 00:01:41 2012
@@ -1,3 +1,7 @@
+2012-09-28  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/mips/dl-trampoline.c (VERSYMIDX): Removed.
+
 2012-08-27  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/mips/kernel-features.h

Modified: fsf/trunk/libc/ports/sysdeps/arm/dl-tlsdesc.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/arm/dl-tlsdesc.h (original)
+++ fsf/trunk/libc/ports/sysdeps/arm/dl-tlsdesc.h Sat Sep 29 00:01:41 2012
@@ -19,12 +19,6 @@
 
 #ifndef _ARM_DL_TLSDESC_H
 # define _ARM_DL_TLSDESC_H 1
-
-/* Use this to access DT_TLSDESC_PLT and DT_TLSDESC_GOT.  */
-#ifndef ADDRIDX
-# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		       + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
-#endif
 
 /* Type used to represent a TLS descriptor in the GOT.  */
 struct tlsdesc

Modified: fsf/trunk/libc/ports/sysdeps/mips/dl-trampoline.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/mips/dl-trampoline.c (original)
+++ fsf/trunk/libc/ports/sysdeps/mips/dl-trampoline.c Sat Sep 29 00:01:41 2012
@@ -111,8 +111,6 @@
 /* The flag _dl_mips_gnu_objects is set if all dynamic objects are
    generated by the gnu linker. */
 int _dl_mips_gnu_objects = 1;
-
-#define VERSYMIDX(sym)  (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
 
 /* This is called from assembly stubs below which the compiler can't see.  */
 static ElfW(Addr)

Modified: fsf/trunk/libc/ports/sysdeps/unix/alpha/sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/alpha/sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/alpha/sysdep.h Sat Sep 29 00:01:41 2012
@@ -52,13 +52,20 @@
 #define END(sym)	.end sym
 
 #ifdef PROF
+# define PSEUDO_PROF				\
+	.set noat;				\
+	lda	AT, _mcount;			\
+	jsr	AT, (AT), _mcount;		\
+	.set at
+#else
+# define PSEUDO_PROF
+#endif
+
+#ifdef PROF
 # define PSEUDO_PROLOGUE			\
 	.frame sp, 0, ra;			\
 	ldgp	gp,0(pv);			\
-	.set noat;				\
-	lda	AT,_mcount;			\
-	jsr	AT,(AT),_mcount;		\
-	.set at;				\
+	PSEUDO_PROF;				\
 	.prologue 1
 #elif defined PIC
 # define PSEUDO_PROLOGUE			\
@@ -80,16 +87,21 @@
 #if RTLD_PRIVATE_ERRNO
 # define SYSCALL_ERROR_LABEL	$syscall_error
 # define SYSCALL_ERROR_HANDLER			\
+$syscall_error:					\
 	stl	v0, rtld_errno(gp)	!gprel;	\
 	lda	v0, -1;				\
 	ret
+# define SYSCALL_ERROR_FALLTHRU
 #elif defined(PIC)
-# define SYSCALL_ERROR_LABEL	__syscall_error !samegp
+# define SYSCALL_ERROR_LABEL		__syscall_error !samegp
 # define SYSCALL_ERROR_HANDLER
-#else
-# define SYSCALL_ERROR_LABEL	$syscall_error
-# define SYSCALL_ERROR_HANDLER \
-	jmp	$31, __syscall_error
+# define SYSCALL_ERROR_FALLTHRU		br SYSCALL_ERROR_LABEL
+#else
+# define SYSCALL_ERROR_LABEL		$syscall_error
+# define SYSCALL_ERROR_HANDLER			\
+$syscall_error:					\
+	jmp $31, __syscall_error
+# define SYSCALL_ERROR_FALLTHRU
 #endif /* RTLD_PRIVATE_ERRNO */
 
 /* Overridden by specific syscalls.  */
@@ -108,14 +120,9 @@
 	bne	a3, SYSCALL_ERROR_LABEL
 
 #undef PSEUDO_END
-#if defined(PIC) && !RTLD_PRIVATE_ERRNO
-# define PSEUDO_END(sym)  END(sym)
-#else
-# define PSEUDO_END(sym)			\
-$syscall_error:					\
+#define PSEUDO_END(sym)				\
 	SYSCALL_ERROR_HANDLER;			\
 	END(sym)
-#endif
 
 #define PSEUDO_NOERRNO(name, syscall_name, args)	\
 	.globl name;					\

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/clone.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/clone.S (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/clone.S Sat Sep 29 00:01:41 2012
@@ -35,89 +35,84 @@
    we don't bother checking FLAGS.  */
 
         .text
-ENTRY(__clone)
+	.align	4
+	.globl	__clone
+	.ent	__clone
+	.usepv	__clone, USEPV_PROF
+
+	cfi_startproc
+__clone:
 #ifdef PROF
 	ldgp	gp,0(pv)
-	.set noat
 	lda	AT, _mcount
 	jsr	AT, (AT), _mcount
-	.set at
-	.prologue 1
-#else
-	.prologue 0
 #endif
 
 	/* Sanity check arguments.  */
-	ldiq	v0,EINVAL
-	beq	a0,$error		/* no NULL function pointers */
-	beq	a1,$error		/* no NULL stack pointers */
+	ldiq	v0, EINVAL
+	beq	a0, SYSCALL_ERROR_LABEL	/* no NULL function pointers */
+	beq	a1, SYSCALL_ERROR_LABEL	/* no NULL stack pointers */
 
 	/* Save the fn ptr and arg on the new stack.  */
-	subq	a1,32,a1
-	stq	a0,0(a1)
-	stq	a3,8(a1)
+	subq	a1, 32, a1
+	stq	a0, 0(a1)
+	stq	a3, 8(a1)
 #ifdef RESET_PID
-	stq	a2,16(a1)
+	stq	a2, 16(a1)
 #endif
 
 	/* The syscall is of the form clone(flags, usp, ptid, ctid, tls).
 	   Shift the flags, ptid, ctid, tls arguments into place; the
 	   child_stack argument is already correct.  */
-	mov	a2,a0
-	mov	a4,a2
-	ldq	a3,0(sp)
-	mov	a5,a4
+	mov	a2, a0
+	mov	a4, a2
+	ldq	a3, 0(sp)
+	mov	a5, a4
 
 	/* Do the system call.  */
-	ldiq	v0,__NR_clone
+	ldiq	v0, __NR_clone
 	call_pal PAL_callsys
 
-	bne	a3,$error
-	beq	v0,thread_start
+	bne	a3, SYSCALL_ERROR_LABEL
+	beq	v0, thread_start
 
 	/* Successful return from the parent.  */
 	ret
 
-	/* Something bad happened -- no child created.  */
-$error:
-#ifndef PROF
-	br	gp,1f
-1:	ldgp	gp,0(gp)
-#endif
-	SYSCALL_ERROR_HANDLER
-
-	END(__clone)
+PSEUDO_END(__clone)
+	cfi_endproc
 
 /* Load up the arguments to the function.  Put this block of code in
    its own function so that we can terminate the stack trace with our
    debug info.  */
 
 	.ent thread_start
+	cfi_startproc
 thread_start:
-	.frame	fp,0,fp,0
 	mov	0, fp
-	.prologue 0
+	cfi_def_cfa_register(fp)
+	cfi_undefined(ra)
 
 #ifdef RESET_PID
 	/* Check and see if we need to reset the PID.  */
-	ldq	t0,16(sp)
-	lda	t1,CLONE_THREAD
-	and	t0,t1,t2
-	beq	t2,2f
+	ldq	t0, 16(sp)
+	lda	t1, CLONE_THREAD
+	and	t0, t1, t2
+	beq	t2, 2f
 1:
 #endif
 
 	/* Load up the arguments.  */
-	ldq	pv,0(sp)
-	ldq	a0,8(sp)
-	addq	sp,32,sp
+	ldq	pv, 0(sp)
+	ldq	a0, 8(sp)
+	addq	sp, 32, sp
 
 	/* Call the user's function.  */
-	jsr	ra,(pv)
-	ldgp	gp,0(ra)
+	jsr	ra, (pv)
+	ldgp	gp, 0(ra)
 
 	/* Call _exit rather than doing it inline for breakpoint purposes.  */
-	mov	v0,a0
+	mov	v0, a0
 #ifdef PIC
 	bsr	ra, HIDDEN_JUMPTARGET(_exit)	!samegp
 #else
@@ -142,7 +137,7 @@
 	stl	v0, TID_OFFSET(s0)
 	br	1b
 #endif
-
+	cfi_endproc
 	.end thread_start
 
 weak_alias (__clone, clone)

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h Sat Sep 29 00:01:41 2012
@@ -22,16 +22,6 @@
 #endif
 
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-
-# ifdef PROF
-#  define PSEUDO_PROF				\
-	.set noat;				\
-	lda	AT, _mcount;			\
-	jsr	AT, (AT), _mcount;		\
-	.set at
-# else
-#  define PSEUDO_PROF
-# endif
 
 /* ??? Assumes that nothing comes between PSEUDO and PSEUDO_END
    besides "ret".  */
@@ -88,7 +78,7 @@
 	addq	sp, 64, sp;					\
 	cfi_restore(ra);					\
 	cfi_def_cfa_offset(0);					\
-__LABEL($syscall_error)						\
+	SYSCALL_ERROR_FALLTHRU;					\
 	SYSCALL_ERROR_HANDLER;					\
 	cfi_endproc;						\
 	.previous

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/syscall.S
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/syscall.S (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/syscall.S Sat Sep 29 00:01:41 2012
@@ -62,16 +62,9 @@
 	ldq	a5,0(sp)	/* arg6 -> a5 */
 
 	call_pal PAL_callsys	/* Invoke system call */
-	bne	a3, $error
+	bne	a3, SYSCALL_ERROR_LABEL
 	ret
 
-$error:
-#ifndef PROF
-	br	gp, 2f
-2:	ldgp	gp, 0(gp)
-#endif
-	SYSCALL_ERROR_HANDLER
-
-END(__syscall)
+PSEUDO_END(__syscall)
 
 weak_alias (__syscall, syscall)

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Sat Sep 29 00:01:41 2012
@@ -129,6 +129,7 @@
 # it will say by examining the system, and write the results in config-name.h.
 uname.c: $(objpfx)config-name.h
 $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
+	$(make-target-directory)
 	$< '$(config-os)' '$(config-release)' \
 	   '$(config-machine)-$(config-vendor)' > $@.new
 	mv -f $@.new $@

Modified: fsf/trunk/libc/posix/gai.conf
==============================================================================
--- fsf/trunk/libc/posix/gai.conf (original)
+++ fsf/trunk/libc/posix/gai.conf Sat Sep 29 00:01:41 2012
@@ -55,23 +55,11 @@
 
 #
 # scopev4  <mask>  <value>
-#    Add another rule to the RFC 3484 scope table for IPv4 addresses.
-#    By default the scope IDs described in section 3.2 in RFC 3484 are
+#    Add another rule to the RFC 6724 scope table for IPv4 addresses.
+#    By default the scope IDs described in section 3.2 in RFC 6724 are
 #    used.  Changing these defaults should hardly ever be necessary.
 #    The defaults are equivalent to:
 #
 #scopev4 ::ffff:169.254.0.0/112  2
 #scopev4 ::ffff:127.0.0.0/104    2
-#scopev4 ::ffff:10.0.0.0/104     5
-#scopev4 ::ffff:172.16.0.0/108   5
-#scopev4 ::ffff:192.168.0.0/112  5
 #scopev4 ::ffff:0.0.0.0/96       14
-#
-#    For sites which use site-local IPv4 addresses behind NAT there is
-#    the problem that even if IPv4 addresses are preferred they do not
-#    have the same scope and are therefore not sorted first.  To change
-#    this use only these rules:
-#
-#scopev4 ::ffff:169.254.0.0/112  2
-#scopev4 ::ffff:127.0.0.0/104    2
-#scopev4 ::ffff:0.0.0.0/96       14

Modified: fsf/trunk/libc/posix/tst-rfc3484.c
==============================================================================
--- fsf/trunk/libc/posix/tst-rfc3484.c (original)
+++ fsf/trunk/libc/posix/tst-rfc3484.c Sat Sep 29 00:01:41 2012
@@ -71,6 +71,9 @@
 
 struct sockaddr_in addrs[] =
 {
+  { .sin_family = AF_INET, .sin_addr = { h (0x0aa85f19) } },
+  { .sin_family = AF_INET, .sin_addr = { h (0xac105f19) } },
+  { .sin_family = AF_INET, .sin_addr = { h (0xc0000219) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a86d1d) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a85d03) } },
   { .sin_family = AF_INET, .sin_addr = { h (0xc0a82c3d) } },
@@ -86,7 +89,7 @@
 
 static int expected[naddrs] =
   {
-    6, 1, 0, 3, 2, 4, 5
+    9, 4, 3, 6, 5, 7, 8, 2, 0, 1
   };
 
 

Modified: fsf/trunk/libc/stdio-common/Makefile
==============================================================================
--- fsf/trunk/libc/stdio-common/Makefile (original)
+++ fsf/trunk/libc/stdio-common/Makefile Sat Sep 29 00:01:41 2012
@@ -116,6 +116,7 @@
 
 # We know the test has a format string problem.
 CFLAGS-tst-sprintf.c = -Wno-format
+tst-sprintf-ENV = LOCPATH=$(common-objpfx)localedata
 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
 tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata
 test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata

Modified: fsf/trunk/libc/stdio-common/tst-sprintf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-sprintf.c (original)
+++ fsf/trunk/libc/stdio-common/tst-sprintf.c Sat Sep 29 00:01:41 2012
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <locale.h>
 #include <string.h>
 
 
@@ -58,5 +59,17 @@
       result = 1;
     }
 
+  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+    {
+      puts ("cannot set locale");
+      result = 1;
+    }
+  else if (sprintf (buf, "%.8s\n", "Foo: \277") != 7
+	   || strcmp (buf, "Foo: \277\n") != 0)
+    {
+      printf ("sprintf (buf, \"%%.8s\\n\", \"Foo: \\277\") produced '%s' output\n", buf);
+      result = 1;
+    }
+
   return result;
 }

Modified: fsf/trunk/libc/stdio-common/vfprintf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/vfprintf.c (original)
+++ fsf/trunk/libc/stdio-common/vfprintf.c Sat Sep 29 00:01:41 2012
@@ -1168,42 +1168,9 @@
 	else if (!is_long && spec != L_('S'))				      \
 	  {								      \
 	    if (prec != -1)						      \
-	      {								      \
-		/* Search for the end of the string, but don't search past    \
-		   the length (in bytes) specified by the precision.  Also    \
-		   don't use incomplete characters.  */			      \
-		if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX) == 1)   \
-		  len = __strnlen (string, prec);			      \
-		else							      \
-		  {							      \
-		    /* In case we have a multibyte character set the	      \
-		       situation is more complicated.  We must not copy	      \
-		       bytes at the end which form an incomplete character. */\
-		    size_t ignore_size = (unsigned) prec > 1024 ? 1024 : prec;\
-		    wchar_t ignore[ignore_size];			      \
-		    const char *str2 = string;				      \
-		    const char *strend = string + prec;			      \
-		    if (strend < string)				      \
-		      strend = (const char *) UINTPTR_MAX;		      \
-									      \
-		    mbstate_t ps;					      \
-		    memset (&ps, '\0', sizeof (ps));			      \
-									      \
-		    while (str2 != NULL && str2 < strend)		      \
-		      if (__mbsnrtowcs (ignore, &str2, strend - str2,	      \
-					ignore_size, &ps) == (size_t) -1)     \
-			{						      \
-			  /* Conversion function has set errno.  */	      \
-			  done = -1;					      \
-			  goto all_done;				      \
-			}						      \
-									      \
-		    if (str2 == NULL)					      \
-		      len = strlen (string);				      \
-		    else						      \
-		      len = str2 - string - (ps.__count & 7);		      \
-		  }							      \
-	      }								      \
+	      /* Search for the end of the string, but don't search past      \
+		 the length (in bytes) specified by the precision.  */	      \
+	      len = __strnlen (string, prec);				      \
 	    else							      \
 	      len = strlen (string);					      \
 	  }								      \

Modified: fsf/trunk/libc/sysdeps/generic/_G_config.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/_G_config.h (original)
+++ fsf/trunk/libc/sysdeps/generic/_G_config.h Sat Sep 29 00:01:41 2012
@@ -28,8 +28,8 @@
   __off64_t __pos;
   __mbstate_t __state;
 } _G_fpos64_t;
-#define _G_off64_t	__off_t
-#define _G_stat64	stat
+#define _G_off64_t	__off64_t
+#define _G_stat64	stat64
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
 # include <gconv.h>
 typedef union
@@ -51,6 +51,11 @@
 
 #define _G_IO_IO_FILE_VERSION 0x20001
 
+#define _G_OPEN64	__open64
+#define _G_LSEEK64	__lseek64
+#define _G_MMAP64	__mmap64
+#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
+
 /* This is defined by <bits/stat.h> if `st_blksize' exists.  */
 #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
 

Modified: fsf/trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldsodefs.h Sat Sep 29 00:01:41 2012
@@ -40,6 +40,12 @@
 #include <kernel-features.h>
 
 __BEGIN_DECLS
+
+#define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
+#define VALIDX(tag)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
+			 + DT_EXTRANUM + DT_VALTAGIDX (tag))
+#define ADDRIDX(tag)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
+			 + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
 
 /* We use this macro to refer to ELF types independent of the native wordsize.
    `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */

Removed: fsf/trunk/libc/sysdeps/gnu/_G_config.h
==============================================================================
--- fsf/trunk/libc/sysdeps/gnu/_G_config.h (original)
+++ fsf/trunk/libc/sysdeps/gnu/_G_config.h (removed)
@@ -1,65 +1,0 @@
-/* This file is needed by libio to define various configuration parameters.
-   These are always the same in the GNU C library.  */
-
-#ifndef _G_config_h
-#define _G_config_h 1
-
-/* Define types for libio in terms of the standard internal type names.  */
-
-#include <bits/types.h>
-#define __need_size_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wchar_t
-#endif
-#define __need_NULL
-#include <stddef.h>
-#define __need_mbstate_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wint_t
-#endif
-#include <wchar.h>
-typedef struct
-{
-  __off_t __pos;
-  __mbstate_t __state;
-} _G_fpos_t;
-typedef struct
-{
-  __off64_t __pos;
-  __mbstate_t __state;
-} _G_fpos64_t;
-#define _G_off64_t	__off64_t
-#define _G_stat64	stat64
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <gconv.h>
-typedef union
-{
-  struct __gconv_info __cd;
-  struct
-  {
-    struct __gconv_info __cd;
-    struct __gconv_step_data __data;
-  } __combined;
-} _G_iconv_t;
-#endif
-
-
-/* These library features are always available in the GNU C library.  */
-#define _G_va_list __gnuc_va_list
-
-#define _G_HAVE_MMAP 1
-#define _G_HAVE_MREMAP 1
-
-#define _G_IO_IO_FILE_VERSION 0x20001
-
-#define _G_OPEN64	__open64
-#define _G_LSEEK64	__lseek64
-#define _G_MMAP64	__mmap64
-#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
-
-/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
-#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
-
-#define _G_BUFSIZ 8192
-
-#endif	/* _G_config.h */

Removed: fsf/trunk/libc/sysdeps/mach/hurd/_G_config.h
==============================================================================
--- fsf/trunk/libc/sysdeps/mach/hurd/_G_config.h (original)
+++ fsf/trunk/libc/sysdeps/mach/hurd/_G_config.h (removed)
@@ -1,64 +1,0 @@
-/* This file is needed by libio to define various configuration parameters.
-   These are always the same in the GNU C library.  */
-
-#ifndef _G_config_h
-#define _G_config_h 1
-
-/* Define types for libio in terms of the standard internal type names.  */
-
-#include <bits/types.h>
-#define __need_size_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wchar_t
-#endif
-#define __need_NULL
-#include <stddef.h>
-#define __need_mbstate_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wint_t
-#endif
-#include <wchar.h>
-typedef struct
-{
-  __off_t __pos;
-  __mbstate_t __state;
-} _G_fpos_t;
-typedef struct
-{
-  __off64_t __pos;
-  __mbstate_t __state;
-} _G_fpos64_t;
-#define _G_off64_t	__off64_t
-#define _G_stat64	stat64
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <gconv.h>
-typedef union
-{
-  struct __gconv_info __cd;
-  struct
-  {
-    struct __gconv_info __cd;
-    struct __gconv_step_data __data;
-  } __combined;
-} _G_iconv_t;
-#endif
-
-
-/* These library features are always available in the GNU C library.  */
-#define _G_va_list __gnuc_va_list
-
-#define _G_HAVE_MMAP 1
-
-#define _G_IO_IO_FILE_VERSION 0x20001
-
-#define _G_OPEN64	__open64
-#define _G_LSEEK64	__lseek64
-#define _G_MMAP64	__mmap64
-#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
-
-/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
-#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
-
-#define _G_BUFSIZ 8192
-
-#endif	/* _G_config.h */

Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Sat Sep 29 00:01:41 2012
@@ -1369,10 +1369,6 @@
     /* Link-local addresses: scope 2.  */
     { { { 169, 254, 0, 0 } }, htonl_c (0xffff0000), 2 },
     { { { 127, 0, 0, 0 } }, htonl_c (0xff000000), 2 },
-    /* Site-local addresses: scope 5.  */
-    { { { 10, 0, 0, 0 } }, htonl_c (0xff000000), 5 },
-    { { { 172, 16, 0, 0 } }, htonl_c (0xfff00000), 5 },
-    { { { 192, 168, 0, 0 } }, htonl_c (0xffff0000), 5 },
     /* Default: scope 14.  */
     { { { 0, 0, 0, 0 } }, htonl_c (0x00000000), 14 }
   };

Modified: fsf/trunk/libc/sysdeps/posix/sleep.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/sleep.c (original)
+++ fsf/trunk/libc/sysdeps/posix/sleep.c Sat Sep 29 00:01:41 2012
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Sleep for a given number of seconds.  POSIX.1 version.
+   Copyright (C) 1991-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,19 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <signal.h>
 #include <time.h>
 #include <unistd.h>
 #include <errno.h>
+#include <sys/param.h>
 
-
-/* SIGALRM signal handler for `sleep'.  This does nothing but return,
-   but SIG_IGN isn't supposed to break `pause'.  */
-static void
-sleep_handler (int sig)
-{
-  return;
-}
 
 /* Make the process sleep for SECONDS seconds, or until a signal arrives
    and is not ignored.  The function returns the number of seconds less
@@ -39,67 +32,44 @@
 unsigned int
 __sleep (unsigned int seconds)
 {
-  unsigned int remaining, slept;
-  time_t before, after;
-  sigset_t set, oset;
-  struct sigaction act, oact;
-  int save = errno;
-
-  if (seconds == 0)
-    return 0;
-
-  /* Block SIGALRM signals while frobbing the handler.  */
-  if (sigemptyset (&set) < 0 ||
-      sigaddset (&set, SIGALRM) < 0 ||
-      sigprocmask (SIG_BLOCK, &set, &oset))
-    return seconds;
-
-  act.sa_handler = sleep_handler;
-  act.sa_flags = 0;
-  act.sa_mask = oset;	/* execute handler with original mask */
-  if (sigaction (SIGALRM, &act, &oact) < 0)
-    return seconds;
-
-  before = time ((time_t *) NULL);
-  remaining = alarm (seconds);
-
-  if (remaining > 0 && remaining < seconds)
+  /* This is not necessary but some buggy programs depend on it.  */
+  if (__builtin_expect (seconds == 0, 0))
     {
-      /* The user's alarm will expire before our own would.
-	 Restore the user's signal action state and let his alarm happen.  */
-      (void) sigaction (SIGALRM, &oact, (struct sigaction *) NULL);
-      alarm (remaining);	/* Restore sooner alarm.  */
-      sigsuspend (&oset);	/* Wait for it to go off.  */
-      after = time ((time_t *) NULL);
-    }
-  else
-    {
-      /* Atomically restore the old signal mask
-	 (which had better not block SIGALRM),
-	 and wait for a signal to arrive.  */
-      sigsuspend (&oset);
-
-      after = time ((time_t *) NULL);
-
-      /* Restore the old signal action state.  */
-      (void) sigaction (SIGALRM, &oact, (struct sigaction *) NULL);
+#ifdef CANCELLATION_P
+      CANCELLATION_P (THREAD_SELF);
+#endif
+      return 0;
     }
 
-  /* Notice how long we actually slept.  */
-  slept = after - before;
+  int save_errno = errno;
 
-  /* Restore the user's alarm if we have not already past it.
-     If we have, be sure to turn off the alarm in case a signal
-     other than SIGALRM was what woke us up.  */
-  (void) alarm (remaining > slept ? remaining - slept : 0);
+  const unsigned int max
+    = (unsigned int) (((unsigned long int) (~((time_t) 0))) >> 1);
+  struct timespec ts = { 0, 0 };
+  do
+    {
+      if (sizeof (ts.tv_sec) <= sizeof (seconds))
+        {
+          /* Since SECONDS is unsigned assigning the value to .tv_sec can
+             overflow it.  In this case we have to wait in steps.  */
+          ts.tv_sec += MIN (seconds, max);
+          seconds -= (unsigned int) ts.tv_sec;
+        }
+      else
+        {
+          ts.tv_sec = (time_t) seconds;
+          seconds = 0;
+        }
 
-  /* Restore the original signal mask.  */
-  (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
+      if (__nanosleep (&ts, &ts) < 0)
+        /* We were interrupted.
+           Return the number of (whole) seconds we have not yet slept.  */
+        return seconds + ts.tv_sec;
+    }
+  while (seconds > 0);
 
-  /* Restore the `errno' value we started with.
-     Some of the calls we made might have failed, but we didn't care.  */
-  __set_errno (save);
+  __set_errno (save_errno);
 
-  return slept > seconds ? 0 : seconds - slept;
+  return 0;
 }
 weak_alias (__sleep, sleep)

Modified: fsf/trunk/libc/sysdeps/pthread/aio_fsync.c
==============================================================================
--- fsf/trunk/libc/sysdeps/pthread/aio_fsync.c (original)
+++ fsf/trunk/libc/sysdeps/pthread/aio_fsync.c Sat Sep 29 00:01:41 2012
@@ -46,7 +46,7 @@
 
   flags = fcntl (aiocbp->aio_fildes, F_GETFL);
   if (__builtin_expect (flags == -1, 0)
-      || __builtin_expect ((flags & (O_RDWR | O_WRONLY)) == 0, 0))
+      || __builtin_expect ((flags & O_ACCMODE) == O_RDONLY, 0))
     {
       __set_errno (EBADF);
       return -1;

Modified: fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/sparc/fpu/libm-test-ulps Sat Sep 29 00:01:41 2012
@@ -876,6 +876,9 @@
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -5.960464655174753498633255797994360530379e-8 + 7.888609052210118054117285652827862296732e-31 i":
+float: 1
+ifloat: 1
 Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
 float: 1
 ifloat: 1
@@ -903,6 +906,9 @@
 Test "Real part of: clog (0x1.fp+16383 - 0x1p-16494 i) == 11356.49165759582936919077408168801636572 - 0 i":
 ildouble: 1
 ldouble: 1
+Test "Imaginary part of: clog (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 3.2047474274603604594851472963586149973093e-29 + 1.4422922682185099608731642353544207976604 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
 double: 1
 idouble: 1
@@ -925,6 +931,50 @@
 ildouble: 1
 ldouble: 1
 Test "Real part of: clog (0x1p-16494 - 0x1.fp+16383 i) == 11356.49165759582936919077408168801636572 - pi/2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i) == 1.5366822245016167178749091974664853785194e-08 + 1.2522014929038946066987318471922169174157 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x298c62cb546588a7p-63 + 0x7911b1dfcc4ecdaep-63 i) == -1.1931267660846218205882675852805793644095e-36 + 1.2402109774337032400594953899784058127412 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x2ede88p-23 + 0x771c3fp-23 i) == -4.4764192352906350039050902870893173560494e-13 + 1.1959106857549200806818600493552847793381 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x3f96469050f650869c2p-75 + 0x6f16b2c9c8b05988335p-75 i) == -1.0509738482436128031927971874674370984602e-45 + 1.0509191467640012308402149909370784281448 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x55cb6d0c83af5p-55 + 0x7fe33c0c7c4e90p-55 i) == -5.2000108498455368032511404449795741611813e-32 + 1.5288921536982513453421343495466824420259 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i) == 8.3076914081087805757422664530653247447136e-30 + 1.2072712126771536614482822173033535043206 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x659feap-24 + 0xeaf6f9p-24 i) == 3.7303493627403868207597214252239749960738e-14 + 1.1625816408046866464773042283673653469061 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x6771f22c64ed551b857c128b4cp-105 + 0x1f570e7a13cc3cf2f44fd793ea1p-105 i) == -1.4281333889622737316199756373421183559948e-62 + 1.3673546561165378090903506783353927980633 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x6b10b4f3520217b6p-64 + 0xe8893cbb449253a1p-64 i) == 2.4244570985709679851855191080208817099132e-37 + 1.1393074519572050614551047548718495655972 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x8ecbf810c4ae6p-52 + 0xd479468b09a37p-52 i) == -9.7375017988218644730510244778042114638107e-30 + 0.9790637929494922564724108399524154766631 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0x9b57bp-20 + 0xcb7b4p-20 i) == -3.9563019528687610863490232935890272740908e-11 + 0.9187593477446338910857133065497364950682 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0xdb85c467ee2aadd5f425fe0f4b8dp-114 + 0x3e83162a0f95f1dcbf97dddf410eap-114 i) == 4.6017338806965821566734340588575402712716e-67 + 1.3547418904611758959096647942223384691728 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i) == 6.6255694866654064502633121109394710807528e-66 + 1.0526409614996288387567810726095850312049 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 5.3718272201930019901317065495843842735179e-26 + 1.0503831592447830576186444373011142397404 i":
 ildouble: 1
 ldouble: 1
 Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i":
@@ -1046,6 +1096,16 @@
 Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i) == -4.821637332766435821255375046554377090472e-17 + 4.053112396770095089737411317782466262176e-302 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -2.588596909321764128428416045209904492216e-8 + 3.425979381266895667295625489912064603415e-31 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-1000 i) == 4.285899851347756186652871946325962330640e-19 + 4.611541215247321502041995872887317363241e-302 i":
 ildouble: 1
 ldouble: 1
@@ -1103,6 +1163,37 @@
 Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i":
 ildouble: 1
 ldouble: 1
+Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 1.3918041236396763648388478552321724382899e-29 + 0.6263795733790237053262025311642907438291 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1415bcaf2105940d49a636e98ae59p-115 + 0x7e6a150adfcd1b0921d44b31f40f4p-115 i) == 1.1288799405048268615023706955013387413519e-67 + 0.6137587762850841972073301550420510507903 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x15cfbd1990d1ffp-53 + 0x176a3973e09a9ap-53 i) == 4.4163015461643576961232672330852798804976e-31 + 0.3564851427422832755956993418877523303529 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i) == -1.3155760824064879362415202279780039150764e-26 + 0.3473590599762514228227328130640352044313 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i) == -6.2126412844802358329771948751248003038444e-07 + 0.4977135139537443711784513409096950995985 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1df515eb171a808b9e400266p-95 + 0x7c71eb0cd4688dfe98581c77p-95 i) == -1.5221162575729652613635150540947625639689e-57 + 0.5795934880811949230121092882659698986043 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1df515eb171a808b9e400266p-95 + 0x7c71eb0cd4688dfe98581c77p-95 i) == -1.5221162575729652613635150540947625639689e-57 + 0.5795934880811949230121092882659698986043 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
 double: 1
 idouble: 1
@@ -1162,6 +1253,89 @@
 float: 1
 idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 1.9312741086596516918394613098872836703188e-20 + 0.5231613813514771042838490538484014771862 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x3f96469050f650869c2p-75 + 0x6f16b2c9c8b05988335p-75 i) == -4.5643214291682663316715446865040356750881e-46 + 0.4564083863660793840592614609053162690362 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i) == -6.4375803621988389731799033530075237868110e-21 + 0.4378257977686804492768642780897650927167 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x4d4ep-15 + 0x6605p-15 i) == -7.0781945783414996953799915941870192015212e-09 + 0.4005747524909781155537088181659175147564 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x4d9c37e2b5cb4533p-63 + 0x65c98be2385a042ep-63 i) == 2.7822833698845776001753149807484078521508e-37 + 0.3992725998539071066769046272515417679815 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x55cb6d0c83af5p-55 + 0x7fe33c0c7c4e90p-55 i) == -2.2583360179249556400630343805573865814771e-32 + 0.6639894257763289307423302343317622430835 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i) == 3.6079845358966994996207055940336690133424e-30 + 0.5243112258263349992771652393178033846555 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x602fd5037c4792efp-64 + 0xed3e2086dcca80b8p-64 i) == -1.0146400362652473358437501879334790111898e-37 + 0.5149047982335273098246594109614460842099 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x6241ef0da53f539f02fad67dabp-106 + 0x3fb46641182f7efd9caa769dac0p-106 i) == 1.8804859395820231849002915747252695375405e-63 + 0.6404513901551516189871978418046651877394 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x659feap-24 + 0xeaf6f9p-24 i) == 1.6200701438094619117335617123525612051457e-14 + 0.5049027913635038013499728086604870749732 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x659feap-24 + 0xeaf6f9p-24 i) == 1.6200701438094619117335617123525612051457e-14 + 0.5049027913635038013499728086604870749732 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x6b10b4f3520217b6p-64 + 0xe8893cbb449253a1p-64 i) == 1.0529283395205396881397407610630442563938e-37 + 0.4947949395762683446121140513971996916447 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i) == -1.7182001068739620267773842120965071561416e-11 + 0.3990121149225253562859800593935899629087 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0xdb85c467ee2aadd5f425fe0f4b8dp-114 + 0x3e83162a0f95f1dcbf97dddf410eap-114 i) == 1.9985076315737626043096596036300177494613e-67 + 0.5883569274304683249184005177865521205198 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i) == 2.8774482675253468630312378575186855052697e-66 + 0.4571561610046221605554903008571429975493 ?":
+ildouble: 2
+Test "Imaginary part of: clog10 (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i) == 2.8774482675253468630312378575186855052697e-66 + 0.4571561610046221605554903008571429975493 i":
+ldouble: 2
+Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 2.3329549194675052736016290082882121135546e-26 + 0.4561756099441139182878993697611751382976 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i":
 double: 1
 idouble: 1
@@ -3051,9 +3225,9 @@
 
 Function: Real part of "clog10":
 double: 2
-float: 1
-idouble: 2
-ifloat: 1
+float: 2
+idouble: 2
+ifloat: 2
 ildouble: 1
 ldouble: 1
 

Modified: fsf/trunk/libc/sysdeps/sparc/sparc32/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/dl-machine.h Sat Sep 29 00:01:41 2012
@@ -28,11 +28,6 @@
 #include <sysdep.h>
 #include <tls.h>
 #include <dl-plt.h>
-
-#ifndef VALIDX
-# define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		      + DT_EXTRANUM + DT_VALTAGIDX (tag))
-#endif
 
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int

Modified: fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile Sat Sep 29 00:01:41 2012
@@ -1,4 +1,4 @@
 ifeq ($(subdir),string)
 sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
-		   memset-niagara1
+		   memset-niagara1 memcpy-niagara4
 endif

Added: fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-niagara4.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-niagara4.S (added)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-niagara4.S Sat Sep 29 00:01:41 2012
@@ -1,0 +1,1 @@
+#include <sparc64/multiarch/memcpy-niagara4.S>

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/dl-machine.h Sat Sep 29 00:01:41 2012
@@ -26,11 +26,6 @@
 #include <ldsodefs.h>
 #include <sysdep.h>
 #include <dl-plt.h>
-
-#ifndef VALIDX
-# define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		      + DT_EXTRANUM + DT_VALTAGIDX (tag))
-#endif
 
 #define ELF64_R_TYPE_ID(info)	((info) & 0xff)
 #define ELF64_R_TYPE_DATA(info) ((info) >> 8)
@@ -458,7 +453,14 @@
       break;
     case R_SPARC_JMP_IREL:
       value = ((Elf64_Addr (*) (int)) value) (GLRO(dl_hwcap));
-      /* Fall thru */
+      /* 'high' is always zero, for large PLT entries the linker
+	 emits an R_SPARC_IRELATIVE.  */
+#ifdef RESOLVE_CONFLICT_FIND_MAP
+      sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
+#else
+      sparc64_fixup_plt (map, reloc, reloc_addr, value, 0, 0);
+#endif
+      break;
     case R_SPARC_JMP_SLOT:
 #ifdef RESOLVE_CONFLICT_FIND_MAP
       /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/Makefile Sat Sep 29 00:01:41 2012
@@ -1,4 +1,4 @@
 ifeq ($(subdir),string)
 sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
-		   memset-niagara1
+		   memset-niagara1 memcpy-niagara4
 endif

Added: fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S (added)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara4.S Sat Sep 29 00:01:41 2012
@@ -1,0 +1,329 @@
+/* Copy SIZE bytes from SRC to DEST.  For SUN4V Niagara-4.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller (davem@xxxxxxxxxxxxx)
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+#define ASI_BLK_INIT_QUAD_LDD_P	0xe2
+
+#define FPRS_FEF		0x04
+
+/* On T4 it is very expensive to access ASRs like %fprs and
+ * %asi, avoiding a read or a write can save ~50 cycles.
+ */
+#define FPU_ENTER			\
+	rd	%fprs, %o5;		\
+	andcc	%o5, FPRS_FEF, %g0;	\
+	be,a,pn	%icc, 999f;		\
+	 wr	%g0, FPRS_FEF, %fprs;	\
+	999:
+
+#define VISEntryHalf FPU_ENTER
+#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
+
+#define GLOBAL_SPARE	%g5
+
+#define STORE_ASI	ASI_BLK_INIT_QUAD_LDD_P
+#define EX_LD(x)	x
+#define EX_ST(x)	x
+#define EX_RETVAL(x)	x
+#define LOAD(type,addr,dest)	type [addr], dest
+#define STORE(type,src,addr)	type src, [addr]
+#define STORE_INIT(src,addr)	stxa src, [addr] STORE_ASI
+
+#if !defined NOT_IN_libc
+
+	.register	%g2,#scratch
+	.register	%g3,#scratch
+	.register	%g6,#scratch
+
+	.text
+
+ENTRY(__mempcpy_niagara4)
+	ba,pt		%icc, 101f
+	 add		%o0, %o2, %o3
+END(__mempcpy_niagara4)
+
+	.align		32
+ENTRY(__memcpy_niagara4)
+100:	/* %o0=dst, %o1=src, %o2=len */
+	mov		%o0, %o3
+101:
+	brz,pn		%o2, .Lexit
+	 cmp		%o2, 3
+	ble,pn		%icc, .Ltiny
+	 cmp		%o2, 19
+	ble,pn		%icc, .Lsmall
+	 or		%o0, %o1, %g2
+	cmp		%o2, 128
+	bl,pn		%icc, .Lmedium
+	 nop
+
+.Llarge:/* len >= 0x80 */
+	/* First get dest 8 byte aligned.  */
+	sub		%g0, %o0, %g1
+	and		%g1, 0x7, %g1
+	brz,pt		%g1, 51f
+	 sub		%o2, %g1, %o2
+
+1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2))
+	add		%o1, 1, %o1
+	subcc		%g1, 1, %g1
+	add		%o0, 1, %o0
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stb, %g2, %o0 - 0x01))
+
+51:	LOAD(prefetch, %o1 + 0x040, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x080, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x0c0, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x100, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x140, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x180, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x1c0, #n_reads_strong)
+	LOAD(prefetch, %o1 + 0x200, #n_reads_strong)
+
+	/* Check if we can use the straight fully aligned
+	 * loop, or we require the alignaddr/faligndata variant.
+	 */
+	andcc		%o1, 0x7, %o5
+	bne,pn		%icc, .Llarge_src_unaligned
+	 sub		%g0, %o0, %g1
+
+	/* Legitimize the use of initializing stores by getting dest
+	 * to be 64-byte aligned.
+	 */
+	and		%g1, 0x3f, %g1
+	brz,pt		%g1, .Llarge_aligned
+	 sub		%o2, %g1, %o2
+
+1:	EX_LD(LOAD(ldx, %o1 + 0x00, %g2))
+	add		%o1, 8, %o1
+	subcc		%g1, 8, %g1
+	add		%o0, 8, %o0
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stx, %g2, %o0 - 0x08))
+
+.Llarge_aligned:
+	/* len >= 0x80 && src 8-byte aligned && dest 8-byte aligned */
+	andn		%o2, 0x3f, %o4
+	sub		%o2, %o4, %o2
+
+1:	EX_LD(LOAD(ldx, %o1 + 0x00, %g1))
+	add		%o1, 0x40, %o1
+	EX_LD(LOAD(ldx, %o1 - 0x38, %g2))
+	subcc		%o4, 0x40, %o4
+	EX_LD(LOAD(ldx, %o1 - 0x30, %g3))
+	EX_LD(LOAD(ldx, %o1 - 0x28, GLOBAL_SPARE))
+	EX_LD(LOAD(ldx, %o1 - 0x20, %o5))
+	EX_ST(STORE_INIT(%g1, %o0))
+	add		%o0, 0x08, %o0
+	EX_ST(STORE_INIT(%g2, %o0))
+	add		%o0, 0x08, %o0
+	EX_LD(LOAD(ldx, %o1 - 0x18, %g2))
+	EX_ST(STORE_INIT(%g3, %o0))
+	add		%o0, 0x08, %o0
+	EX_LD(LOAD(ldx, %o1 - 0x10, %g3))
+	EX_ST(STORE_INIT(GLOBAL_SPARE, %o0))
+	add		%o0, 0x08, %o0
+	EX_LD(LOAD(ldx, %o1 - 0x08, GLOBAL_SPARE))
+	EX_ST(STORE_INIT(%o5, %o0))
+	add		%o0, 0x08, %o0
+	EX_ST(STORE_INIT(%g2, %o0))
+	add		%o0, 0x08, %o0
+	EX_ST(STORE_INIT(%g3, %o0))
+	add		%o0, 0x08, %o0
+	EX_ST(STORE_INIT(GLOBAL_SPARE, %o0))
+	add		%o0, 0x08, %o0
+	bne,pt		%icc, 1b
+	 LOAD(prefetch, %o1 + 0x200, #n_reads_strong)
+
+	membar		#StoreLoad | #StoreStore
+
+	brz,pn		%o2, .Lexit
+	 cmp		%o2, 19
+	ble,pn		%icc, .Lsmall_unaligned
+	 nop
+	ba,a,pt		%icc, .Lmedium_noprefetch
+
+.Lexit:	retl
+	 mov		EX_RETVAL(%o3), %o0
+
+.Llarge_src_unaligned:
+	andn		%o2, 0x3f, %o4
+	sub		%o2, %o4, %o2
+	VISEntryHalf
+	alignaddr	%o1, %g0, %g1
+	add		%o1, %o4, %o1
+	EX_LD(LOAD(ldd, %g1 + 0x00, %f0))
+1:	EX_LD(LOAD(ldd, %g1 + 0x08, %f2))
+	subcc		%o4, 0x40, %o4
+	EX_LD(LOAD(ldd, %g1 + 0x10, %f4))
+	EX_LD(LOAD(ldd, %g1 + 0x18, %f6))
+	EX_LD(LOAD(ldd, %g1 + 0x20, %f8))
+	EX_LD(LOAD(ldd, %g1 + 0x28, %f10))
+	EX_LD(LOAD(ldd, %g1 + 0x30, %f12))
+	EX_LD(LOAD(ldd, %g1 + 0x38, %f14))
+	faligndata	%f0, %f2, %f16
+	EX_LD(LOAD(ldd, %g1 + 0x40, %f0))
+	faligndata	%f2, %f4, %f18
+	add		%g1, 0x40, %g1
+	faligndata	%f4, %f6, %f20
+	faligndata	%f6, %f8, %f22
+	faligndata	%f8, %f10, %f24
+	faligndata	%f10, %f12, %f26
+	faligndata	%f12, %f14, %f28
+	faligndata	%f14, %f0, %f30
+	EX_ST(STORE(std, %f16, %o0 + 0x00))
+	EX_ST(STORE(std, %f18, %o0 + 0x08))
+	EX_ST(STORE(std, %f20, %o0 + 0x10))
+	EX_ST(STORE(std, %f22, %o0 + 0x18))
+	EX_ST(STORE(std, %f24, %o0 + 0x20))
+	EX_ST(STORE(std, %f26, %o0 + 0x28))
+	EX_ST(STORE(std, %f28, %o0 + 0x30))
+	EX_ST(STORE(std, %f30, %o0 + 0x38))
+	add		%o0, 0x40, %o0
+	bne,pt		%icc, 1b
+	 LOAD(prefetch, %g1 + 0x200, #n_reads_strong)
+	VISExitHalf
+
+	brz,pn		%o2, .Lexit
+	 cmp		%o2, 19
+	ble,pn		%icc, .Lsmall_unaligned
+	 nop
+	ba,a,pt		%icc, .Lmedium_unaligned
+
+.Lmedium:
+	LOAD(prefetch, %o1 + 0x40, #n_reads_strong)
+	andcc		%g2, 0x7, %g0
+	bne,pn		%icc, .Lmedium_unaligned
+	 nop
+.Lmedium_noprefetch:
+	andncc		%o2, 0x20 - 1, %o5
+	be,pn		%icc, 2f
+	 sub		%o2, %o5, %o2
+1:	EX_LD(LOAD(ldx, %o1 + 0x00, %g1))
+	EX_LD(LOAD(ldx, %o1 + 0x08, %g2))
+	EX_LD(LOAD(ldx, %o1 + 0x10, GLOBAL_SPARE))
+	EX_LD(LOAD(ldx, %o1 + 0x18, %o4))
+	add		%o1, 0x20, %o1
+	subcc		%o5, 0x20, %o5
+	EX_ST(STORE(stx, %g1, %o0 + 0x00))
+	EX_ST(STORE(stx, %g2, %o0 + 0x08))
+	EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x10))
+	EX_ST(STORE(stx, %o4, %o0 + 0x18))
+	bne,pt		%icc, 1b
+	 add		%o0, 0x20, %o0
+2:	andcc		%o2, 0x18, %o5
+	be,pt		%icc, 3f
+	 sub		%o2, %o5, %o2
+1:	EX_LD(LOAD(ldx, %o1 + 0x00, %g1))
+	add		%o1, 0x08, %o1
+	add		%o0, 0x08, %o0
+	subcc		%o5, 0x08, %o5
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stx, %g1, %o0 - 0x08))
+3:	brz,pt		%o2, .Lexit
+	 cmp		%o2, 0x04
+	bl,pn		%icc, .Ltiny
+	 nop
+	EX_LD(LOAD(lduw, %o1 + 0x00, %g1))
+	add		%o1, 0x04, %o1
+	add		%o0, 0x04, %o0
+	subcc		%o2, 0x04, %o2
+	bne,pn		%icc, .Ltiny
+	 EX_ST(STORE(stw, %g1, %o0 - 0x04))
+	ba,a,pt		%icc, .Lexit
+.Lmedium_unaligned:
+	/* First get dest 8 byte aligned.  */
+	sub		%g0, %o0, %g1
+	and		%g1, 0x7, %g1
+	brz,pt		%g1, 2f
+	 sub		%o2, %g1, %o2
+
+1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2))
+	add		%o1, 1, %o1
+	subcc		%g1, 1, %g1
+	add		%o0, 1, %o0
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stb, %g2, %o0 - 0x01))
+2:
+	and		%o1, 0x7, %g1
+	brz,pn		%g1, .Lmedium_noprefetch
+	 sll		%g1, 3, %g1
+	mov		64, %g2
+	sub		%g2, %g1, %g2
+	andn		%o1, 0x7, %o1
+	EX_LD(LOAD(ldx, %o1 + 0x00, %o4))
+	sllx		%o4, %g1, %o4
+	andn		%o2, 0x08 - 1, %o5
+	sub		%o2, %o5, %o2
+1:	EX_LD(LOAD(ldx, %o1 + 0x08, %g3))
+	add		%o1, 0x08, %o1
+	subcc		%o5, 0x08, %o5
+	srlx		%g3, %g2, GLOBAL_SPARE
+	or		GLOBAL_SPARE, %o4, GLOBAL_SPARE
+	EX_ST(STORE(stx, GLOBAL_SPARE, %o0 + 0x00))
+	add		%o0, 0x08, %o0
+	bne,pt		%icc, 1b
+	 sllx		%g3, %g1, %o4
+	srl		%g1, 3, %g1
+	add		%o1, %g1, %o1
+	brz,pn		%o2, .Lexit
+	 nop
+	ba,pt		%icc, .Lsmall_unaligned
+
+.Ltiny:
+	EX_LD(LOAD(ldub, %o1 + 0x00, %g1))
+	subcc		%o2, 1, %o2
+	be,pn		%icc, .Lexit
+	 EX_ST(STORE(stb, %g1, %o0 + 0x00))
+	EX_LD(LOAD(ldub, %o1 + 0x01, %g1))
+	subcc		%o2, 1, %o2
+	be,pn		%icc, .Lexit
+	 EX_ST(STORE(stb, %g1, %o0 + 0x01))
+	EX_LD(LOAD(ldub, %o1 + 0x02, %g1))
+	ba,pt		%icc, .Lexit
+	 EX_ST(STORE(stb, %g1, %o0 + 0x02))
+
+.Lsmall:
+	andcc		%g2, 0x3, %g0
+	bne,pn		%icc, .Lsmall_unaligned
+	 andn		%o2, 0x4 - 1, %o5
+	sub		%o2, %o5, %o2
+1:
+	EX_LD(LOAD(lduw, %o1 + 0x00, %g1))
+	add		%o1, 0x04, %o1
+	subcc		%o5, 0x04, %o5
+	add		%o0, 0x04, %o0
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stw, %g1, %o0 - 0x04))
+	brz,pt		%o2, .Lexit
+	 nop
+	ba,a,pt		%icc, .Ltiny
+
+.Lsmall_unaligned:
+1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g1))
+	add		%o1, 1, %o1
+	add		%o0, 1, %o0
+	subcc		%o2, 1, %o2
+	bne,pt		%icc, 1b
+	 EX_ST(STORE(stb, %g1, %o0 - 0x01))
+	ba,a,pt		%icc, .Lexit
+END(__memcpy_niagara4)
+
+#endif

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/multiarch/memcpy.S Sat Sep 29 00:01:41 2012
@@ -26,8 +26,19 @@
 # ifdef SHARED
 	SETUP_PIC_REG_LEAF(o3, o5)
 # endif
-	andcc	%o0, HWCAP_SPARC_N2, %g0
+	set	HWCAP_SPARC_CRYPTO, %o1
+	andcc	%o0, %o1, %g0
 	be	1f
+	 andcc	%o0, HWCAP_SPARC_N2, %g0
+# ifdef SHARED
+	sethi	%gdop_hix22(__memcpy_niagara4), %o1
+	xor	%o1, %gdop_lox10(__memcpy_niagara4), %o1
+# else
+	set	__memcpy_niagara4, %o1
+# endif
+	ba	10f
+	 nop
+1:	be	1f
 	 andcc	%o0, HWCAP_SPARC_BLKINIT, %g0
 # ifdef SHARED
 	sethi	%gdop_hix22(__memcpy_niagara2), %o1
@@ -77,8 +88,19 @@
 # ifdef SHARED
 	SETUP_PIC_REG_LEAF(o3, o5)
 # endif
-	andcc	%o0, HWCAP_SPARC_N2, %g0
+	set	HWCAP_SPARC_CRYPTO, %o1
+	andcc	%o0, %o1, %g0
 	be	1f
+	 andcc	%o0, HWCAP_SPARC_N2, %g0
+# ifdef SHARED
+	sethi	%gdop_hix22(__mempcpy_niagara4), %o1
+	xor	%o1, %gdop_lox10(__mempcpy_niagara4), %o1
+# else
+	set	__mempcpy_niagara4, %o1
+# endif
+	ba	10f
+	 nop
+1:	be	1f
 	 andcc	%o0, HWCAP_SPARC_BLKINIT, %g0
 # ifdef SHARED
 	sethi	%gdop_hix22(__mempcpy_niagara2), %o1

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/_G_config.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/_G_config.h (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/_G_config.h Sat Sep 29 00:01:41 2012
@@ -1,0 +1,65 @@
+/* This file is needed by libio to define various configuration parameters.
+   These are always the same in the GNU C library.  */
+
+#ifndef _G_config_h
+#define _G_config_h 1
+
+/* Define types for libio in terms of the standard internal type names.  */
+
+#include <bits/types.h>
+#define __need_size_t
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define __need_wchar_t
+#endif
+#define __need_NULL
+#include <stddef.h>
+#define __need_mbstate_t
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define __need_wint_t
+#endif
+#include <wchar.h>
+typedef struct
+{
+  __off_t __pos;
+  __mbstate_t __state;
+} _G_fpos_t;
+typedef struct
+{
+  __off64_t __pos;
+  __mbstate_t __state;
+} _G_fpos64_t;
+#define _G_off64_t	__off64_t
+#define _G_stat64	stat64
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# include <gconv.h>
+typedef union
+{
+  struct __gconv_info __cd;
+  struct
+  {
+    struct __gconv_info __cd;
+    struct __gconv_step_data __data;
+  } __combined;
+} _G_iconv_t;
+#endif
+
+
+/* These library features are always available in the GNU C library.  */
+#define _G_va_list __gnuc_va_list
+
+#define _G_HAVE_MMAP 1
+#define _G_HAVE_MREMAP 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
+
+#define _G_OPEN64	__open64
+#define _G_LSEEK64	__lseek64
+#define _G_MMAP64	__mmap64
+#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
+
+/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
+#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
+
+#define _G_BUFSIZ 8192
+
+#endif	/* _G_config.h */

Modified: fsf/trunk/libc/sysdeps/x86_64/dl-tlsdesc.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-tlsdesc.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-tlsdesc.h Sat Sep 29 00:01:41 2012
@@ -19,12 +19,6 @@
 
 #ifndef _X86_64_DL_TLSDESC_H
 # define _X86_64_DL_TLSDESC_H 1
-
-/* Use this to access DT_TLSDESC_PLT and DT_TLSDESC_GOT.  */
-#ifndef ADDRIDX
-# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
-		       + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
-#endif
 
 /* Type used to represent a TLS descriptor in the GOT.  */
 struct tlsdesc

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits