This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.25-179-g36fe25f


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af (commit)
       via  ff65c87443fe628d1e1e0106a5fcafc2104a5d7e (commit)
       via  18b6e2c86ce03c9be8ee0a53840fe5d533de22b3 (commit)
      from  b2b1ea8b777c2f1362d41ee34089104f535e9903 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af

commit 36fe25fd0ecdb0e73ef4878a5796a6ab4a4d04af
Author: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
Date:   Wed Apr 5 10:34:39 2017 -0300

    Update elf tests to use the support test driver.
    
    Replaced test-skeleton.c with support/test-driver.c and
    adjusted the tests accordinly.
    
    Checked on x86_64.
    
    	* elf/next.c: Import support/test-driver.c instead of
    	test-skeleton.c and delete TEST_FUNCTION macro definition.
    	* elf/nodelete.c: Likewise.
    	* elf/order2.c: Likewise.
    	* elf/tst-_dl_addr_inside_object.c: Likewise.
    	* elf/tst-addr1.c: Likewise.
    	* elf/tst-align.c: Likewise.
    	* elf/tst-align2.c: Likewise.
    	* elf/tst-audit11.c: Likewise.
    	* elf/tst-audit12.c: Likewise.
    	* elf/tst-audit2.c: Likewise.
    	* elf/tst-audit9.c: Likewise.
    	* elf/tst-auxv.c: Likewise and define
    	TEST_FUNCTION_ARGV macro.
    	* elf/tst-deep1.c: Likewise.
    	* elf/tst-dl-iter-static.c: Likewise.
    	* elf/tst-dlmodcount.c: Likewise.
    	* elf/tst-dlmopen1.c: Likewise.
    	* elf/tst-dlmopen2.c: Likewise.
    	* elf/tst-dlmopen3.c: Likewise.
    	* elf/tst-dlopen-aout.c: Likewise.
    	* elf/tst-dlopenrpath.c: Likewise.
    	* elf/tst-dlsym-error.c: Likewise.
    	* elf/tst-execstack-needed.c: Likewise.
    	* elf/tst-execstack-prog.c: Likewise.
    	* elf/tst-execstack.c: Likewise.
    	* elf/tst-global1.c: Likewise.
    	* elf/tst-gnu2-tls1.c: Likewise.
    	* elf/tst-latepthread.c: Likewise.
    	* elf/tst-leaks1.c: Likewise.
    	* elf/tst-linkall-static.c: Likewise.
    	(do_test): New function.
    	* elf/tst-nodelete-opened.c: Likewise.
    	* elf/tst-nodelete.cc: Likewise.
    	* elf/tst-nodelete2.c: Likewise.
    	* elf/tst-noload.c: Likewise.
    	* elf/tst-null-argv.c: Likewise and define
    	TEST_FUNCTION_ARGV marcro.
    	* elf/tst-order-main.c: Likewise.
    	* elf/tst-pathopt.c: Likewise.
    	* elf/tst-pie2.c: Likewise.
    	* elf/tst-piemod1.c: Likewise.
    	* elf/tst-prelink.c: Likewise.
    	* elf/tst-protected1a.c: Likewise.
    	* elf/tst-protected1b.c: Likewise.
    	* elf/tst-ptrguard1.c: Likewise, import getopt.h,
    	and define _GNU_SOURCE macro.
    	(cmdline_process_function): New function.
    	* elf/tst-relsort1.c: Likewise.
    	* elf/tst-stackguard1.c: Likewise, import getopt.h,
    	and define _GNU_SOURCE macro.
    	(cmdline_process_function): New function.
    	* elf/tst-thrlock.c: Likewise.
    	* elf/tst-tls-dlinfo.c: Likewise.
    	* elf/tst-tls-manydynamic.c: Likewise and import
    	support/xthread.h.
    	* elf/tst-tls1.c: Likewise.
    	* elf/tst-tls10.c: Likewise.
    	* elf/tst-tls11.c: Likewise.
    	* elf/tst-tls12.c: Likewise.
    	* elf/tst-tls13.c: Likewise.
    	* elf/tst-tls14.c: Likewise.
    	* elf/tst-tls15.c: Likewise.
    	* elf/tst-tls16.c: Likewise.
    	* elf/tst-tls17.c: Likewise.
    	* elf/tst-tls18.c: Likewise.
    	* elf/tst-tls19.c: Likewise.
    	* elf/tst-tls2.c: Likewise.
    	* elf/tst-tls3.c: Likewise.
    	* elf/tst-tls4.c: Likewise.
    	* elf/tst-tls5.c: Likewise.
    	* elf/tst-tls6.c: Likewise.
    	* elf/tst-tls7.c: Likewise.
    	* elf/tst-tls8.c: Likewise.
    	* elf/tst-tls9.c: Likewise.
    	* elf/tst-tlsalign-extern.c: Likewise.
    	* elf/tst-tlsalign.c: Likewise.
    	* elf/tst-unique1.c: Likewise.
    	* elf/tst-unique2.c: Likewise.
    	* elf/vismain.c: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 43cb215..e6fcdd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,85 @@
 2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
 
+	* elf/next.c: Import support/test-driver.c instead of
+	test-skeleton.c and delete TEST_FUNCTION macro definition.
+	* elf/nodelete.c: Likewise.
+	* elf/order2.c: Likewise.
+	* elf/tst-_dl_addr_inside_object.c: Likewise.
+	* elf/tst-addr1.c: Likewise.
+	* elf/tst-align.c: Likewise.
+	* elf/tst-align2.c: Likewise.
+	* elf/tst-audit11.c: Likewise.
+	* elf/tst-audit12.c: Likewise.
+	* elf/tst-audit2.c: Likewise.
+	* elf/tst-audit9.c: Likewise.
+	* elf/tst-auxv.c: Likewise and define TEST_FUNCTION_ARGV macro.
+	* elf/tst-deep1.c: Likewise.
+	* elf/tst-dl-iter-static.c: Likewise.
+	* elf/tst-dlmodcount.c: Likewise.
+	* elf/tst-dlmopen1.c: Likewise.
+	* elf/tst-dlmopen2.c: Likewise.
+	* elf/tst-dlmopen3.c: Likewise.
+	* elf/tst-dlopen-aout.c: Likewise.
+	* elf/tst-dlopenrpath.c: Likewise.
+	* elf/tst-dlsym-error.c: Likewise.
+	* elf/tst-execstack-needed.c: Likewise.
+	* elf/tst-execstack-prog.c: Likewise.
+	* elf/tst-execstack.c: Likewise.
+	* elf/tst-global1.c: Likewise.
+	* elf/tst-gnu2-tls1.c: Likewise.
+	* elf/tst-latepthread.c: Likewise.
+	* elf/tst-leaks1.c: Likewise.
+	* elf/tst-linkall-static.c: Likewise.
+	(do_test): New function.
+	* elf/tst-nodelete-opened.c: Likewise.
+	* elf/tst-nodelete.cc: Likewise.
+	* elf/tst-nodelete2.c: Likewise.
+	* elf/tst-noload.c: Likewise.
+	* elf/tst-null-argv.c: Likewise and define TEST_FUNCTION_ARGV marcro.
+	* elf/tst-order-main.c: Likewise.
+	* elf/tst-pathopt.c: Likewise.
+	* elf/tst-pie2.c: Likewise.
+	* elf/tst-piemod1.c: Likewise.
+	* elf/tst-prelink.c: Likewise.
+	* elf/tst-protected1a.c: Likewise.
+	* elf/tst-protected1b.c: Likewise.
+	* elf/tst-ptrguard1.c: Likewise, import getopt.h,
+	and define _GNU_SOURCE macro.
+	(cmdline_process_function): New function.
+	* elf/tst-relsort1.c: Likewise.
+	* elf/tst-stackguard1.c: Likewise, import getopt.h,
+	and define _GNU_SOURCE macro.
+	(cmdline_process_function): New function.
+	* elf/tst-thrlock.c: Likewise.
+	* elf/tst-tls-dlinfo.c: Likewise.
+	* elf/tst-tls-manydynamic.c: Likewise and import support/xthread.h.
+	* elf/tst-tls1.c: Likewise.
+	* elf/tst-tls10.c: Likewise.
+	* elf/tst-tls11.c: Likewise.
+	* elf/tst-tls12.c: Likewise.
+	* elf/tst-tls13.c: Likewise.
+	* elf/tst-tls14.c: Likewise.
+	* elf/tst-tls15.c: Likewise.
+	* elf/tst-tls16.c: Likewise.
+	* elf/tst-tls17.c: Likewise.
+	* elf/tst-tls18.c: Likewise.
+	* elf/tst-tls19.c: Likewise.
+	* elf/tst-tls2.c: Likewise.
+	* elf/tst-tls3.c: Likewise.
+	* elf/tst-tls4.c: Likewise.
+	* elf/tst-tls5.c: Likewise.
+	* elf/tst-tls6.c: Likewise.
+	* elf/tst-tls7.c: Likewise.
+	* elf/tst-tls8.c: Likewise.
+	* elf/tst-tls9.c: Likewise.
+	* elf/tst-tlsalign-extern.c: Likewise.
+	* elf/tst-tlsalign.c: Likewise.
+	* elf/tst-unique1.c: Likewise.
+	* elf/tst-unique2.c: Likewise.
+	* elf/vismain.c: Likewise.
+
+2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
+
 	* string/test-strnlen.c (do_page_tests): New function
 	to check length of strings ending at the page boundary.
 	(test_main): Added call to the do_page_tests function.
