From d980b007745088f55393ad262aed3d782f2cc397 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 3 Nov 2024 09:32:38 +0100 Subject: [PATCH] Add patches to fix dwarf + duo[x]-static builds on new systems Signed-off-by: falkTX --- .github/workflows/bootstrap-minimal.yml | 4 +- bootstrap.sh | 3 + ...arning-about-ambiguous-else-with-Wpa.patch | 75 +++++++ .../0001-fix-signed-shift-overlow.patch | 97 +++++++++ .../0002-dl-openat64-variadic.patch | 197 ++++++++++++++++++ .../glibc-2.21/0003-unused-variables.patch | 171 +++++++++++++++ .../0004-misleading-indentation.patch | 26 +++ .../0005-dl-open-array-bounds.patch | 38 ++++ .../0006-Fix-combreloc-test-BSD-grep.patch | 41 ++++ .../glibc-2.21/0007-typedef-caddr.patch | 17 ++ .../0008-fix-rpc_parse-format.patch | 62 ++++++ .../glibc-2.21/0009-explicit-boolean.patch | 35 ++++ .../0010-nis-bogus-conditional.patch | 64 ++++++ .../glibc-2.21/0011-dlclose-assert.patch | 42 ++++ .../0012-strftime-multiple-stmts.patch | 73 +++++++ .../0013-if_nametoindex-size-check.patch | 29 +++ .../glibc-2.21/0014-utmp-nonstring.patch | 80 +++++++ .../0015-getlogin_r-use-strnlen.patch | 47 +++++ .../glibc-2.21/0016-zic.c-use-memcpy.patch | 25 +++ ...-with-GCC-10-when-long-double-double.patch | 161 ++++++++++++++ ...KEFLAGS-assignment-for-upcoming-make.patch | 105 ++++++++++ 21 files changed, 1390 insertions(+), 2 deletions(-) create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0000-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0001-fix-signed-shift-overlow.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0002-dl-openat64-variadic.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0003-unused-variables.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0004-misleading-indentation.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0005-dl-open-array-bounds.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0006-Fix-combreloc-test-BSD-grep.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0007-typedef-caddr.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0008-fix-rpc_parse-format.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0009-explicit-boolean.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0010-nis-bogus-conditional.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0011-dlclose-assert.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0012-strftime-multiple-stmts.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0013-if_nametoindex-size-check.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0014-utmp-nonstring.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0015-getlogin_r-use-strnlen.patch create mode 100644 patches/crosstool-ng-1.22.0/glibc-2.21/0016-zic.c-use-memcpy.patch create mode 100644 patches/crosstool-ng-1.24.0/glibc-2.27/0001-Fix-build-with-GCC-10-when-long-double-double.patch create mode 100644 patches/crosstool-ng-1.24.0/glibc-2.27/0002-Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch diff --git a/.github/workflows/bootstrap-minimal.yml b/.github/workflows/bootstrap-minimal.yml index 5db06e17..89855fc6 100644 --- a/.github/workflows/bootstrap-minimal.yml +++ b/.github/workflows/bootstrap-minimal.yml @@ -63,8 +63,8 @@ jobs: ubuntu_24_04: strategy: matrix: - # platform: [modduo, modduo-debug, , modduox, modduox-debug, , ] - platform: [modduo-new, modduo-new-debug, modduo-static, modduox-new, modduox-new-debug, modduox-static, moddwarf, moddwarf-debug, moddwarf-new, moddwarf-new-debug, generic-aarch64, generic-aarch64-debug, generic-x86_64, generic-x86_64-debug] + # platform: [modduo, modduo-debug, modduo-static, , modduox, modduox-debug, modduox-static, , ] + platform: [modduo-new, modduo-new-debug, modduox-new, modduox-new-debug, moddwarf, moddwarf-debug, moddwarf-new, moddwarf-new-debug, generic-aarch64, generic-aarch64-debug, generic-x86_64, generic-x86_64-debug] runs-on: ubuntu-latest container: image: ubuntu:24.04 diff --git a/bootstrap.sh b/bootstrap.sh index 59ee46a2..250cc970 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -47,6 +47,7 @@ if [ ! -f ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/configure ]; then mkdir -p ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/linaro-4.9-2017.01 cp -r ${SOURCE_DIR}/patches/${CT_NG_VERSION}/bin-utils-2.26 ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/binutils/2.26 + cp -r ${SOURCE_DIR}/patches/${CT_NG_VERSION}/glibc-2.21 ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/glibc/2.21 cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/gcc-4.9.3/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/4.9.3/ cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/gcc-linaro-4.9-2017.01/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/linaro-4.9-2017.01/ ;; @@ -54,6 +55,8 @@ if [ ! -f ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/configure ]; then "crosstool-ng-1.24.0") patch -d ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION} -p1 -i ${SOURCE_DIR}/patches/${CT_NG_VERSION}/001_linaro-2019.12.patch patch -d ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION} -p1 -i ${SOURCE_DIR}/patches/${CT_NG_VERSION}/002_linaro-gcc7-selects.patch + + cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/glibc-2.27/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/packages/glibc/2.27/ ;; "crosstool-ng-1.25.0") diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0000-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0000-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch new file mode 100644 index 00000000..b9509a35 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0000-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch @@ -0,0 +1,75 @@ +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 + +--- + nis/nis_call.c | 20 +++++++++++--------- + stdlib/setenv.c | 24 +++++++++++++----------- + 2 files changed, 24 insertions(+), 20 deletions(-) + +--- a/nis/nis_call.c ++++ b/nis/nis_call.c +@@ -680,16 +680,18 @@ + /* 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; + +--- a/stdlib/setenv.c ++++ b/stdlib/setenv.c +@@ -269,18 +269,20 @@ + 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; ++ { ++ 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; ++ do ++ dp[0] = dp[1]; ++ while (*dp++); ++ /* Continue the loop in case NAME appears again. */ ++ } ++ else ++ ++ep; ++ } + + UNLOCK; + diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0001-fix-signed-shift-overlow.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0001-fix-signed-shift-overlow.patch new file mode 100644 index 00000000..c7cc3302 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0001-fix-signed-shift-overlow.patch @@ -0,0 +1,97 @@ +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. + +--- + string/memrchr.c | 11 ++--------- + string/rawmemchr.c | 11 ++--------- + string/strchr.c | 9 ++------- + string/strchrnul.c | 9 ++------- + 4 files changed, 8 insertions(+), 32 deletions(-) + +--- a/string/memrchr.c ++++ b/string/memrchr.c +@@ -96,15 +96,8 @@ + + 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); +--- a/string/rawmemchr.c ++++ b/string/rawmemchr.c +@@ -86,15 +86,8 @@ + + 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); +--- a/string/strchr.c ++++ b/string/strchr.c +@@ -60,13 +60,8 @@ + + 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); +--- a/string/strchrnul.c ++++ b/string/strchrnul.c +@@ -66,13 +66,8 @@ + + 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/crosstool-ng-1.22.0/glibc-2.21/0002-dl-openat64-variadic.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0002-dl-openat64-variadic.patch new file mode 100644 index 00000000..552db126 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0002-dl-openat64-variadic.patch @@ -0,0 +1,197 @@ +commit 9dd346ff431fc761f1b748bd4da8bb59f7652094 +Author: Joseph Myers +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 + 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. + +--- + sysdeps/unix/sysv/linux/dl-openat64.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- 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/crosstool-ng-1.22.0/glibc-2.21/0003-unused-variables.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0003-unused-variables.patch new file mode 100644 index 00000000..33598346 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0003-unused-variables.patch @@ -0,0 +1,171 @@ +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. + +--- + resolv/base64.c | 4 ---- + sysdeps/ieee754/dbl-64/atnat2.h | 4 ---- + sysdeps/ieee754/dbl-64/uexp.h | 2 +- + sysdeps/ieee754/dbl-64/upow.h | 2 -- + sysdeps/ieee754/flt-32/e_log10f.c | 2 -- + sysdeps/ieee754/flt-32/s_cosf.c | 2 -- + sysdeps/ieee754/ldbl-128/e_lgammal_r.c | 1 - + sysdeps/ieee754/ldbl-128/s_erfl.c | 1 - + sysdeps/ieee754/ldbl-128/s_log1pl.c | 1 - + timezone/private.h | 10 ---------- + 10 files changed, 1 insertion(+), 28 deletions(-) + +--- 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 +--- 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 */ +--- 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; +--- 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 */ +--- a/sysdeps/ieee754/flt-32/e_log10f.c ++++ b/sysdeps/ieee754/flt-32/e_log10f.c +@@ -22,8 +22,6 @@ + log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ + log10_2lo = 7.9034151668e-07; /* 0x355427db */ + +-static const float zero = 0.0; +- + float + __ieee754_log10f(float x) + { +--- a/sysdeps/ieee754/flt-32/s_cosf.c ++++ b/sysdeps/ieee754/flt-32/s_cosf.c +@@ -21,8 +21,6 @@ + #include + #include + +-static const float one=1.0; +- + #ifndef COSF + # define COSF_FUNC __cosf + #else +--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c ++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +@@ -82,7 +82,6 @@ + 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) +--- a/sysdeps/ieee754/ldbl-128/s_erfl.c ++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c +@@ -140,7 +140,6 @@ + + static const long double + tiny = 1e-4931L, +- half = 0.5L, + one = 1.0L, + two = 2.0L, + /* 2/sqrt(pi) - 1 */ +--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c ++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c +@@ -116,7 +116,6 @@ + + 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 +--- a/timezone/private.h ++++ b/timezone/private.h +@@ -326,16 +326,6 @@ + #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/crosstool-ng-1.22.0/glibc-2.21/0004-misleading-indentation.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0004-misleading-indentation.patch new file mode 100644 index 00000000..8e08259e --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0004-misleading-indentation.patch @@ -0,0 +1,26 @@ +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. + +--- + sysdeps/ieee754/flt-32/k_rem_pio2f.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c ++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c +@@ -65,7 +65,9 @@ + + /* 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/crosstool-ng-1.22.0/glibc-2.21/0005-dl-open-array-bounds.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0005-dl-open-array-bounds.patch new file mode 100644 index 00000000..ae626f13 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0005-dl-open-array-bounds.patch @@ -0,0 +1,38 @@ +commit 328c44c3670ebf6c1bd790acddce65a12998cd6c +Author: Roland McGrath +Date: Fri Apr 17 12:11:58 2015 -0700 + + Fuller check for invalid NSID in _dl_open. + +--- + elf/dl-open.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/elf/dl-open.c ++++ b/elf/dl-open.c +@@ -211,7 +211,7 @@ + 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; +@@ -629,8 +629,14 @@ + /* 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/crosstool-ng-1.22.0/glibc-2.21/0006-Fix-combreloc-test-BSD-grep.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0006-Fix-combreloc-test-BSD-grep.patch new file mode 100644 index 00000000..f90947bb --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0006-Fix-combreloc-test-BSD-grep.patch @@ -0,0 +1,41 @@ +From 61d5f9c09b3157db76bd1a393e248c262a8d9dd4 Mon Sep 17 00:00:00 2001 +From: Alexey Neyman +Date: Wed, 8 Mar 2017 14:31:10 -0800 +Subject: [PATCH] Fix combreloc test with BSD grep + +The test for "-z combreloc" fails when cross-compiling on a machine +that uses BSD grep (e.g. on macos). grep complains about empty +subexpression and exits with non-zero status, which is interpreted +by configure as "not found". As a result, support for "-z combreloc" +(HAVE_Z_COMBRELOC) is not detected, leading to link failure on SPARC. + + * configure.ac: Avoid empty subexpression in grep. + +Signed-off-by: Alexey Neyman +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/configure ++++ b/configure +@@ -6017,7 +6017,7 @@ + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then +- if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then ++ if $READELF -S conftest.so | grep '\.\(rel\|rela\)\.dyn' > /dev/null; then + libc_cv_z_combreloc=yes + else + libc_cv_z_combreloc=no +--- a/configure.ac ++++ b/configure.ac +@@ -1391,7 +1391,7 @@ + dnl introducing new options this is not easily doable. Instead use a tool + dnl which always is cross-platform: readelf. To detect whether -z combreloc + dnl look for a section named .rel.dyn. +- if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then ++ if $READELF -S conftest.so | grep '\.\(rel\|rela\)\.dyn' > /dev/null; then + libc_cv_z_combreloc=yes + else + libc_cv_z_combreloc=no diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0007-typedef-caddr.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0007-typedef-caddr.patch new file mode 100644 index 00000000..980939b9 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0007-typedef-caddr.patch @@ -0,0 +1,17 @@ +--- + posix/sys/types.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/posix/sys/types.h ++++ b/posix/sys/types.h +@@ -113,7 +113,10 @@ + #ifdef __USE_MISC + # ifndef __daddr_t_defined + typedef __daddr_t daddr_t; ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined) + typedef __caddr_t caddr_t; ++# define __caddr_t_defined ++# endif + # define __daddr_t_defined + # endif + #endif diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0008-fix-rpc_parse-format.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0008-fix-rpc_parse-format.patch new file mode 100644 index 00000000..341d5413 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0008-fix-rpc_parse-format.patch @@ -0,0 +1,62 @@ +commit 5874510faaf3cbd0bb112aaacab9f225002beed1 +Author: Joseph Myers +Date: Tue Nov 8 23:44:51 2016 +0000 + + Fix rpcgen buffer overrun (bug 20790). + + Building with GCC 7 produces an error building rpcgen: + + rpc_parse.c: In function 'get_prog_declaration': + rpc_parse.c:543:25: error: may write a terminating nul past the end of the destination [-Werror=format-length=] + sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ + ~~~~^ + rpc_parse.c:543:5: note: format output between 5 and 14 bytes into a destination of size 10 + sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + That buffer overrun is for the case where the .x file declares a + program with a million arguments. The strcpy two lines above can + generate a buffer overrun much more simply for a long argument name. + + The limit on length of line read by rpcgen (MAXLINESIZE == 1024) + provides a bound on the buffer size needed, so this patch just changes + the buffer size to MAXLINESIZE to avoid both possible buffer + overruns. A testcase is added that rpcgen does not crash with a + 500-character argument name, where it previously crashed. + + It would not at all surprise me if there are many other ways of + crashing rpcgen with either valid or invalid input; fuzz testing would + likely find various such bugs, though I don't think they are that + important to fix (rpcgen is not that likely to be used with untrusted + .x files as input). (As well as fuzz-findable bugs there are probably + also issues when various int variables get overflowed on very large + input.) The test infrastructure for rpcgen-not-crashing tests would + need extending if tests are to be added for cases where rpcgen should + produce an error, as opposed to cases where it should succeed. + + Tested for x86_64 and x86. + + [BZ #20790] + * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size + to MAXLINESIZE. + * sunrpc/bug20790.x: New file. + * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New + variable. + [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). + [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule. + +--- + sunrpc/rpc_parse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sunrpc/rpc_parse.c ++++ b/sunrpc/rpc_parse.c +@@ -521,7 +521,7 @@ + get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ ) + { + token tok; +- char name[10]; /* argument name */ ++ char name[MAXLINESIZE]; /* argument name */ + + if (dkind == DEF_PROGRAM) + { diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0009-explicit-boolean.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0009-explicit-boolean.patch new file mode 100644 index 00000000..ff7cd879 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0009-explicit-boolean.patch @@ -0,0 +1,35 @@ +commit e223d1fe72e820d96f43831412ab267a1ace04d0 +Author: steve ellcey-CA Eng-Software +Date: Fri Oct 14 12:53:27 2016 -0700 + + Fix warnings from latest GCC. + + * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly + boolean. + +--- + sysdeps/ieee754/dbl-64/e_pow.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/sysdeps/ieee754/dbl-64/e_pow.c ++++ b/sysdeps/ieee754/dbl-64/e_pow.c +@@ -462,15 +462,15 @@ + return (n & 1) ? -1 : 1; /* odd or even */ + if (k > 20) + { +- if (n << (k - 20)) ++ if (n << (k - 20) != 0) + return 0; /* if not integer */ +- return (n << (k - 21)) ? -1 : 1; ++ return (n << (k - 21) != 0) ? -1 : 1; + } + if (n) + return 0; /*if not integer */ + if (k == 20) + return (m & 1) ? -1 : 1; +- if (m << (k + 12)) ++ if (m << (k + 12) != 0) + return 0; +- return (m << (k + 11)) ? -1 : 1; ++ return (m << (k + 11) != 0) ? -1 : 1; + } diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0010-nis-bogus-conditional.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0010-nis-bogus-conditional.patch new file mode 100644 index 00000000..e7283681 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0010-nis-bogus-conditional.patch @@ -0,0 +1,64 @@ +commit f88759ea9bd3c8d8fef28f123ba9767cb0e421a3 +Author: Joseph Myers +Date: Wed Dec 21 23:44:01 2016 +0000 + + Fix nss_nisplus build with mainline GCC (bug 20978). + + glibc build with current mainline GCC fails because + nis/nss_nisplus/nisplus-alias.c contains code + + if (name != NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; + } + + char buf[strlen (name) + 9 + tablename_len]; + + producing an error about strlen being called on a pointer that is + always NULL (and a subsequent use of that pointer with a %s format in + snprintf). + + As Andreas noted, the bogus conditional comes from a 1997 change: + + - if (name == NULL || strlen(name) > 8) + - return NSS_STATUS_NOTFOUND; + - else + + if (name != NULL || strlen(name) <= 8) + + So the intention is clearly to return an error for NULL name. + + This patch duly inverts the sense of the conditional. It fixes the + build with GCC mainline, and passes usual glibc testsuite testing for + x86_64. However, I have not tried any actual substantive nisplus + testing, do not have an environment for such testing, and do not know + whether it is possible that strlen (name) or tablename_len might be + large so that the VLA for buf is actually a security issue. However, + if it is a security issue, there are plenty of other similar instances + in the nisplus code (that haven't been hidden by a bogus comparison + with NULL) - and nis_table.c:__create_ib_request uses strdupa on the + string passed to nis_list, so a local fix in the caller wouldn't + suffice anyway (see bug 20987). (Calls to strdupa and other such + macros that use alloca must be considered equally questionable + regarding stack overflow issues as direct calls to alloca and VLA + declarations.) + + [BZ #20978] + * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): + Compare name == NULL, not name != NULL. + +--- + nis/nss_nisplus/nisplus-alias.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/nis/nss_nisplus/nisplus-alias.c ++++ b/nis/nss_nisplus/nisplus-alias.c +@@ -291,7 +291,7 @@ + return status; + } + +- if (name != NULL) ++ if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0011-dlclose-assert.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0011-dlclose-assert.patch new file mode 100644 index 00000000..4a9de102 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0011-dlclose-assert.patch @@ -0,0 +1,42 @@ +commit 2bd2cad9e8a410643e80efa0b15f6f2882e1271b +Author: Roland McGrath +Date: Fri Apr 17 14:29:40 2015 -0700 + + Avoid confusing compiler with dynamically impossible statically invalid dereference in _dl_close_worker. + +--- + elf/dl-close.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +--- a/elf/dl-close.c ++++ b/elf/dl-close.c +@@ -641,9 +641,16 @@ + DL_UNMAP (imap); + + /* Finally, unlink the data structure and free it. */ +- if (imap->l_prev != NULL) +- imap->l_prev->l_next = imap->l_next; +- else ++#if DL_NNS == 1 ++ /* The assert in the (imap->l_prev == NULL) case gives ++ the compiler license to warn that NS points outside ++ the dl_ns array bounds in that case (as nsid != LM_ID_BASE ++ is tantamount to nsid >= DL_NNS). That should be impossible ++ in this configuration, so just assert about it instead. */ ++ assert (nsid == LM_ID_BASE); ++ assert (imap->l_prev != NULL); ++#else ++ if (imap->l_prev == NULL) + { + assert (nsid != LM_ID_BASE); + ns->_ns_loaded = imap->l_next; +@@ -652,6 +659,9 @@ + we leave for debuggers to examine. */ + r->r_map = (void *) ns->_ns_loaded; + } ++ else ++#endif ++ imap->l_prev->l_next = imap->l_next; + + --ns->_ns_nloaded; + if (imap->l_next != NULL) diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0012-strftime-multiple-stmts.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0012-strftime-multiple-stmts.patch new file mode 100644 index 00000000..0f97e7d0 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0012-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -738,12 +738,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0013-if_nametoindex-size-check.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0013-if_nametoindex-size-check.patch new file mode 100644 index 00000000..7976fddc --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0013-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0014-utmp-nonstring.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0014-utmp-nonstring.patch new file mode 100644 index 00000000..dab4e029 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0014-utmp-nonstring.patch @@ -0,0 +1,80 @@ +commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c +Author: Martin Sebor +Date: Wed Nov 15 17:39:59 2017 -0700 + + The -Wstringop-truncation option new in GCC 8 detects common misuses + of the strncat and strncpy function that may result in truncating + the copied string before the terminating NUL. To avoid false positive + warnings for correct code that intentionally creates sequences of + characters that aren't guaranteed to be NUL-terminated, arrays that + are intended to store such sequences should be decorated with a new + nonstring attribute. This change add this attribute to Glibc and + uses it to suppress such false positives. + + ChangeLog: + * misc/sys/cdefs.h (__attribute_nonstring__): New macro. + * sysdeps/gnu/bits/utmp.h (struct utmp): Use it. + * sysdeps/unix/sysv/linux/s390/bits/utmp.h (struct utmp): Same. + +--- + misc/sys/cdefs.h | 9 +++++++++ + sysdeps/gnu/bits/utmp.h | 9 ++++++--- + sysdeps/unix/sysv/linux/s390/bits/utmp.h | 9 ++++++--- + 3 files changed, 21 insertions(+), 6 deletions(-) + +--- a/misc/sys/cdefs.h ++++ b/misc/sys/cdefs.h +@@ -399,6 +399,15 @@ + # endif + #endif + ++#if __GNUC_PREREQ (8, 0) ++/* Describes a char array whose address can safely be passed as the first ++ argument to strncpy and strncat, as the char array is not necessarily ++ a NUL-terminated string. */ ++# define __attribute_nonstring__ __attribute__ ((__nonstring__)) ++#else ++# define __attribute_nonstring__ ++#endif ++ + #include + + #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH +--- a/sysdeps/gnu/bits/utmp.h ++++ b/sysdeps/gnu/bits/utmp.h +@@ -59,10 +59,13 @@ + { + short int ut_type; /* Type of login. */ + pid_t ut_pid; /* Process ID of login process. */ +- char ut_line[UT_LINESIZE]; /* Devicename. */ ++ char ut_line[UT_LINESIZE] ++ __attribute_nonstring__; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ +- char ut_user[UT_NAMESIZE]; /* Username. */ +- char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ ++ char ut_user[UT_NAMESIZE] ++ __attribute_nonstring__; /* Username. */ ++ char ut_host[UT_HOSTSIZE] ++ __attribute_nonstring__; /* Hostname for remote login. */ + struct exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ + /* The ut_session and ut_tv fields must be the same size when compiled +--- a/sysdeps/unix/sysv/linux/s390/bits/utmp.h ++++ b/sysdeps/unix/sysv/linux/s390/bits/utmp.h +@@ -59,10 +59,13 @@ + { + short int ut_type; /* Type of login. */ + pid_t ut_pid; /* Process ID of login process. */ +- char ut_line[UT_LINESIZE]; /* Devicename. */ ++ char ut_line[UT_LINESIZE] ++ __attribute_nonstring__; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ +- char ut_user[UT_NAMESIZE]; /* Username. */ +- char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ ++ char ut_user[UT_NAMESIZE] ++ __attribute_nonstring__; /* Username. */ ++ char ut_host[UT_HOSTSIZE] ++ __attribute_nonstring__; /* Hostname for remote login. */ + struct exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ + /* The ut_session and ut_tv fields must be the same size when compiled diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0015-getlogin_r-use-strnlen.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0015-getlogin_r-use-strnlen.patch new file mode 100644 index 00000000..ff199649 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0015-getlogin_r-use-strnlen.patch @@ -0,0 +1,47 @@ +commit 4bae615022cb5a5da79ccda83cc6c9ba9f2d479c +Author: Joseph Myers +Date: Wed Nov 22 18:44:23 2017 +0000 + + Avoid use of strlen in getlogin_r (bug 22447). + + Building glibc with current mainline GCC fails, among other reasons, + because of an error for use of strlen on the nonstring ut_user field. + This patch changes the problem code in getlogin_r to use __strnlen + instead. It also needs to set the trailing NUL byte of the result + explicitly, because of the case where ut_user does not have such a + trailing NUL byte (but the result should always have one). + + Tested for x86_64. Also tested that, in conjunction with + , it fixes + the build for arm with mainline GCC. + + [BZ #22447] + * sysdeps/unix/getlogin_r.c (__getlogin_r): Use __strnlen not + strlen to compute length of ut_user and set trailing NUL byte of + result explicitly. + +--- + sysdeps/unix/getlogin_r.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/sysdeps/unix/getlogin_r.c ++++ b/sysdeps/unix/getlogin_r.c +@@ -82,7 +82,7 @@ + + if (result == 0) + { +- size_t needed = strlen (ut->ut_user) + 1; ++ size_t needed = __strnlen (ut->ut_user, UT_NAMESIZE) + 1; + + if (needed > name_len) + { +@@ -91,7 +91,8 @@ + } + else + { +- memcpy (name, ut->ut_user, needed); ++ memcpy (name, ut->ut_user, needed - 1); ++ name[needed - 1] = 0; + result = 0; + } + } diff --git a/patches/crosstool-ng-1.22.0/glibc-2.21/0016-zic.c-use-memcpy.patch b/patches/crosstool-ng-1.22.0/glibc-2.21/0016-zic.c-use-memcpy.patch new file mode 100644 index 00000000..ef768aa6 --- /dev/null +++ b/patches/crosstool-ng-1.22.0/glibc-2.21/0016-zic.c-use-memcpy.patch @@ -0,0 +1,25 @@ +commit e69897bf202e18034cbef26f363bae64de70a196 +Author: Paul Eggert +Date: Sun Nov 12 22:00:28 2017 -0800 + + timezone: pacify GCC -Wstringop-truncation + + Problem reported by Martin Sebor in: + https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html + * timezone/zic.c (writezone): Use memcpy, not strncpy. + +--- + timezone/zic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/timezone/zic.c ++++ b/timezone/zic.c +@@ -1713,7 +1713,7 @@ + } + #define DO(field) ((void) fwrite(tzh.field, sizeof tzh.field, 1, fp)) + tzh = tzh0; +- (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); ++ memcpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); + tzh.tzh_version[0] = version; + convert(thistypecnt, tzh.tzh_ttisgmtcnt); + convert(thistypecnt, tzh.tzh_ttisstdcnt); diff --git a/patches/crosstool-ng-1.24.0/glibc-2.27/0001-Fix-build-with-GCC-10-when-long-double-double.patch b/patches/crosstool-ng-1.24.0/glibc-2.27/0001-Fix-build-with-GCC-10-when-long-double-double.patch new file mode 100644 index 00000000..ff5fe14a --- /dev/null +++ b/patches/crosstool-ng-1.24.0/glibc-2.27/0001-Fix-build-with-GCC-10-when-long-double-double.patch @@ -0,0 +1,161 @@ +From 49348beafe9ba150c9bd48595b3f372299bddbb0 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 17 Mar 2020 22:57:42 +0000 +Subject: [PATCH] Fix build with GCC 10 when long double = double. + +On platforms where long double has the same ABI as double, glibc +defines long double functions as aliases for the corresponding double +functions. The declarations of those functions in are +disabled to avoid problems with aliases having incompatible types, but +GCC 10 now gives errors for incompatible types when the long double +function is known to GCC as a built-in function, not just when there +is an incompatible header declaration. + +This patch fixes those errors by using appropriate +-fno-builtin- options to compile the double functions. The +list of CFLAGS-* settings is an appropriately adapted version of that +in sysdeps/ieee754/ldbl-opt/Makefile used there for building nldbl-*.c +files; in particular, the options are used even if GCC does not +currently have a built-in function of a given function, so that adding +such a built-in function in future will not break the glibc build. +Thus, various of the CFLAGS-* settings are only for future-proofing +and may not currently be needed (and it's possible some could be +irrelevant for other reasons). + +Tested with build-many-glibcs.py for arm-linux-gnueabi (compilers and +glibcs builds), where it fixes the build that previously failed. +--- + math/Makefile | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 122 insertions(+) + +--- a/math/Makefile ++++ b/math/Makefile +@@ -568,6 +568,128 @@ + # We won't compile the `long double' code at all. Tell the `double' code + # to define aliases for the `FUNCl' names. + math-CPPFLAGS += -DNO_LONG_DOUBLE ++# GCC 10 diagnoses aliases with types conflicting with built-in ++# functions. ++CFLAGS-w_acos.c += -fno-builtin-acosl ++CFLAGS-w_acosh.c += -fno-builtin-acoshl ++CFLAGS-w_asin.c += -fno-builtin-asinl ++CFLAGS-s_asinh.c += -fno-builtin-asinhl ++CFLAGS-s_atan.c += -fno-builtin-atanl ++CFLAGS-w_atan2.c += -fno-builtin-atan2l ++CFLAGS-w_atanh.c += -fno-builtin-atanhl ++CFLAGS-s_cabs.c += -fno-builtin-cabsl ++CFLAGS-s_cacos.c += -fno-builtin-cacosl ++CFLAGS-s_cacosh.c += -fno-builtin-cacoshl ++CFLAGS-s_canonicalize.c += -fno-builtin-canonicalizel ++CFLAGS-s_carg.c += -fno-builtin-cargl ++CFLAGS-s_casin.c += -fno-builtin-casinl ++CFLAGS-s_casinh.c += -fno-builtin-casinhl ++CFLAGS-s_catan.c += -fno-builtin-catanl ++CFLAGS-s_catanh.c += -fno-builtin-catanhl ++CFLAGS-s_cbrt.c += -fno-builtin-cbrtl ++CFLAGS-s_ccos.c += -fno-builtin-ccosl ++CFLAGS-s_ccosh.c += -fno-builtin-ccoshl ++CFLAGS-s_ceil.c += -fno-builtin-ceill ++CFLAGS-s_cexp.c += -fno-builtin-cexpl ++CFLAGS-s_cimag.c += -fno-builtin-cimagl ++CFLAGS-s_clog.c += -fno-builtin-clogl ++CFLAGS-s_clog10.c += -fno-builtin-clog10l ++CFLAGS-s_conj.c += -fno-builtin-conjl ++CFLAGS-s_copysign.c += -fno-builtin-copysignl ++CFLAGS-s_cos.c += -fno-builtin-cosl ++CFLAGS-w_cosh.c += -fno-builtin-coshl ++CFLAGS-s_cpow.c += -fno-builtin-cpowl ++CFLAGS-s_cproj.c += -fno-builtin-cprojl ++CFLAGS-s_creal.c += -fno-builtin-creall ++CFLAGS-s_csin.c += -fno-builtin-csinl ++CFLAGS-s_csinh.c += -fno-builtin-csinhl ++CFLAGS-s_csqrt.c += -fno-builtin-csqrtl ++CFLAGS-s_ctan.c += -fno-builtin-ctanl ++CFLAGS-s_ctanh.c += -fno-builtin-ctanhl ++CFLAGS-s_dadd.c += -fno-builtin-daddl ++CFLAGS-s_ddiv.c += -fno-builtin-ddivl ++CFLAGS-s_dmul.c += -fno-builtin-dmull ++CFLAGS-s_dsub.c += -fno-builtin-dsubl ++CFLAGS-s_erf.c += -fno-builtin-erfl ++CFLAGS-s_erfc.c += -fno-builtin-erfcl ++CFLAGS-e_exp.c += -fno-builtin-expl ++CFLAGS-w_exp10.c += -fno-builtin-exp10l ++CFLAGS-e_exp2.c += -fno-builtin-exp2l ++CFLAGS-s_expm1.c += -fno-builtin-expm1l ++CFLAGS-s_fabs.c += -fno-builtin-fabsl ++CFLAGS-s_fadd.c += -fno-builtin-faddl ++CFLAGS-s_fdim.c += -fno-builtin-fdiml ++CFLAGS-s_fdiv.c += -fno-builtin-fdivl ++CFLAGS-s_finite.c += -fno-builtin-finitel ++CFLAGS-s_floor.c += -fno-builtin-floorl ++CFLAGS-s_fma.c += -fno-builtin-fmal ++CFLAGS-s_fmax.c += -fno-builtin-fmaxl ++CFLAGS-s_fmaxmag.c += -fno-builtin-fmaxmagl ++CFLAGS-s_fmin.c += -fno-builtin-fminl ++CFLAGS-s_fminmag.c += -fno-builtin-fminmagl ++CFLAGS-w_fmod.c += -fno-builtin-fmodl ++CFLAGS-s_fmul.c += -fno-builtin-fmull ++CFLAGS-s_frexp.c += -fno-builtin-frexpl ++CFLAGS-s_fromfp.c += -fno-builtin-fromfpl ++CFLAGS-s_fromfpx.c += -fno-builtin-fromfpxl ++CFLAGS-s_fsub.c += -fno-builtin-fsubl ++CFLAGS-s_gamma.c += -fno-builtin-gammal ++CFLAGS-s_getpayload.c += -fno-builtin-getpayloadl ++CFLAGS-w_hypot.c += -fno-builtin-hypotl ++CFLAGS-w_ilogb.c += -fno-builtin-ilogbl ++CFLAGS-s_isinf.c += -fno-builtin-isinfl ++CFLAGS-s_isnan.c += -fno-builtin-isnanl ++CFLAGS-w_j0.c += -fno-builtin-j0l ++CFLAGS-w_j1.c += -fno-builtin-j1l ++CFLAGS-w_jn.c += -fno-builtin-jnl ++CFLAGS-s_ldexp.c += -fno-builtin-ldexpl ++CFLAGS-w_lgamma.c += -fno-builtin-lgammal ++CFLAGS-w_lgamma_r.c += -fno-builtin-lgammal_r ++CFLAGS-w_llogb.c += -fno-builtin-llogbl ++CFLAGS-s_llrint.c += -fno-builtin-llrintl ++CFLAGS-s_llround.c += -fno-builtin-llroundl ++CFLAGS-e_log.c += -fno-builtin-logl ++CFLAGS-w_log10.c += -fno-builtin-log10l ++CFLAGS-w_log1p.c += -fno-builtin-log1pl ++CFLAGS-e_log2.c += -fno-builtin-log2l ++CFLAGS-s_logb.c += -fno-builtin-logbl ++CFLAGS-s_lrint.c += -fno-builtin-lrintl ++CFLAGS-s_lround.c += -fno-builtin-lroundl ++CFLAGS-s_modf.c += -fno-builtin-modfl ++CFLAGS-s_nan.c += -fno-builtin-nanl ++CFLAGS-s_nearbyint.c += -fno-builtin-nearbyintl ++CFLAGS-s_nextafter.c += -fno-builtin-nextafterl ++CFLAGS-s_nextdown.c += -fno-builtin-nextdownl ++CFLAGS-s_nexttoward.c += -fno-builtin-nexttoward -fno-builtin-nexttowardl ++CFLAGS-s_nexttowardf.c += -fno-builtin-nexttowardf ++CFLAGS-s_nextup.c += -fno-builtin-nextupl ++CFLAGS-e_pow.c += -fno-builtin-powl ++CFLAGS-w_remainder.c += -fno-builtin-remainderl -fno-builtin-dreml ++CFLAGS-s_remquo.c += -fno-builtin-remquol ++CFLAGS-s_rint.c += -fno-builtin-rintl ++CFLAGS-s_round.c += -fno-builtin-roundl ++CFLAGS-s_roundeven.c += -fno-builtin-roundevenl ++CFLAGS-w_scalb.c += -fno-builtin-scalbl ++CFLAGS-w_scalbln.c += -fno-builtin-scalblnl ++CFLAGS-s_scalbn.c += -fno-builtin-scalbnl ++CFLAGS-s_setpayload.c += -fno-builtin-setpayloadl ++CFLAGS-s_setpayloadsig.c += -fno-builtin-setpayloadsigl ++CFLAGS-s_significand.c += -fno-builtin-significandl ++CFLAGS-s_sin.c += -fno-builtin-sinl ++CFLAGS-s_sincos.c += -fno-builtin-sincosl ++CFLAGS-w_sinh.c += -fno-builtin-sinhl ++CFLAGS-w_sqrt.c += -fno-builtin-sqrtl ++CFLAGS-s_tan.c += -fno-builtin-tanl ++CFLAGS-s_tanh.c += -fno-builtin-tanhl ++CFLAGS-w_tgamma.c += -fno-builtin-tgammal ++CFLAGS-s_totalorder.c += -fno-builtin-totalorderl ++CFLAGS-s_totalordermag.c += -fno-builtin-totalordermagl ++CFLAGS-s_trunc.c += -fno-builtin-truncl ++CFLAGS-s_ufromfp.c += -fno-builtin-ufromfpl ++CFLAGS-s_ufromfpx.c += -fno-builtin-ufromfpxl ++CFLAGS-s_y0.c += -fno-builtin-y0l ++CFLAGS-s_y1.c += -fno-builtin-y1l ++CFLAGS-s_yn.c += -fno-builtin-ynl + endif + + # These files quiet sNaNs in a way that is optimized away without diff --git a/patches/crosstool-ng-1.24.0/glibc-2.27/0002-Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch b/patches/crosstool-ng-1.24.0/glibc-2.27/0002-Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch new file mode 100644 index 00000000..3ff2df01 --- /dev/null +++ b/patches/crosstool-ng-1.24.0/glibc-2.27/0002-Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch @@ -0,0 +1,105 @@ +From 2d7ed98add14f75041499ac189696c9bd3d757fe Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Tue, 13 Sep 2022 13:39:13 -0400 +Subject: [PATCH] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4 + [BZ# 29564] + +make-4.4 will add long flags to MAKEFLAGS variable: + + * WARNING: Backward-incompatibility! + Previously only simple (one-letter) options were added to the MAKEFLAGS + variable that was visible while parsing makefiles. Now, all options + are available in MAKEFLAGS. + +This causes locale builds to fail when long options are used: + + $ make --shuffle + ... + make -C localedata install-locales + make: invalid shuffle mode: '1662724426r' + +The change fixes it by passing eash option via whitespace and dashes. +That way option is appended to both single-word form and whitespace +separated form. + +While at it fixed --silent mode detection in $(MAKEFLAGS) by filtering +out --long-options. Otherwise options like --shuffle flag enable silent +mode unintentionally. $(silent-make) variable consolidates the checks. + +Resolves: BZ# 29564 + +CC: Paul Smith +CC: Siddhesh Poyarekar +Signed-off-by: Sergei Trofimovich +Reviewed-by: Siddhesh Poyarekar +--- + Makeconfig | 18 +++++++++++++++++- + Makerules | 4 ++-- + elf/rtld-Rules | 2 +- + 3 files changed, 20 insertions(+), 4 deletions(-) + +--- a/Makeconfig ++++ b/Makeconfig +@@ -42,6 +42,22 @@ + objdir must be defined by the build-directory Makefile. + endif + ++# Did we request 'make -s' run? "yes" or "no". ++# Starting from make-4.4 MAKEFLAGS now contains long ++# options like '--shuffle'. To detect presence of 's' ++# we pick first word with short options. Long options ++# are guaranteed to come after whitespace. We use '-' ++# prefix to always have a word before long options ++# even if no short options were passed. ++# Typical MAKEFLAGS values to watch for: ++# "rs --shuffle=42" (silent) ++# " --shuffle" (not silent) ++ifeq ($(findstring s, $(firstword -$(MAKEFLAGS))),) ++silent-make := no ++else ++silent-make := yes ++endif ++ + # Root of the sysdeps tree. + sysdep_dir := $(..)sysdeps + export sysdep_dir := $(sysdep_dir) +@@ -875,7 +891,7 @@ + # umpteen zillion filenames along with it (we use `...' instead) + # but we don't want this echoing done when the user has said + # he doesn't want to see commands echoed by using -s. +-ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s ++ifeq ($(silent-make),yes) # if -s + +cmdecho := echo >/dev/null + else # not -s + +cmdecho := echo +--- a/Makerules ++++ b/Makerules +@@ -871,7 +871,7 @@ + # Maximize efficiency by minimizing the number of rules. + .SUFFIXES: # Clear the suffix list. We don't use suffix rules. + # Don't define any builtin rules. +-MAKEFLAGS := $(MAKEFLAGS)r ++MAKEFLAGS := $(MAKEFLAGS) -r + + # Generic rule for making directories. + %/: +@@ -888,7 +888,7 @@ + .PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c)) + + # Use the verbose option of ar and tar when not running silently. +-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s ++ifeq ($(silent-make),no) # if not -s + verbose := v + else # -s + verbose := +--- a/elf/rtld-Rules ++++ b/elf/rtld-Rules +@@ -52,7 +52,7 @@ + mv -f $@T $@ + + # Use the verbose option of ar and tar when not running silently. +-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s ++ifeq ($(silent-make),no) # if not -s + verbose := v + else # -s + verbose :=