summaryrefslogtreecommitdiffstats
path: root/patches/glibc-2.20
diff options
context:
space:
mode:
Diffstat (limited to 'patches/glibc-2.20')
-rw-r--r--patches/glibc-2.20/0001-CVE-2014-9402-Avoid-infinite-loop-in-nss_dns-getnetb.patch24
-rw-r--r--patches/glibc-2.20/0002-CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch277
-rw-r--r--patches/glibc-2.20/0003-CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch166
-rw-r--r--patches/glibc-2.20/0004-CVE-2015-1472-wscanf-allocates-too-little-memory.patch95
-rw-r--r--patches/glibc-2.20/0005-CVE-2014-8121-Do-not-close-NSS-files-database-during.patch226
-rw-r--r--patches/glibc-2.20/0006-CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch23
-rw-r--r--patches/glibc-2.20/0100-add-install-lib-all-target.patch35
-rw-r--r--patches/glibc-2.20/0101-don-t-regen-docs-if-perl-is-not-found.patch35
-rw-r--r--patches/glibc-2.20/0200-Fix-localedef-segfault-when-run-under-exec-shield-Pa.patch67
-rw-r--r--patches/glibc-2.20/0300-resolv-dynamic.patch47
-rw-r--r--patches/glibc-2.20/0400-optimized-string-functions-for-NEON-from-Linaro.patch699
-rw-r--r--patches/glibc-2.20/0401-add-libc_hidden_builtin_def-for-all-cortex-functions.patch64
-rw-r--r--patches/glibc-2.20/0500-Hack-around-mips-args-to-host-gcc.patch28
-rw-r--r--patches/glibc-2.20/0600-ARM-fix-PI-futex-breakge-glibc-bug-18463.patch32
-rw-r--r--patches/glibc-2.20/series24
15 files changed, 0 insertions, 1842 deletions
diff --git a/patches/glibc-2.20/0001-CVE-2014-9402-Avoid-infinite-loop-in-nss_dns-getnetb.patch b/patches/glibc-2.20/0001-CVE-2014-9402-Avoid-infinite-loop-in-nss_dns-getnetb.patch
deleted file mode 100644
index 323ee72..0000000
--- a/patches/glibc-2.20/0001-CVE-2014-9402-Avoid-infinite-loop-in-nss_dns-getnetb.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 15 Dec 2014 17:41:13 +0100
-Subject: [PATCH] CVE-2014-9402: Avoid infinite loop in nss_dns getnetbyname
- [BZ #17630]
-
----
- resolv/nss_dns/dns-network.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
-index 0a77c8bc4808..08cf0a6462ce 100644
---- a/resolv/nss_dns/dns-network.c
-+++ b/resolv/nss_dns/dns-network.c
-@@ -398,8 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
-
- case BYNAME:
- {
-- char **ap = result->n_aliases++;
-- while (*ap != NULL)
-+ char **ap;
-+ for (ap = result->n_aliases; *ap != NULL; ++ap)
- {
- /* Check each alias name for being of the forms:
- 4.3.2.1.in-addr.arpa = net 1.2.3.4
diff --git a/patches/glibc-2.20/0002-CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch b/patches/glibc-2.20/0002-CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch
deleted file mode 100644
index 5dc8a07..0000000
--- a/patches/glibc-2.20/0002-CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch
+++ /dev/null
@@ -1,277 +0,0 @@
-From: Jeff Law <law@redhat.com>
-Date: Mon, 15 Dec 2014 10:09:32 +0100
-Subject: [PATCH] CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
-
-A larger number of format specifiers coudld cause a stack overflow,
-potentially allowing to bypass _FORTIFY_SOURCE format string
-protection.
----
- stdio-common/Makefile | 2 +-
- stdio-common/bug23-2.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
- stdio-common/bug23-3.c | 50 +++++++++++++++++++++++++++++++++++
- stdio-common/bug23-4.c | 31 ++++++++++++++++++++++
- stdio-common/vfprintf.c | 40 ++++++++++++++++++++++++++--
- 5 files changed, 190 insertions(+), 3 deletions(-)
- create mode 100644 stdio-common/bug23-2.c
- create mode 100644 stdio-common/bug23-3.c
- create mode 100644 stdio-common/bug23-4.c
-
-diff --git a/stdio-common/Makefile b/stdio-common/Makefile
-index 5f8e5341a5c3..24e8496f7521 100644
---- a/stdio-common/Makefile
-+++ b/stdio-common/Makefile
-@@ -57,7 +57,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
- bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
-- bug25 tst-printf-round bug26
-+ bug25 tst-printf-round bug23-2 bug23-3 bug23-4
-
- test-srcs = tst-unbputc tst-printf
-
-diff --git a/stdio-common/bug23-2.c b/stdio-common/bug23-2.c
-new file mode 100644
-index 000000000000..9e0cfe6860d0
---- /dev/null
-+++ b/stdio-common/bug23-2.c
-@@ -0,0 +1,70 @@
-+#include <stdio.h>
-+#include <string.h>
-+#include <stdlib.h>
-+
-+static const char expected[] = "\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55\
-+\n\
-+a\n\
-+abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
-+
-+static int
-+do_test (void)
-+{
-+ char *buf = malloc (strlen (expected) + 1);
-+ snprintf (buf, strlen (expected) + 1,
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
-+ "a", "b", "c", "d", 5);
-+ return strcmp (buf, expected) != 0;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/stdio-common/bug23-3.c b/stdio-common/bug23-3.c
-new file mode 100644
-index 000000000000..57c8cef195a8
---- /dev/null
-+++ b/stdio-common/bug23-3.c
-@@ -0,0 +1,50 @@
-+#include <stdio.h>
-+#include <string.h>
-+#include <stdlib.h>
-+
-+int
-+do_test (void)
-+{
-+ size_t instances = 16384;
-+#define X0 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
-+ const char *item = "\na\nabbcd55";
-+#define X3 X0 X0 X0 X0 X0 X0 X0 X0
-+#define X6 X3 X3 X3 X3 X3 X3 X3 X3
-+#define X9 X6 X6 X6 X6 X6 X6 X6 X6
-+#define X12 X9 X9 X9 X9 X9 X9 X9 X9
-+#define X14 X12 X12 X12 X12
-+#define TRAILER "%%%%%%%%%%%%%%%%%%%%%%%%%%"
-+#define TRAILER2 TRAILER TRAILER
-+ size_t length = instances * strlen (item) + strlen (TRAILER) + 1;
-+
-+ char *buf = malloc (length + 1);
-+ snprintf (buf, length + 1,
-+ X14 TRAILER2 "\n",
-+ "a", "b", "c", "d", 5);
-+
-+ const char *p = buf;
-+ size_t i;
-+ for (i = 0; i < instances; ++i)
-+ {
-+ const char *expected;
-+ for (expected = item; *expected; ++expected)
-+ {
-+ if (*p != *expected)
-+ {
-+ printf ("mismatch at offset %zu (%zu): expected %d, got %d\n",
-+ (size_t) (p - buf), i, *expected & 0xFF, *p & 0xFF);
-+ return 1;
-+ }
-+ ++p;
-+ }
-+ }
-+ if (strcmp (p, TRAILER "\n") != 0)
-+ {
-+ printf ("mismatch at trailer: [%s]\n", p);
-+ return 1;
-+ }
-+ free (buf);
-+ return 0;
-+}
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/stdio-common/bug23-4.c b/stdio-common/bug23-4.c
-new file mode 100644
-index 000000000000..a4785640dee0
---- /dev/null
-+++ b/stdio-common/bug23-4.c
-@@ -0,0 +1,31 @@
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <sys/resource.h>
-+
-+#define LIMIT 1000000
-+
-+int
-+main (void)
-+{
-+ struct rlimit lim;
-+ getrlimit (RLIMIT_STACK, &lim);
-+ lim.rlim_cur = 1048576;
-+ setrlimit (RLIMIT_STACK, &lim);
-+ char *fmtstr = malloc (4 * LIMIT + 1);
-+ if (fmtstr == NULL)
-+ abort ();
-+ char *output = malloc (LIMIT + 1);
-+ if (output == NULL)
-+ abort ();
-+ for (size_t i = 0; i < LIMIT; i++)
-+ memcpy (fmtstr + 4 * i, "%1$d", 4);
-+ fmtstr[4 * LIMIT] = '\0';
-+ int ret = snprintf (output, LIMIT + 1, fmtstr, 0);
-+ if (ret != LIMIT)
-+ abort ();
-+ for (size_t i = 0; i < LIMIT; i++)
-+ if (output[i] != '0')
-+ abort ();
-+ return 0;
-+}
-diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
-index c4ff8334b206..429a3d1a83ca 100644
---- a/stdio-common/vfprintf.c
-+++ b/stdio-common/vfprintf.c
-@@ -263,6 +263,12 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
- /* For the argument descriptions, which may be allocated on the heap. */
- void *args_malloced = NULL;
-
-+ /* For positional argument handling. */
-+ struct printf_spec *specs;
-+
-+ /* Track if we malloced the SPECS array and thus must free it. */
-+ bool specs_malloced = false;
-+
- /* This table maps a character into a number representing a
- class. In each step there is a destination label for each
- class. */
-@@ -1679,8 +1685,8 @@ do_positional:
- size_t nspecs = 0;
- /* A more or less arbitrary start value. */
- size_t nspecs_size = 32 * sizeof (struct printf_spec);
-- struct printf_spec *specs = alloca (nspecs_size);
-
-+ specs = alloca (nspecs_size);
- /* The number of arguments the format string requests. This will
- determine the size of the array needed to store the argument
- attributes. */
-@@ -1721,11 +1727,39 @@ do_positional:
- if (nspecs * sizeof (*specs) >= nspecs_size)
- {
- /* Extend the array of format specifiers. */
-+ if (nspecs_size * 2 < nspecs_size)
-+ {
-+ __set_errno (ENOMEM);
-+ done = -1;
-+ goto all_done;
-+ }
- struct printf_spec *old = specs;
-- specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
-+ if (__libc_use_alloca (2 * nspecs_size))
-+ specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
-+ else
-+ {
-+ nspecs_size *= 2;
-+ specs = malloc (nspecs_size);
-+ if (specs == NULL)
-+ {
-+ __set_errno (ENOMEM);
-+ specs = old;
-+ done = -1;
-+ goto all_done;
-+ }
-+ }
-
- /* Copy the old array's elements to the new space. */
- memmove (specs, old, nspecs * sizeof (*specs));
-+
-+ /* If we had previously malloc'd space for SPECS, then
-+ release it after the copy is complete. */
-+ if (specs_malloced)
-+ free (old);
-+
-+ /* Now set SPECS_MALLOCED if needed. */
-+ if (!__libc_use_alloca (nspecs_size))
-+ specs_malloced = true;
- }
-
- /* Parse the format specifier. */
-@@ -2046,6 +2080,8 @@ do_positional:
- }
-
- all_done:
-+ if (specs_malloced)
-+ free (specs);
- if (__glibc_unlikely (args_malloced != NULL))
- free (args_malloced);
- if (__glibc_unlikely (workstart != NULL))
diff --git a/patches/glibc-2.20/0003-CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch b/patches/glibc-2.20/0003-CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch
deleted file mode 100644
index 41afda4..0000000
--- a/patches/glibc-2.20/0003-CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch
+++ /dev/null
@@ -1,166 +0,0 @@
-From: Carlos O'Donell <carlos@redhat.com>
-Date: Wed, 19 Nov 2014 11:44:12 -0500
-Subject: [PATCH] CVE-2014-7817: wordexp fails to honour WRDE_NOCMD.
-
-The function wordexp() fails to properly handle the WRDE_NOCMD
-flag when processing arithmetic inputs in the form of "$((... ``))"
-where "..." can be anything valid. The backticks in the arithmetic
-epxression are evaluated by in a shell even if WRDE_NOCMD forbade
-command substitution. This allows an attacker to attempt to pass
-dangerous commands via constructs of the above form, and bypass
-the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD
-in exec_comm(), the only place that can execute a shell. All other
-checks for WRDE_NOCMD are superfluous and removed.
-
-We expand the testsuite and add 3 new regression tests of roughly
-the same form but with a couple of nested levels.
-
-On top of the 3 new tests we add fork validation to the WRDE_NOCMD
-testing. If any forks are detected during the execution of a wordexp()
-call with WRDE_NOCMD, the test is marked as failed. This is slightly
-heuristic since vfork might be used in the future, but it provides a
-higher level of assurance that no shells were executed as part of
-command substitution with WRDE_NOCMD in effect. In addition it doesn't
-require libpthread or libdl, instead we use the public implementation
-namespace function __register_atfork (already part of the public ABI
-for libpthread).
-
-Tested on x86_64 with no regressions.
-
-(cherry picked from commit a39208bd7fb76c1b01c127b4c61f9bfd915bfe7c)
----
- posix/wordexp-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
- posix/wordexp.c | 16 ++++------------
- 2 files changed, 48 insertions(+), 12 deletions(-)
-
-diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
-index 4957006da74b..bdd65e439fe5 100644
---- a/posix/wordexp-test.c
-+++ b/posix/wordexp-test.c
-@@ -27,6 +27,25 @@
-
- #define IFS " \n\t"
-
-+extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
-+extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
-+
-+static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
-+{
-+ return __register_atfork (prepare, parent, child,
-+ &__dso_handle == NULL ? NULL : __dso_handle);
-+}
-+
-+/* Number of forks seen. */
-+static int registered_forks;
-+
-+/* For each fork increment the fork count. */
-+static void
-+register_fork (void)
-+{
-+ registered_forks++;
-+}
-+
- struct test_case_struct
- {
- int retval;
-@@ -206,6 +225,12 @@ struct test_case_struct
- { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
- { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
- { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
-+ /* Test for CVE-2014-7817. We test 3 combinations of command
-+ substitution inside an arithmetic expression to make sure that
-+ no commands are executed and error is returned. */
-+ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
-+ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
-+ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
-
- { -1, NULL, NULL, 0, 0, { NULL, }, IFS },
- };
-@@ -258,6 +283,15 @@ main (int argc, char *argv[])
- return -1;
- }
-
-+ /* If we are not allowed to do command substitution, we install
-+ fork handlers to verify that no forks happened. No forks should
-+ happen at all if command substitution is disabled. */
-+ if (__app_register_atfork (register_fork, NULL, NULL) != 0)
-+ {
-+ printf ("Failed to register fork handler.\n");
-+ return -1;
-+ }
-+
- for (test = 0; test_case[test].retval != -1; test++)
- if (testit (&test_case[test]))
- ++fail;
-@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc)
-
- printf ("Test %d (%s): ", ++tests, tc->words);
-
-+ if (tc->flags & WRDE_NOCMD)
-+ registered_forks = 0;
-+
- if (tc->flags & WRDE_APPEND)
- {
- /* initial wordexp() call, to be appended to */
-@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc)
- }
- retval = wordexp (tc->words, &we, tc->flags);
-
-+ if ((tc->flags & WRDE_NOCMD)
-+ && (registered_forks > 0))
-+ {
-+ printf ("FAILED fork called for WRDE_NOCMD\n");
-+ return 1;
-+ }
-+
- if (tc->flags & WRDE_DOOFFS)
- start_offs = sav_we.we_offs;
-
-diff --git a/posix/wordexp.c b/posix/wordexp.c
-index b6b65dd993ec..26f3a2653feb 100644
---- a/posix/wordexp.c
-+++ b/posix/wordexp.c
-@@ -893,6 +893,10 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
- pid_t pid;
- int noexec = 0;
-
-+ /* Do nothing if command substitution should not succeed. */
-+ if (flags & WRDE_NOCMD)
-+ return WRDE_CMDSUB;
-+
- /* Don't fork() unless necessary */
- if (!comm || !*comm)
- return 0;
-@@ -2082,9 +2086,6 @@ parse_dollars (char **word, size_t *word_length, size_t *max_length,
- }
- }
-
-- if (flags & WRDE_NOCMD)
-- return WRDE_CMDSUB;
--
- (*offset) += 2;
- return parse_comm (word, word_length, max_length, words, offset, flags,
- quoted? NULL : pwordexp, ifs, ifs_white);
-@@ -2196,9 +2197,6 @@ parse_dquote (char **word, size_t *word_length, size_t *max_length,
- break;
-
- case '`':
-- if (flags & WRDE_NOCMD)
-- return WRDE_CMDSUB;
--
- ++(*offset);
- error = parse_backtick (word, word_length, max_length, words,
- offset, flags, NULL, NULL, NULL);
-@@ -2357,12 +2355,6 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
- break;
-
- case '`':
-- if (flags & WRDE_NOCMD)
-- {
-- error = WRDE_CMDSUB;
-- goto do_error;
-- }
--
- ++words_offset;
- error = parse_backtick (&word, &word_length, &max_length, words,
- &words_offset, flags, pwordexp, ifs,
diff --git a/patches/glibc-2.20/0004-CVE-2015-1472-wscanf-allocates-too-little-memory.patch b/patches/glibc-2.20/0004-CVE-2015-1472-wscanf-allocates-too-little-memory.patch
deleted file mode 100644
index 4ff5a63..0000000
--- a/patches/glibc-2.20/0004-CVE-2015-1472-wscanf-allocates-too-little-memory.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From: Paul Pluzhnikov <ppluzhnikov@google.com>
-Date: Fri, 6 Feb 2015 00:30:42 -0500
-Subject: [PATCH] CVE-2015-1472: wscanf allocates too little memory
-
-BZ #16618
-
-Under certain conditions wscanf can allocate too little memory for the
-to-be-scanned arguments and overflow the allocated buffer. The
-implementation now correctly computes the required buffer size when
-using malloc.
-
-A regression test was added to tst-sscanf.
----
- stdio-common/tst-sscanf.c | 33 +++++++++++++++++++++++++++++++++
- stdio-common/vfscanf.c | 12 ++++++------
- 2 files changed, 39 insertions(+), 6 deletions(-)
-
-diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c
-index 9fef93a53578..6394fe1cccd1 100644
---- a/stdio-common/tst-sscanf.c
-+++ b/stdio-common/tst-sscanf.c
-@@ -233,5 +233,38 @@ main (void)
- }
- }
-
-+ /* BZ #16618
-+ The test will segfault during SSCANF if the buffer overflow
-+ is not fixed. The size of `s` is such that it forces the use
-+ of malloc internally and this triggers the incorrect computation.
-+ Thus the value for SIZE is arbitrariy high enough that malloc
-+ is used. */
-+ {
-+#define SIZE 131072
-+ CHAR *s = malloc ((SIZE + 1) * sizeof (*s));
-+ if (s == NULL)
-+ abort ();
-+ for (size_t i = 0; i < SIZE; i++)
-+ s[i] = L('0');
-+ s[SIZE] = L('\0');
-+ int i = 42;
-+ /* Scan multi-digit zero into `i`. */
-+ if (SSCANF (s, L("%d"), &i) != 1)
-+ {
-+ printf ("FAIL: bug16618: SSCANF did not read one input item.\n");
-+ result = 1;
-+ }
-+ if (i != 0)
-+ {
-+ printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n");
-+ result = 1;
-+ }
-+ free (s);
-+ if (result != 1)
-+ printf ("PASS: bug16618: Did not crash.\n");
-+#undef SIZE
-+ }
-+
-+
- return result;
- }
-diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
-index e0d224530cc6..a4f06b44e576 100644
---- a/stdio-common/vfscanf.c
-+++ b/stdio-common/vfscanf.c
-@@ -272,9 +272,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- if (__glibc_unlikely (wpsize == wpmax)) \
- { \
- CHAR_T *old = wp; \
-- size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \
-- ? UCHAR_MAX + 1 : 2 * wpmax); \
-- if (use_malloc || !__libc_use_alloca (newsize)) \
-+ bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); \
-+ size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax); \
-+ size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX; \
-+ if (!__libc_use_alloca (newsize)) \
- { \
- wp = realloc (use_malloc ? wp : NULL, newsize); \
- if (wp == NULL) \
-@@ -286,14 +287,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- } \
- if (! use_malloc) \
- MEMCPY (wp, old, wpsize); \
-- wpmax = newsize; \
-+ wpmax = wpneed; \
- use_malloc = true; \
- } \
- else \
- { \
- size_t s = wpmax * sizeof (CHAR_T); \
-- wp = (CHAR_T *) extend_alloca (wp, s, \
-- newsize * sizeof (CHAR_T)); \
-+ wp = (CHAR_T *) extend_alloca (wp, s, newsize); \
- wpmax = s / sizeof (CHAR_T); \
- if (old != NULL) \
- MEMCPY (wp, old, wpsize); \
diff --git a/patches/glibc-2.20/0005-CVE-2014-8121-Do-not-close-NSS-files-database-during.patch b/patches/glibc-2.20/0005-CVE-2014-8121-Do-not-close-NSS-files-database-during.patch
deleted file mode 100644
index 17861f7..0000000
--- a/patches/glibc-2.20/0005-CVE-2014-8121-Do-not-close-NSS-files-database-during.patch
+++ /dev/null
@@ -1,226 +0,0 @@
-From: Florian Weimer <fweimer@redhat.com>
-Date: Wed, 29 Apr 2015 14:41:25 +0200
-Subject: [PATCH] CVE-2014-8121: Do not close NSS files database during
- iteration [BZ #18007]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Robin Hack discovered Samba would enter an infinite loop processing
-certain quota-related requests. We eventually tracked this down to a
-glibc issue.
-
-Running a (simplified) test case under strace shows that /etc/passwd
-is continuously opened and closed:
-
-…
-open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
-lseek(3, 0, SEEK_CUR) = 0
-read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2717
-lseek(3, 2717, SEEK_SET) = 2717
-close(3) = 0
-open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
-lseek(3, 0, SEEK_CUR) = 0
-lseek(3, 0, SEEK_SET) = 0
-read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2717
-lseek(3, 2717, SEEK_SET) = 2717
-close(3) = 0
-open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
-lseek(3, 0, SEEK_CUR) = 0
-…
-
-The lookup function implementation in
-nss/nss_files/files-XXX.c:DB_LOOKUP has code to prevent that. It is
-supposed skip closing the input file if it was already open.
-
- /* Reset file pointer to beginning or open file. */ \
- status = internal_setent (keep_stream); \
- \
- if (status == NSS_STATUS_SUCCESS) \
- { \
- /* Tell getent function that we have repositioned the file pointer. */ \
- last_use = getby; \
- \
- while ((status = internal_getent (result, buffer, buflen, errnop \
- H_ERRNO_ARG EXTRA_ARGS_VALUE)) \
- == NSS_STATUS_SUCCESS) \
- { break_if_match } \
- \
- if (! keep_stream) \
- internal_endent (); \
- } \
-
-keep_stream is initialized from the stayopen flag in internal_setent.
-internal_setent is called from the set*ent implementation as:
-
- status = internal_setent (stayopen);
-
-However, for non-host database, this flag is always 0, per the
-STAYOPEN magic in nss/getXXent_r.c.
-
-Thus, the fix is this:
-
-- status = internal_setent (stayopen);
-+ status = internal_setent (1);
-
-This is not a behavioral change even for the hosts database (where the
-application can specify the stayopen flag) because with a call to
-sethostent(0), the file handle is still not closed in the
-implementation of gethostent.
----
- nss/Makefile | 2 +-
- nss/nss_files/files-XXX.c | 2 +-
- nss/tst-nss-getpwent.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 120 insertions(+), 2 deletions(-)
- create mode 100644 nss/tst-nss-getpwent.c
-
-diff --git a/nss/Makefile b/nss/Makefile
-index 1fa7f1f397f5..d6f0139bf5c8 100644
---- a/nss/Makefile
-+++ b/nss/Makefile
-@@ -39,7 +39,7 @@ install-bin := getent makedb
- makedb-modules = xmalloc hash-string
- extra-objs += $(makedb-modules:=.o)
-
--tests = test-netdb tst-nss-test1 test-digits-dots
-+tests = test-netdb tst-nss-test1 test-digits-dots tst-nss-getpwent
- xtests = bug-erange
-
- # Specify rules for the nss_* modules. We have some services.
-diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
-index 212b938fdf39..cc38174df0c2 100644
---- a/nss/nss_files/files-XXX.c
-+++ b/nss/nss_files/files-XXX.c
-@@ -134,7 +134,7 @@ CONCAT(_nss_files_set,ENTNAME) (int stayopen)
-
- __libc_lock_lock (lock);
-
-- status = internal_setent (stayopen);
-+ status = internal_setent (1);
-
- if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
- {
-diff --git a/nss/tst-nss-getpwent.c b/nss/tst-nss-getpwent.c
-new file mode 100644
-index 000000000000..f2e8abce6098
---- /dev/null
-+++ b/nss/tst-nss-getpwent.c
-@@ -0,0 +1,118 @@
-+/* Copyright (C) 2015 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <pwd.h>
-+#include <stdbool.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+int
-+do_test (void)
-+{
-+ /* Count the number of entries in the password database, and fetch
-+ data from the first and last entries. */
-+ size_t count = 0;
-+ struct passwd * pw;
-+ char *first_name = NULL;
-+ uid_t first_uid = 0;
-+ char *last_name = NULL;
-+ uid_t last_uid = 0;
-+ setpwent ();
-+ while ((pw = getpwent ()) != NULL)
-+ {
-+ if (first_name == NULL)
-+ {
-+ first_name = strdup (pw->pw_name);
-+ if (first_name == NULL)
-+ {
-+ printf ("strdup: %m\n");
-+ return 1;
-+ }
-+ first_uid = pw->pw_uid;
-+ }
-+
-+ free (last_name);
-+ last_name = strdup (pw->pw_name);
-+ if (last_name == NULL)
-+ {
-+ printf ("strdup: %m\n");
-+ return 1;
-+ }
-+ last_uid = pw->pw_uid;
-+ ++count;
-+ }
-+ endpwent ();
-+
-+ if (count == 0)
-+ {
-+ printf ("No entries in the password database.\n");
-+ return 0;
-+ }
-+
-+ /* Try again, this time interleaving with name-based and UID-based
-+ lookup operations. The counts do not match if the interleaved
-+ lookups affected the enumeration. */
-+ size_t new_count = 0;
-+ setpwent ();
-+ while ((pw = getpwent ()) != NULL)
-+ {
-+ if (new_count == count)
-+ {
-+ printf ("Additional entry in the password database.\n");
-+ return 1;
-+ }
-+ ++new_count;
-+ struct passwd *pw2 = getpwnam (first_name);
-+ if (pw2 == NULL)
-+ {
-+ printf ("getpwnam (%s) failed: %m\n", first_name);
-+ return 1;
-+ }
-+ pw2 = getpwnam (last_name);
-+ if (pw2 == NULL)
-+ {
-+ printf ("getpwnam (%s) failed: %m\n", last_name);
-+ return 1;
-+ }
-+ pw2 = getpwuid (first_uid);
-+ if (pw2 == NULL)
-+ {
-+ printf ("getpwuid (%llu) failed: %m\n",
-+ (unsigned long long) first_uid);
-+ return 1;
-+ }
-+ pw2 = getpwuid (last_uid);
-+ if (pw2 == NULL)
-+ {
-+ printf ("getpwuid (%llu) failed: %m\n",
-+ (unsigned long long) last_uid);
-+ return 1;
-+ }
-+ }
-+ endpwent ();
-+ if (new_count < count)
-+ {
-+ printf ("Missing entry in the password database.\n");
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
diff --git a/patches/glibc-2.20/0006-CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch b/patches/glibc-2.20/0006-CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch
deleted file mode 100644
index 3c035a4..0000000
--- a/patches/glibc-2.20/0006-CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Arjun Shankar <arjun.is@lostca.se>
-Date: Tue, 21 Apr 2015 14:06:31 +0200
-Subject: [PATCH] CVE-2015-1781: resolv/nss_dns/dns-host.c buffer overflow
- [BZ#18287]
-
----
- resolv/nss_dns/dns-host.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
-index 3258e709d20c..ed997030331c 100644
---- a/resolv/nss_dns/dns-host.c
-+++ b/resolv/nss_dns/dns-host.c
-@@ -615,7 +615,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
- int have_to_map = 0;
- uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
- buffer += pad;
-- if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
-+ buflen = buflen > pad ? buflen - pad : 0;
-+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
- {
- /* The buffer is too small. */
- too_small:
diff --git a/patches/glibc-2.20/0100-add-install-lib-all-target.patch b/patches/glibc-2.20/0100-add-install-lib-all-target.patch
deleted file mode 100644
index 45971cc..0000000
--- a/patches/glibc-2.20/0100-add-install-lib-all-target.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From: Michael Olbrich <m.olbrich@pengutronix.de>
-Date: Tue, 1 Nov 2011 19:22:27 +0100
-Subject: [PATCH] add install-lib-all target
-
-From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch
-
-Rule to install all needed libraries, not just the ones installed by install-lib,
-yet not install programs.
-Needed because we can't use the main install target, as we can't build programs before
-we have the final gcc installed; linking fails because libeh.a is not present,
-and glibc insists on linking programs with that library.
-
-Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
----
- Makerules | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/Makerules b/Makerules
-index 6b30e8ce58d0..16b24ad2b20a 100644
---- a/Makerules
-+++ b/Makerules
-@@ -834,6 +834,13 @@ endef
- installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
- $(inst_libdir)/$(patsubst %,$(libtype$o),\
- $(libprefix)$(libc-name)))
-+
-+install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \
-+ $(inst_slibdir)/libc-$(version).so \
-+ $(inst_libdir)/libc.so \
-+ $(inst_libdir)/libc.a \
-+ install-lib
-+
- install: $(installed-libcs)
- $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
- $(make-target-directory)
diff --git a/patches/glibc-2.20/0101-don-t-regen-docs-if-perl-is-not-found.patch b/patches/glibc-2.20/0101-don-t-regen-docs-if-perl-is-not-found.patch
deleted file mode 100644
index 653aee3..0000000
--- a/patches/glibc-2.20/0101-don-t-regen-docs-if-perl-is-not-found.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From: Michael Olbrich <m.olbrich@pengutronix.de>
-Date: Wed, 2 Nov 2011 00:14:37 +0100
-Subject: [PATCH] don't regen docs if perl is not found
-
-If we're using a cvs snapshot which updates the source files, and
-perl isn't installed yet, then we can't regen the docs. Not a big
-deal, so just whine a little and continue on our merry way.
-
-This patch was taken from gentoo.
-http://bugs.gentoo.org/60132
-
-Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
----
- manual/Makefile | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/manual/Makefile b/manual/Makefile
-index 62217a2d7a71..4a726edc215a 100644
---- a/manual/Makefile
-+++ b/manual/Makefile
-@@ -104,9 +104,14 @@ $(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
- $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
- $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
- $(dir)/libm-test-ulps))
-+ifneq ($(PERL),no)
- pwd=`pwd`; \
- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
- $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
-+else
-+ echo "Unable to rebuild math docs, no perl installed"
-+ touch libm-err.texi
-+endif
- touch $@
-
- # Package version and bug reporting URL.
diff --git a/patches/glibc-2.20/0200-Fix-localedef-segfault-when-run-under-exec-shield-Pa.patch b/patches/glibc-2.20/0200-Fix-localedef-segfault-when-run-under-exec-shield-Pa.patch
deleted file mode 100644
index f898798..0000000
--- a/patches/glibc-2.20/0200-Fix-localedef-segfault-when-run-under-exec-shield-Pa.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From: Jakub Jelinek <jakub@redhat.com>
-Date: Tue, 1 Nov 2011 18:58:26 +0100
-Subject: [PATCH] Fix localedef segfault when run under exec-shield, PaX or
- similar
-
-# DP: Description: Fix localedef segfault when run under exec-shield,
-# PaX or similar. (#231438, #198099)
-# DP: Dpatch Author: James Troup <james@nocrew.org>
-# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
-# DP: Upstream status: Unknown
-# DP: Status Details: Unknown
-# DP: Date: 2004-03-16
-
-Taken from Debian.
-
-Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
----
- locale/programs/3level.h | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/locale/programs/3level.h b/locale/programs/3level.h
-index c83cdf205e40..1d4553e512a5 100644
---- a/locale/programs/3level.h
-+++ b/locale/programs/3level.h
-@@ -204,6 +204,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
- }
- }
- }
-+
-+/* GCC ATM seems to do a poor job with pointers to nested functions passed
-+ to inlined functions. Help it a little bit with this hack. */
-+#define wchead_table_iterate(tp, fn) \
-+do \
-+ { \
-+ struct wchead_table *t = (tp); \
-+ uint32_t index1; \
-+ for (index1 = 0; index1 < t->level1_size; index1++) \
-+ { \
-+ uint32_t lookup1 = t->level1[index1]; \
-+ if (lookup1 != ((uint32_t) ~0)) \
-+ { \
-+ uint32_t lookup1_shifted = lookup1 << t->q; \
-+ uint32_t index2; \
-+ for (index2 = 0; index2 < (1 << t->q); index2++) \
-+ { \
-+ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
-+ if (lookup2 != ((uint32_t) ~0)) \
-+ { \
-+ uint32_t lookup2_shifted = lookup2 << t->p; \
-+ uint32_t index3; \
-+ for (index3 = 0; index3 < (1 << t->p); index3++) \
-+ { \
-+ struct element_t *lookup3 \
-+ = t->level3[index3 + lookup2_shifted]; \
-+ if (lookup3 != NULL) \
-+ fn ((((index1 << t->q) + index2) << t->p) + index3, \
-+ lookup3); \
-+ } \
-+ } \
-+ } \
-+ } \
-+ } \
-+ } while (0)
-+
- #endif
-
- #ifndef NO_ADD_LOCALE
diff --git a/patches/glibc-2.20/0300-resolv-dynamic.patch b/patches/glibc-2.20/0300-resolv-dynamic.patch
deleted file mode 100644
index 8865e25..0000000
--- a/patches/glibc-2.20/0300-resolv-dynamic.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From: unknown author <unknown.author@example.com>
-Date: Tue, 1 Nov 2011 18:58:26 +0100
-Subject: [PATCH] resolv dynamic
-
-ripped from SuSE
-
-if /etc/resolv.conf is updated, then make sure applications
-already running get the updated information.
-
-http://bugs.gentoo.org/177416
----
- resolv/res_libc.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/resolv/res_libc.c b/resolv/res_libc.c
-index ee3fa2114b70..10cb08bdd9be 100644
---- a/resolv/res_libc.c
-+++ b/resolv/res_libc.c
-@@ -22,6 +22,7 @@
- #include <arpa/nameser.h>
- #include <resolv.h>
- #include <bits/libc-lock.h>
-+#include <sys/stat.h>
-
-
- /* The following bit is copied from res_data.c (where it is #ifdef'ed
-@@ -95,6 +96,20 @@ int
- __res_maybe_init (res_state resp, int preinit)
- {
- if (resp->options & RES_INIT) {
-+ static time_t last_mtime, last_check;
-+ time_t now;
-+ struct stat statbuf;
-+
-+ time (&now);
-+ if (now != last_check) {
-+ last_check = now;
-+ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
-+ last_mtime = statbuf.st_mtime;
-+ atomicinclock (lock);
-+ atomicinc (__res_initstamp);
-+ atomicincunlock (lock);
-+ }
-+ }
- if (__res_initstamp != resp->_u._ext.initstamp) {
- if (resp->nscount > 0)
- __res_iclose (resp, true);
diff --git a/patches/glibc-2.20/0400-optimized-string-functions-for-NEON-from-Linaro.patch b/patches/glibc-2.20/0400-optimized-string-functions-for-NEON-from-Linaro.patch
deleted file mode 100644
index f823c45..0000000
--- a/patches/glibc-2.20/0400-optimized-string-functions-for-NEON-from-Linaro.patch
+++ /dev/null
@@ -1,699 +0,0 @@
-From: Michael Olbrich <m.olbrich@pengutronix.de>
-Date: Thu, 15 Sep 2011 16:50:56 +0200
-Subject: [PATCH] optimized string functions for NEON from Linaro
-
-Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
----
- cortex-strings/sysdeps/arm/armv7/memchr.S | 155 ++++++++++++++++++++++++++++++
- cortex-strings/sysdeps/arm/armv7/memcpy.S | 152 +++++++++++++++++++++++++++++
- cortex-strings/sysdeps/arm/armv7/memset.S | 118 +++++++++++++++++++++++
- cortex-strings/sysdeps/arm/armv7/strchr.S | 76 +++++++++++++++
- cortex-strings/sysdeps/arm/armv7/strlen.S | 150 +++++++++++++++++++++++++++++
- 5 files changed, 651 insertions(+)
- create mode 100644 cortex-strings/sysdeps/arm/armv7/memchr.S
- create mode 100644 cortex-strings/sysdeps/arm/armv7/memcpy.S
- create mode 100644 cortex-strings/sysdeps/arm/armv7/memset.S
- create mode 100644 cortex-strings/sysdeps/arm/armv7/strchr.S
- create mode 100644 cortex-strings/sysdeps/arm/armv7/strlen.S
-
-diff --git a/cortex-strings/sysdeps/arm/armv7/memchr.S b/cortex-strings/sysdeps/arm/armv7/memchr.S
-new file mode 100644
-index 000000000000..92a2d9f0967d
---- /dev/null
-+++ b/cortex-strings/sysdeps/arm/armv7/memchr.S
-@@ -0,0 +1,155 @@
-+/* Copyright (c) 2010-2011, Linaro Limited
-+ All rights reserved.
-+
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+
-+ * Neither the name of Linaro Limited nor the names of its
-+ contributors may be used to endorse or promote products derived
-+ from this software without specific prior written permission.
-+
-+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+/*
-+ Written by Dave Gilbert <david.gilbert@linaro.org>
-+
-+ This memchr routine is optimised on a Cortex-A9 and should work on
-+ all ARMv7 processors. It has a fast past for short sizes, and has
-+ an optimised path for large data sets; the worst case is finding the
-+ match early in a large data set.
-+
-+ */
-+
-+@ 2011-02-07 david.gilbert@linaro.org
-+@ Extracted from local git a5b438d861
-+@ 2011-07-14 david.gilbert@linaro.org
-+@ Import endianness fix from local git ea786f1b
-+@ 2011-12-07 david.gilbert@linaro.org
-+@ Removed unneeded cbz from align loop
-+
-+ .syntax unified
-+ .arch armv7-a
-+
-+@ this lets us check a flag in a 00/ff byte easily in either endianness
-+#ifdef __ARMEB__
-+#define CHARTSTMASK(c) 1<<(31-(c*8))
-+#else
-+#define CHARTSTMASK(c) 1<<(c*8)
-+#endif
-+ .text
-+ .thumb
-+
-+@ ---------------------------------------------------------------------------
-+ .thumb_func
-+ .align 2
-+ .p2align 4,,15
-+ .global memchr
-+ .type memchr,%function
-+memchr:
-+ @ r0 = start of memory to scan
-+ @ r1 = character to look for
-+ @ r2 = length
-+ @ returns r0 = pointer to character or NULL if not found
-+ and r1,r1,#0xff @ Don't think we can trust the caller to actually pass a char
-+
-+ cmp r2,#16 @ If it's short don't bother with anything clever
-+ blt 20f
-+
-+ tst r0, #7 @ If it's already aligned skip the next bit
-+ beq 10f
-+
-+ @ Work up to an aligned point
-+5:
-+ ldrb r3, [r0],#1
-+ subs r2, r2, #1
-+ cmp r3, r1
-+ beq 50f @ If it matches exit found
-+ tst r0, #7
-+ bne 5b @ If not aligned yet then do next byte
-+
-+10:
-+ @ At this point, we are aligned, we know we have at least 8 bytes to work with
-+ push {r4,r5,r6,r7}
-+ orr r1, r1, r1, lsl #8 @ expand the match word across to all bytes
-+ orr r1, r1, r1, lsl #16
-+ bic r4, r2, #7 @ Number of double words to work with
-+ mvns r7, #0 @ all F's
-+ movs r3, #0
-+
-+15:
-+ ldmia r0!,{r5,r6}
-+ subs r4, r4, #8
-+ eor r5,r5, r1 @ Get it so that r5,r6 have 00's where the bytes match the target
-+ eor r6,r6, r1
-+ uadd8 r5, r5, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0
-+ sel r5, r3, r7 @ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
-+ uadd8 r6, r6, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0
-+ sel r6, r5, r7 @ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION
-+ cbnz r6, 60f
-+ bne 15b @ (Flags from the subs above) If not run out of bytes then go around again
-+
-+ pop {r4,r5,r6,r7}
-+ and r1,r1,#0xff @ Get r1 back to a single character from the expansion above
-+ and r2,r2,#7 @ Leave the count remaining as the number after the double words have been done
-+
-+20:
-+ cbz r2, 40f @ 0 length or hit the end already then not found
-+
-+21: @ Post aligned section, or just a short call
-+ ldrb r3,[r0],#1
-+ subs r2,r2,#1
-+ eor r3,r3,r1 @ r3 = 0 if match - doesn't break flags from sub
-+ cbz r3, 50f
-+ bne 21b @ on r2 flags
-+
-+40:
-+ movs r0,#0 @ not found
-+ bx lr
-+
-+50:
-+ subs r0,r0,#1 @ found
-+ bx lr
-+
-+60: @ We're here because the fast path found a hit - now we have to track down exactly which word it was
-+ @ r0 points to the start of the double word after the one that was tested
-+ @ r5 has the 00/ff pattern for the first word, r6 has the chained value
-+ cmp r5, #0
-+ itte eq
-+ moveq r5, r6 @ the end is in the 2nd word
-+ subeq r0,r0,#3 @ Points to 2nd byte of 2nd word
-+ subne r0,r0,#7 @ or 2nd byte of 1st word
-+
-+ @ r0 currently points to the 3rd byte of the word containing the hit
-+ tst r5, # CHARTSTMASK(0) @ 1st character
-+ bne 61f
-+ adds r0,r0,#1
-+ tst r5, # CHARTSTMASK(1) @ 2nd character
-+ ittt eq
-+ addeq r0,r0,#1
-+ tsteq r5, # (3<<15) @ 2nd & 3rd character
-+ @ If not the 3rd must be the last one
-+ addeq r0,r0,#1
-+
-+61:
-+ pop {r4,r5,r6,r7}
-+ subs r0,r0,#1
-+ bx lr
-diff --git a/cortex-strings/sysdeps/arm/armv7/memcpy.S b/cortex-strings/sysdeps/arm/armv7/memcpy.S
-new file mode 100644
-index 000000000000..3be24cad2c8d
---- /dev/null
-+++ b/cortex-strings/sysdeps/arm/armv7/memcpy.S
-@@ -0,0 +1,152 @@
-+/* Copyright (c) 2010-2011, Linaro Limited
-+ All rights reserved.
-+
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+
-+ * Neither the name of Linaro Limited nor the names of its
-+ contributors may be used to endorse or promote products derived
-+ from this software without specific prior written permission.
-+
-+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+ Written by Dave Gilbert <david.gilbert@linaro.org>
-+
-+ This memcpy routine is optimised on a Cortex-A9 and should work on
-+ all ARMv7 processors with NEON. */
-+
-+@ 2011-09-01 david.gilbert@linaro.org
-+@ Extracted from local git 2f11b436
-+
-+ .syntax unified
-+ .arch armv7-a
-+
-+@ this lets us check a flag in a 00/ff byte easily in either endianness
-+#ifdef __ARMEB__
-+#define CHARTSTMASK(c) 1<<(31-(c*8))
-+#else
-+#define CHARTSTMASK(c) 1<<(c*8)
-+#endif
-+ .text
-+ .thumb
-+
-+@ ---------------------------------------------------------------------------
-+ .thumb_func
-+ .align 2
-+ .p2align 4,,15
-+ .global memcpy
-+ .type memcpy,%function
-+memcpy:
-+ @ r0 = dest
-+ @ r1 = source
-+ @ r2 = count
-+ @ returns dest in r0
-+ @ Overlaps of source/dest not allowed according to spec
-+ @ Note this routine relies on v7 misaligned loads/stores
-+ pld [r1]
-+ mov r12, r0 @ stash original r0
-+ cmp r2,#32
-+ blt 10f @ take the small copy case separately
-+
-+ @ test for either source or destination being misaligned
-+ @ (We only rely on word align)
-+ tst r0,#3
-+ it eq
-+ tsteq r1,#3
-+ bne 30f @ misaligned case
-+
-+4:
-+ @ at this point we are word (or better) aligned and have at least
-+ @ 32 bytes to play with
-+
-+ @ If it's a huge copy, try Neon
-+ cmp r2, #128*1024
-+ bge 35f @ Sharing general non-aligned case here, aligned could be faster
-+
-+ push {r3,r4,r5,r6,r7,r8,r10,r11}
-+5:
-+ ldmia r1!,{r3,r4,r5,r6,r7,r8,r10,r11}
-+ sub r2,r2,#32
-+ pld [r1,#96]
-+ cmp r2,#32
-+ stmia r0!,{r3,r4,r5,r6,r7,r8,r10,r11}
-+ bge 5b
-+
-+ pop {r3,r4,r5,r6,r7,r8,r10,r11}
-+ @ We are now down to less than 32 bytes
-+ cbz r2,15f @ quick exit for the case where we copied a multiple of 32
-+
-+10: @ small copies (not necessarily aligned - note might be slightly more than 32bytes)
-+ cmp r2,#4
-+ blt 12f
-+11:
-+ sub r2,r2,#4
-+ cmp r2,#4
-+ ldr r3, [r1],#4
-+ str r3, [r0],#4
-+ bge 11b
-+12:
-+ tst r2,#2
-+ itt ne
-+ ldrhne r3, [r1],#2
-+ strhne r3, [r0],#2
-+
-+ tst r2,#1
-+ itt ne
-+ ldrbne r3, [r1],#1
-+ strbne r3, [r0],#1
-+
-+15: @ exit
-+ mov r0,r12 @ restore r0
-+ bx lr
-+
-+ .align 2
-+ .p2align 4,,15
-+30: @ non-aligned - at least 32 bytes to play with
-+ @ Test for co-misalignment
-+ eor r3, r0, r1
-+ tst r3,#3
-+ beq 50f
-+
-+ @ Use Neon for misaligned
-+35:
-+ vld1.8 {d0,d1,d2,d3}, [r1]!
-+ sub r2,r2,#32
-+ cmp r2,#32
-+ pld [r1,#96]
-+ vst1.8 {d0,d1,d2,d3}, [r0]!
-+ bge 35b
-+ b 10b @ TODO: Probably a bad idea to switch to ARM at this point
-+
-+ .align 2
-+ .p2align 4,,15
-+50: @ Co-misaligned
-+ @ At this point we've got at least 32 bytes
-+51:
-+ ldrb r3,[r1],#1
-+ sub r2,r2,#1
-+ strb r3,[r0],#1
-+ tst r0,#7
-+ bne 51b
-+
-+ cmp r2,#32
-+ blt 10b
-+ b 4b
-diff --git a/cortex-strings/sysdeps/arm/armv7/memset.S b/cortex-strings/sysdeps/arm/armv7/memset.S
-new file mode 100644
-index 000000000000..921cb7535cc8
---- /dev/null
-+++ b/cortex-strings/sysdeps/arm/armv7/memset.S
-@@ -0,0 +1,118 @@
-+/* Copyright (c) 2010-2011, Linaro Limited
-+ All rights reserved.
-+
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+
-+ * Neither the name of Linaro Limited nor the names of its
-+ contributors may be used to endorse or promote products derived
-+ from this software without specific prior written permission.
-+
-+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+ Written by Dave Gilbert <david.gilbert@linaro.org>
-+
-+ This memset routine is optimised on a Cortex-A9 and should work on
-+ all ARMv7 processors. */
-+
-+ .syntax unified
-+ .arch armv7-a
-+
-+@ 2011-08-30 david.gilbert@linaro.org
-+@ Extracted from local git 2f11b436
-+
-+@ this lets us check a flag in a 00/ff byte easily in either endianness
-+#ifdef __ARMEB__
-+#define CHARTSTMASK(c) 1<<(31-(c*8))
-+#else
-+#define CHARTSTMASK(c) 1<<(c*8)
-+#endif
-+ .text
-+ .thumb
-+
-+@ ---------------------------------------------------------------------------
-+ .thumb_func
-+ .align 2
-+ .p2align 4,,15
-+ .global memset
-+ .type memset,%function
-+memset:
-+ @ r0 = address
-+ @ r1 = character
-+ @ r2 = count
-+ @ returns original address in r0
-+
-+ mov r3, r0 @ Leave r0 alone
-+ cbz r2, 10f @ Exit if 0 length
-+
-+ tst r0, #7
-+ beq 2f @ Already aligned
-+
-+ @ Ok, so we're misaligned here
-+1:
-+ strb r1, [r3], #1
-+ subs r2,r2,#1
-+ tst r3, #7
-+ cbz r2, 10f @ Exit if we hit the end
-+ bne 1b @ go round again if still misaligned
-+
-+2:
-+ @ OK, so we're aligned
-+ push {r4,r5,r6,r7}
-+ bics r4, r2, #15 @ if less than 16 bytes then need to finish it off
-+ beq 5f
-+
-+3:
-+ @ POSIX says that ch is cast to an unsigned char. A uxtb is one
-+ @ byte and takes two cycles, where an AND is four bytes but one
-+ @ cycle.
-+ and r1, #0xFF
-+ orr r1, r1, r1, lsl#8 @ Same character into all bytes
-+ orr r1, r1, r1, lsl#16
-+ mov r5,r1
-+ mov r6,r1
-+ mov r7,r1
-+
-+4:
-+ subs r4,r4,#16
-+ stmia r3!,{r1,r5,r6,r7}
-+ bne 4b
-+ and r2,r2,#15
-+
-+ @ At this point we're still aligned and we have upto align-1 bytes left to right
-+ @ we can avoid some of the byte-at-a time now by testing for some big chunks
-+ tst r2,#8
-+ itt ne
-+ subne r2,r2,#8
-+ stmiane r3!,{r1,r5}
-+
-+5:
-+ pop {r4,r5,r6,r7}
-+ cbz r2, 10f
-+
-+ @ Got to do any last < alignment bytes
-+6:
-+ subs r2,r2,#1
-+ strb r1,[r3],#1
-+ bne 6b
-+
-+10:
-+ bx lr @ goodbye
-diff --git a/cortex-strings/sysdeps/arm/armv7/strchr.S b/cortex-strings/sysdeps/arm/armv7/strchr.S
-new file mode 100644
-index 000000000000..8875dbfce6da
---- /dev/null
-+++ b/cortex-strings/sysdeps/arm/armv7/strchr.S
-@@ -0,0 +1,76 @@
-+/* Copyright (c) 2010-2011, Linaro Limited
-+ All rights reserved.
-+
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+
-+ * Neither the name of Linaro Limited nor the names of its
-+ contributors may be used to endorse or promote products derived
-+ from this software without specific prior written permission.
-+
-+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+ Written by Dave Gilbert <david.gilbert@linaro.org>
-+
-+ A very simple strchr routine, from benchmarks on A9 it's a bit faster than
-+ the current version in eglibc (2.12.1-0ubuntu14 package)
-+ I don't think doing a word at a time version is worth it since a lot
-+ of strchr cases are very short anyway */
-+
-+@ 2011-02-07 david.gilbert@linaro.org
-+@ Extracted from local git a5b438d861
-+
-+ .syntax unified
-+ .arch armv7-a
-+
-+ .text
-+ .thumb
-+
-+@ ---------------------------------------------------------------------------
-+
-+ .thumb_func
-+ .align 2
-+ .p2align 4,,15
-+ .global strchr
-+ .type strchr,%function
-+strchr:
-+ @ r0 = start of string
-+ @ r1 = character to match
-+ @ returns NULL for no match, or a pointer to the match
-+ and r1,r1, #255
-+
-+1:
-+ ldrb r2,[r0],#1
-+ cmp r2,r1
-+ cbz r2,10f
-+ bne 1b
-+
-+ @ We're here if it matched
-+5:
-+ subs r0,r0,#1
-+ bx lr
-+
-+10:
-+ @ We're here if we ran off the end
-+ cmp r1, #0 @ Corner case - you're allowed to search for the nil and get a pointer to it
-+ beq 5b @ A bit messy, if it's common we should branch at the start to a special loop
-+ mov r0,#0
-+ bx lr
-diff --git a/cortex-strings/sysdeps/arm/armv7/strlen.S b/cortex-strings/sysdeps/arm/armv7/strlen.S
-new file mode 100644
-index 000000000000..8efa2356fdd1
---- /dev/null
-+++ b/cortex-strings/sysdeps/arm/armv7/strlen.S
-@@ -0,0 +1,150 @@
-+/* Copyright (c) 2010-2011,2013 Linaro Limited
-+ All rights reserved.
-+
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+
-+ * Neither the name of Linaro Limited nor the names of its
-+ contributors may be used to endorse or promote products derived
-+ from this software without specific prior written permission.
-+
-+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-+
-+/*
-+ Assumes:
-+ ARMv6T2, AArch32
-+
-+ */
-+
-+ .macro def_fn f p2align=0
-+ .text
-+ .p2align \p2align
-+ .global \f
-+ .type \f, %function
-+\f:
-+ .endm
-+
-+#ifdef __ARMEB__
-+#define S2LO lsl
-+#define S2HI lsr
-+#else
-+#define S2LO lsr
-+#define S2HI lsl
-+#endif
-+
-+ /* This code requires Thumb. */
-+ .thumb
-+ .syntax unified
-+
-+/* Parameters and result. */
-+#define srcin r0
-+#define result r0
-+
-+/* Internal variables. */
-+#define src r1
-+#define data1a r2
-+#define data1b r3
-+#define const_m1 r12
-+#define const_0 r4
-+#define tmp1 r4 /* Overlaps const_0 */
-+#define tmp2 r5
-+
-+def_fn strlen p2align=6
-+ pld [srcin, #0]
-+ strd r4, r5, [sp, #-8]!
-+ bic src, srcin, #7
-+ mvn const_m1, #0
-+ ands tmp1, srcin, #7 /* (8 - bytes) to alignment. */
-+ pld [src, #32]
-+ bne.w .Lmisaligned8
-+ mov const_0, #0
-+ mov result, #-8
-+.Lloop_aligned:
-+ /* Bytes 0-7. */
-+ ldrd data1a, data1b, [src]
-+ pld [src, #64]
-+ add result, result, #8
-+.Lstart_realigned:
-+ uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
-+ sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
-+ uadd8 data1b, data1b, const_m1
-+ sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
-+ cbnz data1b, .Lnull_found
-+
-+ /* Bytes 8-15. */
-+ ldrd data1a, data1b, [src, #8]
-+ uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
-+ add result, result, #8
-+ sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
-+ uadd8 data1b, data1b, const_m1
-+ sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
-+ cbnz data1b, .Lnull_found
-+
-+ /* Bytes 16-23. */
-+ ldrd data1a, data1b, [src, #16]
-+ uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
-+ add result, result, #8
-+ sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
-+ uadd8 data1b, data1b, const_m1
-+ sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
-+ cbnz data1b, .Lnull_found
-+
-+ /* Bytes 24-31. */
-+ ldrd data1a, data1b, [src, #24]
-+ add src, src, #32
-+ uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */
-+ add result, result, #8
-+ sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */
-+ uadd8 data1b, data1b, const_m1
-+ sel data1b, data1a, const_m1 /* Only used if d1a == 0. */
-+ cmp data1b, #0
-+ beq .Lloop_aligned
-+
-+.Lnull_found:
-+ cmp data1a, #0
-+ itt eq
-+ addeq result, result, #4
-+ moveq data1a, data1b
-+#ifndef __ARMEB__
-+ rev data1a, data1a
-+#endif
-+ clz data1a, data1a
-+ ldrd r4, r5, [sp], #8
-+ add result, result, data1a, lsr #3 /* Bits -> Bytes. */
-+ bx lr
-+
-+.Lmisaligned8:
-+ ldrd data1a, data1b, [src]
-+ and tmp2, tmp1, #3
-+ rsb result, tmp1, #0
-+ lsl tmp2, tmp2, #3 /* Bytes -> bits. */
-+ tst tmp1, #4
-+ pld [src, #64]
-+ S2HI tmp2, const_m1, tmp2
-+ orn data1a, data1a, tmp2
-+ itt ne
-+ ornne data1b, data1b, tmp2
-+ movne data1a, const_m1
-+ mov const_0, #0
-+ b .Lstart_realigned
-+ .size strlen, . - strlen
-+
diff --git a/patches/glibc-2.20/0401-add-libc_hidden_builtin_def-for-all-cortex-functions.patch b/patches/glibc-2.20/0401-add-libc_hidden_builtin_def-for-all-cortex-functions.patch
deleted file mode 100644
index 2ffcdbb..0000000
--- a/patches/glibc-2.20/0401-add-libc_hidden_builtin_def-for-all-cortex-functions.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From: Michael Olbrich <m.olbrich@pengutronix.de>
-Date: Thu, 15 Sep 2011 23:30:25 +0200
-Subject: [PATCH] add libc_hidden_builtin_def for all cortex functions
-
-Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
----
- cortex-strings/sysdeps/arm/armv7/memchr.S | 3 +++
- cortex-strings/sysdeps/arm/armv7/memcpy.S | 2 ++
- cortex-strings/sysdeps/arm/armv7/memset.S | 2 ++
- cortex-strings/sysdeps/arm/armv7/strchr.S | 3 +++
- cortex-strings/sysdeps/arm/armv7/strlen.S | 1 +
- 5 files changed, 11 insertions(+)
-
-diff --git a/cortex-strings/sysdeps/arm/armv7/memchr.S b/cortex-strings/sysdeps/arm/armv7/memchr.S
-index 92a2d9f0967d..6e4195325c82 100644
---- a/cortex-strings/sysdeps/arm/armv7/memchr.S
-+++ b/cortex-strings/sysdeps/arm/armv7/memchr.S
-@@ -153,3 +153,6 @@ memchr:
- pop {r4,r5,r6,r7}
- subs r0,r0,#1
- bx lr
-+
-+strong_alias (memchr, __memchr)
-+libc_hidden_builtin_def (memchr)
-diff --git a/cortex-strings/sysdeps/arm/armv7/memcpy.S b/cortex-strings/sysdeps/arm/armv7/memcpy.S
-index 3be24cad2c8d..c2742073a329 100644
---- a/cortex-strings/sysdeps/arm/armv7/memcpy.S
-+++ b/cortex-strings/sysdeps/arm/armv7/memcpy.S
-@@ -150,3 +150,5 @@ memcpy:
- cmp r2,#32
- blt 10b
- b 4b
-+
-+libc_hidden_builtin_def (memcpy)
-diff --git a/cortex-strings/sysdeps/arm/armv7/memset.S b/cortex-strings/sysdeps/arm/armv7/memset.S
-index 921cb7535cc8..d4c12a4d1243 100644
---- a/cortex-strings/sysdeps/arm/armv7/memset.S
-+++ b/cortex-strings/sysdeps/arm/armv7/memset.S
-@@ -116,3 +116,5 @@ memset:
-
- 10:
- bx lr @ goodbye
-+
-+libc_hidden_builtin_def (memset)
-diff --git a/cortex-strings/sysdeps/arm/armv7/strchr.S b/cortex-strings/sysdeps/arm/armv7/strchr.S
-index 8875dbfce6da..05c832f1faf4 100644
---- a/cortex-strings/sysdeps/arm/armv7/strchr.S
-+++ b/cortex-strings/sysdeps/arm/armv7/strchr.S
-@@ -74,3 +74,6 @@ strchr:
- beq 5b @ A bit messy, if it's common we should branch at the start to a special loop
- mov r0,#0
- bx lr
-+
-+weak_alias (strchr, index)
-+libc_hidden_builtin_def (strchr)
-diff --git a/cortex-strings/sysdeps/arm/armv7/strlen.S b/cortex-strings/sysdeps/arm/armv7/strlen.S
-index 8efa2356fdd1..1445d8e8118e 100644
---- a/cortex-strings/sysdeps/arm/armv7/strlen.S
-+++ b/cortex-strings/sysdeps/arm/armv7/strlen.S
-@@ -148,3 +148,4 @@ def_fn strlen p2align=6
- b .Lstart_realigned
- .size strlen, . - strlen
-
-+libc_hidden_builtin_def (strlen)
diff --git a/patches/glibc-2.20/0500-Hack-around-mips-args-to-host-gcc.patch b/patches/glibc-2.20/0500-Hack-around-mips-args-to-host-gcc.patch
deleted file mode 100644
index 5cc5c41..0000000
--- a/patches/glibc-2.20/0500-Hack-around-mips-args-to-host-gcc.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Marc Kleine-Budde <mkl@pengutronix.de>
-Date: Wed, 3 Dec 2014 15:05:52 +0100
-Subject: [PATCH] Hack around mips args to host-gcc
-
-originally From: "Steven J dot Hill" <sjhill at realitydiluted dot com>
-for Crosstool
-
-In OSELAS.Toolchain we pass -DBOOTSTRAP_GCC in CC. This patch fixes the
-header extraction from the glibc, by not passing mips specific flags to
-the HOST compiler.
-
-Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
----
- sysdeps/mips/mips32/Makefile | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/sysdeps/mips/mips32/Makefile b/sysdeps/mips/mips32/Makefile
-index dec0b024c3a8..dde2ca6bce1d 100644
---- a/sysdeps/mips/mips32/Makefile
-+++ b/sysdeps/mips/mips32/Makefile
-@@ -1,3 +1,7 @@
-+ifeq ($(filter -DBOOTSTRAP_GCC,$(CC)),)
- ifeq ($(filter -mabi=32,$(CC)),)
- CC += -mabi=32
- endif
-+else
-+CC += -D_MIPS_SZPTR=32
-+endif
diff --git a/patches/glibc-2.20/0600-ARM-fix-PI-futex-breakge-glibc-bug-18463.patch b/patches/glibc-2.20/0600-ARM-fix-PI-futex-breakge-glibc-bug-18463.patch
deleted file mode 100644
index 0fa968c..0000000
--- a/patches/glibc-2.20/0600-ARM-fix-PI-futex-breakge-glibc-bug-18463.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Marc Kleine-Budde <mkl@pengutronix.de>
-Date: Sat, 13 Jun 2015 19:25:07 +0200
-Subject: [PATCH] ARM: fix PI futex breakge - glibc bug 18463
-
-This patch fixes glibc bug 18463:
-
- https://sourceware.org/bugzilla/show_bug.cgi?id=18463
-
-The problem is caused by:
-
- 47c5adebd2c8 Correct robust mutex / PI futex kernel assumptions (bug 9894).
-
-An alternative approach to this bug is to switch to the new condvar
-implementation from Torvald Riegel
-(https://sourceware.org/ml/libc-alpha/2015-02/msg00578.html). Until glibc
-upstream does so, this patch has probably to be ported to new glibc releases.
-
-Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
----
- sysdeps/unix/sysv/linux/arm/kernel-features.h | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
-index e755741de60b..0d9f8910d650 100644
---- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
-+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
-@@ -38,5 +38,4 @@
- futex_atomic_cmpxchg_inatomic, depending on kernel
- configuration. */
- #undef __ASSUME_FUTEX_LOCK_PI
--#undef __ASSUME_REQUEUE_PI
- #undef __ASSUME_SET_ROBUST_LIST
diff --git a/patches/glibc-2.20/series b/patches/glibc-2.20/series
deleted file mode 100644
index 992d079..0000000
--- a/patches/glibc-2.20/series
+++ /dev/null
@@ -1,24 +0,0 @@
-# generated by git-ptx-patches
-#tag:base --start-number 1
-#tag:upstream --start-number 1
-0001-CVE-2014-9402-Avoid-infinite-loop-in-nss_dns-getnetb.patch
-0002-CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch
-0003-CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch
-0004-CVE-2015-1472-wscanf-allocates-too-little-memory.patch
-0005-CVE-2014-8121-Do-not-close-NSS-files-database-during.patch
-0006-CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch
-#tag:build-system --start-number 100
-0100-add-install-lib-all-target.patch
-0101-don-t-regen-docs-if-perl-is-not-found.patch
-#tag:debian --start-number 200
-0200-Fix-localedef-segfault-when-run-under-exec-shield-Pa.patch
-#tag:gentoo --start-number 300
-0300-resolv-dynamic.patch
-#tag:linaro --start-number 400
-0400-optimized-string-functions-for-NEON-from-Linaro.patch
-0401-add-libc_hidden_builtin_def-for-all-cortex-functions.patch
-#tag:hacks --start-number 500
-0500-Hack-around-mips-args-to-host-gcc.patch
-#tag:open-glibc-bugs --start-number 600
-0600-ARM-fix-PI-futex-breakge-glibc-bug-18463.patch
-# 9b9561d3bd8d2a555c8bae5ece64e366 - git-ptx-patches magic