diff --git a/elf/next.c b/elf/next.c
index 6a3670c..a0d532b 100644
--- a/elf/next.c
+++ b/elf/next.c
@@ -40,5 +40,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/nodelete.c b/elf/nodelete.c
index 78364a2..c8d7115 100644
--- a/elf/nodelete.c
+++ b/elf/nodelete.c
@@ -18,7 +18,6 @@ handler (int sig)
 }
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -208,4 +207,4 @@ do_test (void)
   return result;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/order2.c b/elf/order2.c
index 3dbfdd1..bcf266d 100644
--- a/elf/order2.c
+++ b/elf/order2.c
@@ -34,8 +34,7 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
 
 static void
 __attribute__ ((destructor))
diff --git a/elf/tst-_dl_addr_inside_object.c b/elf/tst-_dl_addr_inside_object.c
index 3def22a..1604b8d 100644
--- a/elf/tst-_dl_addr_inside_object.c
+++ b/elf/tst-_dl_addr_inside_object.c
@@ -219,5 +219,4 @@ do_test (void)
   return err;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-addr1.c b/elf/tst-addr1.c
index 637906e..68ff74a 100644
--- a/elf/tst-addr1.c
+++ b/elf/tst-addr1.c
@@ -22,5 +22,4 @@ do_test (void)
 	     && strcmp (i.dli_sname, "_IO_printf") != 0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-align.c b/elf/tst-align.c
index 4c14a3d..01b0b4f 100644
--- a/elf/tst-align.c
+++ b/elf/tst-align.c
@@ -49,5 +49,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-align2.c b/elf/tst-align2.c
index eeae609..78b66be 100644
--- a/elf/tst-align2.c
+++ b/elf/tst-align2.c
@@ -152,5 +152,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit11.c b/elf/tst-audit11.c
index c65301d..ff91a6b 100644
--- a/elf/tst-audit11.c
+++ b/elf/tst-audit11.c
@@ -32,5 +32,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit12.c b/elf/tst-audit12.c
index 4e9e63c..62ac5f2 100644
--- a/elf/tst-audit12.c
+++ b/elf/tst-audit12.c
@@ -45,5 +45,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit2.c b/elf/tst-audit2.c
index 1d69cd6..0e66f5c 100644
--- a/elf/tst-audit2.c
+++ b/elf/tst-audit2.c
@@ -57,5 +57,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-audit9.c b/elf/tst-audit9.c
index 7b90a5a..b9de1bf 100644
--- a/elf/tst-audit9.c
+++ b/elf/tst-audit9.c
@@ -8,5 +8,4 @@ do_test (void)
   return fp() - 1;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-auxv.c b/elf/tst-auxv.c
index d2661d9..bc571c5 100644
--- a/elf/tst-auxv.c
+++ b/elf/tst-auxv.c
@@ -66,4 +66,5 @@ do_test (int argc, char *argv[])
   return 0;
 }
 
-#include "../test-skeleton.c"
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>
diff --git a/elf/tst-deep1.c b/elf/tst-deep1.c
index 5428d13..97dce7e 100644
--- a/elf/tst-deep1.c
+++ b/elf/tst-deep1.c
@@ -32,5 +32,4 @@ do_test (void)
   return foo () + f ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dl-iter-static.c b/elf/tst-dl-iter-static.c
index 47de698..9a2758c 100644
--- a/elf/tst-dl-iter-static.c
+++ b/elf/tst-dl-iter-static.c
@@ -43,5 +43,4 @@ do_test (void)
   return status || count != 1;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmodcount.c b/elf/tst-dlmodcount.c
index 76bae85..34c5b25 100644
--- a/elf/tst-dlmodcount.c
+++ b/elf/tst-dlmodcount.c
@@ -105,5 +105,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen1.c b/elf/tst-dlmopen1.c
index 5a05891..24145cf 100644
--- a/elf/tst-dlmopen1.c
+++ b/elf/tst-dlmopen1.c
@@ -77,5 +77,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen2.c b/elf/tst-dlmopen2.c
index 0569997..8489ffb 100644
--- a/elf/tst-dlmopen2.c
+++ b/elf/tst-dlmopen2.c
@@ -66,5 +66,4 @@ round %d, namespace %d: duplicate allocate of namespace %ld",
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
index 26c86b2..8167507 100644
--- a/elf/tst-dlmopen3.c
+++ b/elf/tst-dlmopen3.c
@@ -18,5 +18,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
index d780f8c..34a1cdb 100644
--- a/elf/tst-dlopen-aout.c
+++ b/elf/tst-dlopen-aout.c
@@ -64,4 +64,4 @@ do_test (int argc, char *argv[])
 }
 
 #define TEST_FUNCTION do_test (argc, argv)
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlopenrpath.c b/elf/tst-dlopenrpath.c
index ac72a1e..77346d3 100644
--- a/elf/tst-dlopenrpath.c
+++ b/elf/tst-dlopenrpath.c
@@ -67,5 +67,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-dlsym-error.c b/elf/tst-dlsym-error.c
index 22dcff4..fac8f10 100644
--- a/elf/tst-dlsym-error.c
+++ b/elf/tst-dlsym-error.c
@@ -110,5 +110,4 @@ do_test (void)
 }
 
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack-needed.c b/elf/tst-execstack-needed.c
index 03090f7..8b794a3 100644
--- a/elf/tst-execstack-needed.c
+++ b/elf/tst-execstack-needed.c
@@ -31,6 +31,4 @@ deeper (void (*f) (void))
   memfrob (stack, sizeof stack);
 }
 
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack-prog.c b/elf/tst-execstack-prog.c
index 5a66d63..8663153 100644
--- a/elf/tst-execstack-prog.c
+++ b/elf/tst-execstack-prog.c
@@ -30,6 +30,4 @@ deeper (void (*f) (void))
   memfrob (stack, sizeof stack);
 }
 
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-execstack.c b/elf/tst-execstack.c
index 02cc270..114f341 100644
--- a/elf/tst-execstack.c
+++ b/elf/tst-execstack.c
@@ -233,5 +233,4 @@ deeper (void (*f) (void))
 }
 
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-global1.c b/elf/tst-global1.c
index 4df335c..5dae74e 100644
--- a/elf/tst-global1.c
+++ b/elf/tst-global1.c
@@ -35,5 +35,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-gnu2-tls1.c b/elf/tst-gnu2-tls1.c
index 8acbfa6..b33b60a 100644
--- a/elf/tst-gnu2-tls1.c
+++ b/elf/tst-gnu2-tls1.c
@@ -48,5 +48,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-latepthread.c b/elf/tst-latepthread.c
index a0a55e4..ca2f822 100644
--- a/elf/tst-latepthread.c
+++ b/elf/tst-latepthread.c
@@ -101,5 +101,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-leaks1.c b/elf/tst-leaks1.c
index dcff28d..d67e826 100644
--- a/elf/tst-leaks1.c
+++ b/elf/tst-leaks1.c
@@ -24,5 +24,4 @@ do_test (void)
   return ret;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-linkall-static.c b/elf/tst-linkall-static.c
