summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/glibc/2.14.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.14.1/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.14.1/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.14.1/104-unused-variables.patch165
-rw-r--r--patches/glibc/2.14.1/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.14.1/106-dl-open-array-bounds.patch27
-rw-r--r--patches/glibc/2.14/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.14/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.14/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.14/104-unused-variables.patch165
-rw-r--r--patches/glibc/2.14/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.14/106-dl-open-array-bounds.patch27
-rw-r--r--patches/glibc/2.15/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.15/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.15/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.15/104-unused-variables.patch161
-rw-r--r--patches/glibc/2.15/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.15/106-dl-open-array-bounds.patch27
-rw-r--r--patches/glibc/2.16.0/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.16.0/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.16.0/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.16.0/104-unused-variables.patch157
-rw-r--r--patches/glibc/2.16.0/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.16.0/106-dl-open-array-bounds.patch27
-rw-r--r--patches/glibc/2.17/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.17/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.17/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.17/104-unused-variables.patch157
-rw-r--r--patches/glibc/2.17/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.17/106-dl-open-array-bounds.patch27
-rw-r--r--patches/glibc/2.18/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.18/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.18/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.18/104-unused-variables.patch157
-rw-r--r--patches/glibc/2.18/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.18/106-dl-open-array-bounds.patch36
-rw-r--r--patches/glibc/2.19/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.19/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.19/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.19/104-unused-variables.patch178
-rw-r--r--patches/glibc/2.19/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.19/106-dl-open-array-bounds.patch36
-rw-r--r--patches/glibc/2.20/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.20/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.20/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.20/104-unused-variables.patch178
-rw-r--r--patches/glibc/2.20/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.20/106-dl-open-array-bounds.patch36
-rw-r--r--patches/glibc/2.21/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.21/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.21/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.21/104-unused-variables.patch178
-rw-r--r--patches/glibc/2.21/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/2.21/106-dl-open-array-bounds.patch36
-rw-r--r--patches/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/2.22/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/2.22/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/2.22/104-unused-variables.patch178
-rw-r--r--patches/glibc/2.22/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/linaro-2.20-2014.11/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch84
-rw-r--r--patches/glibc/linaro-2.20-2014.11/102-fix-signed-shift-overlow.patch98
-rw-r--r--patches/glibc/linaro-2.20-2014.11/103-dl-openat64-variadic.patch195
-rw-r--r--patches/glibc/linaro-2.20-2014.11/104-unused-variables.patch178
-rw-r--r--patches/glibc/linaro-2.20-2014.11/105-misleading-indentation.patch24
-rw-r--r--patches/glibc/linaro-2.20-2014.11/106-dl-open-array-bounds.patch36
65 files changed, 6578 insertions, 0 deletions
diff --git a/patches/glibc/2.14.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.14.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.14.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.14.1/102-fix-signed-shift-overlow.patch b/patches/glibc/2.14.1/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.14.1/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.14.1/103-dl-openat64-variadic.patch b/patches/glibc/2.14.1/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.14.1/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.14.1/104-unused-variables.patch b/patches/glibc/2.14.1/104-unused-variables.patch
new file mode 100644
index 0000000..e063675
--- /dev/null
+++ b/patches/glibc/2.14.1/104-unused-variables.patch
@@ -0,0 +1,165 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+ /**/ NaNQ = {{0x7ff80000, 0x00000000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+ /**/ NaNQ = {{0x00000000, 0x7ff80000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,12 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-#ifdef __STDC__
+-static const float zero = 0.0;
+-#else
+-static float zero = 0.0;
+-#endif
+-
+ #ifdef __STDC__
+ float __ieee754_log10f(float x)
+ #else
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,12 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include "math.h"
+ #include "math_private.h"
+
+-#ifdef __STDC__
+-static const float one=1.0;
+-#else
+-static float one=1.0;
+-#endif
+-
+ #ifdef __STDC__
+ float __cosf(float x)
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+ static long double
+ #endif
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.14.1/105-misleading-indentation.patch b/patches/glibc/2.14.1/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.14.1/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.14.1/106-dl-open-array-bounds.patch b/patches/glibc/2.14.1/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..bdb5c19
--- /dev/null
+++ b/patches/glibc/2.14.1/106-dl-open-array-bounds.patch
@@ -0,0 +1,27 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if ((nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && ((nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.14/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.14/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.14/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.14/102-fix-signed-shift-overlow.patch b/patches/glibc/2.14/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.14/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.14/103-dl-openat64-variadic.patch b/patches/glibc/2.14/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.14/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.14/104-unused-variables.patch b/patches/glibc/2.14/104-unused-variables.patch
new file mode 100644
index 0000000..e063675
--- /dev/null
+++ b/patches/glibc/2.14/104-unused-variables.patch
@@ -0,0 +1,165 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+ /**/ NaNQ = {{0x7ff80000, 0x00000000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+ /**/ NaNQ = {{0x00000000, 0x7ff80000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,12 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-#ifdef __STDC__
+-static const float zero = 0.0;
+-#else
+-static float zero = 0.0;
+-#endif
+-
+ #ifdef __STDC__
+ float __ieee754_log10f(float x)
+ #else
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,12 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include "math.h"
+ #include "math_private.h"
+
+-#ifdef __STDC__
+-static const float one=1.0;
+-#else
+-static float one=1.0;
+-#endif
+-
+ #ifdef __STDC__
+ float __cosf(float x)
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+ static long double
+ #endif
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.14/105-misleading-indentation.patch b/patches/glibc/2.14/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.14/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.14/106-dl-open-array-bounds.patch b/patches/glibc/2.14/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..bdb5c19
--- /dev/null
+++ b/patches/glibc/2.14/106-dl-open-array-bounds.patch
@@ -0,0 +1,27 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if ((nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && ((nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.15/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.15/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.15/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.15/102-fix-signed-shift-overlow.patch b/patches/glibc/2.15/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.15/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.15/103-dl-openat64-variadic.patch b/patches/glibc/2.15/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.15/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.15/104-unused-variables.patch b/patches/glibc/2.15/104-unused-variables.patch
new file mode 100644
index 0000000..63e4a40
--- /dev/null
+++ b/patches/glibc/2.15/104-unused-variables.patch
@@ -0,0 +1,161 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+ /**/ NaNQ = {{0x7ff80000, 0x00000000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+ /**/ NaNQ = {{0x00000000, 0x7ff80000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,12 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include "math.h"
+ #include "math_private.h"
+
+-#ifdef __STDC__
+-static const float one=1.0;
+-#else
+-static float one=1.0;
+-#endif
+-
+ #ifdef __STDC__
+ float __cosf(float x)
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+ static long double
+ #endif
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.15/105-misleading-indentation.patch b/patches/glibc/2.15/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.15/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.15/106-dl-open-array-bounds.patch b/patches/glibc/2.15/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..bdb5c19
--- /dev/null
+++ b/patches/glibc/2.15/106-dl-open-array-bounds.patch
@@ -0,0 +1,27 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if ((nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && ((nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.16.0/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.16.0/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.16.0/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.16.0/102-fix-signed-shift-overlow.patch b/patches/glibc/2.16.0/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.16.0/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.16.0/103-dl-openat64-variadic.patch b/patches/glibc/2.16.0/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.16.0/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.16.0/104-unused-variables.patch b/patches/glibc/2.16.0/104-unused-variables.patch
new file mode 100644
index 0000000..2a85a0c
--- /dev/null
+++ b/patches/glibc/2.16.0/104-unused-variables.patch
@@ -0,0 +1,157 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+ /**/ NaNQ = {{0x7ff80000, 0x00000000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+ /**/ NaNQ = {{0x00000000, 0x7ff80000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ float __cosf(float x)
+ {
+ float y[2],z=0.0;
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.16.0/105-misleading-indentation.patch b/patches/glibc/2.16.0/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.16.0/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.16.0/106-dl-open-array-bounds.patch b/patches/glibc/2.16.0/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..a8efe9a
--- /dev/null
+++ b/patches/glibc/2.16.0/106-dl-open-array-bounds.patch
@@ -0,0 +1,27 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.17/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.17/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.17/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.17/102-fix-signed-shift-overlow.patch b/patches/glibc/2.17/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.17/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.17/103-dl-openat64-variadic.patch b/patches/glibc/2.17/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.17/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.17/104-unused-variables.patch b/patches/glibc/2.17/104-unused-variables.patch
new file mode 100644
index 0000000..80e0ff2
--- /dev/null
+++ b/patches/glibc/2.17/104-unused-variables.patch
@@ -0,0 +1,157 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+ /**/ NaNQ = {{0x7ff80000, 0x00000000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+ /**/ NaNQ = {{0x00000000, 0x7ff80000}}, /* NaNQ */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.17/105-misleading-indentation.patch b/patches/glibc/2.17/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.17/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.17/106-dl-open-array-bounds.patch b/patches/glibc/2.17/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..a8efe9a
--- /dev/null
+++ b/patches/glibc/2.17/106-dl-open-array-bounds.patch
@@ -0,0 +1,27 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.18/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.18/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.18/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.18/102-fix-signed-shift-overlow.patch b/patches/glibc/2.18/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.18/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.18/103-dl-openat64-variadic.patch b/patches/glibc/2.18/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.18/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.18/104-unused-variables.patch b/patches/glibc/2.18/104-unused-variables.patch
new file mode 100644
index 0000000..642edb1
--- /dev/null
+++ b/patches/glibc/2.18/104-unused-variables.patch
@@ -0,0 +1,157 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
diff --git a/patches/glibc/2.18/105-misleading-indentation.patch b/patches/glibc/2.18/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.18/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.18/106-dl-open-array-bounds.patch b/patches/glibc/2.18/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..08a9076
--- /dev/null
+++ b/patches/glibc/2.18/106-dl-open-array-bounds.patch
@@ -0,0 +1,36 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -211,7 +211,7 @@ dl_open_worker (void *a)
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+- call_map = l;
++ call_map = l;
+
+ if (args->nsid == __LM_ID_CALLER)
+ args->nsid = call_map->l_ns;
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.19/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.19/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.19/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.19/102-fix-signed-shift-overlow.patch b/patches/glibc/2.19/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.19/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.19/103-dl-openat64-variadic.patch b/patches/glibc/2.19/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.19/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.19/104-unused-variables.patch b/patches/glibc/2.19/104-unused-variables.patch
new file mode 100644
index 0000000..889c9bb
--- /dev/null
+++ b/patches/glibc/2.19/104-unused-variables.patch
@@ -0,0 +1,178 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
+diff --git a/timezone/private.h b/timezone/private.h
+index 4e8f4ae..ed19e06 100644
+--- a/timezone/private.h
++++ b/timezone/private.h
+@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format);
+ #define TYPE_SIGNED(type) (((type) -1) < 0)
+ #endif /* !defined TYPE_SIGNED */
+
+-/* The minimum and maximum finite time values. */
+-static time_t const time_t_min =
+- (TYPE_SIGNED(time_t)
+- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+- : 0);
+-static time_t const time_t_max =
+- (TYPE_SIGNED(time_t)
+- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+- : -1);
+-
+ #ifndef INT_STRLEN_MAXIMUM
+ /*
+ ** 302 / 1000 is log10(2.0) rounded up.
diff --git a/patches/glibc/2.19/105-misleading-indentation.patch b/patches/glibc/2.19/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.19/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.19/106-dl-open-array-bounds.patch b/patches/glibc/2.19/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..08a9076
--- /dev/null
+++ b/patches/glibc/2.19/106-dl-open-array-bounds.patch
@@ -0,0 +1,36 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -211,7 +211,7 @@ dl_open_worker (void *a)
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+- call_map = l;
++ call_map = l;
+
+ if (args->nsid == __LM_ID_CALLER)
+ args->nsid = call_map->l_ns;
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.20/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.20/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.20/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.20/102-fix-signed-shift-overlow.patch b/patches/glibc/2.20/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.20/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.20/103-dl-openat64-variadic.patch b/patches/glibc/2.20/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.20/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.20/104-unused-variables.patch b/patches/glibc/2.20/104-unused-variables.patch
new file mode 100644
index 0000000..889c9bb
--- /dev/null
+++ b/patches/glibc/2.20/104-unused-variables.patch
@@ -0,0 +1,178 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
+diff --git a/timezone/private.h b/timezone/private.h
+index 4e8f4ae..ed19e06 100644
+--- a/timezone/private.h
++++ b/timezone/private.h
+@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format);
+ #define TYPE_SIGNED(type) (((type) -1) < 0)
+ #endif /* !defined TYPE_SIGNED */
+
+-/* The minimum and maximum finite time values. */
+-static time_t const time_t_min =
+- (TYPE_SIGNED(time_t)
+- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+- : 0);
+-static time_t const time_t_max =
+- (TYPE_SIGNED(time_t)
+- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+- : -1);
+-
+ #ifndef INT_STRLEN_MAXIMUM
+ /*
+ ** 302 / 1000 is log10(2.0) rounded up.
diff --git a/patches/glibc/2.20/105-misleading-indentation.patch b/patches/glibc/2.20/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.20/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.20/106-dl-open-array-bounds.patch b/patches/glibc/2.20/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..08a9076
--- /dev/null
+++ b/patches/glibc/2.20/106-dl-open-array-bounds.patch
@@ -0,0 +1,36 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -211,7 +211,7 @@ dl_open_worker (void *a)
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+- call_map = l;
++ call_map = l;
+
+ if (args->nsid == __LM_ID_CALLER)
+ args->nsid = call_map->l_ns;
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.21/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.21/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.21/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.21/102-fix-signed-shift-overlow.patch b/patches/glibc/2.21/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.21/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.21/103-dl-openat64-variadic.patch b/patches/glibc/2.21/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/2.21/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/2.21/104-unused-variables.patch b/patches/glibc/2.21/104-unused-variables.patch
new file mode 100644
index 0000000..fd4def0
--- /dev/null
+++ b/patches/glibc/2.21/104-unused-variables.patch
@@ -0,0 +1,178 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ DIAG_POP_NEEDS_COMMENT;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = LDBL_MAX;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
+diff --git a/timezone/private.h b/timezone/private.h
+index 4e8f4ae..ed19e06 100644
+--- a/timezone/private.h
++++ b/timezone/private.h
+@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format);
+ #define TYPE_SIGNED(type) (((type) -1) < 0)
+ #endif /* !defined TYPE_SIGNED */
+
+-/* The minimum and maximum finite time values. */
+-static time_t const time_t_min =
+- (TYPE_SIGNED(time_t)
+- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+- : 0);
+-static time_t const time_t_max =
+- (TYPE_SIGNED(time_t)
+- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+- : -1);
+-
+ #ifndef INT_STRLEN_MAXIMUM
+ /*
+ ** 302 / 1000 is log10(2.0) rounded up.
diff --git a/patches/glibc/2.21/105-misleading-indentation.patch b/patches/glibc/2.21/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.21/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/2.21/106-dl-open-array-bounds.patch b/patches/glibc/2.21/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..08a9076
--- /dev/null
+++ b/patches/glibc/2.21/106-dl-open-array-bounds.patch
@@ -0,0 +1,36 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -211,7 +211,7 @@ dl_open_worker (void *a)
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+- call_map = l;
++ call_map = l;
+
+ if (args->nsid == __LM_ID_CALLER)
+ args->nsid = call_map->l_ns;
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
diff --git a/patches/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/2.22/102-fix-signed-shift-overlow.patch b/patches/glibc/2.22/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/2.22/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/2.22/103-dl-openat64-variadic.patch b/patches/glibc/2.22/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..302088e
--- /dev/null
+++ b/patches/glibc/2.22/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert (!__OPEN_NEEDS_MODE (oflag));
+
diff --git a/patches/glibc/2.22/104-unused-variables.patch b/patches/glibc/2.22/104-unused-variables.patch
new file mode 100644
index 0000000..fd4def0
--- /dev/null
+++ b/patches/glibc/2.22/104-unused-variables.patch
@@ -0,0 +1,178 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ DIAG_POP_NEEDS_COMMENT;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = LDBL_MAX;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
+diff --git a/timezone/private.h b/timezone/private.h
+index 4e8f4ae..ed19e06 100644
+--- a/timezone/private.h
++++ b/timezone/private.h
+@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format);
+ #define TYPE_SIGNED(type) (((type) -1) < 0)
+ #endif /* !defined TYPE_SIGNED */
+
+-/* The minimum and maximum finite time values. */
+-static time_t const time_t_min =
+- (TYPE_SIGNED(time_t)
+- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+- : 0);
+-static time_t const time_t_max =
+- (TYPE_SIGNED(time_t)
+- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+- : -1);
+-
+ #ifndef INT_STRLEN_MAXIMUM
+ /*
+ ** 302 / 1000 is log10(2.0) rounded up.
diff --git a/patches/glibc/2.22/105-misleading-indentation.patch b/patches/glibc/2.22/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/2.22/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/linaro-2.20-2014.11/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/linaro-2.20-2014.11/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
new file mode 100644
index 0000000..6fd663a
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch
@@ -0,0 +1,84 @@
+From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
+From: Yvan Roux <yvan.roux@linaro.org>
+Date: Fri, 15 Apr 2016 13:29:26 +0200
+Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
+ -Wparentheses
+
+---
+ ChangeLog | 5 +++++
+ nis/nis_call.c | 20 +++++++++++---------
+ stdlib/setenv.c | 26 ++++++++++++++------------
+ 3 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/nis/nis_call.c b/nis/nis_call.c
+index 3fa37e4..cb7839a 100644
+--- a/nis/nis_call.c
++++ b/nis/nis_call.c
+@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent,
+ /* Choose which entry should be evicted from the cache. */
+ loc = &nis_server_cache[0];
+ if (*loc != NULL)
+- for (i = 1; i < 16; ++i)
+- if (nis_server_cache[i] == NULL)
+- {
++ {
++ for (i = 1; i < 16; ++i)
++ if (nis_server_cache[i] == NULL)
++ {
++ loc = &nis_server_cache[i];
++ break;
++ }
++ else if ((*loc)->uses > nis_server_cache[i]->uses
++ || ((*loc)->uses == nis_server_cache[i]->uses
++ && (*loc)->expires > nis_server_cache[i]->expires))
+ loc = &nis_server_cache[i];
+- break;
+- }
+- else if ((*loc)->uses > nis_server_cache[i]->uses
+- || ((*loc)->uses == nis_server_cache[i]->uses
+- && (*loc)->expires > nis_server_cache[i]->expires))
+- loc = &nis_server_cache[i];
++ }
+ old = *loc;
+ *loc = new;
+
+diff --git a/stdlib/setenv.c b/stdlib/setenv.c
+index da61ee0..e66045f 100644
+--- a/stdlib/setenv.c
++++ b/stdlib/setenv.c
+@@ -278,18 +278,20 @@ unsetenv (const char *name)
+ ep = __environ;
+ if (ep != NULL)
+ while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ {
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++ }
+
+ UNLOCK;
+
+--
+2.7.4
+
diff --git a/patches/glibc/linaro-2.20-2014.11/102-fix-signed-shift-overlow.patch b/patches/glibc/linaro-2.20-2014.11/102-fix-signed-shift-overlow.patch
new file mode 100644
index 0000000..ef49f83
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/102-fix-signed-shift-overlow.patch
@@ -0,0 +1,98 @@
+commit 5542236837c5c41435f8282ec92799f480c36f18
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue Jul 21 22:50:29 2015 -0700
+
+ Port the 0x7efe...feff pattern to GCC 6.
+
+ See Steve Ellcey's bug report in:
+ https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
+ * string/memrchr.c (MEMRCHR):
+ * string/rawmemchr.c (RAWMEMCHR):
+ * string/strchr.c (strchr):
+ * string/strchrnul.c (STRCHRNUL):
+ Rewrite code to avoid issues with signed shift overflow.
+
+diff --git a/string/memrchr.c b/string/memrchr.c
+index 0c8fd84..86cd5b9 100644
+--- a/string/memrchr.c
++++ b/string/memrchr.c
+@@ -96,15 +96,8 @@ MEMRCHR
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 05b22be..228ca9d 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+-
+- if (sizeof (longword) != 4 && sizeof (longword) != 8)
+- abort ();
+-
+-#if LONG_MAX <= LONG_MAX_32_BITS
+- magic_bits = 0x7efefeff;
+-#else
+- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+-#endif
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchr.c b/string/strchr.c
+index 5f90075..f13b2b3 100644
+--- a/string/strchr.c
++++ b/string/strchr.c
+@@ -60,13 +60,8 @@ strchr (const char *s, int c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+diff --git a/string/strchrnul.c b/string/strchrnul.c
+index 2678f1d..daf0b3f 100644
+--- a/string/strchrnul.c
++++ b/string/strchrnul.c
+@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in)
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+- switch (sizeof (longword))
+- {
+- case 4: magic_bits = 0x7efefeffL; break;
+- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+- default:
+- abort ();
+- }
++ magic_bits = -1;
++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
diff --git a/patches/glibc/linaro-2.20-2014.11/103-dl-openat64-variadic.patch b/patches/glibc/linaro-2.20-2014.11/103-dl-openat64-variadic.patch
new file mode 100644
index 0000000..fe94b96
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/103-dl-openat64-variadic.patch
@@ -0,0 +1,195 @@
+commit 9dd346ff431fc761f1b748bd4da8bb59f7652094
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Oct 20 11:54:09 2015 +0000
+
+ Convert 113 more function definitions to prototype style (files with assertions).
+
+ This mostly automatically-generated patch converts 113 function
+ definitions in glibc from old-style K&R to prototype-style. Following
+ my other recent such patches, this one deals with the case of function
+ definitions in files that either contain assertions or where grep
+ suggested they might contain assertions - and thus where it isn't
+ possible to use a simple object code comparison as a sanity check on
+ the correctness of the patch, because line numbers are changed.
+
+ A few such automatically-generated changes needed to be supplemented
+ by manual changes for the result to compile. openat64 had a prototype
+ declaration with "..." but an old-style definition in
+ sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
+ generated prototype in the definition (I've filed
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
+ such cases in GCC; the old state was undefined behavior not requiring
+ a diagnostic, but one seems a good idea). In addition, as Florian has
+ noted regparm attribute mismatches between declaration and definition
+ are only diagnosed for prototype definitions, and five functions
+ needed internal_function added to their definitions (in the case of
+ __pthread_mutex_cond_lock, via the macro definition of
+ __pthread_mutex_lock) to compile on i386.
+
+ After this patch is in, remaining old-style definitions are probably
+ most readily fixed manually before we can turn on
+ -Wold-style-definition for all builds.
+
+ Tested for x86_64 and x86 (testsuite).
+
+ * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
+ function definition.
+ * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
+ * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
+ * debug/backtracesyms.c (__backtrace_symbols): Likewise.
+ * elf/dl-minimal.c (_itoa): Likewise.
+ * hurd/hurdmalloc.c (malloc): Likewise.
+ (free): Likewise.
+ (realloc): Likewise.
+ * inet/inet6_option.c (inet6_option_space): Likewise.
+ (inet6_option_init): Likewise.
+ (inet6_option_append): Likewise.
+ (inet6_option_alloc): Likewise.
+ (inet6_option_next): Likewise.
+ (inet6_option_find): Likewise.
+ * io/ftw.c (FTW_NAME): Likewise.
+ (NFTW_NAME): Likewise.
+ (NFTW_NEW_NAME): Likewise.
+ (NFTW_OLD_NAME): Likewise.
+ * libio/iofwide.c (_IO_fwide): Likewise.
+ * libio/strops.c (_IO_str_init_static_internal): Likewise.
+ (_IO_str_init_static): Likewise.
+ (_IO_str_init_readonly): Likewise.
+ (_IO_str_overflow): Likewise.
+ (_IO_str_underflow): Likewise.
+ (_IO_str_count): Likewise.
+ (_IO_str_seekoff): Likewise.
+ (_IO_str_pbackfail): Likewise.
+ (_IO_str_finish): Likewise.
+ * libio/wstrops.c (_IO_wstr_init_static): Likewise.
+ (_IO_wstr_overflow): Likewise.
+ (_IO_wstr_underflow): Likewise.
+ (_IO_wstr_count): Likewise.
+ (_IO_wstr_seekoff): Likewise.
+ (_IO_wstr_pbackfail): Likewise.
+ (_IO_wstr_finish): Likewise.
+ * locale/programs/localedef.c (normalize_codeset): Likewise.
+ * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+ (add_locales_to_archive): Likewise.
+ (delete_locales_from_archive): Likewise.
+ * malloc/malloc.c (__libc_mallinfo): Likewise.
+ * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
+ * misc/tsearch.c (__tfind): Likewise.
+ * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
+ * nptl/pthread_attr_getdetachstate.c
+ (__pthread_attr_getdetachstate): Likewise.
+ * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
+ Likewise.
+ * nptl/pthread_attr_getinheritsched.c
+ (__pthread_attr_getinheritsched): Likewise.
+ * nptl/pthread_attr_getschedparam.c
+ (__pthread_attr_getschedparam): Likewise.
+ * nptl/pthread_attr_getschedpolicy.c
+ (__pthread_attr_getschedpolicy): Likewise.
+ * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
+ Likewise.
+ * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
+ Likewise.
+ * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
+ Likewise.
+ * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+ Likewise.
+ * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
+ (__pthread_attr_init_2_0): Likewise.
+ * nptl/pthread_attr_setdetachstate.c
+ (__pthread_attr_setdetachstate): Likewise.
+ * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
+ Likewise.
+ * nptl/pthread_attr_setinheritsched.c
+ (__pthread_attr_setinheritsched): Likewise.
+ * nptl/pthread_attr_setschedparam.c
+ (__pthread_attr_setschedparam): Likewise.
+ * nptl/pthread_attr_setschedpolicy.c
+ (__pthread_attr_setschedpolicy): Likewise.
+ * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
+ Likewise.
+ * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
+ Likewise.
+ * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
+ Likewise.
+ * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
+ Likewise.
+ * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
+ Likewise.
+ * nptl/pthread_create.c (__find_in_stack_list): Likewise.
+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
+ * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
+ use internal_function.
+ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
+ prototype-style function definition.
+ * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
+ (__pthread_mutex_cond_lock_adjust): Likewise. Use
+ internal_function.
+ * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
+ Convert to prototype-style function definition.
+ * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
+ Likewise.
+ * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
+ Likewise.
+ (__pthread_mutex_unlock): Likewise.
+ * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
+ * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
+ * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
+ * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
+ * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
+ * nss/makedb.c (process_input): Likewise.
+ * posix/fnmatch.c (__strchrnul): Likewise.
+ (__wcschrnul): Likewise.
+ (fnmatch): Likewise.
+ * posix/fnmatch_loop.c (FCT): Likewise.
+ * posix/glob.c (globfree): Likewise.
+ (__glob_pattern_type): Likewise.
+ (__glob_pattern_p): Likewise.
+ * posix/regcomp.c (re_compile_pattern): Likewise.
+ (re_set_syntax): Likewise.
+ (re_compile_fastmap): Likewise.
+ (regcomp): Likewise.
+ (regerror): Likewise.
+ (regfree): Likewise.
+ * posix/regexec.c (regexec): Likewise.
+ (re_match): Likewise.
+ (re_search): Likewise.
+ (re_match_2): Likewise.
+ (re_search_2): Likewise.
+ (re_search_stub): Likewise. Use internal_function
+ (re_copy_regs): Likewise.
+ (re_set_registers): Convert to prototype-style function
+ definition.
+ (prune_impossible_nodes): Likewise. Use internal_function.
+ * resolv/inet_net_pton.c (inet_net_pton): Convert to
+ prototype-style function definition.
+ (inet_net_pton_ipv4): Likewise.
+ * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
+ * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
+ * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
+ * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
+ * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
+ Make variadic.
+ * time/strptime_l.c (localtime_r): Convert to prototype-style
+ function definition.
+ * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.
+
+diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c
+index 7d100bb..7eea0ca 100644
+--- a/sysdeps/unix/sysv/linux/dl-openat64.c
++++ b/sysdeps/unix/sysv/linux/dl-openat64.c
+@@ -23,10 +23,7 @@
+
+
+ int
+-openat64 (dfd, file, oflag)
+- int dfd;
+- const char *file;
+- int oflag;
++openat64 (int dfd, const char *file, int oflag, ...)
+ {
+ assert ((oflag & O_CREAT) == 0);
+
diff --git a/patches/glibc/linaro-2.20-2014.11/104-unused-variables.patch b/patches/glibc/linaro-2.20-2014.11/104-unused-variables.patch
new file mode 100644
index 0000000..889c9bb
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/104-unused-variables.patch
@@ -0,0 +1,178 @@
+commit 6565fcb6e189d67b5a3f321453daebb805056d73
+Author: Wilco Dijkstra <wdijkstr@arm.com>
+Date: Fri Sep 18 20:27:20 2015 +0100
+
+ Fix several build failures with GCC6 due to unused static variables.
+
+ 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * resolv/base64.c (rcsid): Remove unused static.
+ * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused
+ static. (tqpi1): Likewise.
+ * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise.
+ * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise.
+ * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise.
+ * timezone/private.h (time_t_min): Likewise. (time_t_max):
+ Likewise.
+
+diff --git a/resolv/base64.c b/resolv/base64.c
+index ea584ed..519e5d2 100644
+--- a/resolv/base64.c
++++ b/resolv/base64.c
+@@ -40,10 +40,6 @@
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+-#if !defined(LINT) && !defined(CODECENTER)
+-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+-#endif /* not lint */
+-
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
+index e0d65af..82943f9 100644
+--- a/sysdeps/ieee754/dbl-64/atnat2.h
++++ b/sysdeps/ieee754/dbl-64/atnat2.h
+@@ -65,10 +65,8 @@
+ /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */
+ /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */
+ /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */
+-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */
+ /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */
+ /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */
+ /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */
+ /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */
+@@ -129,10 +127,8 @@
+ /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */
+ /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */
+ /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */
+-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */
+ /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */
+ /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */
+-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */
+ /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */
+ /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */
+ /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */
+diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
+index 6817eaf..42b21f2 100644
+--- a/sysdeps/ieee754/dbl-64/uexp.h
++++ b/sysdeps/ieee754/dbl-64/uexp.h
+@@ -29,7 +29,7 @@
+
+ #include "mydefs.h"
+
+-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+ err_0 = 1.000014, err_1 = 0.000016;
+ const static int4 bigint = 0x40862002,
+ badint = 0x40876000,smallint = 0x3C8fffff;
+diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
+index c8569a9..b4911e5 100644
+--- a/sysdeps/ieee754/dbl-64/upow.h
++++ b/sysdeps/ieee754/dbl-64/upow.h
+@@ -34,7 +34,6 @@
+ /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */
+ /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */
+ /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */
+-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */
+ /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */
+@@ -48,7 +47,6 @@
+ /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */
+ /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */
+ /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */
+-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */
+ /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
+ /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */
+ /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */
+diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
+index 96f0e81..1daeef7 100644
+--- a/sysdeps/ieee754/flt-32/e_log10f.c
++++ b/sysdeps/ieee754/flt-32/e_log10f.c
+@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
+ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
+ log10_2lo = 7.9034151668e-07; /* 0x355427db */
+
+-static const float zero = 0.0;
+-
+ float
+ __ieee754_log10f(float x)
+ {
+diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
+index 864ab27..0affd40 100644
+--- a/sysdeps/ieee754/flt-32/s_cosf.c
++++ b/sysdeps/ieee754/flt-32/s_cosf.c
+@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
+ #include <math.h>
+ #include <math_private.h>
+
+-static const float one=1.0;
+-
+ #ifndef COSF
+ # define COSF_FUNC __cosf
+ #else
+diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+index 500aacc..ab5a96e 100644
+--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
+ static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+ static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+ static const long double one = 1.0L;
+-static const long double zero = 0.0L;
+ static const long double huge = 1.0e4000L;
+
+ /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
+diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
+index fa4609f..08c80a3 100644
+--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
+@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
+
+ static const long double
+ tiny = 1e-4931L,
+- half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+index ff759bc..9609550 100644
+--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
+@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+ static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+ /* ln (2^16384 * (1 - 2^-113)) */
+-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+ static const long double zero = 0.0L;
+
+ long double
+diff --git a/timezone/private.h b/timezone/private.h
+index 4e8f4ae..ed19e06 100644
+--- a/timezone/private.h
++++ b/timezone/private.h
+@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format);
+ #define TYPE_SIGNED(type) (((type) -1) < 0)
+ #endif /* !defined TYPE_SIGNED */
+
+-/* The minimum and maximum finite time values. */
+-static time_t const time_t_min =
+- (TYPE_SIGNED(time_t)
+- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+- : 0);
+-static time_t const time_t_max =
+- (TYPE_SIGNED(time_t)
+- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+- : -1);
+-
+ #ifndef INT_STRLEN_MAXIMUM
+ /*
+ ** 302 / 1000 is log10(2.0) rounded up.
diff --git a/patches/glibc/linaro-2.20-2014.11/105-misleading-indentation.patch b/patches/glibc/linaro-2.20-2014.11/105-misleading-indentation.patch
new file mode 100644
index 0000000..1dd8d85
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/105-misleading-indentation.patch
@@ -0,0 +1,24 @@
+commit 976ef870542580cf5fed896c2c652b3e1a95f9da
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Fri Dec 11 09:19:37 2015 -0800
+
+ Fix indentation.
+
+ * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
+ Fix indentation.
+
+diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+index 0c7685c..392afdb 100644
+--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c
++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c
+@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++)
++ fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
diff --git a/patches/glibc/linaro-2.20-2014.11/106-dl-open-array-bounds.patch b/patches/glibc/linaro-2.20-2014.11/106-dl-open-array-bounds.patch
new file mode 100644
index 0000000..08a9076
--- /dev/null
+++ b/patches/glibc/linaro-2.20-2014.11/106-dl-open-array-bounds.patch
@@ -0,0 +1,36 @@
+commit 328c44c3670ebf6c1bd790acddce65a12998cd6c
+Author: Roland McGrath <roland@hack.frob.com>
+Date: Fri Apr 17 12:11:58 2015 -0700
+
+ Fuller check for invalid NSID in _dl_open.
+
+diff --git a/elf/dl-open.c b/elf/dl-open.c
+index 0dbe07f..2d0e082 100644
+--- a/elf/dl-open.c
++++ b/elf/dl-open.c
+@@ -211,7 +211,7 @@ dl_open_worker (void *a)
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+- call_map = l;
++ call_map = l;
+
+ if (args->nsid == __LM_ID_CALLER)
+ args->nsid = call_map->l_ns;
+@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. Also don't allow
+ loading into a namespace used for auditing. */
+- else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
+- && (GL(dl_ns)[nsid]._ns_nloaded == 0
++ else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
++ && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
++ /* This prevents the [NSID] index expressions from being
++ evaluated, so the compiler won't think that we are
++ accessing an invalid index here in the !SHARED case where
++ DL_NNS is 1 and so any NSID != 0 is invalid. */
++ || DL_NNS == 1
++ || GL(dl_ns)[nsid]._ns_nloaded == 0
+ || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
+ _dl_signal_error (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));