about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-08-04 17:29:01 +0200
committerAndreas Schwab <schwab@redhat.com>2011-08-04 17:29:01 +0200
commit29f9830714c25b8aae6fb553390271bce0f202ce (patch)
tree154094a1009608cbe1f996fde224c753c90a4712
parentc337ae189c10d14db5b3e9a2422acb3b34418386 (diff)
parent943515f05cdbc1463bb06c9adbd3dcee5c1a7f57 (diff)
downloadglibc-29f9830714c25b8aae6fb553390271bce0f202ce.tar.gz
glibc-29f9830714c25b8aae6fb553390271bce0f202ce.tar.xz
glibc-29f9830714c25b8aae6fb553390271bce0f202ce.zip
Merge remote-tracking branch 'origin/release/2.13/master' into fedora/2.13/master
-rw-r--r--ChangeLog91
-rw-r--r--NEWS4
-rw-r--r--elf/Makefile28
-rw-r--r--elf/dl-deps.c91
-rw-r--r--elf/dl-fini.c157
-rw-r--r--elf/dl-runtime.c3
-rw-r--r--elf/rtld.c5
-rw-r--r--elf/tst-initorder.c7
-rw-r--r--elf/tst-initorder.exp13
-rw-r--r--elf/tst-initordera1.c16
-rw-r--r--elf/tst-initordera2.c16
-rw-r--r--elf/tst-initordera3.c16
-rw-r--r--elf/tst-initordera4.c16
-rw-r--r--elf/tst-initorderb1.c16
-rw-r--r--elf/tst-initorderb2.c16
-rw-r--r--elf/tst-order-a1.c16
-rw-r--r--elf/tst-order-a2.c16
-rw-r--r--elf/tst-order-a3.c16
-rw-r--r--elf/tst-order-a4.c16
-rw-r--r--elf/tst-order-b1.c16
-rw-r--r--elf/tst-order-b2.c16
-rw-r--r--elf/tst-order-main.c10
-rw-r--r--nptl/ChangeLog9
-rw-r--r--nptl/pthread_cond_timedwait.c4
-rw-r--r--nptl/pthread_cond_wait.c4
-rw-r--r--nptl/pthread_rwlock_rdlock.c4
-rw-r--r--nptl/pthread_rwlock_timedrdlock.c4
-rw-r--r--nptl/pthread_rwlock_timedwrlock.c4
-rw-r--r--nptl/pthread_rwlock_wrlock.c4
-rw-r--r--shadow/sgetspent.c6
-rw-r--r--sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S2
-rw-r--r--sysdeps/i386/i686/multiarch/memcpy-ssse3.S2
-rw-r--r--sysdeps/powerpc/powerpc64/power7/Makefile5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h4
-rw-r--r--sysdeps/wordsize-64/Makefile6
-rw-r--r--sysdeps/wordsize-64/tst-writev.c107
-rw-r--r--sysdeps/x86_64/multiarch/memcpy-ssse3-back.S2
-rw-r--r--sysdeps/x86_64/multiarch/memcpy-ssse3.S2
38 files changed, 624 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog
index 8321b24203..8ab08062f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,94 @@
+2011-05-30  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12454]
+	* elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
+	when there are multiple maps.
+	* elf/dl-fini.c (_dl_sort_fini): Check for list of one.
+	(_dl_fini): Remove test here.
+
+	* elf/rtld.c (dl_main): Don't allow the loader to load itself.
+
+2011-02-06  Mike Frysinger  <vapier@gentoo.org>
+
+	[BZ #12653]
+	* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Only protect
+	MEMCPY_CHK with USE_AS_BCOPY ifdef check.
+	* sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
+	* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
+	* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
+
+2010-09-28  Andreas Schwab  <schwab@redhat.com>
+	    Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12489]
+	* elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs)
+	before performing relro protection.  At old place add assertion
+	to make sure nothing changed.
+
+2011-02-16  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
+	(INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
+	cast from r3.
+	* sysdeps/wordsize-64/Makefile: New file.  Add tst-writev to
+	'tests' variable.
+	* sysdeps/wordsize-64/tst-writev.c: New file.
+
+2011-02-15  Ryan S. Arnold  <rsa@us.ibm.com>
+
+	* sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
+	-mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
+	insns in _dl_start to prevent a TOC reference before relocs are
+	resolved.
+
+2011-02-02  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the
+	function to the callback.
+	Patch partly by Jiri Olsa <jolsa@redhat.com>.
+
+2011-02-02  Andreas Schwab  <schwab@redhat.com>
+
+	* shadow/sgetspent.c: Check return value of __sgetspent_r instead
+	of errno.
+
+2011-01-19  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #11724]
+	* elf/dl-deps.c (_dl_map_object_deps): Rewrite sorting determining order
+	of constructors.
+	* elf/dl-fini.c (_dl_sort_fini): Rewrite sorting determining order
+	of destructors.
+	(_dl_fini): Don't call _dl_sort_fini if there is only one object.
+
+	[BZ #11724]
+	* elf/Makefile: Add rules to build and run new test.
+	* elf/tst-initorder.c: New file.
+	* elf/tst-initorder.exp: New file.
+	* elf/tst-initordera1.c: New file.
+	* elf/tst-initordera2.c: New file.
+	* elf/tst-initordera3.c: New file.
+	* elf/tst-initordera4.c: New file.
+	* elf/tst-initorderb1.c: New file.
+	* elf/tst-initorderb2.c: New file.
+	* elf/tst-order-a1.c: New file.
+	* elf/tst-order-a2.c: New file.
+	* elf/tst-order-a3.c: New file.
+	* elf/tst-order-a4.c: New file.
+	* elf/tst-order-b1.c: New file.
+	* elf/tst-order-b2.c: New file.
+	* elf/tst-order-main.c: New file.
+	New test case by George Gensure <werkt0@gmail.com>.
+
+2010-10-01  Andreas Schwab  <schwab@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't discard result of
+	decoding ACE if AI_CANONIDN.
+
+2011-01-18  Ulrich Drepper  <drepper@gmail.com>
+
+	* elf/Makefile: Build IFUNC tests unless multi-arch = no.
+
 2011-01-17  Ulrich Drepper  <drepper@gmail.com>
 
 	* version.h (RELEASE): Bump for 2.13 release.
diff --git a/NEWS b/NEWS
index 7444b9de6b..91facbec12 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-1-15
+GNU C Library NEWS -- history of user-visible changes.  2011-5-30
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -13,7 +13,7 @@ Version 2.13
   11655, 11701, 11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005,
   12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
   12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12378,
-  12394, 12397
+  12394, 12397, 12489, 12653, 12454
 
 * New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
 
diff --git a/elf/Makefile b/elf/Makefile
index 1708f01f7c..c169df51c1 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2007,2008,2009,2010 Free Software Foundation, Inc.
+# Copyright (C) 1995-2007,2008,2009,2010,2011 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
@@ -119,7 +119,10 @@ distribute	:= rtld-Rules \
 		   ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
 		   ifuncmain7pie.c ifuncmain7static.c \
 		   tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
-		   tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c
+		   tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \
+			 tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
+			 tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
+			 tst-initorder.c
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -200,7 +203,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
 	 tst-audit1 tst-audit2 \
 	 tst-stackguard1 tst-addr1 tst-thrlock \
-	 tst-unique1 tst-unique2
+	 tst-unique1 tst-unique2 \
+	 tst-initorder
 #	 reldep9
 test-srcs = tst-pathopt
 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
@@ -253,7 +257,10 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
 		order2mod1 order2mod2 order2mod3 order2mod4 \
 		tst-unique1mod1 tst-unique1mod2 \
-		tst-unique2mod1 tst-unique2mod2
+		tst-unique2mod1 tst-unique2mod2 \
+		tst-initordera1 tst-initorderb1 \
+		tst-initordera2 tst-initorderb2 \
+		tst-initordera3 tst-initordera4
 ifeq (yes,$(have-initfini-array))
 modules-names += tst-array2dep tst-array5dep
 endif
@@ -277,7 +284,7 @@ test-extras += $(modules-names)
 # filtmod1.so has a special rule
 modules-names-nobuild := filtmod1
 
-ifeq (yes,$(multi-arch))
+ifneq (no,$(multi-arch))
 tests-static += ifuncmain1static ifuncmain1picstatic \
 		ifuncmain2static ifuncmain2picstatic \
 		ifuncmain4static ifuncmain4picstatic \
@@ -537,6 +544,11 @@ $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
 $(objpfx)unload8mod3.so: $(libdl)
+$(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
+$(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
+$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
+$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
+$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
 
 LDFLAGS-tst-tlsmod5.so = -nostdlib
 LDFLAGS-tst-tlsmod6.so = -nostdlib
@@ -1171,6 +1183,12 @@ $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
 
+$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
+	$(elf-objpfx)${rtld-installed-name} \
+	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+	  $< > $@
+	cmp $@ tst-initorder.exp > /dev/null
+
 ifeq (yes,$(config-cflags-avx))
 CFLAGS-tst-audit4.c += -mavx
 CFLAGS-tst-auditmod4a.c += -mavx
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 1cab2d1c83..bbb3d85235 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
 /* Load the dependencies of a mapped object.
-   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010
+   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010, 2011
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -592,7 +592,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
 	    /* Need to allocate new array of relocation dependencies.  */
 	    struct link_map_reldeps *l_reldeps;
 	    l_reldeps = malloc (sizeof (*l_reldeps)
-	    			+ map->l_reldepsmax
+				+ map->l_reldepsmax
 				  * sizeof (struct link_map *));
 	    if (l_reldeps == NULL)
 	      /* Bad luck, keep the reldeps duplicated between
@@ -614,51 +614,66 @@ Filters not supported with LD_TRACE_PRELINKING"));
 	map->l_searchlist.r_list[i]->l_reserved = 0;
     }
 
-  /* Now determine the order in which the initialization has to happen.  */
+  /* Sort the initializer list to take dependencies into account.  The binary
+     itself will always be initialize last.  */
   memcpy (l_initfini, map->l_searchlist.r_list,
 	  nlist * sizeof (struct link_map *));
-  /* We can skip looking for the binary itself which is at the front
-     of the search list.  Look through the list backward so that circular
-     dependencies are not changing the order.  */
-  for (i = 1; i < nlist; ++i)
+  if (__builtin_expect (nlist > 1, 1))
     {
-      struct link_map *l = map->l_searchlist.r_list[i];
-      unsigned int j;
-      unsigned int k;
-
-      /* Find the place in the initfini list where the map is currently
-	 located.  */
-      for (j = 1; l_initfini[j] != l; ++j)
-	;
-
-      /* Find all object for which the current one is a dependency and
-	 move the found object (if necessary) in front.  */
-      for (k = j + 1; k < nlist; ++k)
+      /* We can skip looking for the binary itself which is at the front
+	 of the search list.  */
+      i = 1;
+      bool seen[nlist];
+      memset (seen, false, nlist * sizeof (seen[0]));
+      while (1)
 	{
-	  struct link_map **runp;
-
-	  runp = l_initfini[k]->l_initfini;
-	  if (runp != NULL)
+	  /* Keep track of which object we looked at this round.  */
+	  seen[i] = true;
+	  struct link_map *thisp = l_initfini[i];
+
+	  /* Find the last object in the list for which the current one is
+	     a dependency and move the current object behind the object
+	     with the dependency.  */
+	  unsigned int k = nlist - 1;
+	  while (k > i)
 	    {
-	      while (*runp != NULL)
-		if (__builtin_expect (*runp++ == l, 0))
-		  {
-		    struct link_map *here = l_initfini[k];
-
-		    /* Move it now.  */
-		    memmove (&l_initfini[j] + 1, &l_initfini[j],
-			     (k - j) * sizeof (struct link_map *));
-		    l_initfini[j] = here;
+	      struct link_map **runp = l_initfini[k]->l_initfini;
+	      if (runp != NULL)
+		/* Look through the dependencies of the object.  */
+		while (*runp != NULL)
+		  if (__builtin_expect (*runp++ == thisp, 0))
+		    {
+		      /* Move the current object to the back past the last
+			 object with it as the dependency.  */
+		      memmove (&l_initfini[i], &l_initfini[i + 1],
+			       (k - i) * sizeof (l_initfini[0]));
+		      l_initfini[k] = thisp;
+
+		      if (seen[i + 1])
+			{
+			  ++i;
+			  goto next_clear;
+			}
+
+		      memmove (&seen[i], &seen[i + 1],
+			       (k - i) * sizeof (seen[0]));
+		      seen[k] = true;
+
+		      goto next;
+		    }
+
+	      --k;
+	    }
 
-		    /* Don't insert further matches before the last
-		       entry moved to the front.  */
-		    ++j;
+	  if (++i == nlist)
+	    break;
+	next_clear:
+	  memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
 
-		    break;
-		  }
-	    }
+	next:;
 	}
     }
+
   /* Terminate the list of dependencies.  */
   l_initfini[nlist] = NULL;
   atomic_write_barrier ();
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index ff4c33e808..269bcece4c 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -1,5 +1,6 @@
 /* Call the termination functions of loaded shared objects.
-   Copyright (C) 1995,96,1998-2002,2004-2005,2009 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,1998-2002,2004-2005,2009,2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,86 +33,87 @@ internal_function
 _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
 	       char *used, Lmid_t ns)
 {
-  if (ns == LM_ID_BASE)
-    /* The main executable always comes first.  */
-    l = l->l_next;
-
-  for (; l != NULL; l = l->l_next)
-    /* Do not handle ld.so in secondary namespaces and object which
-       are not removed.  */
-    if (l == l->l_real && l->l_idx != -1)
-      {
-	/* Find the place in the 'maps' array.  */
-	unsigned int j;
-	for (j = ns == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
-	  assert (j < nmaps);
-
-	/* Find all object for which the current one is a dependency
-	   and move the found object (if necessary) in front.  */
-	for (unsigned int k = j + 1; k < nmaps; ++k)
-	  {
-	    struct link_map **runp = maps[k]->l_initfini;
-	    if (runp != NULL)
-	      {
-		while (*runp != NULL)
-		  if (*runp == l)
+  /* A list of one element need not be sorted.  */
+  if (nmaps == 1)
+    return;
+
+  /* We can skip looking for the binary itself which is at the front
+     of the search list for the main namespace.  */
+  unsigned int i = ns == LM_ID_BASE;
+  bool seen[nmaps];
+  memset (seen, false, nmaps * sizeof (seen[0]));
+  while (1)
+    {
+      /* Keep track of which object we looked at this round.  */
+      seen[i] = true;
+      struct link_map *thisp = maps[i];
+
+      /* Do not handle ld.so in secondary namespaces and object which
+	 are not removed.  */
+      if (thisp != thisp->l_real || thisp->l_idx == -1)
+	goto skip;
+
+      /* Find the last object in the list for which the current one is
+	 a dependency and move the current object behind the object
+	 with the dependency.  */
+      unsigned int k = nmaps - 1;
+      while (k > i)
+	{
+	  struct link_map **runp = maps[k]->l_initfini;
+	  if (runp != NULL)
+	    /* Look through the dependencies of the object.  */
+	    while (*runp != NULL)
+	      if (__builtin_expect (*runp++ == thisp, 0))
+		{
+		move:
+		  /* Move the current object to the back past the last
+		     object with it as the dependency.  */
+		  memmove (&maps[i], &maps[i + 1],
+			   (k - i) * sizeof (maps[0]));
+		  maps[k] = thisp;
+
+		  if (used != NULL)
 		    {
-		      struct link_map *here = maps[k];
+		      char here_used = used[i];
+		      memmove (&used[i], &used[i + 1],
+			       (k - i) * sizeof (used[0]));
+		      used[k] = here_used;
+		    }
 
-		      /* Move it now.  */
-		      memmove (&maps[j] + 1,
-			       &maps[j], (k - j) * sizeof (struct link_map *));
-		      maps[j] = here;
+		  if (seen[i + 1])
+		    {
+		      ++i;
+		      goto next_clear;
+		    }
 
-		      if (used != NULL)
-			{
-			  char here_used = used[k];
+		  memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
+		  seen[k] = true;
 
-			  memmove (&used[j] + 1,
-				   &used[j], (k - j) * sizeof (char));
-			  used[j] = here_used;
-			}
+		  goto next;
+		}
 
-		      ++j;
+	  if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
+	    {
+	      unsigned int m = maps[k]->l_reldeps->act;
+	      struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
 
-		      break;
-		    }
-		  else
-		    ++runp;
-	      }
-
-	    if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
-	      {
-		unsigned int m = maps[k]->l_reldeps->act;
-		struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
-
-		while (m-- > 0)
-		  {
-		    if (relmaps[m] == l)
-		      {
-			struct link_map *here = maps[k];
-
-			/* Move it now.  */
-			memmove (&maps[j] + 1,
-				 &maps[j],
-				 (k - j) * sizeof (struct link_map *));
-			maps[j] = here;
-
-			if (used != NULL)
-			  {
-			    char here_used = used[k];
-
-			    memmove (&used[j] + 1,
-				     &used[j], (k - j) * sizeof (char));
-			    used[j] = here_used;
-			  }
-
-			break;
-		      }
-		  }
-	      }
-	  }
-      }
+	    /* Look through the relocation dependencies of the object.  */
+	      while (m-- > 0)
+		if (__builtin_expect (relmaps[m] == thisp, 0))
+		  goto move;
+	    }
+
+	  --k;
+	}
+
+    skip:
+      if (++i == nmaps)
+	break;
+    next_clear:
+      memset (&seen[i], false, (nmaps - i) * sizeof (seen[0]));
+
+    next:;
+    }
 }
 
 
@@ -196,9 +198,8 @@ _dl_fini (void)
       assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
       nmaps = i;
 
-      if (nmaps != 0)
-	/* Now we have to do the sorting.  */
-	_dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
+      /* Now we have to do the sorting.  */
+      _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
 
       /* We do not rely on the linked list of loaded object anymore from
 	 this point on.  We have our own list here (maps).  The various
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 6847edafc6..ae2d05c776 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -1,5 +1,5 @@
 /* On-demand PLT fixup for shared objects.
-   Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1995-2009, 2010, 2011 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
@@ -446,6 +446,7 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
 
   /* Set up the sym parameter.  */
   ElfW(Sym) sym = *defsym;
+  sym.st_value = DL_FIXUP_VALUE_ADDR (reloc_result->addr);
 
   /* Get the symbol name.  */
   const char *strtab = (const void *) D_PTR (reloc_result->bound,
diff --git a/elf/rtld.c b/elf/rtld.c
index 5e0db1202f..1d989ae820 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1,5 +1,5 @@
 /* Run time dynamic linker.
-   Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1995-2010, 2011 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
@@ -2299,6 +2299,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 			  lossage);
     }
 
+  /* Make sure no new search directories have been added.  */
+  assert (GLRO(dl_init_all_dirs) == GL(dl_all_dirs));
+
   if (! prelinked && rtld_multiple_ref)
     {
       /* There was an explicit ref to the dynamic linker as a shared lib.
diff --git a/elf/tst-initorder.c b/elf/tst-initorder.c
new file mode 100644
index 0000000000..9638382104
--- /dev/null
+++ b/elf/tst-initorder.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int
+main( int argc, char *argv[] )
+{
+  printf( "main\n" );
+}
diff --git a/elf/tst-initorder.exp b/elf/tst-initorder.exp
new file mode 100644
index 0000000000..8718f65765
--- /dev/null
+++ b/elf/tst-initorder.exp
@@ -0,0 +1,13 @@
+start_a1
+start_a2
+start_b1
+start_b2
+start_a3
+start_a4
+main
+finish_a4
+finish_a3
+finish_b2
+finish_b1
+finish_a2
+finish_a1
diff --git a/elf/tst-initordera1.c b/elf/tst-initordera1.c
new file mode 100644
index 0000000000..f161257142
--- /dev/null
+++ b/elf/tst-initordera1.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a1( void ) __attribute__((constructor));
+extern void finish_a1( void ) __attribute__((destructor));
+
+void
+start_a1( void )
+{
+  printf( "start_a1\n" );
+}
+
+void
+finish_a1( void )
+{
+  printf( "finish_a1\n" );
+}
diff --git a/elf/tst-initordera2.c b/elf/tst-initordera2.c
new file mode 100644
index 0000000000..a5a9b42ff6
--- /dev/null
+++ b/elf/tst-initordera2.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a2( void ) __attribute__((constructor));
+extern void finish_a2( void ) __attribute__((destructor));
+
+void
+start_a2( void )
+{
+  printf( "start_a2\n" );
+}
+
+void
+finish_a2( void )
+{
+  printf( "finish_a2\n" );
+}
diff --git a/elf/tst-initordera3.c b/elf/tst-initordera3.c
new file mode 100644
index 0000000000..1c7f496e9a
--- /dev/null
+++ b/elf/tst-initordera3.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a3( void ) __attribute__((constructor));
+extern void finish_a3( void ) __attribute__((destructor));
+
+void
+start_a3( void )
+{
+  printf( "start_a3\n" );
+}
+
+void
+finish_a3( void )
+{
+  printf( "finish_a3\n" );
+}
diff --git a/elf/tst-initordera4.c b/elf/tst-initordera4.c
new file mode 100644
index 0000000000..70b9f5e392
--- /dev/null
+++ b/elf/tst-initordera4.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a4( void ) __attribute__((constructor));
+extern void finish_a4( void ) __attribute__((destructor));
+
+void
+start_a4( void )
+{
+  printf( "start_a4\n" );
+}
+
+void
+finish_a4( void )
+{
+  printf( "finish_a4\n" );
+}
diff --git a/elf/tst-initorderb1.c b/elf/tst-initorderb1.c
new file mode 100644
index 0000000000..993ea3fe30
--- /dev/null
+++ b/elf/tst-initorderb1.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_b1( void ) __attribute__((constructor));
+extern void finish_b1( void ) __attribute__((destructor));
+
+void
+start_b1( void )
+{
+  printf( "start_b1\n" );
+}
+
+void
+finish_b1( void )
+{
+  printf( "finish_b1\n" );
+}
diff --git a/elf/tst-initorderb2.c b/elf/tst-initorderb2.c
new file mode 100644
index 0000000000..3334dda0a9
--- /dev/null
+++ b/elf/tst-initorderb2.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_b2( void ) __attribute__((constructor));
+extern void finish_b2( void ) __attribute__((destructor));
+
+void
+start_b2( void )
+{
+  printf( "start_b2\n" );
+}
+
+void
+finish_b2( void )
+{
+  printf( "finish_b2\n" );
+}
diff --git a/elf/tst-order-a1.c b/elf/tst-order-a1.c
new file mode 100644
index 0000000000..f161257142
--- /dev/null
+++ b/elf/tst-order-a1.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a1( void ) __attribute__((constructor));
+extern void finish_a1( void ) __attribute__((destructor));
+
+void
+start_a1( void )
+{
+  printf( "start_a1\n" );
+}
+
+void
+finish_a1( void )
+{
+  printf( "finish_a1\n" );
+}
diff --git a/elf/tst-order-a2.c b/elf/tst-order-a2.c
new file mode 100644
index 0000000000..a5a9b42ff6
--- /dev/null
+++ b/elf/tst-order-a2.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a2( void ) __attribute__((constructor));
+extern void finish_a2( void ) __attribute__((destructor));
+
+void
+start_a2( void )
+{
+  printf( "start_a2\n" );
+}
+
+void
+finish_a2( void )
+{
+  printf( "finish_a2\n" );
+}
diff --git a/elf/tst-order-a3.c b/elf/tst-order-a3.c
new file mode 100644
index 0000000000..1c7f496e9a
--- /dev/null
+++ b/elf/tst-order-a3.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a3( void ) __attribute__((constructor));
+extern void finish_a3( void ) __attribute__((destructor));
+
+void
+start_a3( void )
+{
+  printf( "start_a3\n" );
+}
+
+void
+finish_a3( void )
+{
+  printf( "finish_a3\n" );
+}
diff --git a/elf/tst-order-a4.c b/elf/tst-order-a4.c
new file mode 100644
index 0000000000..70b9f5e392
--- /dev/null
+++ b/elf/tst-order-a4.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_a4( void ) __attribute__((constructor));
+extern void finish_a4( void ) __attribute__((destructor));
+
+void
+start_a4( void )
+{
+  printf( "start_a4\n" );
+}
+
+void
+finish_a4( void )
+{
+  printf( "finish_a4\n" );
+}
diff --git a/elf/tst-order-b1.c b/elf/tst-order-b1.c
new file mode 100644
index 0000000000..993ea3fe30
--- /dev/null
+++ b/elf/tst-order-b1.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_b1( void ) __attribute__((constructor));
+extern void finish_b1( void ) __attribute__((destructor));
+
+void
+start_b1( void )
+{
+  printf( "start_b1\n" );
+}
+
+void
+finish_b1( void )
+{
+  printf( "finish_b1\n" );
+}
diff --git a/elf/tst-order-b2.c b/elf/tst-order-b2.c
new file mode 100644
index 0000000000..3334dda0a9
--- /dev/null
+++ b/elf/tst-order-b2.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern void start_b2( void ) __attribute__((constructor));
+extern void finish_b2( void ) __attribute__((destructor));
+
+void
+start_b2( void )
+{
+  printf( "start_b2\n" );
+}
+
+void
+finish_b2( void )
+{
+  printf( "finish_b2\n" );
+}
diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
new file mode 100644
index 0000000000..80f4f6be18
--- /dev/null
+++ b/elf/tst-order-main.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int
+main( int argc, char *argv[] )
+{
+  printf( "main\n" );
+  exit(EXIT_SUCCESS);
+}
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 804e4d8ca2..6c9a319b76 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-19  Roland McGrath  <roland@redhat.com>
+
+	* pthread_cond_wait.c (__pthread_cond_wait): Fix comment typo.
+	* pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
+	* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock): Likewise.
+	* pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
+	* pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock): Likewise.
+	* pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock): Likewise.
+
 2011-01-16  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* Makefile (test-extras): Add tst-cleanup4aux.
diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
index 7278ec45b0..c173884b2b 100644
--- a/nptl/pthread_cond_timedwait.c
+++ b/nptl/pthread_cond_timedwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004,2007,2010,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -65,7 +65,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock (cond->__data.__lock, pshared);
 
   /* Now we can release the mutex.  */
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index 670fba5736..467a03a16d 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004,2006,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -101,7 +101,7 @@ __pthread_cond_wait (cond, mutex)
   int pshared = (cond->__data.__mutex == (void *) ~0l)
   		? LLL_SHARED : LLL_PRIVATE;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock (cond->__data.__lock, pshared);
 
   /* Now we can release the mutex.  */
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index 31eb508a0d..2feac57e25 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -31,7 +31,7 @@ __pthread_rwlock_rdlock (rwlock)
 {
   int result = 0;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
 
   while (1)
diff --git a/nptl/pthread_rwlock_timedrdlock.c b/nptl/pthread_rwlock_timedrdlock.c
index fcd10aac90..75be8e7d01 100644
--- a/nptl/pthread_rwlock_timedrdlock.c
+++ b/nptl/pthread_rwlock_timedrdlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -32,7 +32,7 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
 {
   int result = 0;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock(rwlock->__data.__lock, rwlock->__data.__shared);
 
   while (1)
diff --git a/nptl/pthread_rwlock_timedwrlock.c b/nptl/pthread_rwlock_timedwrlock.c
index e6283f4623..6b3c752361 100644
--- a/nptl/pthread_rwlock_timedwrlock.c
+++ b/nptl/pthread_rwlock_timedwrlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -32,7 +32,7 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
 {
   int result = 0;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
 
   while (1)
diff --git a/nptl/pthread_rwlock_wrlock.c b/nptl/pthread_rwlock_wrlock.c
index 64fe970125..9d5f13583b 100644
--- a/nptl/pthread_rwlock_wrlock.c
+++ b/nptl/pthread_rwlock_wrlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003,2007,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -31,7 +31,7 @@ __pthread_rwlock_wrlock (rwlock)
 {
   int result = 0;
 
-  /* Make sure we are along.  */
+  /* Make sure we are alone.  */
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
 
   while (1)
diff --git a/shadow/sgetspent.c b/shadow/sgetspent.c
index ec7f384fa6..f3dce53ea3 100644
--- a/shadow/sgetspent.c
+++ b/shadow/sgetspent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -49,8 +49,8 @@ sgetspent (const char *string)
     }
 
   while (buffer != NULL
-	 && __sgetspent_r (string, &resbuf, buffer, buffer_size, &result) != 0
-	 && errno == ERANGE)
+	 && (__sgetspent_r (string, &resbuf, buffer, buffer_size, &result)
+	     == ERANGE))
     {
       char *new_buf;
       buffer_size += BUFLEN_SPWD;
diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
index 48a109ccd6..8e81183827 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
+++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
 #endif
 
 	.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
+#if !defined USE_AS_BCOPY
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
index ec9eeb95e4..f64f8d2146 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
+++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
 #endif
 
 	.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
+#if !defined USE_AS_BCOPY
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
diff --git a/sysdeps/powerpc/powerpc64/power7/Makefile b/sysdeps/powerpc/powerpc64/power7/Makefile
new file mode 100644
index 0000000000..b0f45205b9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/power7/Makefile
@@ -0,0 +1,5 @@
+ifeq ($(subdir),elf)
+# Prevent the use of VSX registers and insns in _dl_start, which under -O3
+# optimization may require a TOC reference before relocations are resolved.
+CFLAGS-rtld.c += -mno-vsx
+endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index aab4b721c0..e714c4c534 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -172,7 +172,7 @@
        : "r9", "r10", "r11", "r12",					\
          "cr0", "ctr", "lr", "memory");					\
 	  err = (long int) r0;						\
-    (int) r3;								\
+    r3;								\
   })
 
 #undef INLINE_SYSCALL
@@ -219,7 +219,7 @@
        : "r9", "r10", "r11", "r12",					\
          "cr0", "ctr", "memory");					\
 	  err = r0;  \
-    (int) r3;  \
+    r3;  \
   })
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
   INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
diff --git a/sysdeps/wordsize-64/Makefile b/sysdeps/wordsize-64/Makefile
new file mode 100644
index 0000000000..9903f51f9a
--- /dev/null
+++ b/sysdeps/wordsize-64/Makefile
@@ -0,0 +1,6 @@
+ifeq ($(subdir),misc)
+tests += tst-writev
+
+# Time enough for a large writev syscall to complete.
+tst-writev-ENV = TIMEOUTFACTOR="10"
+endif
diff --git a/sysdeps/wordsize-64/tst-writev.c b/sysdeps/wordsize-64/tst-writev.c
new file mode 100644
index 0000000000..6e4788612c
--- /dev/null
+++ b/sysdeps/wordsize-64/tst-writev.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fcntl.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+
+/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
+   macros on 64-bit platforms don't cast the return type to (int) which would
+   erroneously sign extend the return value should the high bit of the bottom
+   half of the word be '1'.  */
+
+#if 0
+/* Used to test the non power-of-2 code path.  */
+#undef IOV_MAX
+#define IOV_MAX 1000
+#endif
+
+/* writev() should report that it has written EXPECTED number of bytes.  */
+#define EXPECTED ((size_t) INT32_MAX + 1)
+
+static int
+do_test (void)
+{
+  struct iovec iv[IOV_MAX];
+  /* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic.  */
+  size_t bufsz = EXPECTED / IOV_MAX;
+  size_t bufrem = EXPECTED % IOV_MAX;
+
+  /* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
+     need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
+     for the remainder.  */
+  if (bufrem)
+    {
+      bufsz = bufsz + 1;
+      bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
+    }
+
+  /* We writev to /dev/null since we're just testing writev's return value.  */
+  int fd = open (_PATH_DEVNULL, O_WRONLY);
+  if (fd == -1)
+    {
+      printf ("Unable to open /dev/null for writing.\n");
+      return -1;
+    }
+
+  iv[0].iov_base = malloc (bufsz);
+  if (iv[0].iov_base == NULL)
+    {
+      printf ("malloc (%zu) failed.\n", bufsz);
+      close (fd);
+      return -1;
+    }
+  iv[0].iov_len = bufsz;
+
+  /* We optimistically presume that there isn't a remainder and set all iovec
+     instances to the same base and len as the first instance.  */
+  for (int i = 1; i < IOV_MAX; i++)
+    {
+      /* We don't care what the data is so reuse the allocation from iv[0];  */
+      iv[i].iov_base = iv[0].iov_base;
+      iv[i].iov_len = iv[0].iov_len;
+    }
+
+  /* If there is a remainder then we correct the last iov_len.  */
+  if (bufrem)
+    iv[IOV_MAX - 1].iov_len = bufrem;
+
+  /* Write junk to /dev/null with the writev syscall in order to get a return
+     of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
+     mangling the result if the signbit of a 32-bit number is set.  */
+  ssize_t ret = writev (fd, iv, IOV_MAX);
+
+  free (iv[0].iov_base);
+  close (fd);
+
+  if (ret != (ssize_t) EXPECTED)
+    {
+      printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
index 48c974e97f..bdd114a1bd 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
@@ -49,7 +49,7 @@
   ud2
 
 	.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc
+#if !defined USE_AS_BCOPY
 ENTRY (MEMCPY_CHK)
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
index 9a878d35ff..cd7e45f255 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
@@ -49,7 +49,7 @@
   ud2
 
 	.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc
+#if !defined USE_AS_BCOPY
 ENTRY (MEMCPY_CHK)
 	cmpq	%rdx, %rcx
 	jb	HIDDEN_JUMPTARGET (__chk_fail)