index 964cd7a..8f40657 100644
--- a/elf/tst-linkall-static.c
+++ b/elf/tst-linkall-static.c
@@ -42,6 +42,11 @@ void *references[] =
     &getaddrinfo_a,             /* libanl */
   };
 
-/* This is a link-time test.  There is nothing to run here.  */
-#define TEST_FUNCTION 0
-#include "../test-skeleton.c"
+static int
+do_test (void)
+{
+  /* This is a link-time test.  There is nothing to run here.  */
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete-opened.c b/elf/tst-nodelete-opened.c
index 9db49da..d71efa4 100644
--- a/elf/tst-nodelete-opened.c
+++ b/elf/tst-nodelete-opened.c
@@ -65,5 +65,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete.cc b/elf/tst-nodelete.cc
index 176cb68..5752e7d 100644
--- a/elf/tst-nodelete.cc
+++ b/elf/tst-nodelete.cc
@@ -47,5 +47,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
index 388e8af..010c4ae 100644
--- a/elf/tst-nodelete2.c
+++ b/elf/tst-nodelete2.c
@@ -33,5 +33,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-noload.c b/elf/tst-noload.c
index fd1e273..3fb2895 100644
--- a/elf/tst-noload.c
+++ b/elf/tst-noload.c
@@ -69,5 +69,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-null-argv.c b/elf/tst-null-argv.c
index caf76aa..21b8732 100644
--- a/elf/tst-null-argv.c
+++ b/elf/tst-null-argv.c
@@ -32,4 +32,5 @@ do_test (int argc, char **argv)
   return 0;
 }
 
-#include <test-skeleton.c>
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>
diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
index 339778a..2a90130 100644
--- a/elf/tst-order-main.c
+++ b/elf/tst-order-main.c
@@ -9,5 +9,4 @@ do_test (void)
   exit(EXIT_SUCCESS);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c
index 8d73ad4..e2c96fb 100644
--- a/elf/tst-pathopt.c
+++ b/elf/tst-pathopt.c
@@ -38,5 +38,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-pie2.c b/elf/tst-pie2.c
index bf11662..32943bb 100644
--- a/elf/tst-pie2.c
+++ b/elf/tst-pie2.c
@@ -37,5 +37,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-piemod1.c b/elf/tst-piemod1.c
index 6e98b5f..72d7e0a 100644
--- a/elf/tst-piemod1.c
+++ b/elf/tst-piemod1.c
@@ -19,5 +19,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
index 6a782ed..7435c32 100644
--- a/elf/tst-prelink.c
+++ b/elf/tst-prelink.c
@@ -26,5 +26,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-protected1a.c b/elf/tst-protected1a.c
index 3730357..4267b95 100644
--- a/elf/tst-protected1a.c
+++ b/elf/tst-protected1a.c
@@ -40,10 +40,8 @@ extern int do_test (void);
 
 int protected2 = -1;
 
-#define TEST_FUNCTION do_test ()
-
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 int
 do_test (void)
diff --git a/elf/tst-protected1b.c b/elf/tst-protected1b.c
index 95f2c47..9fd695b 100644
--- a/elf/tst-protected1b.c
+++ b/elf/tst-protected1b.c
@@ -40,10 +40,8 @@ extern int do_test (void);
 
 int protected2 = -1;
 
-#define TEST_FUNCTION do_test ()
-
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 int
 do_test (void)
diff --git a/elf/tst-ptrguard1.c b/elf/tst-ptrguard1.c
index 91fbc79..8ea65bb 100644
--- a/elf/tst-ptrguard1.c
+++ b/elf/tst-ptrguard1.c
@@ -25,6 +25,12 @@
 #include <tls.h>
 #include <unistd.h>
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+/* Requires _GNU_SOURCE  */
+#include <getopt.h>
+
 #ifndef POINTER_CHK_GUARD
 extern uintptr_t __pointer_chk_guard;
 # define POINTER_CHK_GUARD __pointer_chk_guard
@@ -191,12 +197,21 @@ do_test (void)
 #define CMDLINE_OPTIONS	\
   { "command", required_argument, NULL, OPT_COMMAND },  \
   { "child", no_argument, NULL, OPT_CHILD },
-#define CMDLINE_PROCESS	\
-  case OPT_COMMAND:	\
-    command = optarg;	\
-    break;		\
-  case OPT_CHILD:	\
-    child = true;	\
-    break;
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+
+static void __attribute((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      case OPT_COMMAND:
+        command = optarg;
+        break;
+      case OPT_CHILD:
+        child = true;
+        break;
+    }
+}
+
+#define CMDLINE_PROCESS	cmdline_process_function
+
+#include <support/test-driver.c>
diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
index a87b138..775c968 100644
--- a/elf/tst-relsort1.c
+++ b/elf/tst-relsort1.c
@@ -15,5 +15,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-stackguard1.c b/elf/tst-stackguard1.c
index a3f967b..78e33c7 100644
--- a/elf/tst-stackguard1.c
+++ b/elf/tst-stackguard1.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <getopt.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -185,12 +186,20 @@ do_test (void)
 #define CMDLINE_OPTIONS	\
   { "command", required_argument, NULL, OPT_COMMAND },  \
   { "child", no_argument, NULL, OPT_CHILD },
-#define CMDLINE_PROCESS	\
-  case OPT_COMMAND:	\
-    command = optarg;	\
-    break;		\
-  case OPT_CHILD:	\
-    child = true;	\
-    break;
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+
+static void __attribute__((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      case OPT_COMMAND:
+        command = optarg;
+        break;
+      case OPT_CHILD:
+        child = true;
+        break;
+    }
+}
+#define CMDLINE_PROCESS	cmdline_process_function
+
+#include <support/test-driver.c>
diff --git a/elf/tst-thrlock.c b/elf/tst-thrlock.c
index fe72eba..1beffc3 100644
--- a/elf/tst-thrlock.c
+++ b/elf/tst-thrlock.c
@@ -55,5 +55,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls-dlinfo.c b/elf/tst-tls-dlinfo.c
index 28661b1..7d2b42e 100644
--- a/elf/tst-tls-dlinfo.c
+++ b/elf/tst-tls-dlinfo.c
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -83,4 +82,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls-manydynamic.c b/elf/tst-tls-manydynamic.c
index 49bb52c..b072d0b 100644
--- a/elf/tst-tls-manydynamic.c
+++ b/elf/tst-tls-manydynamic.c
@@ -24,6 +24,7 @@
 
 #include "tst-tls-manydynamic.h"
 
+#include <errno.h>
 #include <dlfcn.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -31,8 +32,8 @@
 #include <string.h>
 
 static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/xthread.h>
