From 30e8549e3db9a74b651cbfe1872148975329dd06 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 10 Mar 2017 14:37:36 -0800 Subject: [PATCH] Add ARM patches for 2.12.2/2.13 Reported-by: Austin Beer (brainwave64) Signed-off-by: Alexey Neyman --- ...arning-about-ambiguous-else-with-Wpa.patch | 84 +++++++++ .../2.12.1/102-fix-signed-shift-overlow.patch | 98 +++++++++++ .../glibc/2.12.1/104-unused-variables.patch | 165 ++++++++++++++++++ .../2.12.1/105-misleading-indentation.patch | 24 +++ .../2.12.1/106-dl-open-array-bounds.patch | 27 +++ ...arning-about-ambiguous-else-with-Wpa.patch | 84 +++++++++ .../2.13/102-fix-signed-shift-overlow.patch | 98 +++++++++++ patches/glibc/2.13/104-unused-variables.patch | 165 ++++++++++++++++++ .../2.13/105-misleading-indentation.patch | 24 +++ .../glibc/2.13/106-dl-open-array-bounds.patch | 27 +++ .../670-support-hard-float-eabi.patch | 22 +++ .../670-support-hard-float-eabi.patch | 22 +++ 12 files changed, 840 insertions(+) create mode 100644 patches/glibc/2.12.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch create mode 100644 patches/glibc/2.12.1/102-fix-signed-shift-overlow.patch create mode 100644 patches/glibc/2.12.1/104-unused-variables.patch create mode 100644 patches/glibc/2.12.1/105-misleading-indentation.patch create mode 100644 patches/glibc/2.12.1/106-dl-open-array-bounds.patch create mode 100644 patches/glibc/2.13/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch create mode 100644 patches/glibc/2.13/102-fix-signed-shift-overlow.patch create mode 100644 patches/glibc/2.13/104-unused-variables.patch create mode 100644 patches/glibc/2.13/105-misleading-indentation.patch create mode 100644 patches/glibc/2.13/106-dl-open-array-bounds.patch create mode 100644 patches/glibc/ports-2.12.1/670-support-hard-float-eabi.patch create mode 100644 patches/glibc/ports-2.13/670-support-hard-float-eabi.patch diff --git a/patches/glibc/2.12.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.12.1/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch new file mode 100644 index 00000000..6fd663a2 --- /dev/null +++ b/patches/glibc/2.12.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 +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.12.1/102-fix-signed-shift-overlow.patch b/patches/glibc/2.12.1/102-fix-signed-shift-overlow.patch new file mode 100644 index 00000000..ef49f831 --- /dev/null +++ b/patches/glibc/2.12.1/102-fix-signed-shift-overlow.patch @@ -0,0 +1,98 @@ +commit 5542236837c5c41435f8282ec92799f480c36f18 +Author: Paul Eggert +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.12.1/104-unused-variables.patch b/patches/glibc/2.12.1/104-unused-variables.patch new file mode 100644 index 00000000..e063675a --- /dev/null +++ b/patches/glibc/2.12.1/104-unused-variables.patch @@ -0,0 +1,165 @@ +commit 6565fcb6e189d67b5a3f321453daebb805056d73 +Author: Wilco Dijkstra +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 + + * 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 + #include + #include +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.12.1/105-misleading-indentation.patch b/patches/glibc/2.12.1/105-misleading-indentation.patch new file mode 100644 index 00000000..1dd8d851 --- /dev/null +++ b/patches/glibc/2.12.1/105-misleading-indentation.patch @@ -0,0 +1,24 @@ +commit 976ef870542580cf5fed896c2c652b3e1a95f9da +Author: Steve Ellcey +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.12.1/106-dl-open-array-bounds.patch b/patches/glibc/2.12.1/106-dl-open-array-bounds.patch new file mode 100644 index 00000000..bdb5c19f --- /dev/null +++ b/patches/glibc/2.12.1/106-dl-open-array-bounds.patch @@ -0,0 +1,27 @@ +commit 328c44c3670ebf6c1bd790acddce65a12998cd6c +Author: Roland McGrath +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.13/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/glibc/2.13/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch new file mode 100644 index 00000000..6fd663a2 --- /dev/null +++ b/patches/glibc/2.13/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 +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.13/102-fix-signed-shift-overlow.patch b/patches/glibc/2.13/102-fix-signed-shift-overlow.patch new file mode 100644 index 00000000..ef49f831 --- /dev/null +++ b/patches/glibc/2.13/102-fix-signed-shift-overlow.patch @@ -0,0 +1,98 @@ +commit 5542236837c5c41435f8282ec92799f480c36f18 +Author: Paul Eggert +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.13/104-unused-variables.patch b/patches/glibc/2.13/104-unused-variables.patch new file mode 100644 index 00000000..e063675a --- /dev/null +++ b/patches/glibc/2.13/104-unused-variables.patch @@ -0,0 +1,165 @@ +commit 6565fcb6e189d67b5a3f321453daebb805056d73 +Author: Wilco Dijkstra +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 + + * 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 + #include + #include +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.13/105-misleading-indentation.patch b/patches/glibc/2.13/105-misleading-indentation.patch new file mode 100644 index 00000000..1dd8d851 --- /dev/null +++ b/patches/glibc/2.13/105-misleading-indentation.patch @@ -0,0 +1,24 @@ +commit 976ef870542580cf5fed896c2c652b3e1a95f9da +Author: Steve Ellcey +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.13/106-dl-open-array-bounds.patch b/patches/glibc/2.13/106-dl-open-array-bounds.patch new file mode 100644 index 00000000..bdb5c19f --- /dev/null +++ b/patches/glibc/2.13/106-dl-open-array-bounds.patch @@ -0,0 +1,27 @@ +commit 328c44c3670ebf6c1bd790acddce65a12998cd6c +Author: Roland McGrath +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/ports-2.12.1/670-support-hard-float-eabi.patch b/patches/glibc/ports-2.12.1/670-support-hard-float-eabi.patch new file mode 100644 index 00000000..3f2bc0f0 --- /dev/null +++ b/patches/glibc/ports-2.12.1/670-support-hard-float-eabi.patch @@ -0,0 +1,22 @@ +diff -ur glibc-2.12.1/ports/sysdeps/arm/preconfigure glibc-2.12.1-patched/ports/sysdeps/arm/preconfigure +--- glibc-2.12.1/ports/sysdeps/arm/preconfigure 2017-03-07 15:33:56.410265000 -0700 ++++ glibc-2.12.1-patched/ports/sysdeps/arm/preconfigure 2017-03-07 15:34:42.016840000 -0700 +@@ -2,7 +2,7 @@ + arm*) + base_machine=arm + case $config_os in +- linux-gnueabi) ++ linux-gnueabi*) + machine=arm/eabi/$machine + ;; + *) +diff -ur glibc-2.12.1/ports/sysdeps/arm/shlib-versions glibc-2.12.1-patched/ports/sysdeps/arm/shlib-versions +--- glibc-2.12.1/ports/sysdeps/arm/shlib-versions 2017-03-07 15:33:56.439267000 -0700 ++++ glibc-2.12.1-patched/ports/sysdeps/arm/shlib-versions 2017-03-07 15:34:42.018837000 -0700 +@@ -1,4 +1,4 @@ +-arm.*-.*-linux-gnueabi DEFAULT GLIBC_2.4 ++arm.*-.*-linux-gnueabi.* DEFAULT GLIBC_2.4 + +-arm.*-.*-linux-gnueabi ld=ld-linux.so.3 ++arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3 + arm.*-.*-linux.* ld=ld-linux.so.2 diff --git a/patches/glibc/ports-2.13/670-support-hard-float-eabi.patch b/patches/glibc/ports-2.13/670-support-hard-float-eabi.patch new file mode 100644 index 00000000..589f11e5 --- /dev/null +++ b/patches/glibc/ports-2.13/670-support-hard-float-eabi.patch @@ -0,0 +1,22 @@ +diff -ur glibc-2.13/ports/sysdeps/arm/preconfigure glibc-2.13-patched/ports/sysdeps/arm/preconfigure +--- glibc-2.13/ports/sysdeps/arm/preconfigure 2011-01-25 14:00:16.000000000 -0700 ++++ glibc-2.13-patched/ports/sysdeps/arm/preconfigure 2017-03-07 15:36:50.310454000 -0700 +@@ -2,7 +2,7 @@ + arm*) + base_machine=arm + case $config_os in +- linux-gnueabi) ++ linux-gnueabi*) + machine=arm/eabi/$machine + if [ "${CFLAGS+set}" != "set" ]; then + CFLAGS="-g -O2" +diff -ur glibc-2.13/ports/sysdeps/arm/shlib-versions glibc-2.13-patched/ports/sysdeps/arm/shlib-versions +--- glibc-2.13/ports/sysdeps/arm/shlib-versions 2011-01-25 14:00:16.000000000 -0700 ++++ glibc-2.13-patched/ports/sysdeps/arm/shlib-versions 2017-03-07 15:36:50.312457000 -0700 +@@ -1,4 +1,4 @@ +-arm.*-.*-linux-gnueabi DEFAULT GLIBC_2.4 ++arm.*-.*-linux-gnueabi.* DEFAULT GLIBC_2.4 + +-arm.*-.*-linux-gnueabi ld=ld-linux.so.3 ++arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3 + arm.*-.*-linux.* ld=ld-linux.so.2