+#include <support/test-driver.c>
 
 void *handles[COUNT];
 set_value_func set_value_funcs[COUNT];
diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c
index bec0a2f..c31da56 100644
--- a/elf/tst-tls1.c
+++ b/elf/tst-tls1.c
@@ -9,7 +9,6 @@ COMMON_INT_DEF(foo);
 COMMON_INT_DEF(bar);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -80,4 +79,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls10.c b/elf/tst-tls10.c
index eb1ecb9..d9611aa 100644
--- a/elf/tst-tls10.c
+++ b/elf/tst-tls10.c
@@ -36,5 +36,4 @@ do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls11.c b/elf/tst-tls11.c
index 8ceac14..a5c3dd7 100644
--- a/elf/tst-tls11.c
+++ b/elf/tst-tls11.c
@@ -25,5 +25,4 @@ do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls12.c b/elf/tst-tls12.c
index 8093894..ccd5f8b 100644
--- a/elf/tst-tls12.c
+++ b/elf/tst-tls12.c
@@ -16,5 +16,4 @@ do_test (void)
   exit (0);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls13.c b/elf/tst-tls13.c
index 9af08cf..b1d3033 100644
--- a/elf/tst-tls13.c
+++ b/elf/tst-tls13.c
@@ -25,5 +25,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls14.c b/elf/tst-tls14.c
index 6bacb59..a6a79ef 100644
--- a/elf/tst-tls14.c
+++ b/elf/tst-tls14.c
@@ -51,5 +51,4 @@ do_test (void)
   return result;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls15.c b/elf/tst-tls15.c
index d2e1f3d..db2a4f4 100644
--- a/elf/tst-tls15.c
+++ b/elf/tst-tls15.c
@@ -29,5 +29,4 @@ do_test (void)
   return fp ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls16.c b/elf/tst-tls16.c
index 347b2f5..f2830b8 100644
--- a/elf/tst-tls16.c
+++ b/elf/tst-tls16.c
@@ -49,5 +49,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls17.c b/elf/tst-tls17.c
index 6dde974..c2a972d 100644
--- a/elf/tst-tls17.c
+++ b/elf/tst-tls17.c
@@ -25,5 +25,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls18.c b/elf/tst-tls18.c
index ba4b800..b705b61 100644
--- a/elf/tst-tls18.c
+++ b/elf/tst-tls18.c
@@ -34,5 +34,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls19.c b/elf/tst-tls19.c
index acbc1d6..dd8ea42 100644
--- a/elf/tst-tls19.c
+++ b/elf/tst-tls19.c
@@ -23,5 +23,4 @@ do_test (void)
   return fn ();
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c
index d0b6d51..963b8d6 100644
--- a/elf/tst-tls2.c
+++ b/elf/tst-tls2.c
@@ -9,7 +9,6 @@ VAR_INT_DEF(foo);
 VAR_INT_DEF(bar);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -80,4 +79,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c
index ca96c6a..7e0abb4 100644
--- a/elf/tst-tls3.c
+++ b/elf/tst-tls3.c
@@ -13,7 +13,6 @@ VAR_INT_DEF(baz);
 extern int in_dso (void);
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -65,4 +64,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls4.c b/elf/tst-tls4.c
index 63170c3..6841f81 100644
--- a/elf/tst-tls4.c
+++ b/elf/tst-tls4.c
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -47,4 +46,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls5.c b/elf/tst-tls5.c
index 76905c5..5f006fd 100644
--- a/elf/tst-tls5.c
+++ b/elf/tst-tls5.c
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -63,4 +62,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls6.c b/elf/tst-tls6.c
index 9e6235f..df81c1f 100644
--- a/elf/tst-tls6.c
+++ b/elf/tst-tls6.c
@@ -5,7 +5,6 @@
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -82,4 +81,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls7.c b/elf/tst-tls7.c
index 23a16e4..fa46709 100644
--- a/elf/tst-tls7.c
+++ b/elf/tst-tls7.c
@@ -5,7 +5,6 @@
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -53,4 +52,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls8.c b/elf/tst-tls8.c
index 4bf3e3f..c779572 100644
--- a/elf/tst-tls8.c
+++ b/elf/tst-tls8.c
@@ -5,7 +5,6 @@
 #include <link.h>
 
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -165,5 +164,4 @@ do_test (void)
   return result;
 }
 
-
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tls9.c b/elf/tst-tls9.c
index 6306fb5..ee21b47 100644
--- a/elf/tst-tls9.c
+++ b/elf/tst-tls9.c
@@ -4,7 +4,6 @@
 
 #include <link.h>
 
-#define TEST_FUNCTION do_test ()
 static int
 do_test (void)
 {
@@ -34,4 +33,4 @@ do_test (void)
 }
 
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tlsalign-extern.c b/elf/tst-tlsalign-extern.c
index 11659a3..11384d0 100644
--- a/elf/tst-tlsalign-extern.c
+++ b/elf/tst-tlsalign-extern.c
@@ -70,5 +70,4 @@ do_test (void)
   return fail ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-tlsalign.c b/elf/tst-tlsalign.c
index bd82112..b129ebd 100644
--- a/elf/tst-tlsalign.c
+++ b/elf/tst-tlsalign.c
@@ -81,5 +81,4 @@ do_test (void)
   return fail ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-unique1.c b/elf/tst-unique1.c
index 17af6f1..b5e53e4 100644
--- a/elf/tst-unique1.c
+++ b/elf/tst-unique1.c
@@ -70,5 +70,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/tst-unique2.c b/elf/tst-unique2.c
index 4426754..e0173b7 100644
--- a/elf/tst-unique2.c
+++ b/elf/tst-unique2.c
@@ -24,5 +24,4 @@ do_test (void)
   return f (&var);
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/elf/vismain.c b/elf/vismain.c
index d001023..43f1d8f 100644
--- a/elf/vismain.c
+++ b/elf/vismain.c
@@ -29,10 +29,9 @@
 /* Prototype for our test function.  */
 extern int do_test (void);
 
-#define TEST_FUNCTION do_test ()
 
 /* This defines the `main' function and some more.  */
-#include <test-skeleton.c>
+#include <support/test-driver.c>
 
 
 /* Prototypes for local functions.  */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ff65c87443fe628d1e1e0106a5fcafc2104a5d7e

commit ff65c87443fe628d1e1e0106a5fcafc2104a5d7e
Author: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
Date:   Wed Apr 5 10:28:21 2017 -0300

    Add page tests to string/test-strnlen.
    
    May be tricky for otimized implementations to handle strings around
    page boundary once, for instance, it is performed unaligned loads or
    when maxlen is used as a hint for vectorized loops. The test cases
    should unveil regression bugs on these cases.
    
    To some extend do_random_tests in string/test-strnlen tests strings
    placed at page end but it does not cover all cases. So this change
    adds tests which consists of placing strings of varying sizes ending
    at the page boundary. It also combines with different values of maxlen.
    
    Tested on ppc64le and x86_64.
    
    	* string/test-strnlen.c (do_page_tests): New function
    	to check length of strings ending at the page boundary.
    	(test_main): Added call to the do_page_tests function.

diff --git a/ChangeLog b/ChangeLog
index 7ee1347..43cb215 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
 2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
+
+	* string/test-strnlen.c (do_page_tests): New function
+	to check length of strings ending at the page boundary.
+	(test_main): Added call to the do_page_tests function.
+
+2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
 	    Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/multiarch/Makefile
diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index 277146f..e56cdb6 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -143,6 +143,59 @@ do_random_tests (void)
     }
 }
 
+/* Tests meant to unveil fail on implementation that does not access bytes
+   around the page boundary accordingly.  */
+static void
+do_page_tests (void)
+{
+  size_t i, exp_len, start_offset, offset;
+  /* Calculate the null character offset.  */
+  size_t last_offset = (page_size / sizeof (CHAR)) - 1;
+
+  CHAR *s = (CHAR *) buf2;
+  memset (s, 65, (last_offset - 1));
+  s[last_offset] = 0;
+
+  /* Place short strings ending at page boundary.  */
+  offset = last_offset;
+  for (i = 0; i < 128; i++)
+    {
+      /* Decrease offset to stress several sizes and alignments.  */
+      offset--;
+      exp_len = last_offset - offset;
+      FOR_EACH_IMPL (impl, 0)
+        {
+          /* Varies maxlen value to cover the cases where it is:
+               - larger than length;
+               - slightly greater than length;
+               - equal to length;
+               - slightly less than length.  */
+          do_one_test (impl, (CHAR *) (s + offset), page_size, exp_len);
+          do_one_test (impl, (CHAR *) (s + offset), exp_len + 1, exp_len);
+          do_one_test (impl, (CHAR *) (s + offset), exp_len, exp_len);
+          if (exp_len > 0)
+            do_one_test (impl, (CHAR *) (s + offset), exp_len - 1, exp_len - 1);
+        }
+    }
+
+  /* Place long strings ending at page boundary.  */
+  start_offset = (last_offset + 1) / 2;
+  for (i = 0; i < 64; ++i)
+    {
+      /* Increase offset to stress several alignments.  */
+      offset = start_offset + i;
+      if (offset >= (last_offset + 1))
+        break;
+      exp_len = last_offset - offset;
+      FOR_EACH_IMPL (impl, 0)
+        {
+          /* Checks only for maxlen much larger than length because smaller
+             values are already covered in do_random_tests function.  */
+          do_one_test (impl, (CHAR *) (s + offset), page_size, exp_len);
+        }
+    }
+}
+
 int
 test_main (void)
 {
@@ -188,6 +241,7 @@ test_main (void)
     }
 
   do_random_tests ();
+  do_page_tests ();
   return ret;
 }
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=18b6e2c86ce03c9be8ee0a53840fe5d533de22b3

commit 18b6e2c86ce03c9be8ee0a53840fe5d533de22b3
Author: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
Date:   Wed Apr 5 10:24:24 2017 -0300

    powerpc64: Add POWER8 strnlen
    
    Added strnlen POWER8 otimized for long strings. It delivers
    same performance as POWER7 implementation for short strings.
    
    This takes advantage of reasonably performing unaligned loads
    and bit permutes to check the first 1-16 bytes until
    quadword aligned, then checks in 64 bytes strides until unsafe,
    then 16 bytes, truncating the count if need be.
    
    Likewise, the POWER7 code is recycled for less than 32 bytes strings.
    
    Tested on ppc64 and ppc64le.
    
    	* sysdeps/powerpc/powerpc64/multiarch/Makefile
    	(sysdep_routines): Add strnlen-power8.
    	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
    	(strnlen): Add __strnlen_power8 to list of strnlen functions.
    	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S:
    	New file.
    	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c
    	(__strnlen): Add __strnlen_power8 to ifunc list.
    	* sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.

diff --git a/ChangeLog b/ChangeLog
index 7bc2507..7ee1347 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-04-05  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
+	    Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
+	* sysdeps/powerpc/powerpc64/multiarch/Makefile
+	(sysdep_routines): Add strnlen-power8.
+	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+	(strnlen): Add __strnlen_power8 to list of strnlen functions.
+	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S: New file.
+	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+	(__strnlen): Add __strnlen_power8 to ifunc list.
+	* sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.
+
 2017-04-04  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>
 
 	* wcsmbs/tst-btowc.c: Import support/test-driver.c and remove
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
index f5889a3..38233a7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -5,8 +5,9 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
 		   memset-ppc64 memset-power8 \
 		   mempcpy-power7 mempcpy-ppc64 memchr-power7 memchr-ppc64 \
 		   memrchr-power7 memrchr-ppc64 rawmemchr-power7 \
-		   rawmemchr-ppc64 strlen-power7 strlen-ppc64 strnlen-power7 \
-		   strnlen-ppc64 strcasecmp-power7 strcasecmp_l-power7 \
+		   rawmemchr-ppc64 strlen-power7 strlen-ppc64 \
+		   strnlen-power8 strnlen-power7 strnlen-ppc64 \
+		   strcasecmp-power7 strcasecmp_l-power7 \
 		   strncase-power7 strncase_l-power7 \
 		   strncmp-power9 strncmp-power8 strncmp-power7 \
 		   strncmp-power4 strncmp-ppc64 \
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
index 209aec5..30a0133 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -204,6 +204,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   /* Support sysdeps/powerpc/powerpc64/multiarch/strnlen.c.  */
   IFUNC_IMPL (i, name, strnlen,
+	      IFUNC_IMPL_ADD (array, i, strnlen,
+			      hwcap2 & PPC_FEATURE2_ARCH_2_07,
+			      __strnlen_power8)
 	      IFUNC_IMPL_ADD (array, i, strnlen, hwcap & PPC_FEATURE_HAS_VSX,
 			      __strnlen_power7)
 	      IFUNC_IMPL_ADD (array, i, strnlen, 1,
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c b/sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S
similarity index 53%
copy from sysdeps/powerpc/powerpc64/multiarch/strnlen.c
copy to sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S
index 9854c18..ccea15d 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S
@@ -1,5 +1,5 @@
-/* Multiple versions of strnlen.
-   Copyright (C) 2013-2017 Free Software Foundation, Inc.
+/* Optimized strnlen version for POWER8.
+   Copyright (C) 2017 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,23 +16,13 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
-# define strnlen __redirect_strnlen
-# define __strnlen __redirect___strnlen
-# include <string.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
+#include <sysdep.h>
 
-extern __typeof (__strnlen) __strnlen_ppc attribute_hidden;
-extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
-# undef strnlen
-# undef __strnlen
-libc_ifunc_redirected (__redirect___strnlen, __strnlen,
-		       (hwcap & PPC_FEATURE_HAS_VSX)
-		       ? __strnlen_power7
-		       : __strnlen_ppc);
-weak_alias (__strnlen, strnlen)
+#define __strnlen __strnlen_power8
 
-#else
-#include <string/strnlen.c>
-#endif
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+#undef weak_alias
+#define weak_alias(name, alias)
+
+#include <sysdeps/powerpc/powerpc64/power8/strnlen.S>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
index 9854c18..7f89132 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
@@ -25,12 +25,15 @@
 
 extern __typeof (__strnlen) __strnlen_ppc attribute_hidden;
 extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
+extern __typeof (__strnlen) __strnlen_power8 attribute_hidden;
 # undef strnlen
 # undef __strnlen
 libc_ifunc_redirected (__redirect___strnlen, __strnlen,
-		       (hwcap & PPC_FEATURE_HAS_VSX)
-		       ? __strnlen_power7
-		       : __strnlen_ppc);
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strnlen_power8 :
+			 (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strnlen_power7
+			 : __strnlen_ppc);
 weak_alias (__strnlen, strnlen)
 
 #else
diff --git a/sysdeps/powerpc/powerpc64/power8/strnlen.S b/sysdeps/powerpc/powerpc64/power8/strnlen.S
new file mode 100644
index 0000000..3eadbfb
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/power8/strnlen.S
@@ -0,0 +1,433 @@
+/* Optimized strnlen implementation for POWER8 using a vmx loop.
+
+   Copyright (C) 2017 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/>.  */
+
+/* It is implemented the following heuristic:
+	1. Case maxlen <= 32: align the pointer to 8 bytes to loop through
+	reading doublewords. Uses the POWER7 algorithm.
+	2. Case maxlen > 32: check for null bytes in the first 16 bytes using
+	unaligned accesses. Return length if found. Otherwise:
+		2.1 Case maxlen < 64: deduct the bytes previously read, align
+		the pointer to 16 bytes and loop through reading quadwords
+		until find null bytes or reach maxlen.
+		2.2 Case maxlen > 64: deduct the bytes previously read, align
+		the pointer to 64 bytes and set up a counter to loop through
+		reading in strides of 64 bytes. In case it finished the loop
+		with null bytes not found, process the remainder bytes by
+		switching to the loop to heuristic in 2.1.  */
+
+#include <sysdep.h>
+
+/* Define default page size to 4KB.  */
+#define PAGE_SIZE 4096
+
+/* The following macros implement Power ISA v2.07 opcodes
+   that could not be used directly into this code to the keep
+   compatibility with older binutils versions.  */
+
+/* Move from vector register doubleword.  */
+#define MFVRD(r,v) .long (0x7c000067 | ((v)<<(32-11)) | ((r)<<(32-16)))
+
+/* Move to vector register doubleword.  */
+#define MTVRD(v,r) .long (0x7c000167 | ((v)<<(32-11)) | ((r)<<(32-16)))
+
+/* Vector Bit Permute Quadword.  */
+#define VBPERMQ(t,a,b)	.long (0x1000054c	\
+			       | ((t)<<(32-11))	\
+			       | ((a)<<(32-16))	\
+			       | ((b)<<(32-21)) )
+
+/* Vector Population Count Halfword.  */
+#define VPOPCNTH(t,b) .long (0x10000743 | ((t)<<(32-11)) | ((b)<<(32-21)))
+
+/* Vector Count Leading Zeros Halfword.  */
+#define VCLZH(t,b) .long (0x10000742 | ((t)<<(32-11)) | ((b)<<(32-21)))
+
+
+/* int [r3] strnlen (char *s [r3], size_t maxlen [r4])  */
+/* TODO: change to power8 when minimum required binutils allows it.  */
+	.machine  power7
+ENTRY (__strnlen)
+	CALL_MCOUNT 2
+	dcbt	0,r3
+
+	cmpldi	r4,32           /* Check if maxlen <= 32.  */
+	ble	L(small_range)  /* If maxlen <= 32.  */
+
+	/* Upcoming 16 bytes unaligned accesses cannot cross the page boundary
+	   otherwise the processor throws an memory access error.
+	   Use following code to check there is room for such as accesses:
+	     (((size_t) s) % PAGE_SIZE > (PAGE_SIZE - 16)
+	   If it is disallowed then switch to the code that handles
+	   the string when maxlen <= 32.  */
+	clrldi	r10,r3,52
+	cmpldi  cr7,r10,PAGE_SIZE-16
+	bgt     cr7,L(small_range)	/* If less than 16B of page end.  */
+
+	/* Compute our permute constant r8.  */
+	li	r7,0
+	/* Compute a bpermd constant to move bit 0 of each word into
+	   a halfword value, and count trailing zeros.  */
+#ifdef __LITTLE_ENDIAN__
+	li	r8,0x2820
+	oris	r8,r8,0x3830
+	sldi	r8,r8,32
+	ori	r8,r8,0x0800
+	oris	r8,r8,0x1810
+#else
+	li	r8,0x1018
+	oris	r8,r8,0x0008
+	sldi	r8,r8,32
+	ori	r8,r8,0x3038
+	oris	r8,r8,0x2028
+#endif
+
+	/* maxlen > 32. Optimistically check for null bytes in the first
+	   16 bytes of the string using unaligned accesses.  */
+	ld	r5,0(r3)
+	ld	r6,8(r3)
+	cmpb	r10,r7,r5		/* Check for null bytes in DWORD1.  */
+	cmpb	r11,r7,r6		/* Check for null bytes in DWORD2.  */
+	or.	r7,r10,r11
+	bne	cr0, L(early_find)	/* If found null bytes.  */
+
+	/* At this point maxlen > 32 and null bytes were not found at first
+	   16 bytes. Prepare for loop using VMX.  */
+
+	/* r3 == s, r4 == maxlen. All other volatile regs are unused now.  */
+
+	addi	r5,r3,16	/* Align up, or just add the 16B we
+				   already checked.  */
+	li	r0,15
+	and	r7,r5,r0	/* Find offset into 16B alignment.  */
+	andc	r5,r5,r0	/* Quadword align up s to the next quadword.  */
+	li	r0,16
+	subf	r0,r7,r0
+	subf	r4,r0,r4	/* Deduct unaligned bytes from maxlen.  */
+
+
+	/* Compute offsets for vmx loads, and precompute the vbpermq
+	   constants for both the 64B and 16B loops.  */
+	li	r6,0
+	vspltisb  v0,0
+	vspltisb  v10,3
+	lvsl	  v11,r6,r6
+	vslb	  v10,v11,v10
+
+	cmpldi  r4,64		/* Check maxlen < 64.  */
+	blt	L(smaller)	/* If maxlen < 64 */
+
+	/* In order to begin the 64B loop, it needs to be 64
+	   bytes aligned. So read quadwords until it is aligned or found null
+	   bytes. At worst case it will be aligned after the fourth iteration,
+	   so unroll the loop to avoid counter checking.  */
+	andi.   r7,r5,63		/* Check if is 64 bytes aligned.  */
+	beq     cr0,L(preloop_64B)	/* If it is already 64B aligned.  */
+	lvx     v1,r5,r6
+	vcmpequb.       v1,v1,v0
+	addi    r5,r5,16
+	addi    r4,r4,-16		/* Decrement maxlen in 16 bytes. */
+	bne     cr6,L(found_aligning64B) /* If found null bytes.  */
+
+	/* Unroll 3x above code block until aligned or find null bytes.  */
+	andi.   r7,r5,63
+	beq     cr0,L(preloop_64B)
+	lvx     v1,r5,r6
+	vcmpequb.      v1,v1,v0
+	addi    r5,r5,16
+	addi    r4,r4,-16
+	bne     cr6,L(found_aligning64B)
+
+	andi.   r7,r5,63
+	beq     cr0,L(preloop_64B)
+	lvx     v1,r5,r6
+	vcmpequb.      v1,v1,v0
+	addi    r5,r5,16
+	addi    r4,r4,-16
+	bne     cr6,L(found_aligning64B)
+
+	andi.   r7,r5,63
+	beq     cr0,L(preloop_64B)
+	lvx     v1,r5,r6
+	vcmpequb.      v1,v1,v0
+	addi    r5,r5,16
+	addi    r4,r4,-16
+	bne     cr6,L(found_aligning64B)
+
+	/* At this point it should be 16 bytes aligned.
+	   Prepare for the 64B loop.  */
+	.p2align 4
+L(preloop_64B):
+	/* Check if maxlen became is less than 64, therefore disallowing the
+	   64B loop. If it happened switch to the 16B loop code.  */
+	cmpldi  r4,64		/* Check if maxlen < 64.  */
+	blt     L(smaller)	/* If maxlen < 64.  */
+	/* Set some constant values.  */
+	li      r7,16
+	li      r10,32
+	li      r9,48
+
+	/* Compute the number of 64 bytes iterations needed.  */
+	srdi	r11,r4,6	/* Compute loop count (maxlen / 64).  */
+	andi.	r4,r4,63	/* Set maxlen the remainder (maxlen % 64).  */
+	mtctr	r11		/* Move loop count to counter register.  */
+
+	/* Handle maxlen > 64. Loop over the bytes in strides of 64B.  */
+	.p2align 4
+L(loop_64B):
+	lvx	v1,r5,r6	/* r5 is the pointer to s.  */
+	lvx	v2,r5,r7
+	lvx	v3,r5,r10
+	lvx	v4,r5,r9
+	/* Compare the four 16B vectors to obtain the least 16 values.
+	   Null bytes should emerge into v7, then check for null bytes.  */
+	vminub	v5,v1,v2
+	vminub	v6,v3,v4
+	vminub	v7,v5,v6
+	vcmpequb. v7,v7,v0		/* Check for null bytes.  */
+	addi	r5,r5,64		/* Add pointer to next iteraction.  */
+	bne	cr6,L(found_64B)	/* If found null bytes.  */
+	bdnz	L(loop_64B)		/* Continue the loop if count > 0. */
+
+/* Hit loop end without null match. So branch to handle the remainder.  */
+
+	/* Prepare a 16B loop to handle two cases:
+		1. If 32 > maxlen < 64.
+		2. If maxlen >= 64, and reached end of the 64B loop with null
+		bytes not found. Thus handle the remainder bytes here. */
+	.p2align 4
+L(smaller):
+        cmpldi  r4,0            /* Check maxlen is zero.  */
+        beq     L(done)         /* If maxlen is zero.  */
+
+	/* Place rounded up number of qw's to check into a vmx
+	   register, and use some vector tricks to minimize
+	   branching.  */
+        MTVRD(v7,r4)            /* Copy maxlen from GPR to vector register. */
+        vspltisb v5,1
+        vspltisb v6,15
+        vspltb   v2,v7,7
+        vaddubs  v3,v5,v6
+
+#ifdef __LITTLE_ENDIAN__
+	vspltish v5,1           /* Compute 16 in each byte.  */
+#endif
+
+	/* Loop in 16B aligned incremements now. */
+	.p2align 4
+L(loop_16B):
+	lvx     v1,r5,r6        /* Load quadword into vector register.  */
+	addi    r5,r5,16        /* Increment address to next 16B block.  */
+	vor     v7,v2,v2        /* Save loop count (v2) into v7. */
+	vsububs v2,v2,v3        /* Subtract 16B from count, saturate at 0. */
+	vminub  v4,v1,v2
+	vcmpequb. v4,v4,v0      /* Checking for null bytes.  */
+	beq     cr6,L(loop_16B) /* If null bytes not found.  */
+
+	vcmpequb  v1,v1,v0
+	VBPERMQ(v1,v1,v10)
+#ifdef __LITTLE_ENDIAN__
+	vsubuhm  v2,v1,v5       /* Form a mask of trailing zeros.  */
+	vandc    v2,v2,v1
+	VPOPCNTH(v1,v2)         /* Count of trailing zeros, 16 if none.  */
+#else
+	VCLZH(v1,v1)            /* Count the leading zeros, 16 if none.  */
+#endif
+	/* Truncate to maximum allowable offset.  */
+	vcmpgtub v2,v1,v7       /* Compare and truncate for matches beyond
+				   maxlen.  */
+	vsel     v1,v1,v7,v2    /* 0-16 is now in byte 7.  */
+
+	MFVRD(r0,v1)
+	addi    r5,r5,-16       /* Undo speculative bump.  */
+	extsb   r0,r0           /* Clear whatever gunk is in the high 56b.  */
+	add     r5,r5,r0        /* Add the offset of whatever was found.  */
+L(done):
+	subf    r3,r3,r5        /* Length is equal to the offset of null byte
+				   matched minus the pointer to s.  */
+	blr                     /* Done.  */
+
+	/* Handle case of maxlen > 64 and found null bytes in last block
+	   of 64 bytes read.  */
+	.p2align 4
+L(found_64B):
+	/* A zero was found. Reduce the result.  */
+	vcmpequb  v1,v1,v0
+	vcmpequb  v2,v2,v0
+	vcmpequb  v3,v3,v0
+	vcmpequb  v4,v4,v0
+
+	/* Permute the first bit of each byte into bits 48-63.  */
+	VBPERMQ(v1,v1,v10)
+	VBPERMQ(v2,v2,v10)
+	VBPERMQ(v3,v3,v10)
+	VBPERMQ(v4,v4,v10)
+
+	/* Shift each component into its correct position for merging.  */
+#ifdef __LITTLE_ENDIAN__
+	vsldoi	v2,v2,v2,2
+	vsldoi	v3,v3,v3,4
+	vsldoi	v4,v4,v4,6
+#else
+	vsldoi	v1,v1,v1,6
+	vsldoi	v2,v2,v2,4
+	vsldoi	v3,v3,v3,2
+#endif
+
+	/* Merge the results and move to a GPR.  */
+	vor	v1,v2,v1
+	vor	v2,v3,v4
+	vor	v4,v1,v2
+
+	/* Adjust address to the start of the current 64B block.  */
+	addi	r5,r5,-64
+
+	MFVRD(r10,v4)
+#ifdef __LITTLE_ENDIAN__
+	addi	r9,r10,-1	/* Form a mask from trailing zeros.  */
+	andc	r9,r9,r10
+	popcntd	r0,r9		/* Count the bits in the mask.  */
+#else
+	cntlzd	r0,r10		/* Count leading zeros before the match.  */
+#endif
+	subf	r5,r3,r5
+	add	r3,r5,r0	/* Compute final length.  */
+	blr                     /* Done.  */
+
+	/* Handle case where null bytes were found while aligning
+	   as a preparation for the 64B loop.  */
+	.p2align 4
+L(found_aligning64B):
+	VBPERMQ(v1,v1,v10)
+#ifdef __LITTLE_ENDIAN__
+	MFVRD(r10,v1)
+	addi    r9,r10,-1       /* Form a mask from trailing zeros.  */
+	andc    r9,r9,r10
+	popcntd r0,r9           /* Count the bits in the mask.  */
+#else
+	vsldoi  v1,v1,v1,6
+	MFVRD(r10,v1)
+	cntlzd  r0,r10          /* Count leading zeros before the match.  */
+#endif
+	addi    r5,r5,-16	/* Adjust address to offset of last 16 bytes
+				   read.  */
+	/* Calculate length as subtracted the pointer to s of last 16 bytes
+	   offset, added with the bytes before the match.  */
+	subf    r5,r3,r5
+	add     r3,r5,r0
+	blr			/* Done.  */
+
+	/* Handle case of maxlen > 32 and found a null bytes within the first
+	   16 bytes of s.  */
+	.p2align 4
+L(early_find):
+	bpermd	r5,r8,r10        /* r8 contains the bit permute constants.  */
+	bpermd	r6,r8,r11
+	sldi	r5,r5,8
+	or	r5,r5,r6	/* r5 should hold a 16B mask of
+				   a potential 0.  */
+	cntlzd	r5,r5		/* Count leading zeros.  */
+	addi	r3,r5,-48	/* Deduct the 48 leading zeros always
+				   present.  */
+	blr			/* Done.  */
+
+	/* Handle case of maxlen <= 32. Use the POWER7 algorithm.  */
+	.p2align 4
+L(small_range):
+	clrrdi	r8,r3,3  	/* Align the pointer to 8B.  */
+	li	r0,0
+	/* Register's content at this point:
+	   r3 == pointer to s, r4 == maxlen, r8 == pointer to s aligned to 8B,
+	   r7 == last acceptable address. */
+	cmpldi	r4,0                 /* Check if maxlen is zero.  */
+	beq	L(end_max)	     /* If maxlen is zero.  */
+
+	/* Calculate the last acceptable address and check for possible
+	   addition overflow by using satured math:
+	   r7 = r3 + r4
+	   r7 |= -(r7 < x)  */
+	add     r7,r3,r4
+	subfc   r6,r3,r7
+	subfe   r9,r9,r9
+	extsw   r6,r9
+	or      r7,r7,r6
+	addi    r7,r7,-1
+
+	clrrdi	r7,r7,3              /* Align to 8B address of last
+					acceptable address.  */
+
+	rlwinm	r6,r3,3,26,28        /* Calculate padding.  */
+	ld	r12,0(r8)            /* Load aligned doubleword.  */
+	cmpb	r10,r12,r0           /* Check for null bytes. */
+#ifdef __LITTLE_ENDIAN__
+	srd	r10,r10,r6
+	sld	r10,r10,r6
+#else
+	sld	r10,r10,r6
+	srd	r10,r10,r6
+#endif /* __LITTLE_ENDIAN__  */
+	cmpldi	cr7,r10,0
+	bne	cr7,L(done_small)    /* If found null byte.  */
+
+	cmpld	r8,r7                /* Check if reached maxlen.  */
+	beq	L(end_max)	     /* If reached maxlen.  */
+
+	/* Still handling case of maxlen <= 32. Read doubleword aligned until
+	   find null bytes or reach maxlen.  */
+	.p2align 4
+L(loop_small):
+	ldu	r12,8(r8)         /* Load next doubleword and update r8.  */
+	cmpb	r10,r12,r0        /* Check for null bytes.  */
+	cmpldi	cr6,r10,0
+	bne	cr6,L(done_small) /* If found null bytes.  */
+	cmpld	r8,r7             /* Check if reached maxlen. */
+	bne	L(loop_small)	  /* If it has more bytes to read.  */
+	mr	r3,r4             /* Reached maxlen with null bytes not found.
+				     Length is equal to maxlen.  */
+	blr			  /* Done.  */
+
+	/* Still handling case of maxlen <= 32. Found null bytes.
+	   Registers: r10 == match bits within doubleword, r8 == address of
+	   last doubleword read, r3 == pointer to s, r4 == maxlen.  */
+	.p2align 4
+L(done_small):
+#ifdef __LITTLE_ENDIAN__
+	/* Count trailing zeros.  */
+	addi	r0,r10,-1
+	andc	r0,r0,r10
+	popcntd	r0,r0
+#else
+	cntlzd	r0,r10	      /* Count leading zeros before the match.  */
+#endif
+	sub	r3,r8,r3      /* Calculate total of bytes before the match.  */
+	srdi	r0,r0,3	      /* Convert leading/trailing zeros to bytes.  */
+	add	r3,r3,r0      /* Length until the match.  */
+	cmpld	r3,r4         /* Check length is greater than maxlen.  */
+	blelr
+	mr	r3,r4	      /* If length is greater than maxlen, return
+				 maxlen.  */
+	blr
+
+	/* Handle case of reached maxlen with null bytes not found.  */
+	.p2align 4
+L(end_max):
+	mr	r3,r4	/* Length is equal to maxlen.  */
+	blr		/* Done.  */
+
+
+END (__strnlen)
+libc_hidden_def (__strnlen)
+weak_alias (__strnlen, strnlen)
+libc_hidden_def (strnlen)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   98 +++++
 elf/next.c                                         |    3 +-
 elf/nodelete.c                                     |    3 +-
 elf/order2.c                                       |    3 +-
 elf/tst-_dl_addr_inside_object.c                   |    3 +-
 elf/tst-addr1.c                                    |    3 +-
 elf/tst-align.c                                    |    3 +-
 elf/tst-align2.c                                   |    3 +-
 elf/tst-audit11.c                                  |    3 +-
 elf/tst-audit12.c                                  |    3 +-
 elf/tst-audit2.c                                   |    3 +-
 elf/tst-audit9.c                                   |    3 +-
 elf/tst-auxv.c                                     |    3 +-
 elf/tst-deep1.c                                    |    3 +-
 elf/tst-dl-iter-static.c                           |    3 +-
 elf/tst-dlmodcount.c                               |    3 +-
 elf/tst-dlmopen1.c                                 |    3 +-
 elf/tst-dlmopen2.c                                 |    3 +-
 elf/tst-dlmopen3.c                                 |    3 +-
 elf/tst-dlopen-aout.c                              |    2 +-
 elf/tst-dlopenrpath.c                              |    3 +-
 elf/tst-dlsym-error.c                              |    3 +-
 elf/tst-execstack-needed.c                         |    4 +-
 elf/tst-execstack-prog.c                           |    4 +-
 elf/tst-execstack.c                                |    3 +-
 elf/tst-global1.c                                  |    3 +-
 elf/tst-gnu2-tls1.c                                |    3 +-
 elf/tst-latepthread.c                              |    3 +-
 elf/tst-leaks1.c                                   |    3 +-
 elf/tst-linkall-static.c                           |   11 +-
 elf/tst-nodelete-opened.c                          |    3 +-
 elf/tst-nodelete.cc                                |    3 +-
 elf/tst-nodelete2.c                                |    3 +-
 elf/tst-noload.c                                   |    3 +-
 elf/tst-null-argv.c                                |    3 +-
 elf/tst-order-main.c                               |    3 +-
 elf/tst-pathopt.c                                  |    3 +-
 elf/tst-pie2.c                                     |    3 +-
 elf/tst-piemod1.c                                  |    3 +-
 elf/tst-prelink.c                                  |    3 +-
 elf/tst-protected1a.c                              |    4 +-
 elf/tst-protected1b.c                              |    4 +-
 elf/tst-ptrguard1.c                                |   33 ++-
 elf/tst-relsort1.c                                 |    3 +-
 elf/tst-stackguard1.c                              |   27 +-
 elf/tst-thrlock.c                                  |    3 +-
 elf/tst-tls-dlinfo.c                               |    3 +-
 elf/tst-tls-manydynamic.c                          |    5 +-
 elf/tst-tls1.c                                     |    3 +-
 elf/tst-tls10.c                                    |    3 +-
 elf/tst-tls11.c                                    |    3 +-
 elf/tst-tls12.c                                    |    3 +-
 elf/tst-tls13.c                                    |    3 +-
 elf/tst-tls14.c                                    |    3 +-
 elf/tst-tls15.c                                    |    3 +-
 elf/tst-tls16.c                                    |    3 +-
 elf/tst-tls17.c                                    |    3 +-
 elf/tst-tls18.c                                    |    3 +-
 elf/tst-tls19.c                                    |    3 +-
 elf/tst-tls2.c                                     |    3 +-
 elf/tst-tls3.c                                     |    3 +-
 elf/tst-tls4.c                                     |    3 +-
 elf/tst-tls5.c                                     |    3 +-
 elf/tst-tls6.c                                     |    3 +-
 elf/tst-tls7.c                                     |    3 +-
 elf/tst-tls8.c                                     |    4 +-
 elf/tst-tls9.c                                     |    3 +-
 elf/tst-tlsalign-extern.c                          |    3 +-
 elf/tst-tlsalign.c                                 |    3 +-
 elf/tst-unique1.c                                  |    3 +-
 elf/tst-unique2.c                                  |    3 +-
 elf/vismain.c                                      |    3 +-
 string/test-strnlen.c                              |   54 +++
 sysdeps/powerpc/powerpc64/multiarch/Makefile       |    5 +-
 .../powerpc/powerpc64/multiarch/ifunc-impl-list.c  |    3 +
 .../{strcasecmp-power7.S => strnlen-power8.S}      |   12 +-
 sysdeps/powerpc/powerpc64/multiarch/strnlen.c      |    9 +-
 sysdeps/powerpc/powerpc64/power8/strnlen.S         |  433 ++++++++++++++++++++
 78 files changed, 725 insertions(+), 170 deletions(-)
 copy sysdeps/powerpc/powerpc64/multiarch/{strcasecmp-power7.S => strnlen-power8.S} (80%)
 create mode 100644 sysdeps/powerpc/powerpc64/power8/strnlen.S


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]