$ git diff --patch-with-stat --summary 8ff08b134035f3c2f5f042664f0f8d7b7e149eb3..fd5a308d8ddf559aa3a34af2bb73c6f79ed0eaaa
.abf.yml | 2 +-
...-avoid-leak-on-empty-paths-in-config-file.patch | 31 -
0002-gconv_parseconfdir-Fix-memory-leak.patch | 38 -
...t-Avoid-double-free-in-label-and-preceden.patch | 38 -
...nd_spawn_sgid-Avoid-double-calls-to-close.patch | 29 -
...iconv_charmap-Close-output-file-when-done.patch | 27 -
...cntl-ioctl-prctl-redirects-for-_TIME_BITS.patch | 92 -
...rt-fix-NULL-pointer-dereference-bug-28213.patch | 40 -
0008-librt-add-test-bug-28213.patch | 147 -
...sing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch | 30 -
...4-Use-testl-to-check-__x86_string_control.patch | 39 -
0011-MIPS-Setup-errno-for-f-l-xstat.patch | 69 -
...-support-Add-support_wait_for_thread_exit.patch | 125 -
...d_kill-pthread_cancel-should-not-fail-aft.patch | 306 -
...ce-between-pthread_kill-and-thread-exit-b.patch | 438 --
...config-Fix-behaviour-with-prefix-BZ-28199.patch | 124 -
...-nss-tst-nss-files-hosts-long-with-local-.patch | 38 -
0017-Use-Linux-5.14-in-build-many-glibcs.py.patch | 31 -
0018-Update-syscall-lists-for-Linux-5.14.patch | 407 --
...nel-version-to-5.14-in-tst-mman-consts.py.patch | 32 -
...PULATE_READ-and-MADV_POPULATE_WRITE-from-.patch | 35 -
...-attribute-access-mode-on-getcwd-BZ-27476.patch | 50 -
...d_kill-needs-to-return-ESRCH-for-old-prog.patch | 144 -
...pe-of-pthread_mutexattr_getrobust_np-pthr.patch | 51 -
0024-support-Add-support_open_dev_null_range.patch | 365 --
..._open_dev_null_range-io-tst-closefrom-mis.patch | 212 -
...setxid-deadlock-with-blocked-signals-in-t.patch | 151 -
...-check-for-TID-zero-in-support_wait_for_t.patch | 43 -
...d_kill-must-send-signals-to-a-specific-th.patch | 176 -
0029-misc-Add-__get_nprocs_sched.patch | 110 -
0030-linux-Simplify-get_nprocs.patch | 216 -
...t-the-use-of-sched_getaffinity-on-get_npr.patch | 220 -
0032-Suppress-Wcast-qual-warnings-in-bsearch.patch | 47 -
...-braces-to-bsearch-inline-implementation-.patch | 43 -
0034-support-Also-return-fd-when-it-is-0.patch | 46 -
0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch | 90 -
...-elf-Replace-nsid-with-args.nsid-BZ-27609.patch | 52 -
...-a-common-definition-for-stat-for-sparc32.patch | 142 -
...4-bit-fields-on-32-bit-TIMESIZE-64-system.patch | 47 -
...eadlock-between-pthread_create-and-ctors-.patch | 496 --
...NULL-input-to-malloc_usable_size-BZ-28506.patch | 158 -
...ce-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch | 529 --
...alize-bootstrap_map.l_ld_readonly-BZ-2834.patch | 127 -
...ng-overriding-recipe-for-.-tst-ro-dynamic.patch | 36 -
...t-emit-spurious-NUL-character-in-ISO-2022.patch | 204 -
...-missing-dynamic-segment-check-in-_dl_map.patch | 74 -
...ng-branches-across-object-boundaries-jgh-.patch | 48 -
...-set-signal-mask-on-second-setjmp-return-.patch | 124 -
...roc-stat-fallback-for-__get_nprocs_conf-B.patch | 103 -
...e-Fix-CFI-and-LR-save-address-for-asm-sys.patch | 120 -
...-Add-one-more-barrier-to-nptl-tst-create1.patch | 81 -
...-Run-conform-tests-using-newly-built-libc.patch | 198 -
0052-Use-pie-default-with-conformtest.patch | 42 -
...-cancel28-Fix-barrier-re-init-race-condit.patch | 43 -
0054-mips-align-stack-in-clone-BZ-28223.patch | 50 -
...se-stack-alignment-in-clone-to-match-the-.patch | 43 -
...context-_rtld_global_ro-access-by-SHARED-.patch | 72 -
...es-dns-as-the-default-for-the-hosts-datab.patch | 95 -
...-cpu-features-cpuinfo-for-KVM-guests-on-s.patch | 54 -
...e-Allocate-extra-stack-frame-on-syscall.S.patch | 40 -
0060-riscv-align-stack-in-clone-BZ-28702.patch | 50 -
...gn-stack-before-calling-_dl_init-BZ-28703.patch | 52 -
0062-Update-hppa-libm-test-ulps.patch | 26 -
0063-Update-sparc-libm-test-ulps.patch | 26 -
0064-linux-Add-sparck-brk-implementation.patch | 87 -
...2-bit-vDSO-for-clock_gettime-on-powerpc32.patch | 38 -
....y-Avoid-conflicting-declarations-of-yyer.patch | 43 -
...-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch | 70 -
...bscript-error-with-odd-TZif-file-BZ-28338.patch | 53 -
...ndle-truncated-timezones-from-tzcode-2021.patch | 71 -
0070-timezone-test-case-for-BZ-28707.patch | 139 -
...-unrecognized-instruction-errors-with-rec.patch | 45 -
0072-Update-syscall-lists-for-Linux-5.15.patch | 409 --
...-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch | 464 --
0074-Update-syscall-lists-for-Linux-5.16.patch | 367 --
...able-debuginfod-in-printer-tests-BZ-28757.patch | 58 -
...socket-Add-the-__sockaddr_un_set-function.patch | 175 -
...219-Buffer-overflow-in-sunrpc-clnt_create.patch | 62 -
...-case-for-clnt_create-unix-buffer-overflo.patch | 90 -
...218-Buffer-overflow-in-sunrpc-svcunix_cre.patch | 134 -
...ault-cache-size-if-it-cannot-be-determine.patch | 75 -
...-unrecognized-instruction-errors-with-rec.patch | 71 -
...-helpers-to-create-paths-longer-than-PATH.patch | 283 -
0083-stdlib-Sort-tests-in-Makefile.patch | 126 -
...-Fix-formatting-of-tests-list-in-Makefile.patch | 178 -
...t-errno-to-ENAMETOOLONG-for-result-larger.patch | 134 -
0086-tst-realpath-toolong-Fix-hurd-build.patch | 31 -
...-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch | 356 --
...oid-overwriting-preexisting-error-CVE-202.patch | 34 -
...t-user-namespace-support-in-io-tst-getcwd.patch | 53 -
...S-add-bug-entry-for-BZ-28769-and-BZ-28770.patch | 25 -
...-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch | 41 -
...-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch | 41 -
0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch | 24 -
4483f2500825a84382c2a6a9ac60fc77954533d7.patch | 35 +-
alternate_trim.patch | 29 -
eglibc-fedora-strict-aliasing.patch | 76 -
eglibc-mandriva-ENOTTY-fr-translation.patch | 12 -
...andriva-localedef-archive-follow-symlinks.patch | 11 -
eglibc-mandriva-string-format-fixes.patch | 44 -
glibc-2.25-force-use-ld-bfd.patch | 21 +-
glibc-2.29-strict-aliasing.patch | 247 +-
glibc-2.33-clang-_Float32-_Float64.patch | 147 +-
glibc-2.33-compile.patch | 25 -
glibc-2.33-gcc-11.1.patch | 16 -
glibc-2.33-no-x86-isa-level.patch | 28 +-
glibc-2.34-headers-clang.patch | 27 +-
glibc-2.37-aarch64-clang++-16.0.6.patch | 12 +
glibc-2.37-lld-detection.patch | 12 +
glibc-bench-build.patch | 41 -
glibc-c-utf8-locale.patch | 270 -
glibc-c_stubs.patch | 754 ---
glibc-fedora-getrlimit-PLT.patch | 45 -
glibc-fedora-localedata-rh61908.patch | 28 +-
glibc-fedora-uname-getrlimit.patch | 50 -
glibc-new-condvar.patch | 6264 --------------------
glibc-rh1009145.patch | 19 -
glibc-rh1070416.patch | 29 -
glibc-rh1315108.patch | 1946 ------
glibc-rh1324623.patch | 113 -
glibc-rh1335011.patch | 176 -
glibc-rh697421.patch | 10 -
glibc-rh825061.patch | 13 -
glibc-rh827510.patch | 12 +-
glibc-rtkaio-clock.patch | 102 -
glibc-rtkaio-libof.patch | 26 -
glibc-rtkaio.patch | 5015 ----------------
glibc.spec | 749 ++-
large-page-huge-page.patch | 22 +-
locale_install.sh | 34 -
locale_uninstall.sh | 36 -
localepkg.sh | 2 +-
nostackshrink.patch | 14 -
nptl-getrlimit-compile.patch | 11 -
nss-dont-crash-on-NULL.patch | 9 +-
reenable_DT_HASH.patch | 101 +
spin-smarter.patch | 17 -
137 files changed, 887 insertions(+), 26754 deletions(-)
delete mode 100644 0001-ldconfig-avoid-leak-on-empty-paths-in-config-file.patch
delete mode 100644 0002-gconv_parseconfdir-Fix-memory-leak.patch
delete mode 100644 0003-gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
delete mode 100644 0004-copy_and_spawn_sgid-Avoid-double-calls-to-close.patch
delete mode 100644 0005-iconv_charmap-Close-output-file-when-done.patch
delete mode 100644 0006-Linux-Fix-fcntl-ioctl-prctl-redirects-for-_TIME_BITS.patch
delete mode 100644 0007-librt-fix-NULL-pointer-dereference-bug-28213.patch
delete mode 100644 0008-librt-add-test-bug-28213.patch
delete mode 100644 0009-elf-Fix-missing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch
delete mode 100644 0010-x86-64-Use-testl-to-check-__x86_string_control.patch
delete mode 100644 0011-MIPS-Setup-errno-for-f-l-xstat.patch
delete mode 100644 0012-support-Add-support_wait_for_thread_exit.patch
delete mode 100644 0013-nptl-pthread_kill-pthread_cancel-should-not-fail-aft.patch
delete mode 100644 0014-nptl-Fix-race-between-pthread_kill-and-thread-exit-b.patch
delete mode 100644 0015-iconvconfig-Fix-behaviour-with-prefix-BZ-28199.patch
delete mode 100644 0016-Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch
delete mode 100644 0017-Use-Linux-5.14-in-build-many-glibcs.py.patch
delete mode 100644 0018-Update-syscall-lists-for-Linux-5.14.patch
delete mode 100644 0019-Update-kernel-version-to-5.14-in-tst-mman-consts.py.patch
delete mode 100644 0020-Add-MADV_POPULATE_READ-and-MADV_POPULATE_WRITE-from-.patch
delete mode 100644 0021-posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch
delete mode 100644 0022-nptl-pthread_kill-needs-to-return-ESRCH-for-old-prog.patch
delete mode 100644 0023-nptl-Fix-type-of-pthread_mutexattr_getrobust_np-pthr.patch
delete mode 100644 0024-support-Add-support_open_dev_null_range.patch
delete mode 100644 0025-Use-support_open_dev_null_range-io-tst-closefrom-mis.patch
delete mode 100644 0026-nptl-Avoid-setxid-deadlock-with-blocked-signals-in-t.patch
delete mode 100644 0027-support-Add-check-for-TID-zero-in-support_wait_for_t.patch
delete mode 100644 0028-nptl-pthread_kill-must-send-signals-to-a-specific-th.patch
delete mode 100644 0029-misc-Add-__get_nprocs_sched.patch
delete mode 100644 0030-linux-Simplify-get_nprocs.patch
delete mode 100644 0031-linux-Revert-the-use-of-sched_getaffinity-on-get_npr.patch
delete mode 100644 0032-Suppress-Wcast-qual-warnings-in-bsearch.patch
delete mode 100644 0033-Add-missing-braces-to-bsearch-inline-implementation-.patch
delete mode 100644 0034-support-Also-return-fd-when-it-is-0.patch
delete mode 100644 0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch
delete mode 100644 0036-elf-Replace-nsid-with-args.nsid-BZ-27609.patch
delete mode 100644 0037-y2038-Use-a-common-definition-for-stat-for-sparc32.patch
delete mode 100644 0038-timex-Use-64-bit-fields-on-32-bit-TIMESIZE-64-system.patch
delete mode 100644 0039-elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch
delete mode 100644 0040-Handle-NULL-input-to-malloc_usable_size-BZ-28506.patch
delete mode 100644 0041-ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch
delete mode 100644 0042-ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch
delete mode 100644 0043-Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch
delete mode 100644 0044-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch
delete mode 100644 0045-elf-Earlier-missing-dynamic-segment-check-in-_dl_map.patch
delete mode 100644 0046-s390-Use-long-branches-across-object-boundaries-jgh-.patch
delete mode 100644 0047-nptl-Do-not-set-signal-mask-on-second-setjmp-return-.patch
delete mode 100644 0048-linux-Use-proc-stat-fallback-for-__get_nprocs_conf-B.patch
delete mode 100644 0049-powerpc64-le-Fix-CFI-and-LR-save-address-for-asm-sys.patch
delete mode 100644 0050-nptl-Add-one-more-barrier-to-nptl-tst-create1.patch
delete mode 100644 0051-Run-conform-tests-using-newly-built-libc.patch
delete mode 100644 0052-Use-pie-default-with-conformtest.patch
delete mode 100644 0053-pthread-tst-cancel28-Fix-barrier-re-init-race-condit.patch
delete mode 100644 0054-mips-align-stack-in-clone-BZ-28223.patch
delete mode 100644 0055-mips-increase-stack-alignment-in-clone-to-match-the-.patch
delete mode 100644 0056-arm-Guard-ucontext-_rtld_global_ro-access-by-SHARED-.patch
delete mode 100644 0057-nss-Use-files-dns-as-the-default-for-the-hosts-datab.patch
delete mode 100644 0058-elf-Fix-tst-cpu-features-cpuinfo-for-KVM-guests-on-s.patch
delete mode 100644 0059-powerpc64-le-Allocate-extra-stack-frame-on-syscall.S.patch
delete mode 100644 0060-riscv-align-stack-in-clone-BZ-28702.patch
delete mode 100644 0061-riscv-align-stack-before-calling-_dl_init-BZ-28703.patch
delete mode 100644 0062-Update-hppa-libm-test-ulps.patch
delete mode 100644 0063-Update-sparc-libm-test-ulps.patch
delete mode 100644 0064-linux-Add-sparck-brk-implementation.patch
delete mode 100644 0065-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch
delete mode 100644 0066-intl-plural.y-Avoid-conflicting-declarations-of-yyer.patch
delete mode 100644 0067-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch
delete mode 100644 0068-Fix-subscript-error-with-odd-TZif-file-BZ-28338.patch
delete mode 100644 0069-timezone-handle-truncated-timezones-from-tzcode-2021.patch
delete mode 100644 0070-timezone-test-case-for-BZ-28707.patch
delete mode 100644 0071-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
delete mode 100644 0072-Update-syscall-lists-for-Linux-5.15.patch
delete mode 100644 0073-i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch
delete mode 100644 0074-Update-syscall-lists-for-Linux-5.16.patch
delete mode 100644 0075-Disable-debuginfod-in-printer-tests-BZ-28757.patch
delete mode 100644 0076-socket-Add-the-__sockaddr_un_set-function.patch
delete mode 100644 0077-CVE-2022-23219-Buffer-overflow-in-sunrpc-clnt_create.patch
delete mode 100644 0078-sunrpc-Test-case-for-clnt_create-unix-buffer-overflo.patch
delete mode 100644 0079-CVE-2022-23218-Buffer-overflow-in-sunrpc-svcunix_cre.patch
delete mode 100644 0080-x86-use-default-cache-size-if-it-cannot-be-determine.patch
delete mode 100644 0081-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
delete mode 100644 0082-support-Add-helpers-to-create-paths-longer-than-PATH.patch
delete mode 100644 0083-stdlib-Sort-tests-in-Makefile.patch
delete mode 100644 0084-stdlib-Fix-formatting-of-tests-list-in-Makefile.patch
delete mode 100644 0085-realpath-Set-errno-to-ENAMETOOLONG-for-result-larger.patch
delete mode 100644 0086-tst-realpath-toolong-Fix-hurd-build.patch
delete mode 100644 0087-getcwd-Set-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch
delete mode 100644 0088-realpath-Avoid-overwriting-preexisting-error-CVE-202.patch
delete mode 100644 0089-Linux-Detect-user-namespace-support-in-io-tst-getcwd.patch
delete mode 100644 0090-NEWS-add-bug-entry-for-BZ-28769-and-BZ-28770.patch
delete mode 100644 0091-x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch
delete mode 100644 0092-x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch
delete mode 100644 0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch
delete mode 100644 alternate_trim.patch
delete mode 100644 eglibc-fedora-strict-aliasing.patch
delete mode 100644 eglibc-mandriva-ENOTTY-fr-translation.patch
delete mode 100644 eglibc-mandriva-localedef-archive-follow-symlinks.patch
delete mode 100644 eglibc-mandriva-string-format-fixes.patch
delete mode 100644 glibc-2.33-compile.patch
delete mode 100644 glibc-2.33-gcc-11.1.patch
create mode 100644 glibc-2.37-aarch64-clang++-16.0.6.patch
create mode 100644 glibc-2.37-lld-detection.patch
delete mode 100644 glibc-bench-build.patch
delete mode 100644 glibc-c-utf8-locale.patch
delete mode 100644 glibc-c_stubs.patch
delete mode 100644 glibc-fedora-getrlimit-PLT.patch
delete mode 100644 glibc-fedora-uname-getrlimit.patch
delete mode 100644 glibc-new-condvar.patch
delete mode 100644 glibc-rh1009145.patch
delete mode 100644 glibc-rh1070416.patch
delete mode 100644 glibc-rh1315108.patch
delete mode 100644 glibc-rh1324623.patch
delete mode 100644 glibc-rh1335011.patch
delete mode 100644 glibc-rh697421.patch
delete mode 100644 glibc-rh825061.patch
delete mode 100644 glibc-rtkaio-clock.patch
delete mode 100644 glibc-rtkaio-libof.patch
delete mode 100644 glibc-rtkaio.patch
delete mode 100644 nostackshrink.patch
delete mode 100644 nptl-getrlimit-compile.patch
create mode 100644 reenable_DT_HASH.patch
delete mode 100644 spin-smarter.patch
diff --git a/.abf.yml b/.abf.yml
index a54698f..12459b8 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,3 +1,3 @@
sources:
glibc-manpages.tar.bz2: ca54bfb832b703c8e35170fcc1c1f5470b45ff0f
- glibc-2.34.tar.xz: 7c3b8890a6346793b6334cc5f2fea5d437d307b8
+ glibc-2.39.tar.xz: 4b043eaba31efbdfc92c85d062e975141870295e
diff --git a/0001-ldconfig-avoid-leak-on-empty-paths-in-config-file.patch b/0001-ldconfig-avoid-leak-on-empty-paths-in-config-file.patch
deleted file mode 100644
index d5b20c0..0000000
--- a/0001-ldconfig-avoid-leak-on-empty-paths-in-config-file.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0b03996304f86d6dba8f0d4b7048b9bb7186f17d Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 3 Aug 2021 21:10:10 +0530
-Subject: [PATCH 01/66] ldconfig: avoid leak on empty paths in config file
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit b0234d79e7d82475d1666f25326ec045c045b3ed)
----
- elf/ldconfig.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/elf/ldconfig.c b/elf/ldconfig.c
-index 1037e8d0cf..b8893637f8 100644
---- a/elf/ldconfig.c
-+++ b/elf/ldconfig.c
-@@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
- entry->path[--i] = '\0';
-
- if (i == 0)
-- return;
-+ {
-+ free (entry->path);
-+ free (entry);
-+ return;
-+ }
-
- char *path = entry->path;
- if (opt_chroot != NULL)
---
-2.34.1
-
diff --git a/0002-gconv_parseconfdir-Fix-memory-leak.patch b/0002-gconv_parseconfdir-Fix-memory-leak.patch
deleted file mode 100644
index 628680b..0000000
--- a/0002-gconv_parseconfdir-Fix-memory-leak.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 3a48da47a91ccc6f5de260574809e7a44551b876 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 3 Aug 2021 21:10:20 +0530
-Subject: [PATCH 02/66] gconv_parseconfdir: Fix memory leak
-
-The allocated `conf` would leak if we have to skip over the file due
-to the underlying filesystem not supporting dt_type.
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit 5f9b78fe35d08739b6da1e5b356786d41116c108)
----
- iconv/gconv_parseconfdir.h | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
-index a4153e54c6..2f062689ec 100644
---- a/iconv/gconv_parseconfdir.h
-+++ b/iconv/gconv_parseconfdir.h
-@@ -153,12 +153,11 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
- struct stat64 st;
- if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
- continue;
-- if (ent->d_type == DT_UNKNOWN
-- && (lstat64 (conf, &st) == -1
-- || !S_ISREG (st.st_mode)))
-- continue;
-
-- found |= read_conf_file (conf, dir, dir_len);
-+ if (ent->d_type != DT_UNKNOWN
-+ || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
-+ found |= read_conf_file (conf, dir, dir_len);
-+
- free (conf);
- }
- }
---
-2.34.1
-
diff --git a/0003-gaiconf_init-Avoid-double-free-in-label-and-preceden.patch b/0003-gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
deleted file mode 100644
index 6079f27..0000000
--- a/0003-gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From a5bd2e10e0c25b80286dc36068e22a4cb4893af0 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 3 Aug 2021 21:11:03 +0530
-Subject: [PATCH 03/66] gaiconf_init: Avoid double-free in label and precedence
- lists
-
-labellist and precedencelist could get freed a second time if there
-are allocation failures, so set them to NULL to avoid a double-free.
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)
----
- sysdeps/posix/getaddrinfo.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
-index 838a68f022..43dfc6739e 100644
---- a/sysdeps/posix/getaddrinfo.c
-+++ b/sysdeps/posix/getaddrinfo.c
-@@ -2008,6 +2008,7 @@ gaiconf_init (void)
- l = l->next;
- }
- free_prefixlist (labellist);
-+ labellist = NULL;
-
- /* Sort the entries so that the most specific ones are at
- the beginning. */
-@@ -2046,6 +2047,7 @@ gaiconf_init (void)
- l = l->next;
- }
- free_prefixlist (precedencelist);
-+ precedencelist = NULL;
-
- /* Sort the entries so that the most specific ones are at
- the beginning. */
---
-2.34.1
-
diff --git a/0004-copy_and_spawn_sgid-Avoid-double-calls-to-close.patch b/0004-copy_and_spawn_sgid-Avoid-double-calls-to-close.patch
deleted file mode 100644
index c70c68e..0000000
--- a/0004-copy_and_spawn_sgid-Avoid-double-calls-to-close.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 7ff4da3dc26de351a5abe7c2905038cbe55c8041 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 3 Aug 2021 21:10:53 +0530
-Subject: [PATCH 04/66] copy_and_spawn_sgid: Avoid double calls to close()
-
-If close() on infd and outfd succeeded, reset the fd numbers so that
-we don't attempt to close them again.
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit 45caed9d67a00af917d8b5b88d4b5eb1225b7aef)
----
- support/support_capture_subprocess.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
-index 27bfd19c93..0bacf6dbc2 100644
---- a/support/support_capture_subprocess.c
-+++ b/support/support_capture_subprocess.c
-@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
- support_subprogram because we only want the program exit status, not the
- contents. */
- ret = 0;
-+ infd = outfd = -1;
-
- char * const args[] = {execname, child_id, NULL};
-
---
-2.34.1
-
diff --git a/0005-iconv_charmap-Close-output-file-when-done.patch b/0005-iconv_charmap-Close-output-file-when-done.patch
deleted file mode 100644
index c8d7c12..0000000
--- a/0005-iconv_charmap-Close-output-file-when-done.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 9995d0588f4f9adc68419224d2b3698e2ca4f77e Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 3 Aug 2021 21:10:29 +0530
-Subject: [PATCH 05/66] iconv_charmap: Close output file when done
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)
----
- iconv/iconv_charmap.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
-index e2d53fee3c..a8b6b56124 100644
---- a/iconv/iconv_charmap.c
-+++ b/iconv/iconv_charmap.c
-@@ -234,6 +234,8 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
- while (++remaining < argc);
-
- /* All done. */
-+ if (output != stdout)
-+ fclose (output);
- free_table (cvtbl);
- return status;
- }
---
-2.34.1
-
diff --git a/0006-Linux-Fix-fcntl-ioctl-prctl-redirects-for-_TIME_BITS.patch b/0006-Linux-Fix-fcntl-ioctl-prctl-redirects-for-_TIME_BITS.patch
deleted file mode 100644
index 5c6fbaf..0000000
--- a/0006-Linux-Fix-fcntl-ioctl-prctl-redirects-for-_TIME_BITS.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 31902ae639d6a50e768a85f1cd2a17e56b8463c2 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 6 Aug 2021 09:51:38 +0200
-Subject: [PATCH 06/66] Linux: Fix fcntl, ioctl, prctl redirects for
- _TIME_BITS=64 (bug 28182)
-
-__REDIRECT and __THROW are not compatible with C++ due to the ordering of the
-__asm__ alias and the throw specifier. __REDIRECT_NTH has to be used
-instead.
-
-Fixes commit 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias
-for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add
-time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158
-("Linux: Add time64 alias for prctl").
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit c87fcacc50505d550f1bb038382bcc7ea73a5926)
----
- NEWS | 7 +++++++
- io/fcntl.h | 8 ++++----
- misc/sys/ioctl.h | 4 ++--
- sysdeps/unix/sysv/linux/sys/prctl.h | 2 +-
- 4 files changed, 14 insertions(+), 7 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 3c610744c9..89e20cf062 100644
---- a/NEWS
-+++ b/NEWS
-@@ -4,6 +4,13 @@ See the end for copying conditions.
-
- Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
- using `glibc' in the "product" field.
-+
-+Version 2.34.1
-+
-+The following bugs are resolved with this release:
-+
-+ [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-+
-
- Version 2.34
-
-diff --git a/io/fcntl.h b/io/fcntl.h
-index 8917a73b42..1c96f98f4d 100644
---- a/io/fcntl.h
-+++ b/io/fcntl.h
-@@ -187,10 +187,10 @@ extern int fcntl64 (int __fd, int __cmd, ...);
- # endif
- #else /* __USE_TIME_BITS64 */
- # ifdef __REDIRECT
--extern int __REDIRECT (fcntl, (int __fd, int __request, ...),
-- __fcntl_time64) __THROW;
--extern int __REDIRECT (fcntl64, (int __fd, int __request, ...),
-- __fcntl_time64) __THROW;
-+extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
-+ __fcntl_time64);
-+extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
-+ __fcntl_time64);
- # else
- extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
- # define fcntl64 __fcntl_time64
-diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h
-index 6884d9925f..9945c1e918 100644
---- a/misc/sys/ioctl.h
-+++ b/misc/sys/ioctl.h
-@@ -42,8 +42,8 @@ __BEGIN_DECLS
- extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
- #else
- # ifdef __REDIRECT
--extern int __REDIRECT (ioctl, (int __fd, unsigned long int __request, ...),
-- __ioctl_time64) __THROW;
-+extern int __REDIRECT_NTH (ioctl, (int __fd, unsigned long int __request, ...),
-+ __ioctl_time64);
- # else
- extern int __ioctl_time64 (int __fd, unsigned long int __request, ...) __THROW;
- # define ioctl __ioctl_time64
-diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h
-index db88938b3a..f0e0d2f27f 100644
---- a/sysdeps/unix/sysv/linux/sys/prctl.h
-+++ b/sysdeps/unix/sysv/linux/sys/prctl.h
-@@ -42,7 +42,7 @@ __BEGIN_DECLS
- extern int prctl (int __option, ...) __THROW;
- #else
- # ifdef __REDIRECT
--extern int __REDIRECT (prctl, (int __option, ...), __prctl_time64) __THROW;
-+extern int __REDIRECT_NTH (prctl, (int __option, ...), __prctl_time64);
- # else
- extern int __prctl_time64 (int __option,d ...) __THROW;
- # define ioctl __prctl_time64
---
-2.34.1
-
diff --git a/0007-librt-fix-NULL-pointer-dereference-bug-28213.patch b/0007-librt-fix-NULL-pointer-dereference-bug-28213.patch
deleted file mode 100644
index 182630d..0000000
--- a/0007-librt-fix-NULL-pointer-dereference-bug-28213.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 79474303223c5665bec75ffbdb2a86ee04a2514b Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Mon, 9 Aug 2021 20:17:34 +0530
-Subject: [PATCH 07/66] librt: fix NULL pointer dereference (bug 28213)
-
-Helper thread frees copied attribute on NOTIFY_REMOVED message
-received from the OS kernel. Unfortunately, it fails to check whether
-copied attribute actually exists (data.attr != NULL). This worked
-earlier because free() checks passed pointer before actually
-attempting to release corresponding memory. But
-__pthread_attr_destroy assumes pointer is not NULL.
-
-So passing NULL pointer to __pthread_attr_destroy will result in
-segmentation fault. This scenario is possible if
-notification->sigev_notify_attributes == NULL (which means default
-thread attributes should be used).
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit b805aebd42364fe696e417808a700fdb9800c9e8)
----
- sysdeps/unix/sysv/linux/mq_notify.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
-index 9799dcdaa4..eccae2e4c6 100644
---- a/sysdeps/unix/sysv/linux/mq_notify.c
-+++ b/sysdeps/unix/sysv/linux/mq_notify.c
-@@ -131,7 +131,7 @@ helper_thread (void *arg)
- to wait until it is done with it. */
- (void) __pthread_barrier_wait (¬ify_barrier);
- }
-- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
-+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
- {
- /* The only state we keep is the copy of the thread attributes. */
- __pthread_attr_destroy (data.attr);
---
-2.34.1
-
diff --git a/0008-librt-add-test-bug-28213.patch b/0008-librt-add-test-bug-28213.patch
deleted file mode 100644
index c94bbc1..0000000
--- a/0008-librt-add-test-bug-28213.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 7c987a5ccb31df80456d53a094e47f81310f549b Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Thu, 12 Aug 2021 16:09:50 +0530
-Subject: [PATCH 08/66] librt: add test (bug 28213)
-
-This test implements following logic:
-1) Create POSIX message queue.
- Register a notification with mq_notify (using NULL attributes).
- Then immediately unregister the notification with mq_notify.
- Helper thread in a vulnerable version of glibc
- should cause NULL pointer dereference after these steps.
-2) Once again, register the same notification.
- Try to send a dummy message.
- Test is considered successfulif the dummy message
- is successfully received by the callback function.
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 4cc79c217744743077bf7a0ec5e0a4318f1e6641)
----
- rt/Makefile | 1 +
- rt/tst-bz28213.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 102 insertions(+)
- create mode 100644 rt/tst-bz28213.c
-
-diff --git a/rt/Makefile b/rt/Makefile
-index 113cea03a5..910e775995 100644
---- a/rt/Makefile
-+++ b/rt/Makefile
-@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \
- tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
- tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
- tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
-+ tst-bz28213 \
- tst-timer3 tst-timer4 tst-timer5 \
- tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
- tst-shm-cancel \
-diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c
-new file mode 100644
-index 0000000000..0c096b5a0a
---- /dev/null
-+++ b/rt/tst-bz28213.c
-@@ -0,0 +1,101 @@
-+/* Bug 28213: test for NULL pointer dereference in mq_notify.
-+ Copyright (C) The GNU Toolchain Authors.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <mqueue.h>
-+#include <signal.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <support/check.h>
-+
-+static mqd_t m = -1;
-+static const char msg[] = "hello";
-+
-+static void
-+check_bz28213_cb (union sigval sv)
-+{
-+ char buf[sizeof (msg)];
-+
-+ (void) sv;
-+
-+ TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL)
-+ == sizeof (buf));
-+ TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0);
-+
-+ exit (0);
-+}
-+
-+static void
-+check_bz28213 (void)
-+{
-+ struct sigevent sev;
-+
-+ memset (&sev, '\0', sizeof (sev));
-+ sev.sigev_notify = SIGEV_THREAD;
-+ sev.sigev_notify_function = check_bz28213_cb;
-+
-+ /* Step 1: Register & unregister notifier.
-+ Helper thread should receive NOTIFY_REMOVED notification.
-+ In a vulnerable version of glibc, NULL pointer dereference follows. */
-+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
-+ TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0);
-+
-+ /* Step 2: Once again, register notification.
-+ Try to send one message.
-+ Test is considered successful, if the callback does exit (0). */
-+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
-+ TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0);
-+
-+ /* Wait... */
-+ pause ();
-+}
-+
-+static int
-+do_test (void)
-+{
-+ static const char m_name[] = "/bz28213_queue";
-+ struct mq_attr m_attr;
-+
-+ memset (&m_attr, '\0', sizeof (m_attr));
-+ m_attr.mq_maxmsg = 1;
-+ m_attr.mq_msgsize = sizeof (msg);
-+
-+ m = mq_open (m_name,
-+ O_RDWR | O_CREAT | O_EXCL,
-+ 0600,
-+ &m_attr);
-+
-+ if (m < 0)
-+ {
-+ if (errno == ENOSYS)
-+ FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n");
-+ FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n");
-+ }
-+
-+ TEST_VERIFY_EXIT (mq_unlink (m_name) == 0);
-+
-+ check_bz28213 ();
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0009-elf-Fix-missing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch b/0009-elf-Fix-missing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch
deleted file mode 100644
index 77a526c..0000000
--- a/0009-elf-Fix-missing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 9acab0bba6a5a57323b1f94bf95b21618a9e5aa4 Mon Sep 17 00:00:00 2001
-From: Arjun Shankar <arjun@redhat.com>
-Date: Fri, 20 Aug 2021 16:24:05 +0200
-Subject: [PATCH 09/66] elf: Fix missing colon in LD_SHOW_AUXV output [BZ
- #28253]
-
-This commit adds a missing colon in the AT_MINSIGSTKSZ entry in
-the _dl_show_auxv function.
-
-(cherry picked from commit 82fbcd7118d760492e2ecc9fa291e358b9ba0361)
----
- elf/dl-sysdep.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
-index d47bef1340..2c684c2db2 100644
---- a/elf/dl-sysdep.c
-+++ b/elf/dl-sysdep.c
-@@ -317,7 +317,7 @@ _dl_show_auxv (void)
- [AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex },
- [AT_RANDOM - 2] = { "RANDOM: 0x", hex },
- [AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex },
-- [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ ", dec },
-+ [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ: ", dec },
- [AT_L1I_CACHESIZE - 2] = { "L1I_CACHESIZE: ", dec },
- [AT_L1I_CACHEGEOMETRY - 2] = { "L1I_CACHEGEOMETRY: 0x", hex },
- [AT_L1D_CACHESIZE - 2] = { "L1D_CACHESIZE: ", dec },
---
-2.34.1
-
diff --git a/0010-x86-64-Use-testl-to-check-__x86_string_control.patch b/0010-x86-64-Use-testl-to-check-__x86_string_control.patch
deleted file mode 100644
index 5d2fae0..0000000
--- a/0010-x86-64-Use-testl-to-check-__x86_string_control.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From f2413f2710d5d5cc884b413b83fcf8198e3717fa Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 28 Aug 2021 06:10:38 -0700
-Subject: [PATCH 10/66] x86-64: Use testl to check __x86_string_control
-
-Use testl, instead of andl, to check __x86_string_control to avoid
-updating __x86_string_control.
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit 3c8b9879cab6d41787bc5b14c1748f62fd6d0e5f)
----
- sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
-index 9f02624375..abde8438d4 100644
---- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
-+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
-@@ -325,7 +325,7 @@ L(movsb):
- /* Avoid slow backward REP MOVSB. */
- jb L(more_8x_vec_backward)
- # if AVOID_SHORT_DISTANCE_REP_MOVSB
-- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
-+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
- jz 3f
- movq %rdi, %rcx
- subq %rsi, %rcx
-@@ -333,7 +333,7 @@ L(movsb):
- # endif
- 1:
- # if AVOID_SHORT_DISTANCE_REP_MOVSB
-- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
-+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
- jz 3f
- movq %rsi, %rcx
- subq %rdi, %rcx
---
-2.34.1
-
diff --git a/0011-MIPS-Setup-errno-for-f-l-xstat.patch b/0011-MIPS-Setup-errno-for-f-l-xstat.patch
deleted file mode 100644
index 7f8236d..0000000
--- a/0011-MIPS-Setup-errno-for-f-l-xstat.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 52d0119743180164d1664b6773ac5d873f224608 Mon Sep 17 00:00:00 2001
-From: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Date: Tue, 7 Sep 2021 13:31:42 +0800
-Subject: [PATCH 11/66] MIPS: Setup errno for {f,l,}xstat
-
-{f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL
-to do xstat syscall for glibc ver, However it leaves
-errno untouched and thus giving bad errno output.
-
-Setup errno properly when syscall returns non-zero.
-
-Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
-(cherry picked from commit 66016ec8aeefd40e016d7040d966484c764b0e9c)
----
- sysdeps/unix/sysv/linux/mips/fxstat.c | 4 +++-
- sysdeps/unix/sysv/linux/mips/lxstat.c | 4 +++-
- sysdeps/unix/sysv/linux/mips/xstat.c | 4 +++-
- 3 files changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c
-index 11511d30b3..4a6016ff12 100644
---- a/sysdeps/unix/sysv/linux/mips/fxstat.c
-+++ b/sysdeps/unix/sysv/linux/mips/fxstat.c
-@@ -35,7 +35,9 @@ __fxstat (int vers, int fd, struct stat *buf)
- {
- struct kernel_stat kbuf;
- int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf);
-- return r ?: __xstat_conv (vers, &kbuf, buf);
-+ if (r == 0)
-+ return __xstat_conv (vers, &kbuf, buf);
-+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
- }
- }
- }
-diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c
-index 871fb6c6c5..54f990a250 100644
---- a/sysdeps/unix/sysv/linux/mips/lxstat.c
-+++ b/sysdeps/unix/sysv/linux/mips/lxstat.c
-@@ -35,7 +35,9 @@ __lxstat (int vers, const char *name, struct stat *buf)
- {
- struct kernel_stat kbuf;
- int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf);
-- return r ?: __xstat_conv (vers, &kbuf, buf);
-+ if (r == 0)
-+ return __xstat_conv (vers, &kbuf, buf);
-+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
- }
- }
- }
-diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c
-index 9d810b6f65..86f4dc31a8 100644
---- a/sysdeps/unix/sysv/linux/mips/xstat.c
-+++ b/sysdeps/unix/sysv/linux/mips/xstat.c
-@@ -35,7 +35,9 @@ __xstat (int vers, const char *name, struct stat *buf)
- {
- struct kernel_stat kbuf;
- int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf);
-- return r ?: __xstat_conv (vers, &kbuf, buf);
-+ if (r == 0)
-+ return __xstat_conv (vers, &kbuf, buf);
-+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
- }
- }
- }
---
-2.34.1
-
diff --git a/0012-support-Add-support_wait_for_thread_exit.patch b/0012-support-Add-support_wait_for_thread_exit.patch
deleted file mode 100644
index bf2f680..0000000
--- a/0012-support-Add-support_wait_for_thread_exit.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From addc9d62d61eea790a35328cbfce53333a07bd3e Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 30 Aug 2021 13:43:56 +0200
-Subject: [PATCH 12/66] support: Add support_wait_for_thread_exit
-
-(cherry picked from commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60)
----
- support/Makefile | 3 +-
- support/support.h | 4 ++
- support/support_wait_for_thread_exit.c | 72 ++++++++++++++++++++++++++
- 3 files changed, 78 insertions(+), 1 deletion(-)
- create mode 100644 support/support_wait_for_thread_exit.c
-
-diff --git a/support/Makefile b/support/Makefile
-index a462781718..ef2b1a980a 100644
---- a/support/Makefile
-+++ b/support/Makefile
-@@ -82,9 +82,10 @@ libsupport-routines = \
- support_test_compare_blob \
- support_test_compare_failure \
- support_test_compare_string \
-- support_write_file_string \
- support_test_main \
- support_test_verify_impl \
-+ support_wait_for_thread_exit \
-+ support_write_file_string \
- temp_file \
- timespec \
- timespec-time64 \
-diff --git a/support/support.h b/support/support.h
-index 834dba9097..a5978b939a 100644
---- a/support/support.h
-+++ b/support/support.h
-@@ -174,6 +174,10 @@ timer_t support_create_timer (uint64_t sec, long int nsec, bool repeat,
- /* Disable the timer TIMER. */
- void support_delete_timer (timer_t timer);
-
-+/* Wait until all threads except the current thread have exited (as
-+ far as the kernel is concerned). */
-+void support_wait_for_thread_exit (void);
-+
- struct support_stack
- {
- void *stack;
-diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
-new file mode 100644
-index 0000000000..658a813810
---- /dev/null
-+++ b/support/support_wait_for_thread_exit.c
-@@ -0,0 +1,72 @@
-+/* Wait until all threads except the current thread has exited.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <dirent.h>
-+#include <errno.h>
-+#include <string.h>
-+#include <support/check.h>
-+#include <support/support.h>
-+#include <unistd.h>
-+
-+void
-+support_wait_for_thread_exit (void)
-+{
-+#ifdef __linux__
-+ DIR *proc_self_task = opendir ("/proc/self/task");
-+ TEST_VERIFY_EXIT (proc_self_task != NULL);
-+
-+ while (true)
-+ {
-+ errno = 0;
-+ struct dirent *e = readdir (proc_self_task);
-+ if (e == NULL && errno != 0)
-+ FAIL_EXIT1 ("readdir: %m");
-+ if (e == NULL)
-+ {
-+ /* Only the main thread remains. Testing may continue. */
-+ closedir (proc_self_task);
-+ return;
-+ }
-+
-+ if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0)
-+ continue;
-+
-+ int task_tid = atoi (e->d_name);
-+ if (task_tid <= 0)
-+ FAIL_EXIT1 ("Invalid /proc/self/task entry: %s", e->d_name);
-+
-+ if (task_tid == gettid ())
-+ /* The current thread. Keep scanning for other
-+ threads. */
-+ continue;
-+
-+ /* task_tid does not refer to this thread here, i.e., there is
-+ another running thread. */
-+
-+ /* Small timeout to give the thread a chance to exit. */
-+ usleep (50 * 1000);
-+
-+ /* Start scanning the directory from the start. */
-+ rewinddir (proc_self_task);
-+ }
-+#else
-+ /* Use a large timeout because we cannot verify that the thread has
-+ exited. */
-+ usleep (5 * 1000 * 1000);
-+#endif
-+}
---
-2.34.1
-
diff --git a/0013-nptl-pthread_kill-pthread_cancel-should-not-fail-aft.patch b/0013-nptl-pthread_kill-pthread_cancel-should-not-fail-aft.patch
deleted file mode 100644
index 2b50b83..0000000
--- a/0013-nptl-pthread_kill-pthread_cancel-should-not-fail-aft.patch
+++ /dev/null
@@ -1,306 +0,0 @@
-From 3abf3bd4edc86fb28c099cc85203cb46a811e0b8 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 13 Sep 2021 11:06:08 +0200
-Subject: [PATCH 13/66] nptl: pthread_kill, pthread_cancel should not fail
- after exit (bug 19193)
-
-This closes one remaining race condition related to bug 12889: if
-the thread already exited on the kernel side, returning ESRCH
-is not correct because that error is reserved for the thread IDs
-(pthread_t values) whose lifetime has ended. In case of a
-kernel-side exit and a valid thread ID, no signal needs to be sent
-and cancellation does not have an effect, so just return 0.
-
-sysdeps/pthread/tst-kill4.c triggers undefined behavior and is
-removed with this commit.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 8af8456004edbab71f8903a60a3cae442cf6fe69)
----
- NEWS | 1 +
- nptl/pthread_cancel.c | 9 ++-
- nptl/pthread_kill.c | 7 +-
- sysdeps/pthread/Makefile | 5 +-
- sysdeps/pthread/tst-kill4.c | 90 ---------------------
- sysdeps/pthread/tst-pthread_cancel-exited.c | 45 +++++++++++
- sysdeps/pthread/tst-pthread_kill-exited.c | 46 +++++++++++
- 7 files changed, 107 insertions(+), 96 deletions(-)
- delete mode 100644 sysdeps/pthread/tst-kill4.c
- create mode 100644 sysdeps/pthread/tst-pthread_cancel-exited.c
- create mode 100644 sysdeps/pthread/tst-pthread_kill-exited.c
-
-diff --git a/NEWS b/NEWS
-index 89e20cf062..8e9e56d2c2 100644
---- a/NEWS
-+++ b/NEWS
-@@ -9,6 +9,7 @@ Version 2.34.1
-
- The following bugs are resolved with this release:
-
-+ [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-
-
-diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
-index cc25ff21f3..9bac6e3b76 100644
---- a/nptl/pthread_cancel.c
-+++ b/nptl/pthread_cancel.c
-@@ -62,10 +62,11 @@ __pthread_cancel (pthread_t th)
- {
- volatile struct pthread *pd = (volatile struct pthread *) th;
-
-- /* Make sure the descriptor is valid. */
-- if (INVALID_TD_P (pd))
-- /* Not a valid thread handle. */
-- return ESRCH;
-+ if (pd->tid == 0)
-+ /* The thread has already exited on the kernel side. Its outcome
-+ (regular exit, other cancelation) has already been
-+ determined. */
-+ return 0;
-
- static int init_sigcancel = 0;
- if (atomic_load_relaxed (&init_sigcancel) == 0)
-diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
-index f79a2b26fc..5d4c86f920 100644
---- a/nptl/pthread_kill.c
-+++ b/nptl/pthread_kill.c
-@@ -46,7 +46,12 @@ __pthread_kill_internal (pthread_t threadid, int signo)
- ? INTERNAL_SYSCALL_ERRNO (val) : 0);
- }
- else
-- val = ESRCH;
-+ /* The kernel reports that the thread has exited. POSIX specifies
-+ the ESRCH error only for the case when the lifetime of a thread
-+ ID has ended, but calling pthread_kill on such a thread ID is
-+ undefined in glibc. Therefore, do not treat kernel thread exit
-+ as an error. */
-+ val = 0;
-
- return val;
- }
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index 42f9fc5072..dedfa0d290 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -89,7 +89,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 tst-join13 \
- tst-join14 tst-join15 \
- tst-key1 tst-key2 tst-key3 tst-key4 \
-- tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
-+ tst-kill1 tst-kill2 tst-kill3 tst-kill5 tst-kill6 \
- tst-locale1 tst-locale2 \
- tst-memstream \
- tst-mutex-errorcheck tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 \
-@@ -118,6 +118,9 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-unload \
- tst-unwind-thread \
- tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
-+ tst-pthread_cancel-exited \
-+ tst-pthread_kill-exited \
-+ # tests
-
- tests-time64 := \
- tst-abstime-time64 \
-diff --git a/sysdeps/pthread/tst-kill4.c b/sysdeps/pthread/tst-kill4.c
-deleted file mode 100644
-index 9563939792..0000000000
---- a/sysdeps/pthread/tst-kill4.c
-+++ /dev/null
-@@ -1,90 +0,0 @@
--/* Copyright (C) 2003-2021 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <https://www.gnu.org/licenses/>. */
--
--#include <errno.h>
--#include <pthread.h>
--#include <signal.h>
--#include <stdio.h>
--#include <stdlib.h>
--#include <unistd.h>
--
--
--static void *
--tf (void *a)
--{
-- return NULL;
--}
--
--
--int
--do_test (void)
--{
-- pthread_attr_t at;
-- if (pthread_attr_init (&at) != 0)
-- {
-- puts ("attr_create failed");
-- exit (1);
-- }
--
-- /* Limit thread stack size, because if it is too large, pthread_join
-- will free it immediately rather than put it into stack cache. */
-- if (pthread_attr_setstacksize (&at, 2 * 1024 * 1024) != 0)
-- {
-- puts ("setstacksize failed");
-- exit (1);
-- }
--
-- pthread_t th;
-- if (pthread_create (&th, &at, tf, NULL) != 0)
-- {
-- puts ("create failed");
-- exit (1);
-- }
--
-- pthread_attr_destroy (&at);
--
-- if (pthread_join (th, NULL) != 0)
-- {
-- puts ("join failed");
-- exit (1);
-- }
--
-- /* The following only works because we assume here something about
-- the implementation. Namely, that the memory allocated for the
-- thread descriptor is not going away, that the TID field is
-- cleared and therefore the signal is sent to process 0, and that
-- we can savely assume there is no other process with this ID at
-- that time. */
-- int e = pthread_kill (th, 0);
-- if (e == 0)
-- {
-- puts ("pthread_kill succeeded");
-- exit (1);
-- }
-- if (e != ESRCH)
-- {
-- puts ("pthread_kill didn't return ESRCH");
-- exit (1);
-- }
--
-- return 0;
--}
--
--
--#define TEST_FUNCTION do_test ()
--#include "../test-skeleton.c"
-diff --git a/sysdeps/pthread/tst-pthread_cancel-exited.c b/sysdeps/pthread/tst-pthread_cancel-exited.c
-new file mode 100644
-index 0000000000..811c9bee07
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread_cancel-exited.c
-@@ -0,0 +1,45 @@
-+/* Test that pthread_kill succeeds for an exited thread.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
-+ a thread that has exited on the kernel side. */
-+
-+#include <stddef.h>
-+#include <support/support.h>
-+#include <support/xthread.h>
-+
-+static void *
-+noop_thread (void *closure)
-+{
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ pthread_t thr = xpthread_create (NULL, noop_thread, NULL);
-+
-+ support_wait_for_thread_exit ();
-+
-+ xpthread_cancel (thr);
-+ xpthread_join (thr);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c
-new file mode 100644
-index 0000000000..7575fb6d58
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread_kill-exited.c
-@@ -0,0 +1,46 @@
-+/* Test that pthread_kill succeeds for an exited thread.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
-+ a thread that has exited on the kernel side. */
-+
-+#include <signal.h>
-+#include <stddef.h>
-+#include <support/support.h>
-+#include <support/xthread.h>
-+
-+static void *
-+noop_thread (void *closure)
-+{
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ pthread_t thr = xpthread_create (NULL, noop_thread, NULL);
-+
-+ support_wait_for_thread_exit ();
-+
-+ xpthread_kill (thr, SIGUSR1);
-+ xpthread_join (thr);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0014-nptl-Fix-race-between-pthread_kill-and-thread-exit-b.patch b/0014-nptl-Fix-race-between-pthread_kill-and-thread-exit-b.patch
deleted file mode 100644
index c139f5b..0000000
--- a/0014-nptl-Fix-race-between-pthread_kill-and-thread-exit-b.patch
+++ /dev/null
@@ -1,438 +0,0 @@
-From a8ac8c4725ddb1119764126a8674a04c9dd5aea8 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 13 Sep 2021 11:06:08 +0200
-Subject: [PATCH 14/66] nptl: Fix race between pthread_kill and thread exit
- (bug 12889)
-
-A new thread exit lock and flag are introduced. They are used to
-detect that the thread is about to exit or has exited in
-__pthread_kill_internal, and the signal is not sent in this case.
-
-The test sysdeps/pthread/tst-pthread_cancel-select-loop.c is derived
-from a downstream test originally written by Marek Polacek.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be)
----
- NEWS | 1 +
- nptl/allocatestack.c | 3 +
- nptl/descr.h | 6 +
- nptl/pthread_create.c | 14 ++
- nptl/pthread_kill.c | 65 +++++----
- sysdeps/pthread/Makefile | 2 +
- .../pthread/tst-pthread_cancel-select-loop.c | 87 +++++++++++++
- sysdeps/pthread/tst-pthread_kill-exiting.c | 123 ++++++++++++++++++
- 8 files changed, 276 insertions(+), 25 deletions(-)
- create mode 100644 sysdeps/pthread/tst-pthread_cancel-select-loop.c
- create mode 100644 sysdeps/pthread/tst-pthread_kill-exiting.c
-
-diff --git a/NEWS b/NEWS
-index 8e9e56d2c2..00fae31e92 100644
---- a/NEWS
-+++ b/NEWS
-@@ -9,6 +9,7 @@ Version 2.34.1
-
- The following bugs are resolved with this release:
-
-+ [12889] nptl: Fix race between pthread_kill and thread exit
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-
-diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
-index cfe37a3443..50065bc9bd 100644
---- a/nptl/allocatestack.c
-+++ b/nptl/allocatestack.c
-@@ -32,6 +32,7 @@
- #include <futex-internal.h>
- #include <kernel-features.h>
- #include <nptl-stack.h>
-+#include <libc-lock.h>
-
- /* Default alignment of stack. */
- #ifndef STACK_ALIGN
-@@ -127,6 +128,8 @@ get_cached_stack (size_t *sizep, void **memp)
- /* No pending event. */
- result->nextevent = NULL;
-
-+ result->exiting = false;
-+ __libc_lock_init (result->exit_lock);
- result->tls_state = (struct tls_internal_t) { 0 };
-
- /* Clear the DTV. */
-diff --git a/nptl/descr.h b/nptl/descr.h
-index c85778d449..4de84138fb 100644
---- a/nptl/descr.h
-+++ b/nptl/descr.h
-@@ -396,6 +396,12 @@ struct pthread
- PTHREAD_CANCEL_ASYNCHRONOUS). */
- unsigned char canceltype;
-
-+ /* Used in __pthread_kill_internal to detected a thread that has
-+ exited or is about to exit. exit_lock must only be acquired
-+ after blocking signals. */
-+ bool exiting;
-+ int exit_lock; /* A low-level lock (for use with __libc_lock_init etc). */
-+
- /* Used on strsignal. */
- struct tls_internal_t tls_state;
-
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index d8ec299cb1..33b426fc68 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -37,6 +37,7 @@
- #include <sys/single_threaded.h>
- #include <version.h>
- #include <clone_internal.h>
-+#include <futex-internal.h>
-
- #include <shlib-compat.h>
-
-@@ -485,6 +486,19 @@ start_thread (void *arg)
- /* This was the last thread. */
- exit (0);
-
-+ /* This prevents sending a signal from this thread to itself during
-+ its final stages. This must come after the exit call above
-+ because atexit handlers must not run with signals blocked. */
-+ __libc_signal_block_all (NULL);
-+
-+ /* Tell __pthread_kill_internal that this thread is about to exit.
-+ If there is a __pthread_kill_internal in progress, this delays
-+ the thread exit until the signal has been queued by the kernel
-+ (so that the TID used to send it remains valid). */
-+ __libc_lock_lock (pd->exit_lock);
-+ pd->exiting = true;
-+ __libc_lock_unlock (pd->exit_lock);
-+
- #ifndef __ASSUME_SET_ROBUST_LIST
- /* If this thread has any robust mutexes locked, handle them now. */
- # if __PTHREAD_MUTEX_HAVE_PREV
-diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
-index 5d4c86f920..fb7862eff7 100644
---- a/nptl/pthread_kill.c
-+++ b/nptl/pthread_kill.c
-@@ -16,6 +16,7 @@
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-+#include <libc-lock.h>
- #include <unistd.h>
- #include <pthreadP.h>
- #include <shlib-compat.h>
-@@ -23,37 +24,51 @@
- int
- __pthread_kill_internal (pthread_t threadid, int signo)
- {
-- pid_t tid;
- struct pthread *pd = (struct pthread *) threadid;
--
- if (pd == THREAD_SELF)
-- /* It is a special case to handle raise() implementation after a vfork
-- call (which does not update the PD tid field). */
-- tid = INLINE_SYSCALL_CALL (gettid);
-- else
-- /* Force load of pd->tid into local variable or register. Otherwise
-- if a thread exits between ESRCH test and tgkill, we might return
-- EINVAL, because pd->tid would be cleared by the kernel. */
-- tid = atomic_forced_read (pd->tid);
--
-- int val;
-- if (__glibc_likely (tid > 0))
- {
-- pid_t pid = __getpid ();
--
-- val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
-- val = (INTERNAL_SYSCALL_ERROR_P (val)
-- ? INTERNAL_SYSCALL_ERRNO (val) : 0);
-+ /* Use the actual TID from the kernel, so that it refers to the
-+ current thread even if called after vfork. There is no
-+ signal blocking in this case, so that the signal is delivered
-+ immediately, before __pthread_kill_internal returns: a signal
-+ sent to the thread itself needs to be delivered
-+ synchronously. (It is unclear if Linux guarantees the
-+ delivery of all pending signals after unblocking in the code
-+ below. POSIX only guarantees delivery of a single signal,
-+ which may not be the right one.) */
-+ pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
-+ int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
-+ return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
- }
-+
-+ /* Block all signals, as required by pd->exit_lock. */
-+ sigset_t old_mask;
-+ __libc_signal_block_all (&old_mask);
-+ __libc_lock_lock (pd->exit_lock);
-+
-+ int ret;
-+ if (pd->exiting)
-+ /* The thread is about to exit (or has exited). Sending the
-+ signal is either not observable (the target thread has already
-+ blocked signals at this point), or it will fail, or it might be
-+ delivered to a new, unrelated thread that has reused the TID.
-+ So do not actually send the signal. Do not report an error
-+ because the threadid argument is still valid (the thread ID
-+ lifetime has not ended), and ESRCH (for example) would be
-+ misleading. */
-+ ret = 0;
- else
-- /* The kernel reports that the thread has exited. POSIX specifies
-- the ESRCH error only for the case when the lifetime of a thread
-- ID has ended, but calling pthread_kill on such a thread ID is
-- undefined in glibc. Therefore, do not treat kernel thread exit
-- as an error. */
-- val = 0;
-+ {
-+ /* Using tgkill is a safety measure. pd->exit_lock ensures that
-+ the target thread cannot exit. */
-+ ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
-+ ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
-+ }
-+
-+ __libc_lock_unlock (pd->exit_lock);
-+ __libc_signal_restore_set (&old_mask);
-
-- return val;
-+ return ret;
- }
-
- int
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index dedfa0d290..48dba717a1 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -119,7 +119,9 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-unwind-thread \
- tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
- tst-pthread_cancel-exited \
-+ tst-pthread_cancel-select-loop \
- tst-pthread_kill-exited \
-+ tst-pthread_kill-exiting \
- # tests
-
- tests-time64 := \
-diff --git a/sysdeps/pthread/tst-pthread_cancel-select-loop.c b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
-new file mode 100644
-index 0000000000..a62087589c
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
-@@ -0,0 +1,87 @@
-+/* Test that pthread_cancel succeeds during thread exit.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* This test tries to trigger an internal race condition in
-+ pthread_cancel, where the cancellation signal is sent after the
-+ thread has begun the cancellation process. This can result in a
-+ spurious ESRCH error. For the original bug 12889, the window is
-+ quite small, so the bug was not reproduced in every run. */
-+
-+#include <stdbool.h>
-+#include <stddef.h>
-+#include <support/check.h>
-+#include <support/xthread.h>
-+#include <support/xunistd.h>
-+#include <sys/select.h>
-+#include <unistd.h>
-+
-+/* Set to true by timeout_thread_function when the test should
-+ terminate. */
-+static bool timeout;
-+
-+static void *
-+timeout_thread_function (void *unused)
-+{
-+ usleep (5 * 1000 * 1000);
-+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
-+ return NULL;
-+}
-+
-+/* Used for blocking the select function below. */
-+static int pipe_fds[2];
-+
-+static void *
-+canceled_thread_function (void *unused)
-+{
-+ while (true)
-+ {
-+ fd_set rfs;
-+ fd_set wfs;
-+ fd_set efs;
-+ FD_ZERO (&rfs);
-+ FD_ZERO (&wfs);
-+ FD_ZERO (&efs);
-+ FD_SET (pipe_fds[0], &rfs);
-+
-+ /* If the cancellation request is recognized early, the thread
-+ begins exiting while the cancellation signal arrives. */
-+ select (FD_SETSIZE, &rfs, &wfs, &efs, NULL);
-+ }
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ xpipe (pipe_fds);
-+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
-+
-+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
-+ {
-+ pthread_t thr = xpthread_create (NULL, canceled_thread_function, NULL);
-+ xpthread_cancel (thr);
-+ TEST_VERIFY (xpthread_join (thr) == PTHREAD_CANCELED);
-+ }
-+
-+ xpthread_join (thr_timeout);
-+ xclose (pipe_fds[0]);
-+ xclose (pipe_fds[1]);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/sysdeps/pthread/tst-pthread_kill-exiting.c b/sysdeps/pthread/tst-pthread_kill-exiting.c
-new file mode 100644
-index 0000000000..f803e94f11
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread_kill-exiting.c
-@@ -0,0 +1,123 @@
-+/* Test that pthread_kill succeeds during thread exit.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* This test verifies that pthread_kill for a thread that is exiting
-+ succeeds (with or without actually delivering the signal). */
-+
-+#include <array_length.h>
-+#include <stdbool.h>
-+#include <stddef.h>
-+#include <support/xsignal.h>
-+#include <support/xthread.h>
-+#include <unistd.h>
-+
-+/* Set to true by timeout_thread_function when the test should
-+ terminate. */
-+static bool timeout;
-+
-+static void *
-+timeout_thread_function (void *unused)
-+{
-+ usleep (1000 * 1000);
-+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
-+ return NULL;
-+}
-+
-+/* Used to synchronize the sending threads with the target thread and
-+ main thread. */
-+static pthread_barrier_t barrier_1;
-+static pthread_barrier_t barrier_2;
-+
-+/* The target thread to which signals are to be sent. */
-+static pthread_t target_thread;
-+
-+/* Set by the main thread to true after timeout has been set to
-+ true. */
-+static bool exiting;
-+
-+static void *
-+sender_thread_function (void *unused)
-+{
-+ while (true)
-+ {
-+ /* Wait until target_thread has been initialized. The target
-+ thread and main thread participate in this barrier. */
-+ xpthread_barrier_wait (&barrier_1);
-+
-+ if (exiting)
-+ break;
-+
-+ xpthread_kill (target_thread, SIGUSR1);
-+
-+ /* Communicate that the signal has been sent. The main thread
-+ participates in this barrier. */
-+ xpthread_barrier_wait (&barrier_2);
-+ }
-+ return NULL;
-+}
-+
-+static void *
-+target_thread_function (void *unused)
-+{
-+ target_thread = pthread_self ();
-+ xpthread_barrier_wait (&barrier_1);
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ xsignal (SIGUSR1, SIG_IGN);
-+
-+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
-+
-+ pthread_t threads[4];
-+ xpthread_barrier_init (&barrier_1, NULL, array_length (threads) + 2);
-+ xpthread_barrier_init (&barrier_2, NULL, array_length (threads) + 1);
-+
-+ for (int i = 0; i < array_length (threads); ++i)
-+ threads[i] = xpthread_create (NULL, sender_thread_function, NULL);
-+
-+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
-+ {
-+ xpthread_create (NULL, target_thread_function, NULL);
-+
-+ /* Wait for the target thread to be set up and signal sending to
-+ start. */
-+ xpthread_barrier_wait (&barrier_1);
-+
-+ /* Wait for signal sending to complete. */
-+ xpthread_barrier_wait (&barrier_2);
-+
-+ xpthread_join (target_thread);
-+ }
-+
-+ exiting = true;
-+
-+ /* Signal the sending threads to exit. */
-+ xpthread_create (NULL, target_thread_function, NULL);
-+ xpthread_barrier_wait (&barrier_1);
-+
-+ for (int i = 0; i < array_length (threads); ++i)
-+ xpthread_join (threads[i]);
-+ xpthread_join (thr_timeout);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0015-iconvconfig-Fix-behaviour-with-prefix-BZ-28199.patch b/0015-iconvconfig-Fix-behaviour-with-prefix-BZ-28199.patch
deleted file mode 100644
index 3455dfa..0000000
--- a/0015-iconvconfig-Fix-behaviour-with-prefix-BZ-28199.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 3fc51f35b4f32e1bb99d85c1578e930e725ff929 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Mon, 13 Sep 2021 20:48:35 +0530
-Subject: [PATCH 15/66] iconvconfig: Fix behaviour with --prefix [BZ #28199]
-
-The consolidation of configuration parsing broke behaviour with
---prefix, where the prefix bled into the modules cache. Accept a
-prefix which, when non-NULL, is prepended to the path when looking for
-configuration files but only the original directory is added to the
-modules cache.
-
-This has no effect on the codegen of gconv_conf since it passes NULL.
-
-Reported-by: Patrick McCarty <patrick.mccarty@intel.com>
-Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
-Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
-(cherry picked from commit 43cea6d5652b6b9e61ac6ecc69419c909b504f47)
----
- iconv/gconv_conf.c | 2 +-
- iconv/gconv_parseconfdir.h | 22 +++++++++++++++-------
- iconv/iconvconfig.c | 16 ++++++++++++----
- 3 files changed, 28 insertions(+), 12 deletions(-)
-
-diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
-index 62bee28769..cc391d8f93 100644
---- a/iconv/gconv_conf.c
-+++ b/iconv/gconv_conf.c
-@@ -478,7 +478,7 @@ __gconv_read_conf (void)
- __gconv_get_path ();
-
- for (cnt = 0; __gconv_path_elem[cnt].name != NULL; ++cnt)
-- gconv_parseconfdir (__gconv_path_elem[cnt].name,
-+ gconv_parseconfdir (NULL, __gconv_path_elem[cnt].name,
- __gconv_path_elem[cnt].len);
- #endif
-
-diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
-index 2f062689ec..a586268abc 100644
---- a/iconv/gconv_parseconfdir.h
-+++ b/iconv/gconv_parseconfdir.h
-@@ -39,7 +39,6 @@
- /* Name of the file containing the module information in the directories
- along the path. */
- static const char gconv_conf_filename[] = "gconv-modules";
--static const char gconv_conf_dirname[] = "gconv-modules.d";
-
- static void add_alias (char *);
- static void add_module (char *, const char *, size_t, int);
-@@ -110,19 +109,28 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len)
- return true;
- }
-
-+/* Prefix DIR (with length DIR_LEN) with PREFIX if the latter is non-NULL and
-+ parse configuration in it. */
-+
- static __always_inline bool
--gconv_parseconfdir (const char *dir, size_t dir_len)
-+gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len)
- {
-- /* No slash needs to be inserted between dir and gconv_conf_filename;
-- dir already ends in a slash. */
-- char *buf = malloc (dir_len + sizeof (gconv_conf_dirname));
-+ /* No slash needs to be inserted between dir and gconv_conf_filename; dir
-+ already ends in a slash. The additional 2 is to accommodate the ".d"
-+ when looking for configuration files in gconv-modules.d. */
-+ size_t buflen = dir_len + sizeof (gconv_conf_filename) + 2;
-+ char *buf = malloc (buflen + (prefix != NULL ? strlen (prefix) : 0));
-+ char *cp = buf;
- bool found = false;
-
- if (buf == NULL)
- return false;
-
-- char *cp = mempcpy (mempcpy (buf, dir, dir_len), gconv_conf_filename,
-- sizeof (gconv_conf_filename));
-+ if (prefix != NULL)
-+ cp = stpcpy (cp, prefix);
-+
-+ cp = mempcpy (mempcpy (cp, dir, dir_len), gconv_conf_filename,
-+ sizeof (gconv_conf_filename));
-
- /* Read the gconv-modules configuration file first. */
- found = read_conf_file (buf, dir, dir_len);
-diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
-index 783b2bbdbb..273a71f673 100644
---- a/iconv/iconvconfig.c
-+++ b/iconv/iconvconfig.c
-@@ -653,13 +653,21 @@ add_module (char *rp, const char *directory,
- static int
- handle_dir (const char *dir)
- {
-+ char *newp = NULL;
- size_t dirlen = strlen (dir);
- bool found = false;
-
-- char *fulldir = xasprintf ("%s%s%s", dir[0] == '/' ? prefix : "",
-- dir, dir[dirlen - 1] != '/' ? "/" : "");
-+ /* End directory path with a '/' if it doesn't already. */
-+ if (dir[dirlen - 1] != '/')
-+ {
-+ newp = xmalloc (dirlen + 2);
-+ memcpy (newp, dir, dirlen);
-+ newp[dirlen++] = '/';
-+ newp[dirlen] = '\0';
-+ dir = newp;
-+ }
-
-- found = gconv_parseconfdir (fulldir, strlen (fulldir));
-+ found = gconv_parseconfdir (dir[0] == '/' ? prefix : NULL, dir, dirlen);
-
- if (!found)
- {
-@@ -671,7 +679,7 @@ handle_dir (const char *dir)
- "configuration files with names ending in .conf.");
- }
-
-- free (fulldir);
-+ free (newp);
-
- return found ? 0 : 1;
- }
---
-2.34.1
-
diff --git a/0016-Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch b/0016-Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch
deleted file mode 100644
index a1ea891..0000000
--- a/0016-Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From ae925404a10bf0ea63d6e8d41e3821f68b4d776c Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Fri, 3 Sep 2021 00:28:14 +0200
-Subject: [PATCH 16/66] Fix failing nss/tst-nss-files-hosts-long with local
- resolver
-
-When a local resolver like unbound is listening on the IPv4 loopback
-address 127.0.0.1, the nss/tst-nss-files-hosts-long test fails. This is
-due to:
-- the default resolver in the absence of resolv.conf being 127.0.0.1
-- the default DNS NSS database configuration in the absence of
- nsswitch.conf being 'hosts: dns [!UNAVAIL=return] file'
-
-This causes the requests for 'test4' and 'test6' to first be sent to the
-local resolver, which responds with NXDOMAIN in the likely case those
-records do no exist. In turn that causes the access to /etc/hosts to be
-skipped, which is the purpose of that test.
-
-Fix that by providing a simple nsswitch.conf file forcing access to
-/etc/hosts for that test. I have tested that the only changed result in
-the testsuite is that test.
-
-(cherry picked from commit 2738480a4b0866723fb8c633f36bdd34a8767581)
----
- nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf | 1 +
- 1 file changed, 1 insertion(+)
- create mode 100644 nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
-
-diff --git a/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
-new file mode 100644
-index 0000000000..5b0c6a4199
---- /dev/null
-+++ b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
-@@ -0,0 +1 @@
-+hosts: files
---
-2.34.1
-
diff --git a/0017-Use-Linux-5.14-in-build-many-glibcs.py.patch b/0017-Use-Linux-5.14-in-build-many-glibcs.py.patch
deleted file mode 100644
index 69a49dd..0000000
--- a/0017-Use-Linux-5.14-in-build-many-glibcs.py.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 007d699d0e0d0957eead78ad252ad592656284de Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Tue, 7 Sep 2021 13:08:38 +0000
-Subject: [PATCH 17/66] Use Linux 5.14 in build-many-glibcs.py
-
-This patch makes build-many-glibcs.py use Linux 5.14.
-
-Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
-builds).
-
-(cherry picked from commit 4e04a47208e1712fcf202a6d9831f0900d575225)
----
- scripts/build-many-glibcs.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
-index 5a77af90a6..86537fa800 100755
---- a/scripts/build-many-glibcs.py
-+++ b/scripts/build-many-glibcs.py
-@@ -782,7 +782,7 @@ class Context(object):
- 'gcc': 'vcs-11',
- 'glibc': 'vcs-mainline',
- 'gmp': '6.2.1',
-- 'linux': '5.13',
-+ 'linux': '5.14',
- 'mpc': '1.2.1',
- 'mpfr': '4.1.0',
- 'mig': 'vcs-mainline',
---
-2.34.1
-
diff --git a/0018-Update-syscall-lists-for-Linux-5.14.patch b/0018-Update-syscall-lists-for-Linux-5.14.patch
deleted file mode 100644
index 5b34c00..0000000
--- a/0018-Update-syscall-lists-for-Linux-5.14.patch
+++ /dev/null
@@ -1,407 +0,0 @@
-From 005bafcf5b8a85d4c82831401f052747e160a7e8 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Wed, 8 Sep 2021 12:42:06 +0000
-Subject: [PATCH 18/66] Update syscall lists for Linux 5.14
-
-Linux 5.14 has two new syscalls, memfd_secret (on some architectures
-only) and quotactl_fd. Update syscall-names.list and regenerate the
-arch-syscall.h headers with build-many-glibcs.py update-syscalls.
-
-Tested with build-many-glibcs.py.
-
-(cherry picked from commit 89dc0372a9055e7ef86fe19be6201fa0b16b2f0e)
----
- sysdeps/unix/sysv/linux/aarch64/arch-syscall.h | 2 ++
- sysdeps/unix/sysv/linux/alpha/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arc/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arm/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/csky/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/hppa/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/i386/arch-syscall.h | 2 ++
- sysdeps/unix/sysv/linux/ia64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/m68k/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/microblaze/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/nios2/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sh/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/syscall-names.list | 6 ++++--
- sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h | 2 ++
- sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h | 2 ++
- 26 files changed, 33 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-index e9eb707d0a..bedab1abba 100644
---- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-@@ -126,6 +126,7 @@
- #define __NR_mbind 235
- #define __NR_membarrier 283
- #define __NR_memfd_create 279
-+#define __NR_memfd_secret 447
- #define __NR_migrate_pages 238
- #define __NR_mincore 232
- #define __NR_mkdirat 34
-@@ -187,6 +188,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-index bd6b7d4003..91354ed9e2 100644
---- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-@@ -337,6 +337,7 @@
- #define __NR_pwritev2 521
- #define __NR_query_module 347
- #define __NR_quotactl 148
-+#define __NR_quotactl_fd 553
- #define __NR_read 3
- #define __NR_readahead 379
- #define __NR_readlink 58
-diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-index 10650549c1..ff5c7eb36d 100644
---- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-@@ -190,6 +190,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-index 85c9b236ce..5772333cee 100644
---- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-@@ -244,6 +244,7 @@
- #define __NR_pwritev 362
- #define __NR_pwritev2 393
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 225
- #define __NR_readlink 85
-diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-index 24b0d1f94e..4af6d6202f 100644
---- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-@@ -199,6 +199,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-index feb70abc3e..b07fc8549d 100644
---- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-@@ -231,6 +231,7 @@
- #define __NR_pwritev 316
- #define __NR_pwritev2 348
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 207
- #define __NR_readlink 85
-diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-index 3b1894a79b..6e4264698b 100644
---- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-@@ -183,6 +183,7 @@
- #define __NR_mbind 274
- #define __NR_membarrier 375
- #define __NR_memfd_create 356
-+#define __NR_memfd_secret 447
- #define __NR_migrate_pages 294
- #define __NR_mincore 218
- #define __NR_mkdir 39
-@@ -266,6 +267,7 @@
- #define __NR_pwritev2 379
- #define __NR_query_module 167
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 225
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-index fb388a5fa4..1ca706d721 100644
---- a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-@@ -218,6 +218,7 @@
- #define __NR_pwritev 1320
- #define __NR_pwritev2 1349
- #define __NR_quotactl 1137
-+#define __NR_quotactl_fd 1467
- #define __NR_read 1026
- #define __NR_readahead 1216
- #define __NR_readlink 1092
-diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-index 7bc8c4af92..2f10f71f90 100644
---- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-@@ -254,6 +254,7 @@
- #define __NR_pwritev2 378
- #define __NR_query_module 167
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 240
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-index cf560d3af4..0607a4dfa6 100644
---- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-@@ -266,6 +266,7 @@
- #define __NR_pwritev2 394
- #define __NR_query_module 167
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 225
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-index f346460f48..0055eec0b1 100644
---- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-@@ -251,6 +251,7 @@
- #define __NR_pwritev2 4362
- #define __NR_query_module 4187
- #define __NR_quotactl 4131
-+#define __NR_quotactl_fd 4443
- #define __NR_read 4003
- #define __NR_readahead 4223
- #define __NR_readdir 4089
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-index 38ed84997a..8e8e9f91cc 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-@@ -232,6 +232,7 @@
- #define __NR_pwritev2 6326
- #define __NR_query_module 6171
- #define __NR_quotactl 6172
-+#define __NR_quotactl_fd 6443
- #define __NR_read 6000
- #define __NR_readahead 6179
- #define __NR_readlink 6087
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-index e6a10c8421..ebd1545f80 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-@@ -219,6 +219,7 @@
- #define __NR_pwritev2 5322
- #define __NR_query_module 5171
- #define __NR_quotactl 5172
-+#define __NR_quotactl_fd 5443
- #define __NR_read 5000
- #define __NR_readahead 5179
- #define __NR_readlink 5087
-diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-index 5314890289..2b530b1f88 100644
---- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-@@ -198,6 +198,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-index b5b0758532..a32984a9c1 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-@@ -260,6 +260,7 @@
- #define __NR_pwritev2 381
- #define __NR_query_module 166
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 191
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-index c77435ca61..b01e464fb9 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-@@ -243,6 +243,7 @@
- #define __NR_pwritev2 381
- #define __NR_query_module 166
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 191
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-index 70854bb9e3..24d0a2c455 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-@@ -179,6 +179,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-index 83b9f31aba..e526c89ae7 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-@@ -187,6 +187,7 @@
- #define __NR_pwritev 70
- #define __NR_pwritev2 287
- #define __NR_quotactl 60
-+#define __NR_quotactl_fd 443
- #define __NR_read 63
- #define __NR_readahead 213
- #define __NR_readlinkat 78
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-index b224c4aad4..d4c7b101b6 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-@@ -251,6 +251,7 @@
- #define __NR_pwritev2 377
- #define __NR_query_module 167
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 222
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-index 59864af125..bd8c78d705 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-@@ -221,6 +221,7 @@
- #define __NR_pwritev2 377
- #define __NR_query_module 167
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 222
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-index 23612c9092..3b6ac3d084 100644
---- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-@@ -246,6 +246,7 @@
- #define __NR_pwritev 334
- #define __NR_pwritev2 382
- #define __NR_quotactl 131
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 225
- #define __NR_readdir 89
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-index 380cddb2d8..35221a707e 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-@@ -252,6 +252,7 @@
- #define __NR_pwritev2 359
- #define __NR_query_module 184
- #define __NR_quotactl 165
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 205
- #define __NR_readdir 204
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-index 2175eeb6ed..5ba2b20509 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-@@ -231,6 +231,7 @@
- #define __NR_pwritev2 359
- #define __NR_query_module 184
- #define __NR_quotactl 165
-+#define __NR_quotactl_fd 443
- #define __NR_read 3
- #define __NR_readahead 205
- #define __NR_readdir 204
-diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
-index 89c5895b9b..fd98893b0e 100644
---- a/sysdeps/unix/sysv/linux/syscall-names.list
-+++ b/sysdeps/unix/sysv/linux/syscall-names.list
-@@ -21,8 +21,8 @@
- # This file can list all potential system calls. The names are only
- # used if the installed kernel headers also provide them.
-
--# The list of system calls is current as of Linux 5.13.
--kernel 5.13
-+# The list of system calls is current as of Linux 5.14.
-+kernel 5.14
-
- FAST_atomic_update
- FAST_cmpxchg
-@@ -247,6 +247,7 @@ madvise
- mbind
- membarrier
- memfd_create
-+memfd_secret
- memory_ordering
- migrate_pages
- mincore
-@@ -452,6 +453,7 @@ pwritev
- pwritev2
- query_module
- quotactl
-+quotactl_fd
- read
- readahead
- readdir
-diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-index 8e028eb62b..26d6ac68a6 100644
---- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-@@ -154,6 +154,7 @@
- #define __NR_mbind 237
- #define __NR_membarrier 324
- #define __NR_memfd_create 319
-+#define __NR_memfd_secret 447
- #define __NR_migrate_pages 256
- #define __NR_mincore 27
- #define __NR_mkdir 83
-@@ -224,6 +225,7 @@
- #define __NR_pwritev2 328
- #define __NR_query_module 178
- #define __NR_quotactl 179
-+#define __NR_quotactl_fd 443
- #define __NR_read 0
- #define __NR_readahead 187
- #define __NR_readlink 89
-diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-index 004feb53f1..36847783f6 100644
---- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-@@ -148,6 +148,7 @@
- #define __NR_mbind 1073742061
- #define __NR_membarrier 1073742148
- #define __NR_memfd_create 1073742143
-+#define __NR_memfd_secret 1073742271
- #define __NR_migrate_pages 1073742080
- #define __NR_mincore 1073741851
- #define __NR_mkdir 1073741907
-@@ -216,6 +217,7 @@
- #define __NR_pwritev 1073742359
- #define __NR_pwritev2 1073742371
- #define __NR_quotactl 1073742003
-+#define __NR_quotactl_fd 1073742267
- #define __NR_read 1073741824
- #define __NR_readahead 1073742011
- #define __NR_readlink 1073741913
---
-2.34.1
-
diff --git a/0019-Update-kernel-version-to-5.14-in-tst-mman-consts.py.patch b/0019-Update-kernel-version-to-5.14-in-tst-mman-consts.py.patch
deleted file mode 100644
index 2e0751e..0000000
--- a/0019-Update-kernel-version-to-5.14-in-tst-mman-consts.py.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 114581bf53864aaee562ee237461fc394bc61963 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Tue, 14 Sep 2021 13:51:58 +0000
-Subject: [PATCH 19/66] Update kernel version to 5.14 in tst-mman-consts.py
-
-This patch updates the kernel version in the test tst-mman-consts.py
-to 5.14. (There are no new MAP_* constants covered by this test in
-5.14 that need any other header changes.)
-
-Tested with build-many-glibcs.py.
-
-(cherry picked from commit 4b39e3498324d1aea802fea8d4b8764f5ddb4fd1)
----
- sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
-index ee5b13ee12..810433c238 100644
---- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
-+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
-@@ -33,7 +33,7 @@ def main():
- help='C compiler (including options) to use')
- args = parser.parse_args()
- linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
-- linux_version_glibc = (5, 13)
-+ linux_version_glibc = (5, 14)
- sys.exit(glibcextract.compare_macro_consts(
- '#define _GNU_SOURCE 1\n'
- '#include <sys/mman.h>\n',
---
-2.34.1
-
diff --git a/0020-Add-MADV_POPULATE_READ-and-MADV_POPULATE_WRITE-from-.patch b/0020-Add-MADV_POPULATE_READ-and-MADV_POPULATE_WRITE-from-.patch
deleted file mode 100644
index c3e871b..0000000
--- a/0020-Add-MADV_POPULATE_READ-and-MADV_POPULATE_WRITE-from-.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 4ed990e5b97a61f29f929bdeb36c5b2abb547a64 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Tue, 14 Sep 2021 14:19:24 +0000
-Subject: [PATCH 20/66] Add MADV_POPULATE_READ and MADV_POPULATE_WRITE from
- Linux 5.14 to bits/mman-linux.h
-
-Linux 5.14 adds constants MADV_POPULATE_READ and MADV_POPULATE_WRITE
-(with the same values on all architectures). Add these to glibc's
-bits/mman-linux.h.
-
-Tested for x86_64.
-
-(cherry picked from commit 3561106278cddd2f007bd27fd4c3e90caaf14b43)
----
- sysdeps/unix/sysv/linux/bits/mman-linux.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
-index 3b1ae418e0..31451c28d9 100644
---- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
-+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
-@@ -89,6 +89,10 @@
- # define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK. */
- # define MADV_COLD 20 /* Deactivate these pages. */
- # define MADV_PAGEOUT 21 /* Reclaim these pages. */
-+# define MADV_POPULATE_READ 22 /* Populate (prefault) page tables
-+ readable. */
-+# define MADV_POPULATE_WRITE 23 /* Populate (prefault) page tables
-+ writable. */
- # define MADV_HWPOISON 100 /* Poison a page for testing. */
- #endif
-
---
-2.34.1
-
diff --git a/0021-posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch b/0021-posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch
deleted file mode 100644
index ebbe956..0000000
--- a/0021-posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 433ec4f14a5753c7689c83c20c9972915c53c204 Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Fri, 10 Sep 2021 19:39:35 +0200
-Subject: [PATCH 21/66] posix: Fix attribute access mode on getcwd [BZ #27476]
-
-There is a GNU extension that allows to call getcwd(NULL, >0). It is
-described in the documentation, but also directly in the unistd.h
-header, just above the declaration.
-
-Therefore the attribute access mode added in commit 06febd8c6705
-is not correct. Drop it.
----
- posix/bits/unistd.h | 5 ++---
- posix/unistd.h | 3 +--
- 2 files changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
-index f0831386c7..622adeb2b2 100644
---- a/posix/bits/unistd.h
-+++ b/posix/bits/unistd.h
-@@ -199,10 +199,9 @@ __NTH (readlinkat (int __fd, const char *__restrict __path,
- #endif
-
- extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
-- __THROW __wur __attr_access ((__write_only__, 1, 2));
-+ __THROW __wur;
- extern char *__REDIRECT_NTH (__getcwd_alias,
-- (char *__buf, size_t __size), getcwd)
-- __wur __attr_access ((__write_only__, 1, 2));
-+ (char *__buf, size_t __size), getcwd) __wur;
- extern char *__REDIRECT_NTH (__getcwd_chk_warn,
- (char *__buf, size_t __size, size_t __buflen),
- __getcwd_chk)
-diff --git a/posix/unistd.h b/posix/unistd.h
-index 3dca65732f..8224c5fbc9 100644
---- a/posix/unistd.h
-+++ b/posix/unistd.h
-@@ -528,8 +528,7 @@ extern int fchdir (int __fd) __THROW __wur;
- an array is allocated with `malloc'; the array is SIZE
- bytes long, unless SIZE == 0, in which case it is as
- big as necessary. */
--extern char *getcwd (char *__buf, size_t __size) __THROW __wur
-- __attr_access ((__write_only__, 1, 2));
-+extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
-
- #ifdef __USE_GNU
- /* Return a malloc'd string containing the current directory name.
---
-2.34.1
-
diff --git a/0022-nptl-pthread_kill-needs-to-return-ESRCH-for-old-prog.patch b/0022-nptl-pthread_kill-needs-to-return-ESRCH-for-old-prog.patch
deleted file mode 100644
index 3e17e3f..0000000
--- a/0022-nptl-pthread_kill-needs-to-return-ESRCH-for-old-prog.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From 73c7f5a87971de2797f261e1a447f68dce09284b Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 20 Sep 2021 14:56:08 +0200
-Subject: [PATCH 22/66] nptl: pthread_kill needs to return ESRCH for old
- programs (bug 19193)
-
-The fix for bug 19193 breaks some old applications which appear
-to use pthread_kill to probe if a thread is still running, something
-that is not supported by POSIX.
-
-(cherry picked from commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93)
----
- nptl/pthread_kill.c | 37 ++++++++++++++++++-----
- sysdeps/pthread/tst-pthread_kill-exited.c | 21 +++++++++++--
- 2 files changed, 48 insertions(+), 10 deletions(-)
-
-diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
-index fb7862eff7..a44dc8f2d9 100644
---- a/nptl/pthread_kill.c
-+++ b/nptl/pthread_kill.c
-@@ -21,8 +21,11 @@
- #include <pthreadP.h>
- #include <shlib-compat.h>
-
--int
--__pthread_kill_internal (pthread_t threadid, int signo)
-+/* Sends SIGNO to THREADID. If the thread is about to exit or has
-+ already exited on the kernel side, return NO_TID. Otherwise return
-+ 0 or an error code. */
-+static int
-+__pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
- {
- struct pthread *pd = (struct pthread *) threadid;
- if (pd == THREAD_SELF)
-@@ -52,11 +55,8 @@ __pthread_kill_internal (pthread_t threadid, int signo)
- signal is either not observable (the target thread has already
- blocked signals at this point), or it will fail, or it might be
- delivered to a new, unrelated thread that has reused the TID.
-- So do not actually send the signal. Do not report an error
-- because the threadid argument is still valid (the thread ID
-- lifetime has not ended), and ESRCH (for example) would be
-- misleading. */
-- ret = 0;
-+ So do not actually send the signal. */
-+ ret = no_tid;
- else
- {
- /* Using tgkill is a safety measure. pd->exit_lock ensures that
-@@ -71,6 +71,15 @@ __pthread_kill_internal (pthread_t threadid, int signo)
- return ret;
- }
-
-+int
-+__pthread_kill_internal (pthread_t threadid, int signo)
-+{
-+ /* Do not report an error in the no-tid case because the threadid
-+ argument is still valid (the thread ID lifetime has not ended),
-+ and ESRCH (for example) would be misleading. */
-+ return __pthread_kill_implementation (threadid, signo, 0);
-+}
-+
- int
- __pthread_kill (pthread_t threadid, int signo)
- {
-@@ -81,6 +90,7 @@ __pthread_kill (pthread_t threadid, int signo)
-
- return __pthread_kill_internal (threadid, signo);
- }
-+
- /* Some architectures (for instance arm) might pull raise through libgcc, so
- avoid the symbol version if it ends up being used on ld.so. */
- #if !IS_IN(rtld)
-@@ -88,6 +98,17 @@ libc_hidden_def (__pthread_kill)
- versioned_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_34);
-
- # if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
--compat_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_0);
-+/* Variant which returns ESRCH in the no-TID case, for backwards
-+ compatibility. */
-+int
-+attribute_compat_text_section
-+__pthread_kill_esrch (pthread_t threadid, int signo)
-+{
-+ if (__is_internal_signal (signo))
-+ return EINVAL;
-+
-+ return __pthread_kill_implementation (threadid, signo, ESRCH);
-+}
-+compat_symbol (libc, __pthread_kill_esrch, pthread_kill, GLIBC_2_0);
- # endif
- #endif
-diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c
-index 7575fb6d58..a2fddad526 100644
---- a/sysdeps/pthread/tst-pthread_kill-exited.c
-+++ b/sysdeps/pthread/tst-pthread_kill-exited.c
-@@ -16,11 +16,15 @@
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
--/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
-- a thread that has exited on the kernel side. */
-+/* This test verifies that the default pthread_kill returns 0 (and not
-+ ESRCH) for a thread that has exited on the kernel side. */
-
-+#include <errno.h>
-+#include <pthread.h>
-+#include <shlib-compat.h>
- #include <signal.h>
- #include <stddef.h>
-+#include <support/check.h>
- #include <support/support.h>
- #include <support/xthread.h>
-
-@@ -30,6 +34,12 @@ noop_thread (void *closure)
- return NULL;
- }
-
-+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
-+extern __typeof (pthread_kill) compat_pthread_kill;
-+compat_symbol_reference (libpthread, compat_pthread_kill, pthread_kill,
-+ GLIBC_2_0);
-+#endif
-+
- static int
- do_test (void)
- {
-@@ -37,7 +47,14 @@ do_test (void)
-
- support_wait_for_thread_exit ();
-
-+ /* NB: Always uses the default symbol due to separate compilation. */
- xpthread_kill (thr, SIGUSR1);
-+
-+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
-+ /* Old binaries need the non-conforming ESRCH error code. */
-+ TEST_COMPARE (compat_pthread_kill (thr, SIGUSR1), ESRCH);
-+#endif
-+
- xpthread_join (thr);
-
- return 0;
---
-2.34.1
-
diff --git a/0023-nptl-Fix-type-of-pthread_mutexattr_getrobust_np-pthr.patch b/0023-nptl-Fix-type-of-pthread_mutexattr_getrobust_np-pthr.patch
deleted file mode 100644
index 604086d..0000000
--- a/0023-nptl-Fix-type-of-pthread_mutexattr_getrobust_np-pthr.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 8b8a1d0b7375c547ae905917a03743ed6759c5bc Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Tue, 21 Sep 2021 07:12:56 +0200
-Subject: [PATCH 23/66] nptl: Fix type of pthread_mutexattr_getrobust_np,
- pthread_mutexattr_setrobust_np (bug 28036)
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-Tested-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit f3e664563361dc17530113b3205998d1f19dc4d9)
----
- NEWS | 1 +
- sysdeps/nptl/pthread.h | 4 ++--
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 00fae31e92..a0c27ecf55 100644
---- a/NEWS
-+++ b/NEWS
-@@ -11,6 +11,7 @@ The following bugs are resolved with this release:
-
- [12889] nptl: Fix race between pthread_kill and thread exit
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
-+ [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-
-
-diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
-index f1b7f2bdc6..43146e91c9 100644
---- a/sysdeps/nptl/pthread.h
-+++ b/sysdeps/nptl/pthread.h
-@@ -933,7 +933,7 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
- # ifdef __USE_GNU
- # ifdef __REDIRECT_NTH
- extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
-- (pthread_mutex_t *, int *),
-+ (pthread_mutexattr_t *, int *),
- pthread_mutexattr_getrobust) __nonnull ((1))
- __attribute_deprecated_msg__ ("\
- pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
-@@ -949,7 +949,7 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
- # ifdef __USE_GNU
- # ifdef __REDIRECT_NTH
- extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
-- (pthread_mutex_t *, int),
-+ (pthread_mutexattr_t *, int),
- pthread_mutexattr_setrobust) __nonnull ((1))
- __attribute_deprecated_msg__ ("\
- pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
---
-2.34.1
-
diff --git a/0024-support-Add-support_open_dev_null_range.patch b/0024-support-Add-support_open_dev_null_range.patch
deleted file mode 100644
index c071a9b..0000000
--- a/0024-support-Add-support_open_dev_null_range.patch
+++ /dev/null
@@ -1,365 +0,0 @@
-From 5ad589d63bc2d9b1fc3d9f32144acaebb85e0803 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Tue, 24 Aug 2021 16:12:24 -0300
-Subject: [PATCH 24/66] support: Add support_open_dev_null_range
-
-It returns a range of file descriptor referring to the '/dev/null'
-pathname. The function takes care of restarting the open range
-if a file descriptor is found within the specified range and
-also increases RLIMIT_NOFILE if required.
-
-Checked on x86_64-linux-gnu.
-
-(cherry picked from commit e814f4b04ee413a7bb3dfa43e74c8fb4abf58359)
----
- support/Makefile | 2 +
- support/support-open-dev-null-range.c | 134 +++++++++++++++++++
- support/support.h | 8 ++
- support/tst-support-open-dev-null-range.c | 155 ++++++++++++++++++++++
- 4 files changed, 299 insertions(+)
- create mode 100644 support/support-open-dev-null-range.c
- create mode 100644 support/tst-support-open-dev-null-range.c
-
-diff --git a/support/Makefile b/support/Makefile
-index ef2b1a980a..2a0731796f 100644
---- a/support/Makefile
-+++ b/support/Makefile
-@@ -66,6 +66,7 @@ libsupport-routines = \
- support_path_support_time64 \
- support_process_state \
- support_ptrace \
-+ support-open-dev-null-range \
- support_openpty \
- support_paths \
- support_quote_blob \
-@@ -265,6 +266,7 @@ tests = \
- tst-support_capture_subprocess \
- tst-support_descriptors \
- tst-support_format_dns_packet \
-+ tst-support-open-dev-null-range \
- tst-support-process_state \
- tst-support_quote_blob \
- tst-support_quote_string \
-diff --git a/support/support-open-dev-null-range.c b/support/support-open-dev-null-range.c
-new file mode 100644
-index 0000000000..80d9dba504
---- /dev/null
-+++ b/support/support-open-dev-null-range.c
-@@ -0,0 +1,134 @@
-+/* Return a range of open file descriptors.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <support/support.h>
-+#include <support/check.h>
-+#include <support/xunistd.h>
-+#include <stdlib.h>
-+#include <sys/resource.h>
-+
-+static void
-+increase_nofile (void)
-+{
-+ struct rlimit rl;
-+ if (getrlimit (RLIMIT_NOFILE, &rl) == -1)
-+ FAIL_EXIT1 ("getrlimit (RLIMIT_NOFILE): %m");
-+
-+ rl.rlim_cur += 128;
-+
-+ if (setrlimit (RLIMIT_NOFILE, &rl) == 1)
-+ FAIL_EXIT1 ("setrlimit (RLIMIT_NOFILE): %m");
-+}
-+
-+static int
-+open_dev_null (int flags, mode_t mode)
-+{
-+ int fd = open64 ("/dev/null", flags, mode);
-+ if (fd > 0)
-+ return fd;
-+
-+ if (fd < 0 && errno != EMFILE)
-+ FAIL_EXIT1 ("open64 (\"/dev/null\", 0x%x, 0%o): %m", flags, mode);
-+
-+ increase_nofile ();
-+
-+ return xopen ("/dev/null", flags, mode);
-+}
-+
-+struct range
-+{
-+ int lowfd;
-+ size_t len;
-+};
-+
-+struct range_list
-+{
-+ size_t total;
-+ size_t used;
-+ struct range *ranges;
-+};
-+
-+static void
-+range_init (struct range_list *r)
-+{
-+ r->total = 8;
-+ r->used = 0;
-+ r->ranges = xmalloc (r->total * sizeof (struct range));
-+}
-+
-+static void
-+range_add (struct range_list *r, int lowfd, size_t len)
-+{
-+ if (r->used == r->total)
-+ {
-+ r->total *= 2;
-+ r->ranges = xrealloc (r->ranges, r->total * sizeof (struct range));
-+ }
-+ r->ranges[r->used].lowfd = lowfd;
-+ r->ranges[r->used].len = len;
-+ r->used++;
-+}
-+
-+static void
-+range_close (struct range_list *r)
-+{
-+ for (size_t i = 0; i < r->used; i++)
-+ {
-+ int minfd = r->ranges[i].lowfd;
-+ int maxfd = r->ranges[i].lowfd + r->ranges[i].len;
-+ for (int fd = minfd; fd < maxfd; fd++)
-+ xclose (fd);
-+ }
-+ free (r->ranges);
-+}
-+
-+int
-+support_open_dev_null_range (int num, int flags, mode_t mode)
-+{
-+ /* We keep track of the ranges that hit an already opened descriptor, so
-+ we close them after we get a working range. */
-+ struct range_list rl;
-+ range_init (&rl);
-+
-+ int lowfd = open_dev_null (flags, mode);
-+ int prevfd = lowfd;
-+ while (true)
-+ {
-+ int i = 1;
-+ for (; i < num; i++)
-+ {
-+ int fd = open_dev_null (flags, mode);
-+ if (fd != lowfd + i)
-+ {
-+ range_add (&rl, lowfd, prevfd - lowfd + 1);
-+
-+ prevfd = lowfd = fd;
-+ break;
-+ }
-+ prevfd = fd;
-+ }
-+ if (i == num)
-+ break;
-+ }
-+
-+ range_close (&rl);
-+
-+ return lowfd;
-+}
-diff --git a/support/support.h b/support/support.h
-index a5978b939a..c219e0d9d1 100644
---- a/support/support.h
-+++ b/support/support.h
-@@ -197,6 +197,14 @@ struct support_stack support_stack_alloc (size_t size);
- /* Deallocate the STACK. */
- void support_stack_free (struct support_stack *stack);
-
-+
-+/* Create a range of NUM opened '/dev/null' file descriptors using FLAGS and
-+ MODE. The function takes care of restarting the open range if a file
-+ descriptor is found within the specified range and also increases
-+ RLIMIT_NOFILE if required.
-+ The returned value is the lowest file descriptor number. */
-+int support_open_dev_null_range (int num, int flags, mode_t mode);
-+
- __END_DECLS
-
- #endif /* SUPPORT_H */
-diff --git a/support/tst-support-open-dev-null-range.c b/support/tst-support-open-dev-null-range.c
-new file mode 100644
-index 0000000000..8e29def1ce
---- /dev/null
-+++ b/support/tst-support-open-dev-null-range.c
-@@ -0,0 +1,155 @@
-+/* Tests for support_open_dev_null_range.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <dirent.h>
-+#include <fcntl.h>
-+#include <limits.h>
-+#include <support/check.h>
-+#include <support/support.h>
-+#include <support/xunistd.h>
-+#include <sys/resource.h>
-+#include <stdlib.h>
-+
-+#ifndef PATH_MAX
-+# define PATH_MAX 1024
-+#endif
-+
-+#include <stdio.h>
-+
-+static void
-+check_path (int fd)
-+{
-+ char *proc_fd_path = xasprintf ("/proc/self/fd/%d", fd);
-+ char file_path[PATH_MAX];
-+ ssize_t file_path_length
-+ = readlink (proc_fd_path, file_path, sizeof (file_path));
-+ free (proc_fd_path);
-+ if (file_path_length < 0)
-+ FAIL_EXIT1 ("readlink (%s, %p, %zu)", proc_fd_path, file_path,
-+ sizeof (file_path));
-+ file_path[file_path_length] = '\0';
-+ TEST_COMPARE_STRING (file_path, "/dev/null");
-+}
-+
-+static int
-+number_of_opened_files (void)
-+{
-+ DIR *fds = opendir ("/proc/self/fd");
-+ if (fds == NULL)
-+ FAIL_EXIT1 ("opendir (\"/proc/self/fd\"): %m");
-+
-+ int r = 0;
-+ while (true)
-+ {
-+ errno = 0;
-+ struct dirent64 *e = readdir64 (fds);
-+ if (e == NULL)
-+ {
-+ if (errno != 0)
-+ FAIL_EXIT1 ("readdir: %m");
-+ break;
-+ }
-+
-+ if (e->d_name[0] == '.')
-+ continue;
-+
-+ char *endptr;
-+ long int fd = strtol (e->d_name, &endptr, 10);
-+ if (*endptr != '\0' || fd < 0 || fd > INT_MAX)
-+ FAIL_EXIT1 ("readdir: invalid file descriptor name: /proc/self/fd/%s",
-+ e->d_name);
-+
-+ /* Skip the descriptor which is used to enumerate the
-+ descriptors. */
-+ if (fd == dirfd (fds))
-+ continue;
-+
-+ r = r + 1;
-+ }
-+
-+ closedir (fds);
-+
-+ return r;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ const int nfds1 = 8;
-+ int lowfd = support_open_dev_null_range (nfds1, O_RDONLY, 0600);
-+ for (int i = 0; i < nfds1; i++)
-+ {
-+ TEST_VERIFY (fcntl (lowfd + i, F_GETFL) > -1);
-+ check_path (lowfd + i);
-+ }
-+
-+ /* create some gaps. */
-+ xclose (lowfd + 1);
-+ xclose (lowfd + 5);
-+ xclose (lowfd + 6);
-+
-+ const int nfds2 = 16;
-+ int lowfd2 = support_open_dev_null_range (nfds2, O_RDONLY, 0600);
-+ for (int i = 0; i < nfds2; i++)
-+ {
-+ TEST_VERIFY (fcntl (lowfd2 + i, F_GETFL) > -1);
-+ check_path (lowfd2 + i);
-+ }
-+
-+ /* Decrease the maximum number of files. */
-+ {
-+ struct rlimit rl;
-+ if (getrlimit (RLIMIT_NOFILE, &rl) == -1)
-+ FAIL_EXIT1 ("getrlimit (RLIMIT_NOFILE): %m");
-+
-+ rl.rlim_cur = number_of_opened_files ();
-+
-+ if (setrlimit (RLIMIT_NOFILE, &rl) == 1)
-+ FAIL_EXIT1 ("setrlimit (RLIMIT_NOFILE): %m");
-+ }
-+
-+ const int nfds3 = 16;
-+ int lowfd3 = support_open_dev_null_range (nfds3, O_RDONLY, 0600);
-+ for (int i = 0; i < nfds3; i++)
-+ {
-+ TEST_VERIFY (fcntl (lowfd3 + i, F_GETFL) > -1);
-+ check_path (lowfd3 + i);
-+ }
-+
-+ /* create a lot of gaps to trigger the range extension. */
-+ xclose (lowfd3 + 1);
-+ xclose (lowfd3 + 3);
-+ xclose (lowfd3 + 5);
-+ xclose (lowfd3 + 7);
-+ xclose (lowfd3 + 9);
-+ xclose (lowfd3 + 11);
-+ xclose (lowfd3 + 13);
-+
-+ const int nfds4 = 16;
-+ int lowfd4 = support_open_dev_null_range (nfds4, O_RDONLY, 0600);
-+ for (int i = 0; i < nfds4; i++)
-+ {
-+ TEST_VERIFY (fcntl (lowfd4 + i, F_GETFL) > -1);
-+ check_path (lowfd4 + i);
-+ }
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0025-Use-support_open_dev_null_range-io-tst-closefrom-mis.patch b/0025-Use-support_open_dev_null_range-io-tst-closefrom-mis.patch
deleted file mode 100644
index 52ce43a..0000000
--- a/0025-Use-support_open_dev_null_range-io-tst-closefrom-mis.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From 772e33411bc730f832f415f93eb3e7c67e4d5488 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Tue, 24 Aug 2021 16:15:50 -0300
-Subject: [PATCH 25/66] Use support_open_dev_null_range io/tst-closefrom,
- misc/tst-close_range, and posix/tst-spawn5 (BZ #28260)
-
-It ensures a continuous range of file descriptor and avoid hitting
-the RLIMIT_NOFILE.
-
-Checked on x86_64-linux-gnu.
-
-(cherry picked from commit 6b20880b22d1d0fce7e9f506baa6fe2d5c7fcfdc)
----
- io/tst-closefrom.c | 21 +++++----------
- posix/tst-spawn5.c | 13 +---------
- sysdeps/unix/sysv/linux/tst-close_range.c | 31 ++++++++---------------
- 3 files changed, 17 insertions(+), 48 deletions(-)
-
-diff --git a/io/tst-closefrom.c b/io/tst-closefrom.c
-index d4c187073c..395ec0d894 100644
---- a/io/tst-closefrom.c
-+++ b/io/tst-closefrom.c
-@@ -24,31 +24,22 @@
- #include <support/check.h>
- #include <support/descriptors.h>
- #include <support/xunistd.h>
-+#include <support/support.h>
-
- #include <array_length.h>
-
- #define NFDS 100
-
--static int
--open_multiple_temp_files (void)
--{
-- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
-- for (int i = 1; i <= NFDS; i++)
-- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600), lowfd + i);
-- return lowfd;
--}
--
- static int
- closefrom_test (void)
- {
- struct support_descriptors *descrs = support_descriptors_list ();
-
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
-- const int maximum_fd = lowfd + NFDS;
-+ const int maximum_fd = lowfd + NFDS - 1;
- const int half_fd = lowfd + NFDS / 2;
-- const int gap = maximum_fd / 4;
-+ const int gap = lowfd + NFDS / 4;
-
- /* Close half of the descriptors and check result. */
- closefrom (half_fd);
-@@ -58,7 +49,7 @@ closefrom_test (void)
- TEST_COMPARE (fcntl (i, F_GETFL), -1);
- TEST_COMPARE (errno, EBADF);
- }
-- for (int i = 0; i < half_fd; i++)
-+ for (int i = lowfd; i < half_fd; i++)
- TEST_VERIFY (fcntl (i, F_GETFL) > -1);
-
- /* Create some gaps, close up to a threshold, and check result. */
-@@ -74,7 +65,7 @@ closefrom_test (void)
- TEST_COMPARE (fcntl (i, F_GETFL), -1);
- TEST_COMPARE (errno, EBADF);
- }
-- for (int i = 0; i < gap; i++)
-+ for (int i = lowfd; i < gap; i++)
- TEST_VERIFY (fcntl (i, F_GETFL) > -1);
-
- /* Close the remmaining but the last one. */
-diff --git a/posix/tst-spawn5.c b/posix/tst-spawn5.c
-index ac66738004..a95199af6b 100644
---- a/posix/tst-spawn5.c
-+++ b/posix/tst-spawn5.c
-@@ -47,17 +47,6 @@ static int initial_argv_count;
-
- #define NFDS 100
-
--static int
--open_multiple_temp_files (void)
--{
-- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
-- for (int i = 1; i <= NFDS; i++)
-- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600),
-- lowfd + i);
-- return lowfd;
--}
--
- static int
- parse_fd (const char *str)
- {
-@@ -185,7 +174,7 @@ spawn_closefrom_test (posix_spawn_file_actions_t *fa, int lowfd, int highfd,
- static void
- do_test_closefrom (void)
- {
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
- const int half_fd = lowfd + NFDS / 2;
-
- /* Close half of the descriptors and check result. */
-diff --git a/sysdeps/unix/sysv/linux/tst-close_range.c b/sysdeps/unix/sysv/linux/tst-close_range.c
-index dccb6189c5..f5069d1b8a 100644
---- a/sysdeps/unix/sysv/linux/tst-close_range.c
-+++ b/sysdeps/unix/sysv/linux/tst-close_range.c
-@@ -36,23 +36,12 @@
-
- #define NFDS 100
-
--static int
--open_multiple_temp_files (void)
--{
-- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
-- for (int i = 1; i <= NFDS; i++)
-- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600),
-- lowfd + i);
-- return lowfd;
--}
--
- static void
- close_range_test_max_upper_limit (void)
- {
- struct support_descriptors *descrs = support_descriptors_list ();
-
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
- {
- int r = close_range (lowfd, ~0U, 0);
-@@ -68,7 +57,7 @@ close_range_test_max_upper_limit (void)
- static void
- close_range_test_common (int lowfd, unsigned int flags)
- {
-- const int maximum_fd = lowfd + NFDS;
-+ const int maximum_fd = lowfd + NFDS - 1;
- const int half_fd = lowfd + NFDS / 2;
- const int gap_1 = maximum_fd - 8;
-
-@@ -121,7 +110,7 @@ close_range_test (void)
- struct support_descriptors *descrs = support_descriptors_list ();
-
- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
- close_range_test_common (lowfd, 0);
-
-@@ -146,7 +135,7 @@ close_range_test_subprocess (void)
- struct support_descriptors *descrs = support_descriptors_list ();
-
- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
- struct support_stack stack = support_stack_alloc (4096);
-
-@@ -184,7 +173,7 @@ close_range_unshare_test (void)
- struct support_descriptors *descrs1 = support_descriptors_list ();
-
- /* Check if the temporary file descriptor has no no gaps. */
-- int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
- struct support_descriptors *descrs2 = support_descriptors_list ();
-
-@@ -200,7 +189,7 @@ close_range_unshare_test (void)
-
- support_stack_free (&stack);
-
-- for (int i = 0; i < NFDS; i++)
-+ for (int i = lowfd; i < lowfd + NFDS; i++)
- TEST_VERIFY (fcntl (i, F_GETFL) > -1);
-
- support_descriptors_check (descrs2);
-@@ -226,9 +215,9 @@ static void
- close_range_cloexec_test (void)
- {
- /* Check if the temporary file descriptor has no no gaps. */
-- const int lowfd = open_multiple_temp_files ();
-+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
-
-- const int maximum_fd = lowfd + NFDS;
-+ const int maximum_fd = lowfd + NFDS - 1;
- const int half_fd = lowfd + NFDS / 2;
- const int gap_1 = maximum_fd - 8;
-
-@@ -251,13 +240,13 @@ close_range_cloexec_test (void)
- /* Create some gaps, close up to a threshold, and check result. */
- static int gap_close[] = { 57, 78, 81, 82, 84, 90 };
- for (int i = 0; i < array_length (gap_close); i++)
-- xclose (gap_close[i]);
-+ xclose (lowfd + gap_close[i]);
-
- TEST_COMPARE (close_range (half_fd + 1, gap_1, CLOSE_RANGE_CLOEXEC), 0);
- for (int i = half_fd + 1; i < gap_1; i++)
- {
- int flags = fcntl (i, F_GETFD);
-- if (is_in_array (gap_close, array_length (gap_close), i))
-+ if (is_in_array (gap_close, array_length (gap_close), i - lowfd))
- TEST_COMPARE (flags, -1);
- else
- {
---
-2.34.1
-
diff --git a/0026-nptl-Avoid-setxid-deadlock-with-blocked-signals-in-t.patch b/0026-nptl-Avoid-setxid-deadlock-with-blocked-signals-in-t.patch
deleted file mode 100644
index 8809adf..0000000
--- a/0026-nptl-Avoid-setxid-deadlock-with-blocked-signals-in-t.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From 33adeaa3e2b9143c38884bc5aa65ded222ed274e Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Thu, 23 Sep 2021 09:55:54 +0200
-Subject: [PATCH 26/66] nptl: Avoid setxid deadlock with blocked signals in
- thread exit [BZ #28361]
-
-As part of the fix for bug 12889, signals are blocked during
-thread exit, so that application code cannot run on the thread that
-is about to exit. This would cause problems if the application
-expected signals to be delivered after the signal handler revealed
-the thread to still exist, despite pthread_kill can no longer be used
-to send signals to it. However, glibc internally uses the SIGSETXID
-signal in a way that is incompatible with signal blocking, due to the
-way the setxid handshake delays thread exit until the setxid operation
-has completed. With a blocked SIGSETXID, the handshake can never
-complete, causing a deadlock.
-
-As a band-aid, restore the previous handshake protocol by not blocking
-SIGSETXID during thread exit.
-
-The new test sysdeps/pthread/tst-pthread-setuid-loop.c is based on
-a downstream test by Martin Osvald.
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-Tested-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit 2849e2f53311b66853cb5159b64cba2bddbfb854)
----
- NEWS | 1 +
- nptl/pthread_create.c | 12 ++++-
- sysdeps/pthread/Makefile | 1 +
- sysdeps/pthread/tst-pthread-setuid-loop.c | 61 +++++++++++++++++++++++
- 4 files changed, 73 insertions(+), 2 deletions(-)
- create mode 100644 sysdeps/pthread/tst-pthread-setuid-loop.c
-
-diff --git a/NEWS b/NEWS
-index a0c27ecf55..cccbf11ad9 100644
---- a/NEWS
-+++ b/NEWS
-@@ -13,6 +13,7 @@ The following bugs are resolved with this release:
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-+ [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
-
-
- Version 2.34
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index 33b426fc68..bc213f0bc4 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -488,8 +488,16 @@ start_thread (void *arg)
-
- /* This prevents sending a signal from this thread to itself during
- its final stages. This must come after the exit call above
-- because atexit handlers must not run with signals blocked. */
-- __libc_signal_block_all (NULL);
-+ because atexit handlers must not run with signals blocked.
-+
-+ Do not block SIGSETXID. The setxid handshake below expects the
-+ signal to be delivered. (SIGSETXID cannot run application code,
-+ nor does it use pthread_kill.) Reuse the pd->sigmask space for
-+ computing the signal mask, to save stack space. */
-+ __sigfillset (&pd->sigmask);
-+ __sigdelset (&pd->sigmask, SIGSETXID);
-+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &pd->sigmask, NULL,
-+ __NSIG_BYTES);
-
- /* Tell __pthread_kill_internal that this thread is about to exit.
- If there is a __pthread_kill_internal in progress, this delays
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index 48dba717a1..d4bd2d4e3e 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-unload \
- tst-unwind-thread \
- tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
-+ tst-pthread-setuid-loop \
- tst-pthread_cancel-exited \
- tst-pthread_cancel-select-loop \
- tst-pthread_kill-exited \
-diff --git a/sysdeps/pthread/tst-pthread-setuid-loop.c b/sysdeps/pthread/tst-pthread-setuid-loop.c
-new file mode 100644
-index 0000000000..fda2a49b7f
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread-setuid-loop.c
-@@ -0,0 +1,61 @@
-+/* Test that setuid, pthread_create, thread exit do not deadlock (bug 28361).
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <support/check.h>
-+#include <support/xthread.h>
-+#include <unistd.h>
-+
-+/* How many threads to launch during each iteration. */
-+enum { threads = 4 };
-+
-+/* How many iterations to perform. This value seems to reproduce
-+ bug 28361 in a bout one in three runs. */
-+enum { iterations = 5000 };
-+
-+/* Cache of the real user ID used by setuid_thread. */
-+static uid_t uid;
-+
-+/* Start routine for the threads. */
-+static void *
-+setuid_thread (void *closure)
-+{
-+ TEST_COMPARE (setuid (uid), 0);
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ /* The setxid machinery is still invoked even if the UID is
-+ unchanged. (The kernel might reset other credentials as part of
-+ the system call.) */
-+ uid = getuid ();
-+
-+ for (int i = 0; i < iterations; ++i)
-+ {
-+ pthread_t thread_ids[threads];
-+ for (int j = 0; j < threads; ++j)
-+ thread_ids[j] = xpthread_create (NULL, setuid_thread, NULL);
-+ for (int j = 0; j < threads; ++j)
-+ xpthread_join (thread_ids[j]);
-+ }
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0027-support-Add-check-for-TID-zero-in-support_wait_for_t.patch b/0027-support-Add-check-for-TID-zero-in-support_wait_for_t.patch
deleted file mode 100644
index a1af4cd..0000000
--- a/0027-support-Add-check-for-TID-zero-in-support_wait_for_t.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 4bf72519987ebc2be4a2058c670379040fae90ea Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 1 Oct 2021 18:16:41 +0200
-Subject: [PATCH 27/66] support: Add check for TID zero in
- support_wait_for_thread_exit
-
-Some kernel versions (observed with kernel 5.14 and earlier) can list
-"0" entries in /proc/self/task. This happens when a thread exits
-while the task list is being constructed. Treat this entry as not
-present, like the proposed kernel patch does:
-
-[PATCH] procfs: Do not list TID 0 in /proc/<pid>/task
-<https://lore.kernel.org/all/8735pn5dx7.fsf@oldenburg.str.redhat.com/>
-
-Fixes commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60 ("support: Add
-support_wait_for_thread_exit").
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-Tested-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit 176c88f5214d8107d330971cbbfbbba5186a111f)
----
- support/support_wait_for_thread_exit.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
-index 658a813810..5e3be421a7 100644
---- a/support/support_wait_for_thread_exit.c
-+++ b/support/support_wait_for_thread_exit.c
-@@ -43,7 +43,10 @@ support_wait_for_thread_exit (void)
- return;
- }
-
-- if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0)
-+ /* In some kernels, "0" entries denote a thread that has just
-+ exited. */
-+ if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0
-+ || strcmp (e->d_name, "0") == 0)
- continue;
-
- int task_tid = atoi (e->d_name);
---
-2.34.1
-
diff --git a/0028-nptl-pthread_kill-must-send-signals-to-a-specific-th.patch b/0028-nptl-pthread_kill-must-send-signals-to-a-specific-th.patch
deleted file mode 100644
index f6b9119..0000000
--- a/0028-nptl-pthread_kill-must-send-signals-to-a-specific-th.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-From 40bade26d5bcbda3d21fb598c5063d9df62de966 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 1 Oct 2021 18:16:41 +0200
-Subject: [PATCH 28/66] nptl: pthread_kill must send signals to a specific
- thread [BZ #28407]
-
-The choice between the kill vs tgkill system calls is not just about
-the TID reuse race, but also about whether the signal is sent to the
-whole process (and any thread in it) or to a specific thread.
-
-This was caught by the openposix test suite:
-
- LTP: openposix test suite - FAIL: SIGUSR1 is member of new thread pendingset.
- <https://gitlab.com/cki-project/kernel-tests/-/issues/764>
-
-Fixes commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be ("nptl: Fix race
-between pthread_kill and thread exit (bug 12889)").
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-Tested-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit eae81d70574e923ce3c59078b8df857ae192efa6)
----
- NEWS | 1 +
- nptl/pthread_kill.c | 4 +-
- sysdeps/pthread/Makefile | 1 +
- .../pthread/tst-pthread-raise-blocked-self.c | 92 +++++++++++++++++++
- 4 files changed, 95 insertions(+), 3 deletions(-)
- create mode 100644 sysdeps/pthread/tst-pthread-raise-blocked-self.c
-
-diff --git a/NEWS b/NEWS
-index cccbf11ad9..b7994015d9 100644
---- a/NEWS
-+++ b/NEWS
-@@ -14,6 +14,7 @@ The following bugs are resolved with this release:
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
-+ [28407] pthread_kill assumes that kill and tgkill are equivalent
-
-
- Version 2.34
-diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
-index a44dc8f2d9..35bf1f973e 100644
---- a/nptl/pthread_kill.c
-+++ b/nptl/pthread_kill.c
-@@ -40,7 +40,7 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
- below. POSIX only guarantees delivery of a single signal,
- which may not be the right one.) */
- pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
-- int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
-+ int ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), tid, signo);
- return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
- }
-
-@@ -59,8 +59,6 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
- ret = no_tid;
- else
- {
-- /* Using tgkill is a safety measure. pd->exit_lock ensures that
-- the target thread cannot exit. */
- ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
- ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
- }
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index d4bd2d4e3e..0af9c59b42 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -121,6 +121,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-pthread-setuid-loop \
- tst-pthread_cancel-exited \
- tst-pthread_cancel-select-loop \
-+ tst-pthread-raise-blocked-self \
- tst-pthread_kill-exited \
- tst-pthread_kill-exiting \
- # tests
-diff --git a/sysdeps/pthread/tst-pthread-raise-blocked-self.c b/sysdeps/pthread/tst-pthread-raise-blocked-self.c
-new file mode 100644
-index 0000000000..128e1a6071
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread-raise-blocked-self.c
-@@ -0,0 +1,92 @@
-+/* Test that raise sends signal to current thread even if blocked.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <signal.h>
-+#include <support/check.h>
-+#include <support/xsignal.h>
-+#include <support/xthread.h>
-+#include <pthread.h>
-+#include <unistd.h>
-+
-+/* Used to create a dummy thread ID distinct from all other thread
-+ IDs. */
-+static void *
-+noop (void *ignored)
-+{
-+ return NULL;
-+}
-+
-+static volatile pthread_t signal_thread;
-+
-+static void
-+signal_handler (int signo)
-+{
-+ signal_thread = pthread_self ();
-+}
-+
-+/* Used to ensure that waiting_thread has launched and can accept
-+ signals. */
-+static pthread_barrier_t barrier;
-+
-+static void *
-+waiting_thread (void *ignored)
-+{
-+ xpthread_barrier_wait (&barrier);
-+ pause ();
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ xsignal (SIGUSR1, signal_handler);
-+ xpthread_barrier_init (&barrier, NULL, 2);
-+
-+ /* Distinct thread ID value to */
-+ pthread_t dummy = xpthread_create (NULL, noop, NULL);
-+ signal_thread = dummy;
-+
-+ pthread_t helper = xpthread_create (NULL, waiting_thread, NULL);
-+
-+ /* Make sure that the thread is running. */
-+ xpthread_barrier_wait (&barrier);
-+
-+ /* Block signals on this thread. */
-+ sigset_t set;
-+ sigfillset (&set);
-+ xpthread_sigmask (SIG_BLOCK, &set, NULL);
-+
-+ /* Send the signal to this thread. It must not be delivered. */
-+ raise (SIGUSR1);
-+ TEST_VERIFY (signal_thread == dummy);
-+
-+ /* Wait a bit to give a chance for signal delivery (increases
-+ chances of failure with bug 28407). */
-+ usleep (50 * 1000);
-+
-+ /* Unblocking should cause synchronous delivery of the signal. */
-+ xpthread_sigmask (SIG_UNBLOCK, &set, NULL);
-+ TEST_VERIFY (signal_thread == pthread_self ());
-+
-+ xpthread_cancel (helper);
-+ xpthread_join (helper);
-+ xpthread_join (dummy);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0029-misc-Add-__get_nprocs_sched.patch b/0029-misc-Add-__get_nprocs_sched.patch
deleted file mode 100644
index c0991ee..0000000
--- a/0029-misc-Add-__get_nprocs_sched.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From e870aac8974cda746157a5a3c9f452ccd70da29b Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Mon, 6 Sep 2021 12:22:54 -0300
-Subject: [PATCH 29/66] misc: Add __get_nprocs_sched
-
-This is an internal function meant to return the number of avaliable
-processor where the process can scheduled, different than the
-__get_nprocs which returns a the system available online CPU.
-
-The Linux implementation currently only calls __get_nprocs(), which
-in tuns calls sched_getaffinity.
-
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit 11a02b035b464ab6813676adfd19c4a59c36d907)
----
- include/sys/sysinfo.h | 7 ++++++-
- malloc/arena.c | 2 +-
- misc/getsysstats.c | 6 ++++++
- sysdeps/mach/getsysstats.c | 6 ++++++
- sysdeps/unix/sysv/linux/getsysstats.c | 6 ++++++
- 5 files changed, 25 insertions(+), 2 deletions(-)
-
-diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
-index 7388356a19..c490561581 100644
---- a/include/sys/sysinfo.h
-+++ b/include/sys/sysinfo.h
-@@ -9,10 +9,15 @@
- extern int __get_nprocs_conf (void);
- libc_hidden_proto (__get_nprocs_conf)
-
--/* Return number of available processors. */
-+/* Return number of available processors (not all of them will be
-+ available to the caller process). */
- extern int __get_nprocs (void);
- libc_hidden_proto (__get_nprocs)
-
-+/* Return the number of available processors which the process can
-+ be scheduled. */
-+extern int __get_nprocs_sched (void) attribute_hidden;
-+
- /* Return number of physical pages of memory in the system. */
- extern long int __get_phys_pages (void);
- libc_hidden_proto (__get_phys_pages)
-diff --git a/malloc/arena.c b/malloc/arena.c
-index 667484630e..f1f0af8648 100644
---- a/malloc/arena.c
-+++ b/malloc/arena.c
-@@ -879,7 +879,7 @@ arena_get2 (size_t size, mstate avoid_arena)
- narenas_limit = mp_.arena_max;
- else if (narenas > mp_.arena_test)
- {
-- int n = __get_nprocs ();
-+ int n = __get_nprocs_sched ();
-
- if (n >= 1)
- narenas_limit = NARENAS_FROM_NCORES (n);
-diff --git a/misc/getsysstats.c b/misc/getsysstats.c
-index 0eedface6d..57d93601e2 100644
---- a/misc/getsysstats.c
-+++ b/misc/getsysstats.c
-@@ -45,6 +45,12 @@ weak_alias (__get_nprocs, get_nprocs)
- link_warning (get_nprocs, "warning: get_nprocs will always return 1")
-
-
-+int
-+__get_nprocs_sched (void)
-+{
-+ return 1;
-+}
-+
- long int
- __get_phys_pages (void)
- {
-diff --git a/sysdeps/mach/getsysstats.c b/sysdeps/mach/getsysstats.c
-index 1267f39da2..cc8023f979 100644
---- a/sysdeps/mach/getsysstats.c
-+++ b/sysdeps/mach/getsysstats.c
-@@ -62,6 +62,12 @@ __get_nprocs (void)
- libc_hidden_def (__get_nprocs)
- weak_alias (__get_nprocs, get_nprocs)
-
-+int
-+__get_nprocs_sched (void)
-+{
-+ return __get_nprocs ();
-+}
-+
- /* Return the number of physical pages on the system. */
- long int
- __get_phys_pages (void)
-diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
-index 1391e360b8..120ce1bb75 100644
---- a/sysdeps/unix/sysv/linux/getsysstats.c
-+++ b/sysdeps/unix/sysv/linux/getsysstats.c
-@@ -88,6 +88,12 @@ __get_nprocs (void)
- libc_hidden_def (__get_nprocs)
- weak_alias (__get_nprocs, get_nprocs)
-
-+int
-+__get_nprocs_sched (void)
-+{
-+ return __get_nprocs ();
-+}
-+
-
- /* On some architectures it is possible to distinguish between configured
- and active cpus. */
---
-2.34.1
-
diff --git a/0030-linux-Simplify-get_nprocs.patch b/0030-linux-Simplify-get_nprocs.patch
deleted file mode 100644
index 9a490fb..0000000
--- a/0030-linux-Simplify-get_nprocs.patch
+++ /dev/null
@@ -1,216 +0,0 @@
-From cda99af14e82b4bb6abaecd717ebe3b57c0aa534 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Mon, 6 Sep 2021 12:28:24 -0300
-Subject: [PATCH 30/66] linux: Simplify get_nprocs
-
-This patch simplifies the memory allocation code and uses the sched
-routines instead of reimplement it. This still uses a stack
-allocation buffer, so it can be used on malloc initialization code.
-
-Linux currently supports at maximum of 4096 cpus for most architectures:
-
-$ find -iname Kconfig | xargs git grep -A10 -w NR_CPUS | grep -w range
-arch/alpha/Kconfig- range 2 32
-arch/arc/Kconfig- range 2 4096
-arch/arm/Kconfig- range 2 16 if DEBUG_KMAP_LOCAL
-arch/arm/Kconfig- range 2 32 if !DEBUG_KMAP_LOCAL
-arch/arm64/Kconfig- range 2 4096
-arch/csky/Kconfig- range 2 32
-arch/hexagon/Kconfig- range 2 6 if SMP
-arch/ia64/Kconfig- range 2 4096
-arch/mips/Kconfig- range 2 256
-arch/openrisc/Kconfig- range 2 32
-arch/parisc/Kconfig- range 2 32
-arch/riscv/Kconfig- range 2 32
-arch/s390/Kconfig- range 2 512
-arch/sh/Kconfig- range 2 32
-arch/sparc/Kconfig- range 2 32 if SPARC32
-arch/sparc/Kconfig- range 2 4096 if SPARC64
-arch/um/Kconfig- range 1 1
-arch/x86/Kconfig-# [NR_CPUS_RANGE_BEGIN ... NR_CPUS_RANGE_END] range.
-arch/x86/Kconfig- range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
-arch/xtensa/Kconfig- range 2 32
-
-With x86 supporting 8192:
-
-arch/x86/Kconfig
- 976 config NR_CPUS_RANGE_END
- 977 int
- 978 depends on X86_64
- 979 default 8192 if SMP && CPUMASK_OFFSTACK
- 980 default 512 if SMP && !CPUMASK_OFFSTACK
- 981 default 1 if !SMP
-
-So using a maximum of 32k cpu should cover all cases (and I would
-expect once we start to have many more CPUs that Linux would provide
-a more straightforward way to query for such information).
-
-A test is added to check if sched_getaffinity can successfully return
-with large buffers.
-
-Checked on x86_64-linux-gnu and i686-linux-gnu.
-
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit 33099d72e41cf8a129b362e9709eb2be9372d844)
----
- posix/Makefile | 3 +-
- posix/tst-sched_getaffinity.c | 48 +++++++++++++++++++
- sysdeps/unix/sysv/linux/getsysstats.c | 68 +++++++--------------------
- 3 files changed, 68 insertions(+), 51 deletions(-)
- create mode 100644 posix/tst-sched_getaffinity.c
-
-diff --git a/posix/Makefile b/posix/Makefile
-index 059efb3cd2..09460a28e8 100644
---- a/posix/Makefile
-+++ b/posix/Makefile
-@@ -107,7 +107,8 @@ tests := test-errno tstgetopt testfnm runtests runptests \
- tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
- tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
- bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
-- tst-wordexp-nocmd tst-execveat tst-spawn5
-+ tst-wordexp-nocmd tst-execveat tst-spawn5 \
-+ tst-sched_getaffinity
-
- # Test for the glob symbol version that was replaced in glibc 2.27.
- ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
-diff --git a/posix/tst-sched_getaffinity.c b/posix/tst-sched_getaffinity.c
-new file mode 100644
-index 0000000000..db9d517a96
---- /dev/null
-+++ b/posix/tst-sched_getaffinity.c
-@@ -0,0 +1,48 @@
-+/* Tests for sched_getaffinity with large buffers.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <array_length.h>
-+#include <sched.h>
-+#include <support/check.h>
-+
-+/* NB: this test may fail on system with more than 32k cpus. */
-+
-+static int
-+do_test (void)
-+{
-+ /* The values are larger than the default cpu_set_t. */
-+ const int bufsize[] = { 1<<11, 1<<12, 1<<13, 1<<14, 1<<15, 1<<16, 1<<17 };
-+ int cpucount[array_length (bufsize)];
-+
-+ for (int i = 0; i < array_length (bufsize); i++)
-+ {
-+ cpu_set_t *cpuset = CPU_ALLOC (bufsize[i]);
-+ TEST_VERIFY (cpuset != NULL);
-+ size_t size = CPU_ALLOC_SIZE (bufsize[i]);
-+ TEST_COMPARE (sched_getaffinity (0, size, cpuset), 0);
-+ cpucount[i] = CPU_COUNT_S (size, cpuset);
-+ CPU_FREE (cpuset);
-+ }
-+
-+ for (int i = 0; i < array_length (cpucount) - 1; i++)
-+ TEST_COMPARE (cpucount[i], cpucount[i + 1]);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
-index 120ce1bb75..61d20e7bab 100644
---- a/sysdeps/unix/sysv/linux/getsysstats.c
-+++ b/sysdeps/unix/sysv/linux/getsysstats.c
-@@ -29,61 +29,29 @@
- #include <sys/sysinfo.h>
- #include <sysdep.h>
-
--/* Compute the population count of the entire array. */
--static int
--__get_nprocs_count (const unsigned long int *array, size_t length)
--{
-- int count = 0;
-- for (size_t i = 0; i < length; ++i)
-- if (__builtin_add_overflow (count, __builtin_popcountl (array[i]),
-- &count))
-- return INT_MAX;
-- return count;
--}
--
--/* __get_nprocs with a large buffer. */
--static int
--__get_nprocs_large (void)
--{
-- /* This code cannot use scratch_buffer because it is used during
-- malloc initialization. */
-- size_t pagesize = GLRO (dl_pagesize);
-- unsigned long int *page = __mmap (0, pagesize, PROT_READ | PROT_WRITE,
-- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
-- if (page == MAP_FAILED)
-- return 2;
-- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, pagesize, page);
-- int count;
-- if (r > 0)
-- count = __get_nprocs_count (page, pagesize / sizeof (unsigned long int));
-- else if (r == -EINVAL)
-- /* One page is still not enough to store the bits. A more-or-less
-- arbitrary value. This assumes t hat such large systems never
-- happen in practice. */
-- count = GLRO (dl_pagesize) * CHAR_BIT;
-- else
-- count = 2;
-- __munmap (page, GLRO (dl_pagesize));
-- return count;
--}
--
- int
- __get_nprocs (void)
- {
-- /* Fast path for most systems. The kernel expects a buffer size
-- that is a multiple of 8. */
-- unsigned long int small_buffer[1024 / CHAR_BIT / sizeof (unsigned long int)];
-- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0,
-- sizeof (small_buffer), small_buffer);
-+ enum
-+ {
-+ max_num_cpus = 32768,
-+ cpu_bits_size = CPU_ALLOC_SIZE (32768)
-+ };
-+
-+ /* This cannot use malloc because it is used on malloc initialization. */
-+ __cpu_mask cpu_bits[cpu_bits_size / sizeof (__cpu_mask)];
-+ int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
-+ cpu_bits);
- if (r > 0)
-- return __get_nprocs_count (small_buffer, r / sizeof (unsigned long int));
-+ return CPU_COUNT_S (cpu_bits_size, (cpu_set_t*) cpu_bits);
- else if (r == -EINVAL)
-- /* The kernel requests a larger buffer to store the data. */
-- return __get_nprocs_large ();
-- else
-- /* Some other error. 2 is conservative (not a uniprocessor
-- system, so atomics are needed). */
-- return 2;
-+ /* The input buffer is still not enough to store the number of cpus. This
-+ is an arbitrary values assuming such systems should be rare and there
-+ is no offline cpus. */
-+ return max_num_cpus;
-+ /* Some other error. 2 is conservative (not a uniprocessor system, so
-+ atomics are needed). */
-+ return 2;
- }
- libc_hidden_def (__get_nprocs)
- weak_alias (__get_nprocs, get_nprocs)
---
-2.34.1
-
diff --git a/0031-linux-Revert-the-use-of-sched_getaffinity-on-get_npr.patch b/0031-linux-Revert-the-use-of-sched_getaffinity-on-get_npr.patch
deleted file mode 100644
index e5d3b31..0000000
--- a/0031-linux-Revert-the-use-of-sched_getaffinity-on-get_npr.patch
+++ /dev/null
@@ -1,220 +0,0 @@
-From 822662cf2a4b170ade4c5342f035d68815a03276 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Mon, 6 Sep 2021 14:19:51 -0300
-Subject: [PATCH 31/66] linux: Revert the use of sched_getaffinity on get_nproc
- (BZ #28310)
-
-The use of sched_getaffinity on get_nproc and
-sysconf (_SC_NPROCESSORS_ONLN) done in 903bc7dcc2acafc40 (BZ #27645)
-breaks the top command in common hypervisor configurations and also
-other monitoring tools.
-
-The main issue using sched_getaffinity changed the symbols semantic
-from system-wide scope of online CPUs to per-process one (which can
-be changed with kernel cpusets or book parameters in VM).
-
-This patch reverts mostly of the 903bc7dcc2acafc40, with the
-exceptions:
-
- * No more cached values and atomic updates, since they are inherent
- racy.
-
- * No /proc/cpuinfo fallback, since /proc/stat is already used and
- it would require to revert more arch-specific code.
-
- * The alloca is replace with a static buffer of 1024 bytes.
-
-So the implementation first consult the sysfs, and fallbacks to procfs.
-
-Checked on x86_64-linux-gnu.
-
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit 342298278eabc75baabcaced110a11a02c3d3580)
----
- NEWS | 1 +
- sysdeps/unix/sysv/linux/getsysstats.c | 139 +++++++++++++++++++++++++-
- 2 files changed, 135 insertions(+), 5 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index b7994015d9..273a85da4d 100644
---- a/NEWS
-+++ b/NEWS
-@@ -13,6 +13,7 @@ The following bugs are resolved with this release:
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-+ [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
-
-diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
-index 61d20e7bab..d70ed95869 100644
---- a/sysdeps/unix/sysv/linux/getsysstats.c
-+++ b/sysdeps/unix/sysv/linux/getsysstats.c
-@@ -18,6 +18,8 @@
- <https://www.gnu.org/licenses/>. */
-
- #include <array_length.h>
-+#include <assert.h>
-+#include <ctype.h>
- #include <dirent.h>
- #include <errno.h>
- #include <ldsodefs.h>
-@@ -30,7 +32,7 @@
- #include <sysdep.h>
-
- int
--__get_nprocs (void)
-+__get_nprocs_sched (void)
- {
- enum
- {
-@@ -53,14 +55,141 @@ __get_nprocs (void)
- atomics are needed). */
- return 2;
- }
--libc_hidden_def (__get_nprocs)
--weak_alias (__get_nprocs, get_nprocs)
-+
-+static char *
-+next_line (int fd, char *const buffer, char **cp, char **re,
-+ char *const buffer_end)
-+{
-+ char *res = *cp;
-+ char *nl = memchr (*cp, '\n', *re - *cp);
-+ if (nl == NULL)
-+ {
-+ if (*cp != buffer)
-+ {
-+ if (*re == buffer_end)
-+ {
-+ memmove (buffer, *cp, *re - *cp);
-+ *re = buffer + (*re - *cp);
-+ *cp = buffer;
-+
-+ ssize_t n = __read_nocancel (fd, *re, buffer_end - *re);
-+ if (n < 0)
-+ return NULL;
-+
-+ *re += n;
-+
-+ nl = memchr (*cp, '\n', *re - *cp);
-+ while (nl == NULL && *re == buffer_end)
-+ {
-+ /* Truncate too long lines. */
-+ *re = buffer + 3 * (buffer_end - buffer) / 4;
-+ n = __read_nocancel (fd, *re, buffer_end - *re);
-+ if (n < 0)
-+ return NULL;
-+
-+ nl = memchr (*re, '\n', n);
-+ **re = '\n';
-+ *re += n;
-+ }
-+ }
-+ else
-+ nl = memchr (*cp, '\n', *re - *cp);
-+
-+ res = *cp;
-+ }
-+
-+ if (nl == NULL)
-+ nl = *re - 1;
-+ }
-+
-+ *cp = nl + 1;
-+ assert (*cp <= *re);
-+
-+ return res == *re ? NULL : res;
-+}
-+
-
- int
--__get_nprocs_sched (void)
-+__get_nprocs (void)
- {
-- return __get_nprocs ();
-+ enum { buffer_size = 1024 };
-+ char buffer[buffer_size];
-+ char *buffer_end = buffer + buffer_size;
-+ char *cp = buffer_end;
-+ char *re = buffer_end;
-+
-+ const int flags = O_RDONLY | O_CLOEXEC;
-+ /* This file contains comma-separated ranges. */
-+ int fd = __open_nocancel ("/sys/devices/system/cpu/online", flags);
-+ char *l;
-+ int result = 0;
-+ if (fd != -1)
-+ {
-+ l = next_line (fd, buffer, &cp, &re, buffer_end);
-+ if (l != NULL)
-+ do
-+ {
-+ char *endp;
-+ unsigned long int n = strtoul (l, &endp, 10);
-+ if (l == endp)
-+ {
-+ result = 0;
-+ break;
-+ }
-+
-+ unsigned long int m = n;
-+ if (*endp == '-')
-+ {
-+ l = endp + 1;
-+ m = strtoul (l, &endp, 10);
-+ if (l == endp)
-+ {
-+ result = 0;
-+ break;
-+ }
-+ }
-+
-+ result += m - n + 1;
-+
-+ l = endp;
-+ if (l < re && *l == ',')
-+ ++l;
-+ }
-+ while (l < re && *l != '\n');
-+
-+ __close_nocancel_nostatus (fd);
-+
-+ if (result > 0)
-+ return result;
-+ }
-+
-+ cp = buffer_end;
-+ re = buffer_end;
-+
-+ /* Default to an SMP system in case we cannot obtain an accurate
-+ number. */
-+ result = 2;
-+
-+ fd = __open_nocancel ("/proc/stat", flags);
-+ if (fd != -1)
-+ {
-+ result = 0;
-+
-+ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
-+ /* The current format of /proc/stat has all the cpu* entries
-+ at the front. We assume here that stays this way. */
-+ if (strncmp (l, "cpu", 3) != 0)
-+ break;
-+ else if (isdigit (l[3]))
-+ ++result;
-+
-+ __close_nocancel_nostatus (fd);
-+ }
-+
-+ return result;
- }
-+libc_hidden_def (__get_nprocs)
-+weak_alias (__get_nprocs, get_nprocs)
-
-
- /* On some architectures it is possible to distinguish between configured
---
-2.34.1
-
diff --git a/0032-Suppress-Wcast-qual-warnings-in-bsearch.patch b/0032-Suppress-Wcast-qual-warnings-in-bsearch.patch
deleted file mode 100644
index ab62231..0000000
--- a/0032-Suppress-Wcast-qual-warnings-in-bsearch.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 80a009119ba2330768120476aaad63767b81d543 Mon Sep 17 00:00:00 2001
-From: Jonathan Wakely <jwakely@redhat.com>
-Date: Wed, 19 May 2021 16:48:19 +0100
-Subject: [PATCH 32/66] Suppress -Wcast-qual warnings in bsearch
-
-The first cast to (void *) is redundant but should be (const void *)
-anyway, because that's the type of the lvalue being assigned to.
-
-The second cast is necessary and intentionally not const-correct, so
-tell the compiler not to warn about it.
-
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7)
----
- bits/stdlib-bsearch.h | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h
-index 4132dc6af0..d688ed2e15 100644
---- a/bits/stdlib-bsearch.h
-+++ b/bits/stdlib-bsearch.h
-@@ -29,14 +29,21 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
- while (__l < __u)
- {
- __idx = (__l + __u) / 2;
-- __p = (void *) (((const char *) __base) + (__idx * __size));
-+ __p = (const void *) (((const char *) __base) + (__idx * __size));
- __comparison = (*__compar) (__key, __p);
- if (__comparison < 0)
- __u = __idx;
- else if (__comparison > 0)
- __l = __idx + 1;
- else
-+#if __GNUC_PREREQ(4, 6)
-+# pragma GCC diagnostic push
-+# pragma GCC diagnostic ignored "-Wcast-qual"
-+#endif
- return (void *) __p;
-+#if __GNUC_PREREQ(4, 6)
-+# pragma GCC diagnostic pop
-+#endif
- }
-
- return NULL;
---
-2.34.1
-
diff --git a/0033-Add-missing-braces-to-bsearch-inline-implementation-.patch b/0033-Add-missing-braces-to-bsearch-inline-implementation-.patch
deleted file mode 100644
index f6745c9..0000000
--- a/0033-Add-missing-braces-to-bsearch-inline-implementation-.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From a996d13b8a2e101bedbb1bdaa7ffcfea3b959bb2 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Thu, 30 Sep 2021 18:44:06 +0200
-Subject: [PATCH 33/66] Add missing braces to bsearch inline implementation [BZ
- #28400]
-
-GCC treats the pragma as a statement, so that the else branch only
-consists of the pragma, not the return statement.
-
-Fixes commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7 ("Suppress
--Wcast-qual warnings in bsearch").
-
-Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-(cherry picked from commit 32b96d0dec0294465d2221a8f049703599d9d8e4)
----
- bits/stdlib-bsearch.h | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h
-index d688ed2e15..e2fcea6e17 100644
---- a/bits/stdlib-bsearch.h
-+++ b/bits/stdlib-bsearch.h
-@@ -36,14 +36,16 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
- else if (__comparison > 0)
- __l = __idx + 1;
- else
-+ {
- #if __GNUC_PREREQ(4, 6)
- # pragma GCC diagnostic push
- # pragma GCC diagnostic ignored "-Wcast-qual"
- #endif
-- return (void *) __p;
-+ return (void *) __p;
- #if __GNUC_PREREQ(4, 6)
- # pragma GCC diagnostic pop
- #endif
-+ }
- }
-
- return NULL;
---
-2.34.1
-
diff --git a/0034-support-Also-return-fd-when-it-is-0.patch b/0034-support-Also-return-fd-when-it-is-0.patch
deleted file mode 100644
index 2c38350..0000000
--- a/0034-support-Also-return-fd-when-it-is-0.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 558168c78ea1eb8efb33959c1da9d6b5a997fd7b Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Wed, 6 Oct 2021 21:48:35 +0530
-Subject: [PATCH 34/66] support: Also return fd when it is 0
-
-The fd validity check in open_dev_null checks if fd > 0, which would
-lead to a leaked fd if it is == 0.
-
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 27b6edbb090f736b101f569620d8ad0e7217ddf8)
----
- support/support-open-dev-null-range.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/support/support-open-dev-null-range.c b/support/support-open-dev-null-range.c
-index 80d9dba504..66a8504105 100644
---- a/support/support-open-dev-null-range.c
-+++ b/support/support-open-dev-null-range.c
-@@ -40,16 +40,16 @@ increase_nofile (void)
- static int
- open_dev_null (int flags, mode_t mode)
- {
-- int fd = open64 ("/dev/null", flags, mode);
-- if (fd > 0)
-- return fd;
-+ int fd = open64 ("/dev/null", flags, mode);
-+ if (fd >= 0)
-+ return fd;
-
-- if (fd < 0 && errno != EMFILE)
-- FAIL_EXIT1 ("open64 (\"/dev/null\", 0x%x, 0%o): %m", flags, mode);
-+ if (fd < 0 && errno != EMFILE)
-+ FAIL_EXIT1 ("open64 (\"/dev/null\", 0x%x, 0%o): %m", flags, mode);
-
-- increase_nofile ();
-+ increase_nofile ();
-
-- return xopen ("/dev/null", flags, mode);
-+ return xopen ("/dev/null", flags, mode);
- }
-
- struct range
---
-2.34.1
-
diff --git a/0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch b/0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch
deleted file mode 100644
index b263add..0000000
--- a/0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From cb44a620ef2336449af60694b6696efced161774 Mon Sep 17 00:00:00 2001
-From: Stefan Liebler <stli@linux.ibm.com>
-Date: Tue, 5 Oct 2021 16:14:10 +0200
-Subject: [PATCH 35/66] S390: Add PCI_MIO and SIE HWCAPs
-
-Both new HWCAPs were introduced in these kernel commits:
-- 7e8403ecaf884f307b627f3c371475913dd29292
- "s390: add HWCAP_S390_PCI_MIO to ELF hwcaps"
-- 7e82523f2583e9813e4109df3656707162541297
- "s390/hwcaps: make sie capability regular hwcap"
-
-Also note that the kernel commit 511ad531afd4090625def4d9aba1f5227bd44b8e
-"s390/hwcaps: shorten HWCAP defines" has shortened the prefix of the macros
-from "HWCAP_S390_" to "HWCAP_". For compatibility reasons, we do not
-change the prefix in public glibc header file.
-
-(cherry picked from commit f2e06656d04a9fcb0603802a4f8ce7aa3a1f055e)
----
- sysdeps/s390/dl-procinfo.c | 4 ++--
- sysdeps/s390/dl-procinfo.h | 4 +++-
- sysdeps/unix/sysv/linux/s390/bits/hwcap.h | 7 +++++++
- 3 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/sysdeps/s390/dl-procinfo.c b/sysdeps/s390/dl-procinfo.c
-index c174e27b35..155f0bd99e 100644
---- a/sysdeps/s390/dl-procinfo.c
-+++ b/sysdeps/s390/dl-procinfo.c
-@@ -46,13 +46,13 @@
- #if !defined PROCINFO_DECL && defined SHARED
- ._dl_s390_cap_flags
- #else
--PROCINFO_CLASS const char _dl_s390_cap_flags[21][9]
-+PROCINFO_CLASS const char _dl_s390_cap_flags[23][9]
- #endif
- #ifndef PROCINFO_DECL
- = {
- "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", "edat", "etf3eh",
- "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
-- "vxp2", "nnpa"
-+ "vxp2", "nnpa", "pcimio", "sie"
- }
- #endif
- #if !defined SHARED || defined PROCINFO_DECL
-diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
-index 2d9c305808..e4e3e334a5 100644
---- a/sysdeps/s390/dl-procinfo.h
-+++ b/sysdeps/s390/dl-procinfo.h
-@@ -21,7 +21,7 @@
- #define _DL_PROCINFO_H 1
- #include <ldsodefs.h>
-
--#define _DL_HWCAP_COUNT 21
-+#define _DL_HWCAP_COUNT 23
-
- #define _DL_PLATFORMS_COUNT 10
-
-@@ -63,6 +63,8 @@ enum
- HWCAP_S390_DFLT = 1 << 18,
- HWCAP_S390_VXRS_PDE2 = 1 << 19,
- HWCAP_S390_NNPA = 1 << 20,
-+ HWCAP_S390_PCI_MIO = 1 << 21,
-+ HWCAP_S390_SIE = 1 << 22,
- };
-
- #define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
-diff --git a/sysdeps/unix/sysv/linux/s390/bits/hwcap.h b/sysdeps/unix/sysv/linux/s390/bits/hwcap.h
-index e9bd3684db..00e73a3e3b 100644
---- a/sysdeps/unix/sysv/linux/s390/bits/hwcap.h
-+++ b/sysdeps/unix/sysv/linux/s390/bits/hwcap.h
-@@ -22,6 +22,11 @@
-
- /*
- * The following must match the kernels asm/elf.h.
-+ * Note: The kernel commit 511ad531afd4090625def4d9aba1f5227bd44b8e
-+ * "s390/hwcaps: shorten HWCAP defines" has shortened the prefix of the macros
-+ * from "HWCAP_S390_" to "HWCAP_". For compatibility reasons, we do not
-+ * change the prefix in public glibc header file.
-+ *
- * Note that these are *not* the same as the STORE FACILITY LIST bits.
- */
- #define HWCAP_S390_ESAN3 1
-@@ -48,3 +53,5 @@
- #define HWCAP_S390_DFLT 262144
- #define HWCAP_S390_VXRS_PDE2 524288
- #define HWCAP_S390_NNPA 1048576
-+#define HWCAP_S390_PCI_MIO 2097152
-+#define HWCAP_S390_SIE 4194304
---
-2.34.1
-
diff --git a/0036-elf-Replace-nsid-with-args.nsid-BZ-27609.patch b/0036-elf-Replace-nsid-with-args.nsid-BZ-27609.patch
deleted file mode 100644
index f8bf762..0000000
--- a/0036-elf-Replace-nsid-with-args.nsid-BZ-27609.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 79528414dc1578800cbf1fba2fbdb6335f4f39bf Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Thu, 30 Sep 2021 10:29:17 -0700
-Subject: [PATCH 36/66] elf: Replace nsid with args.nsid [BZ #27609]
-
-commit ec935dea6332cb22f9881cd1162bad156173f4b0
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Fri Apr 24 22:31:15 2020 +0200
-
- elf: Implement __libc_early_init
-
-has
-
-@@ -856,6 +876,11 @@ no more namespaces available for dlmopen()"));
- /* See if an error occurred during loading. */
- if (__glibc_unlikely (exception.errstring != NULL))
- {
-+ /* Avoid keeping around a dangling reference to the libc.so link
-+ map in case it has been cached in libc_map. */
-+ if (!args.libc_already_loaded)
-+ GL(dl_ns)[nsid].libc_map = NULL;
-+
-
-do_dlopen calls _dl_open with nsid == __LM_ID_CALLER (-2), which calls
-dl_open_worker with args.nsid = nsid. dl_open_worker updates args.nsid
-if it is __LM_ID_CALLER. After dl_open_worker returns, it is wrong to
-use nsid.
-
-Replace nsid with args.nsid after dl_open_worker returns. This fixes
-BZ #27609.
-
-(cherry picked from commit 1e1ecea62e899acb58c3fdf3b320a0833ddd0dff)
----
- elf/dl-open.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/elf/dl-open.c b/elf/dl-open.c
-index ec386626f9..41c7250bf6 100644
---- a/elf/dl-open.c
-+++ b/elf/dl-open.c
-@@ -886,7 +886,7 @@ no more namespaces available for dlmopen()"));
- /* Avoid keeping around a dangling reference to the libc.so link
- map in case it has been cached in libc_map. */
- if (!args.libc_already_loaded)
-- GL(dl_ns)[nsid].libc_map = NULL;
-+ GL(dl_ns)[args.nsid].libc_map = NULL;
-
- /* Remove the object from memory. It may be in an inconsistent
- state if relocation failed, for example. */
---
-2.34.1
-
diff --git a/0037-y2038-Use-a-common-definition-for-stat-for-sparc32.patch b/0037-y2038-Use-a-common-definition-for-stat-for-sparc32.patch
deleted file mode 100644
index cd8cf4f..0000000
--- a/0037-y2038-Use-a-common-definition-for-stat-for-sparc32.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From 76843f3b3ecb886b8d300220e6ec378e0fd09a8b Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Wed, 6 Oct 2021 08:10:13 -0300
-Subject: [PATCH 37/66] y2038: Use a common definition for stat for sparc32
-
-The sparc32 misses support for support done by 4e8521333bea6.
-
-Checked on sparcv9-linux-gnu.
-
-(cherry picked from commit d2b1254db208b35ff060f00a15f22a1eed5306d2)
----
- .../unix/sysv/linux/sparc/bits/struct_stat.h | 54 +++++++++++--------
- 1 file changed, 31 insertions(+), 23 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h
-index b481b4f9f8..45db6b6ffb 100644
---- a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h
-+++ b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h
-@@ -28,32 +28,35 @@
-
- struct stat
- {
-+#ifdef __USE_TIME_BITS64
-+# include <bits/struct_stat_time64_helper.h>
-+#else
- __dev_t st_dev; /* Device. */
--#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
-+# if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
- unsigned short int __pad1;
- __ino_t st_ino; /* File serial number. */
--#else
-+# else
- __ino64_t st_ino; /* File serial number. */
--#endif
-+# endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
--#ifndef __USE_FILE_OFFSET64
-+# ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
--#else
-+# else
- __off64_t st_size; /* Size of file, in bytes. */
--#endif
-+# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
--#ifndef __USE_FILE_OFFSET64
-+# ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
--#else
-+# else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
--#endif
--#ifdef __USE_XOPEN2K8
-+# endif
-+# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
-@@ -63,28 +66,32 @@ struct stat
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
--# define st_atime st_atim.tv_sec /* Backward compatibility. */
--# define st_mtime st_mtim.tv_sec
--# define st_ctime st_ctim.tv_sec
--#else
-+# define st_atime st_atim.tv_sec /* Backward compatibility. */
-+# define st_mtime st_mtim.tv_sec
-+# define st_ctime st_ctim.tv_sec
-+# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
--#endif
-+# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-+#endif /* __USE_TIME_BITS64 */
- };
-
- #ifdef __USE_LARGEFILE64
- struct stat64
- {
-+# ifdef __USE_TIME_BITS64
-+# include <bits/struct_stat_time64_helper.h>
-+# else
- __dev_t st_dev; /* Device. */
--# if __WORDSIZE == 64
-+# if __WORDSIZE == 64
- unsigned short int __pad1;
--# endif
-+# endif
- __ino64_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
-@@ -96,7 +103,7 @@ struct stat64
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
--# ifdef __USE_XOPEN2K8
-+# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
-@@ -106,19 +113,20 @@ struct stat64
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
--# define st_atime st_atim.tv_sec /* Backward compatibility. */
--# define st_mtime st_mtim.tv_sec
--# define st_ctime st_ctim.tv_sec
--# else
-+# define st_atime st_atim.tv_sec /* Backward compatibility. */
-+# define st_mtime st_mtim.tv_sec
-+# define st_ctime st_ctim.tv_sec
-+# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
--# endif
-+# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-+# endif /* __USE_TIME_BITS64 */
- };
- #endif
-
---
-2.34.1
-
diff --git a/0038-timex-Use-64-bit-fields-on-32-bit-TIMESIZE-64-system.patch b/0038-timex-Use-64-bit-fields-on-32-bit-TIMESIZE-64-system.patch
deleted file mode 100644
index 3c02a43..0000000
--- a/0038-timex-Use-64-bit-fields-on-32-bit-TIMESIZE-64-system.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From cb9b8b5d7670df1a13544857640efd86a299d0e4 Mon Sep 17 00:00:00 2001
-From: Stafford Horne <shorne@gmail.com>
-Date: Fri, 15 Oct 2021 06:17:41 +0900
-Subject: [PATCH 38/66] timex: Use 64-bit fields on 32-bit TIMESIZE=64 systems
- (BZ #28469)
-
-This was found when testing the OpenRISC port I am working on. These
-two tests fail with SIGSEGV:
-
- FAIL: misc/tst-ntp_gettime
- FAIL: misc/tst-ntp_gettimex
-
-This was found to be due to the kernel overwriting the stack space
-allocated by the timex structure. The reason for the overwrite being
-that the kernel timex has 64-bit fields and user space code only
-allocates enough stack space for timex with 32-bit fields.
-
-On 32-bit systems with TIMESIZE=64 __USE_TIME_BITS64 is not defined.
-This causes the timex structure to use 32-bit fields with type
-__syscall_slong_t.
-
-This patch adjusts the ifdef condition to allow 32-bit systems with
-TIMESIZE=64 to use the 64-bit long long timex definition.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
-(Cherry picked from commit 1d550265a75b412cea4889a50b101395f6a8e025)
----
- sysdeps/unix/sysv/linux/bits/timex.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h
-index ee37694e8f..4a5db6deca 100644
---- a/sysdeps/unix/sysv/linux/bits/timex.h
-+++ b/sysdeps/unix/sysv/linux/bits/timex.h
-@@ -25,7 +25,7 @@
-
- struct timex
- {
--# ifdef __USE_TIME_BITS64
-+# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32)
- unsigned int modes; /* mode selector */
- int :32; /* pad */
- long long offset; /* time offset (usec) */
---
-2.34.1
-
diff --git a/0039-elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch b/0039-elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch
deleted file mode 100644
index c888451..0000000
--- a/0039-elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch
+++ /dev/null
@@ -1,496 +0,0 @@
-From 024a7640ab9ecea80e527f4e4d7f7a1868e952c5 Mon Sep 17 00:00:00 2001
-From: Szabolcs Nagy <szabolcs.nagy@arm.com>
-Date: Wed, 15 Sep 2021 15:16:19 +0100
-Subject: [PATCH 39/66] elf: Avoid deadlock between pthread_create and ctors
- [BZ #28357]
-
-The fix for bug 19329 caused a regression such that pthread_create can
-deadlock when concurrent ctors from dlopen are waiting for it to finish.
-Use a new GL(dl_load_tls_lock) in pthread_create that is not taken
-around ctors in dlopen.
-
-The new lock is also used in __tls_get_addr instead of GL(dl_load_lock).
-
-The new lock is held in _dl_open_worker and _dl_close_worker around
-most of the logic before/after the init/fini routines. When init/fini
-routines are running then TLS is in a consistent, usable state.
-In _dl_open_worker the new lock requires catching and reraising dlopen
-failures that happen in the critical section.
-
-The new lock is reinitialized in a fork child, to keep the existing
-behaviour and it is kept recursive in case malloc interposition or TLS
-access from signal handlers can retake it. It is not obvious if this
-is necessary or helps, but avoids changing the preexisting behaviour.
-
-The new lock may be more appropriate for dl_iterate_phdr too than
-GL(dl_load_write_lock), since TLS state of an incompletely loaded
-module may be accessed. If the new lock can replace the old one,
-that can be a separate change.
-
-Fixes bug 28357.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 83b5323261bb72313bffcf37476c1b8f0847c736)
----
- NEWS | 1 +
- elf/dl-close.c | 6 ++
- elf/dl-open.c | 35 ++++++++-
- elf/dl-support.c | 7 ++
- elf/dl-tls.c | 16 ++---
- elf/rtld.c | 1 +
- posix/fork.c | 3 +
- sysdeps/generic/ldsodefs.h | 9 ++-
- sysdeps/pthread/Makefile | 10 ++-
- sysdeps/pthread/tst-create1.c | 119 +++++++++++++++++++++++++++++++
- sysdeps/pthread/tst-create1mod.c | 41 +++++++++++
- 11 files changed, 236 insertions(+), 12 deletions(-)
- create mode 100644 sysdeps/pthread/tst-create1.c
- create mode 100644 sysdeps/pthread/tst-create1mod.c
-
-diff --git a/NEWS b/NEWS
-index 273a85da4d..c0952d7558 100644
---- a/NEWS
-+++ b/NEWS
-@@ -14,6 +14,7 @@ The following bugs are resolved with this release:
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
- [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
-+ [28357] deadlock between pthread_create and ELF constructors
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
-
-diff --git a/elf/dl-close.c b/elf/dl-close.c
-index f39001cab9..cd7b9c9fe8 100644
---- a/elf/dl-close.c
-+++ b/elf/dl-close.c
-@@ -549,6 +549,9 @@ _dl_close_worker (struct link_map *map, bool force)
- size_t tls_free_end;
- tls_free_start = tls_free_end = NO_TLS_OFFSET;
-
-+ /* Protects global and module specitic TLS state. */
-+ __rtld_lock_lock_recursive (GL(dl_load_tls_lock));
-+
- /* We modify the list of loaded objects. */
- __rtld_lock_lock_recursive (GL(dl_load_write_lock));
-
-@@ -784,6 +787,9 @@ _dl_close_worker (struct link_map *map, bool force)
- GL(dl_tls_static_used) = tls_free_start;
- }
-
-+ /* TLS is cleaned up for the unloaded modules. */
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
-+
- #ifdef SHARED
- /* Auditing checkpoint: we have deleted all objects. */
- if (__glibc_unlikely (do_audit))
-diff --git a/elf/dl-open.c b/elf/dl-open.c
-index 41c7250bf6..bc68e2c376 100644
---- a/elf/dl-open.c
-+++ b/elf/dl-open.c
-@@ -66,6 +66,9 @@ struct dl_open_args
- libc_map value in the namespace in case of a dlopen failure. */
- bool libc_already_loaded;
-
-+ /* Set to true if the end of dl_open_worker_begin was reached. */
-+ bool worker_continue;
-+
- /* Original parameters to the program and the current environment. */
- int argc;
- char **argv;
-@@ -482,7 +485,7 @@ call_dl_init (void *closure)
- }
-
- static void
--dl_open_worker (void *a)
-+dl_open_worker_begin (void *a)
- {
- struct dl_open_args *args = a;
- const char *file = args->file;
-@@ -774,6 +777,36 @@ dl_open_worker (void *a)
- _dl_call_libc_early_init (libc_map, false);
- }
-
-+ args->worker_continue = true;
-+}
-+
-+static void
-+dl_open_worker (void *a)
-+{
-+ struct dl_open_args *args = a;
-+
-+ args->worker_continue = false;
-+
-+ {
-+ /* Protects global and module specific TLS state. */
-+ __rtld_lock_lock_recursive (GL(dl_load_tls_lock));
-+
-+ struct dl_exception ex;
-+ int err = _dl_catch_exception (&ex, dl_open_worker_begin, args);
-+
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
-+
-+ if (__glibc_unlikely (ex.errstring != NULL))
-+ /* Reraise the error. */
-+ _dl_signal_exception (err, &ex, NULL);
-+ }
-+
-+ if (!args->worker_continue)
-+ return;
-+
-+ int mode = args->mode;
-+ struct link_map *new = args->map;
-+
- /* Run the initializer functions of new objects. Temporarily
- disable the exception handler, so that lazy binding failures are
- fatal. */
-diff --git a/elf/dl-support.c b/elf/dl-support.c
-index 0155718175..d8c06ba7eb 100644
---- a/elf/dl-support.c
-+++ b/elf/dl-support.c
-@@ -229,6 +229,13 @@ __rtld_lock_define_initialized_recursive (, _dl_load_lock)
- list of loaded objects while an object is added to or removed from
- that list. */
- __rtld_lock_define_initialized_recursive (, _dl_load_write_lock)
-+ /* This lock protects global and module specific TLS related data.
-+ E.g. it is held in dlopen and dlclose when GL(dl_tls_generation),
-+ GL(dl_tls_max_dtv_idx) or GL(dl_tls_dtv_slotinfo_list) are
-+ accessed and when TLS related relocations are processed for a
-+ module. It was introduced to keep pthread_create accessing TLS
-+ state that is being set up. */
-+__rtld_lock_define_initialized_recursive (, _dl_load_tls_lock)
-
-
- #ifdef HAVE_AUX_VECTOR
-diff --git a/elf/dl-tls.c b/elf/dl-tls.c
-index 423e380f7c..40263cf586 100644
---- a/elf/dl-tls.c
-+++ b/elf/dl-tls.c
-@@ -532,7 +532,7 @@ _dl_allocate_tls_init (void *result)
- size_t maxgen = 0;
-
- /* Protects global dynamic TLS related state. */
-- __rtld_lock_lock_recursive (GL(dl_load_lock));
-+ __rtld_lock_lock_recursive (GL(dl_load_tls_lock));
-
- /* Check if the current dtv is big enough. */
- if (dtv[-1].counter < GL(dl_tls_max_dtv_idx))
-@@ -606,7 +606,7 @@ _dl_allocate_tls_init (void *result)
- listp = listp->next;
- assert (listp != NULL);
- }
-- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
-
- /* The DTV version is up-to-date now. */
- dtv[0].counter = maxgen;
-@@ -745,7 +745,7 @@ _dl_update_slotinfo (unsigned long int req_modid)
-
- Here the dtv needs to be updated to new_gen generation count.
-
-- This code may be called during TLS access when GL(dl_load_lock)
-+ This code may be called during TLS access when GL(dl_load_tls_lock)
- is not held. In that case the user code has to synchronize with
- dlopen and dlclose calls of relevant modules. A module m is
- relevant if the generation of m <= new_gen and dlclose of m is
-@@ -867,11 +867,11 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
- if (__glibc_unlikely (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET))
- {
-- __rtld_lock_lock_recursive (GL(dl_load_lock));
-+ __rtld_lock_lock_recursive (GL(dl_load_tls_lock));
- if (__glibc_likely (the_map->l_tls_offset == NO_TLS_OFFSET))
- {
- the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
-- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
- }
- else if (__glibc_likely (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET))
-@@ -883,7 +883,7 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
- #else
- # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
- #endif
-- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
-
- dtv[GET_ADDR_MODULE].pointer.to_free = NULL;
- dtv[GET_ADDR_MODULE].pointer.val = p;
-@@ -891,7 +891,7 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t *dtv, struct link_map *the_map)
- return (char *) p + GET_ADDR_OFFSET;
- }
- else
-- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-+ __rtld_lock_unlock_recursive (GL(dl_load_tls_lock));
- }
- struct dtv_pointer result = allocate_and_init (the_map);
- dtv[GET_ADDR_MODULE].pointer = result;
-@@ -962,7 +962,7 @@ _dl_tls_get_addr_soft (struct link_map *l)
- return NULL;
-
- dtv_t *dtv = THREAD_DTV ();
-- /* This may be called without holding the GL(dl_load_lock). Reading
-+ /* This may be called without holding the GL(dl_load_tls_lock). Reading
- arbitrary gen value is fine since this is best effort code. */
- size_t gen = atomic_load_relaxed (&GL(dl_tls_generation));
- if (__glibc_unlikely (dtv[0].counter != gen))
-diff --git a/elf/rtld.c b/elf/rtld.c
-index d733359eaf..08cf50145a 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -322,6 +322,7 @@ struct rtld_global _rtld_global =
- #ifdef _LIBC_REENTRANT
- ._dl_load_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
- ._dl_load_write_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
-+ ._dl_load_tls_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER,
- #endif
- ._dl_nns = 1,
- ._dl_ns =
-diff --git a/posix/fork.c b/posix/fork.c
-index c471f7b15f..021691b9b7 100644
---- a/posix/fork.c
-+++ b/posix/fork.c
-@@ -99,6 +99,9 @@ __libc_fork (void)
- /* Reset the lock the dynamic loader uses to protect its data. */
- __rtld_lock_initialize (GL(dl_load_lock));
-
-+ /* Reset the lock protecting dynamic TLS related data. */
-+ __rtld_lock_initialize (GL(dl_load_tls_lock));
-+
- reclaim_stacks ();
-
- /* Run the handlers registered for the child. */
-diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
-index 9c15259236..1ceb9c3212 100644
---- a/sysdeps/generic/ldsodefs.h
-+++ b/sysdeps/generic/ldsodefs.h
-@@ -372,6 +372,13 @@ struct rtld_global
- list of loaded objects while an object is added to or removed
- from that list. */
- __rtld_lock_define_recursive (EXTERN, _dl_load_write_lock)
-+ /* This lock protects global and module specific TLS related data.
-+ E.g. it is held in dlopen and dlclose when GL(dl_tls_generation),
-+ GL(dl_tls_max_dtv_idx) or GL(dl_tls_dtv_slotinfo_list) are
-+ accessed and when TLS related relocations are processed for a
-+ module. It was introduced to keep pthread_create accessing TLS
-+ state that is being set up. */
-+ __rtld_lock_define_recursive (EXTERN, _dl_load_tls_lock)
-
- /* Incremented whenever something may have been added to dl_loaded. */
- EXTERN unsigned long long _dl_load_adds;
-@@ -1261,7 +1268,7 @@ extern int _dl_scope_free (void *) attribute_hidden;
-
- /* Add module to slot information data. If DO_ADD is false, only the
- required memory is allocated. Must be called with GL
-- (dl_load_lock) acquired. If the function has already been called
-+ (dl_load_tls_lock) acquired. If the function has already been called
- for the link map L with !do_add, then this function will not raise
- an exception, otherwise it is possible that it encounters a memory
- allocation failure. */
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index 0af9c59b42..df8943f486 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -152,15 +152,17 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx6 tst-cancelx8 tst-cancelx9 \
- tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3
-
- ifeq ($(build-shared),yes)
--tests += tst-atfork2 tst-pt-tls4 tst-_res1 tst-fini1
-+tests += tst-atfork2 tst-pt-tls4 tst-_res1 tst-fini1 tst-create1
- tests-nolibpthread += tst-fini1
- endif
-
- modules-names += tst-atfork2mod tst-tls4moda tst-tls4modb \
-- tst-_res1mod1 tst-_res1mod2 tst-fini1mod
-+ tst-_res1mod1 tst-_res1mod2 tst-fini1mod \
-+ tst-create1mod
- test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
-
- tst-atfork2mod.so-no-z-defs = yes
-+tst-create1mod.so-no-z-defs = yes
-
- ifeq ($(build-shared),yes)
- # Build all the modules even when not actually running test programs.
-@@ -279,4 +281,8 @@ LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
-
- CFLAGS-tst-unwind-thread.c += -funwind-tables
-
-+LDFLAGS-tst-create1 = -Wl,-export-dynamic
-+$(objpfx)tst-create1: $(shared-thread-library)
-+$(objpfx)tst-create1.out: $(objpfx)tst-create1mod.so
-+
- endif
-diff --git a/sysdeps/pthread/tst-create1.c b/sysdeps/pthread/tst-create1.c
-new file mode 100644
-index 0000000000..932586c309
---- /dev/null
-+++ b/sysdeps/pthread/tst-create1.c
-@@ -0,0 +1,119 @@
-+/* Verify that pthread_create does not deadlock when ctors take locks.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <stdio.h>
-+#include <support/xdlfcn.h>
-+#include <support/xthread.h>
-+
-+/*
-+Check if ctor and pthread_create deadlocks in
-+
-+thread 1: dlopen -> ctor -> lock(user_lock)
-+thread 2: lock(user_lock) -> pthread_create
-+
-+or in
-+
-+thread 1: dlclose -> dtor -> lock(user_lock)
-+thread 2: lock(user_lock) -> pthread_create
-+*/
-+
-+static pthread_barrier_t bar_ctor;
-+static pthread_barrier_t bar_dtor;
-+static pthread_mutex_t user_lock = PTHREAD_MUTEX_INITIALIZER;
-+
-+void
-+ctor (void)
-+{
-+ xpthread_barrier_wait (&bar_ctor);
-+ dprintf (1, "thread 1: in ctor: started.\n");
-+ xpthread_mutex_lock (&user_lock);
-+ dprintf (1, "thread 1: in ctor: locked user_lock.\n");
-+ xpthread_mutex_unlock (&user_lock);
-+ dprintf (1, "thread 1: in ctor: unlocked user_lock.\n");
-+ dprintf (1, "thread 1: in ctor: done.\n");
-+}
-+
-+void
-+dtor (void)
-+{
-+ xpthread_barrier_wait (&bar_dtor);
-+ dprintf (1, "thread 1: in dtor: started.\n");
-+ xpthread_mutex_lock (&user_lock);
-+ dprintf (1, "thread 1: in dtor: locked user_lock.\n");
-+ xpthread_mutex_unlock (&user_lock);
-+ dprintf (1, "thread 1: in dtor: unlocked user_lock.\n");
-+ dprintf (1, "thread 1: in dtor: done.\n");
-+}
-+
-+static void *
-+thread3 (void *a)
-+{
-+ dprintf (1, "thread 3: started.\n");
-+ dprintf (1, "thread 3: done.\n");
-+ return 0;
-+}
-+
-+static void *
-+thread2 (void *a)
-+{
-+ pthread_t t3;
-+ dprintf (1, "thread 2: started.\n");
-+
-+ xpthread_mutex_lock (&user_lock);
-+ dprintf (1, "thread 2: locked user_lock.\n");
-+ xpthread_barrier_wait (&bar_ctor);
-+ t3 = xpthread_create (0, thread3, 0);
-+ xpthread_mutex_unlock (&user_lock);
-+ dprintf (1, "thread 2: unlocked user_lock.\n");
-+ xpthread_join (t3);
-+
-+ xpthread_mutex_lock (&user_lock);
-+ dprintf (1, "thread 2: locked user_lock.\n");
-+ xpthread_barrier_wait (&bar_dtor);
-+ t3 = xpthread_create (0, thread3, 0);
-+ xpthread_mutex_unlock (&user_lock);
-+ dprintf (1, "thread 2: unlocked user_lock.\n");
-+ xpthread_join (t3);
-+
-+ dprintf (1, "thread 2: done.\n");
-+ return 0;
-+}
-+
-+static void
-+thread1 (void)
-+{
-+ dprintf (1, "thread 1: started.\n");
-+ xpthread_barrier_init (&bar_ctor, NULL, 2);
-+ xpthread_barrier_init (&bar_dtor, NULL, 2);
-+ pthread_t t2 = xpthread_create (0, thread2, 0);
-+ void *p = xdlopen ("tst-create1mod.so", RTLD_NOW | RTLD_GLOBAL);
-+ dprintf (1, "thread 1: dlopen done.\n");
-+ xdlclose (p);
-+ dprintf (1, "thread 1: dlclose done.\n");
-+ xpthread_join (t2);
-+ dprintf (1, "thread 1: done.\n");
-+}
-+
-+static int
-+do_test (void)
-+{
-+ thread1 ();
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/sysdeps/pthread/tst-create1mod.c b/sysdeps/pthread/tst-create1mod.c
-new file mode 100644
-index 0000000000..62c9006961
---- /dev/null
-+++ b/sysdeps/pthread/tst-create1mod.c
-@@ -0,0 +1,41 @@
-+/* Verify that pthread_create does not deadlock when ctors take locks.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <stdio.h>
-+
-+/* Require TLS setup for the module. */
-+__thread int tlsvar;
-+
-+void ctor (void);
-+void dtor (void);
-+
-+static void __attribute__ ((constructor))
-+do_init (void)
-+{
-+ dprintf (1, "constructor started: %d.\n", tlsvar++);
-+ ctor ();
-+ dprintf (1, "constructor done: %d.\n", tlsvar++);
-+}
-+
-+static void __attribute__ ((destructor))
-+do_end (void)
-+{
-+ dprintf (1, "destructor started: %d.\n", tlsvar++);
-+ dtor ();
-+ dprintf (1, "destructor done: %d.\n", tlsvar++);
-+}
---
-2.34.1
-
diff --git a/0040-Handle-NULL-input-to-malloc_usable_size-BZ-28506.patch b/0040-Handle-NULL-input-to-malloc_usable_size-BZ-28506.patch
deleted file mode 100644
index 2c9ab8d..0000000
--- a/0040-Handle-NULL-input-to-malloc_usable_size-BZ-28506.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-From 01bffc013cdad1e0c45db7aa57efb2bee61f3338 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Fri, 29 Oct 2021 14:53:55 +0530
-Subject: [PATCH 40/66] Handle NULL input to malloc_usable_size [BZ #28506]
-
-Hoist the NULL check for malloc_usable_size into its entry points in
-malloc-debug and malloc and assume non-NULL in all callees. This fixes
-BZ #28506
-
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
-(cherry picked from commit 88e316b06414ee7c944cd6f8b30b07a972b78499)
----
- malloc/malloc-debug.c | 13 +++++++------
- malloc/malloc.c | 25 +++++++++----------------
- malloc/tst-malloc-usable.c | 22 +++++++++-------------
- 3 files changed, 25 insertions(+), 35 deletions(-)
-
-diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
-index 9922ef5f25..3d7e6d44fd 100644
---- a/malloc/malloc-debug.c
-+++ b/malloc/malloc-debug.c
-@@ -1,5 +1,6 @@
- /* Malloc debug DSO.
- Copyright (C) 2021 Free Software Foundation, Inc.
-+ Copyright The GNU Toolchain Authors.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
-@@ -399,17 +400,17 @@ strong_alias (__debug_calloc, calloc)
- size_t
- malloc_usable_size (void *mem)
- {
-+ if (mem == NULL)
-+ return 0;
-+
- if (__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK))
- return mcheck_usable_size (mem);
- if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
- return malloc_check_get_size (mem);
-
-- if (mem != NULL)
-- {
-- mchunkptr p = mem2chunk (mem);
-- if (DUMPED_MAIN_ARENA_CHUNK (p))
-- return chunksize (p) - SIZE_SZ;
-- }
-+ mchunkptr p = mem2chunk (mem);
-+ if (DUMPED_MAIN_ARENA_CHUNK (p))
-+ return chunksize (p) - SIZE_SZ;
-
- return musable (mem);
- }
-diff --git a/malloc/malloc.c b/malloc/malloc.c
-index e065785af7..7882c70f0a 100644
---- a/malloc/malloc.c
-+++ b/malloc/malloc.c
-@@ -1,5 +1,6 @@
- /* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 1996-2021 Free Software Foundation, Inc.
-+ Copyright The GNU Toolchain Authors.
- This file is part of the GNU C Library.
- Contributed by Wolfram Gloger <wg@malloc.de>
- and Doug Lea <dl@cs.oswego.edu>, 2001.
-@@ -5009,20 +5010,13 @@ __malloc_trim (size_t s)
- static size_t
- musable (void *mem)
- {
-- mchunkptr p;
-- if (mem != 0)
-- {
-- size_t result = 0;
--
-- p = mem2chunk (mem);
-+ mchunkptr p = mem2chunk (mem);
-
-- if (chunk_is_mmapped (p))
-- result = chunksize (p) - CHUNK_HDR_SZ;
-- else if (inuse (p))
-- result = memsize (p);
-+ if (chunk_is_mmapped (p))
-+ return chunksize (p) - CHUNK_HDR_SZ;
-+ else if (inuse (p))
-+ return memsize (p);
-
-- return result;
-- }
- return 0;
- }
-
-@@ -5030,10 +5024,9 @@ musable (void *mem)
- size_t
- __malloc_usable_size (void *m)
- {
-- size_t result;
--
-- result = musable (m);
-- return result;
-+ if (m == NULL)
-+ return 0;
-+ return musable (m);
- }
- #endif
-
-diff --git a/malloc/tst-malloc-usable.c b/malloc/tst-malloc-usable.c
-index a1074b782a..b0d702be10 100644
---- a/malloc/tst-malloc-usable.c
-+++ b/malloc/tst-malloc-usable.c
-@@ -2,6 +2,7 @@
- MALLOC_CHECK_ exported to a positive value.
-
- Copyright (C) 2012-2021 Free Software Foundation, Inc.
-+ Copyright The GNU Toolchain Authors.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
-@@ -21,29 +22,24 @@
- #include <malloc.h>
- #include <string.h>
- #include <stdio.h>
-+#include <support/support.h>
-+#include <support/check.h>
-
- static int
- do_test (void)
- {
- size_t usable_size;
- void *p = malloc (7);
-- if (!p)
-- {
-- printf ("memory allocation failed\n");
-- return 1;
-- }
-
-+ TEST_VERIFY_EXIT (p != NULL);
- usable_size = malloc_usable_size (p);
-- if (usable_size != 7)
-- {
-- printf ("malloc_usable_size: expected 7 but got %zu\n", usable_size);
-- return 1;
-- }
--
-+ TEST_COMPARE (usable_size, 7);
- memset (p, 0, usable_size);
- free (p);
-+
-+ TEST_COMPARE (malloc_usable_size (NULL), 0);
-+
- return 0;
- }
-
--#define TEST_FUNCTION do_test ()
--#include "../test-skeleton.c"
-+#include "support/test-driver.c"
---
-2.34.1
-
diff --git a/0041-ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch b/0041-ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch
deleted file mode 100644
index f6e4429..0000000
--- a/0041-ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch
+++ /dev/null
@@ -1,529 +0,0 @@
-From f42373f911a28d34325a5bfc1ed5a962c89da7eb Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Thu, 16 Sep 2021 08:15:29 -0700
-Subject: [PATCH 41/66] ld.so: Replace DL_RO_DYN_SECTION with dl_relocate_ld
- [BZ #28340]
-
-We can't relocate entries in dynamic section if it is readonly:
-
-1. Add a l_ld_readonly field to struct link_map to indicate if dynamic
-section is readonly and set it based on p_flags of PT_DYNAMIC segment.
-2. Replace DL_RO_DYN_SECTION with dl_relocate_ld to decide if dynamic
-section should be relocated.
-3. Remove DL_RO_DYN_TEMP_CNT.
-4. Don't use a static dynamic section to make readonly dynamic section
-in vDSO writable.
-5. Remove the temp argument from elf_get_dynamic_info.
-
-This fixes BZ #28340.
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit b413280cfb16834450f66f554bc0d618bb513851)
----
- NEWS | 1 +
- elf/Makefile | 11 +++++++++--
- elf/dl-load.c | 3 ++-
- elf/dl-reloc-static-pie.c | 12 +++++++++++-
- elf/get-dynamic-info.h | 21 +++------------------
- elf/rtld.c | 6 ++++--
- elf/setup-vdso.h | 5 ++---
- elf/tst-ro-dynamic-mod.c | 19 +++++++++++++++++++
- elf/tst-ro-dynamic-mod.map | 16 ++++++++++++++++
- elf/tst-ro-dynamic.c | 31 +++++++++++++++++++++++++++++++
- include/link.h | 3 +++
- sysdeps/generic/dl-relocate-ld.h | 32 ++++++++++++++++++++++++++++++++
- sysdeps/generic/ldsodefs.h | 7 ++-----
- sysdeps/mips/dl-relocate-ld.h | 32 ++++++++++++++++++++++++++++++++
- sysdeps/mips/ldsodefs.h | 4 ----
- sysdeps/riscv/dl-relocate-ld.h | 32 ++++++++++++++++++++++++++++++++
- sysdeps/riscv/ldsodefs.h | 5 -----
- 17 files changed, 199 insertions(+), 41 deletions(-)
- create mode 100644 elf/tst-ro-dynamic-mod.c
- create mode 100644 elf/tst-ro-dynamic-mod.map
- create mode 100644 elf/tst-ro-dynamic.c
- create mode 100644 sysdeps/generic/dl-relocate-ld.h
- create mode 100644 sysdeps/mips/dl-relocate-ld.h
- create mode 100644 sysdeps/riscv/dl-relocate-ld.h
-
-diff --git a/NEWS b/NEWS
-index c0952d7558..cc5641e4da 100644
---- a/NEWS
-+++ b/NEWS
-@@ -17,6 +17,7 @@ The following bugs are resolved with this release:
- [28357] deadlock between pthread_create and ELF constructors
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
-+ [28340] ld.so crashes while loading a DSO with a read-only dynamic section
-
-
- Version 2.34
-diff --git a/elf/Makefile b/elf/Makefile
-index d05f410592..de854b4d1a 100644
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -224,7 +224,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
- tst-tls-ie tst-tls-ie-dlmopen argv0test \
- tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
- tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \
-- tst-dl-is_dso
-+ tst-dl-is_dso tst-ro-dynamic
- # reldep9
- tests-internal += loadtest unload unload2 circleload1 \
- neededtest neededtest2 neededtest3 neededtest4 \
-@@ -357,7 +357,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
- libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkermod4-4 \
- tst-tls20mod-bad tst-tls21mod tst-dlmopen-dlerror-mod \
- tst-auxvalmod \
-- tst-dlmopen-gethostbyname-mod \
-+ tst-dlmopen-gethostbyname-mod tst-ro-dynamic-mod \
-
- # Most modules build with _ISOMAC defined, but those filtered out
- # depend on internal headers.
-@@ -1906,3 +1906,10 @@ $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
- tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
-
- $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
-+
-+$(objpfx)tst-ro-dynamic: $(objpfx)tst-ro-dynamic-mod.so
-+$(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
-+ tst-ro-dynamic-mod.map
-+ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-+ -Wl,--script=tst-ro-dynamic-mod.map \
-+ $(objpfx)tst-ro-dynamic-mod.os
-diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 650e4edc35..4445c28ef3 100644
---- a/elf/dl-load.c
-+++ b/elf/dl-load.c
-@@ -1149,6 +1149,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- such a segment to avoid a crash later. */
- l->l_ld = (void *) ph->p_vaddr;
- l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn));
-+ l->l_ld_readonly = (ph->p_flags & PF_W) == 0;
- }
- break;
-
-@@ -1292,7 +1293,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- else
- l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
-
-- elf_get_dynamic_info (l, NULL);
-+ elf_get_dynamic_info (l);
-
- /* Make sure we are not dlopen'ing an object that has the
- DF_1_NOOPEN flag set, or a PIE object. */
-diff --git a/elf/dl-reloc-static-pie.c b/elf/dl-reloc-static-pie.c
-index d5bd2f31e9..2fb02d7276 100644
---- a/elf/dl-reloc-static-pie.c
-+++ b/elf/dl-reloc-static-pie.c
-@@ -40,7 +40,17 @@ _dl_relocate_static_pie (void)
-
- /* Read our own dynamic section and fill in the info array. */
- main_map->l_ld = ((void *) main_map->l_addr + elf_machine_dynamic ());
-- elf_get_dynamic_info (main_map, NULL);
-+
-+ const ElfW(Phdr) *ph, *phdr = GL(dl_phdr);
-+ size_t phnum = GL(dl_phnum);
-+ for (ph = phdr; ph < &phdr[phnum]; ++ph)
-+ if (ph->p_type == PT_DYNAMIC)
-+ {
-+ main_map->l_ld_readonly = (ph->p_flags & PF_W) == 0;
-+ break;
-+ }
-+
-+ elf_get_dynamic_info (main_map);
-
- # ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
- ELF_MACHINE_BEFORE_RTLD_RELOC (main_map->l_info);
-diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
-index d8ec32377d..4aa2058abf 100644
---- a/elf/get-dynamic-info.h
-+++ b/elf/get-dynamic-info.h
-@@ -28,7 +28,7 @@ static
- auto
- #endif
- inline void __attribute__ ((unused, always_inline))
--elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
-+elf_get_dynamic_info (struct link_map *l)
- {
- #if __ELF_NATIVE_CLASS == 32
- typedef Elf32_Word d_tag_utype;
-@@ -69,28 +69,15 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
- info[i] = dyn;
- }
-
--#define DL_RO_DYN_TEMP_CNT 8
--
--#ifndef DL_RO_DYN_SECTION
- /* Don't adjust .dynamic unnecessarily. */
-- if (l->l_addr != 0)
-+ if (l->l_addr != 0 && dl_relocate_ld (l))
- {
- ElfW(Addr) l_addr = l->l_addr;
-- int cnt = 0;
-
- # define ADJUST_DYN_INFO(tag) \
- do \
- if (info[tag] != NULL) \
-- { \
-- if (temp) \
-- { \
-- temp[cnt].d_tag = info[tag]->d_tag; \
-- temp[cnt].d_un.d_ptr = info[tag]->d_un.d_ptr + l_addr; \
-- info[tag] = temp + cnt++; \
-- } \
-- else \
-- info[tag]->d_un.d_ptr += l_addr; \
-- } \
-+ info[tag]->d_un.d_ptr += l_addr; \
- while (0)
-
- ADJUST_DYN_INFO (DT_HASH);
-@@ -107,9 +94,7 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
- ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
- ADJUST_DYN_INFO (ADDRIDX (DT_GNU_HASH));
- # undef ADJUST_DYN_INFO
-- assert (cnt <= DL_RO_DYN_TEMP_CNT);
- }
--#endif
- if (info[DT_PLTREL] != NULL)
- {
- #if ELF_MACHINE_NO_RELA
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 08cf50145a..405166d62b 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -464,6 +464,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
- #ifndef DONT_USE_BOOTSTRAP_MAP
- GL(dl_rtld_map).l_addr = info->l.l_addr;
- GL(dl_rtld_map).l_ld = info->l.l_ld;
-+ GL(dl_rtld_map).l_ld_readonly = info->l.l_ld_readonly;
- memcpy (GL(dl_rtld_map).l_info, info->l.l_info,
- sizeof GL(dl_rtld_map).l_info);
- GL(dl_rtld_map).l_mach = info->l.l_mach;
-@@ -547,7 +548,7 @@ _dl_start (void *arg)
-
- /* Read our own dynamic section and fill in the info array. */
- bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
-- elf_get_dynamic_info (&bootstrap_map, NULL);
-+ elf_get_dynamic_info (&bootstrap_map);
-
- #if NO_TLS_OFFSET != 0
- bootstrap_map.l_tls_offset = NO_TLS_OFFSET;
-@@ -1469,6 +1470,7 @@ dl_main (const ElfW(Phdr) *phdr,
- /* This tells us where to find the dynamic section,
- which tells us everything we need to do. */
- main_map->l_ld = (void *) main_map->l_addr + ph->p_vaddr;
-+ main_map->l_ld_readonly = (ph->p_flags & PF_W) == 0;
- break;
- case PT_INTERP:
- /* This "interpreter segment" was used by the program loader to
-@@ -1614,7 +1616,7 @@ dl_main (const ElfW(Phdr) *phdr,
- if (! rtld_is_main)
- {
- /* Extract the contents of the dynamic section for easy access. */
-- elf_get_dynamic_info (main_map, NULL);
-+ elf_get_dynamic_info (main_map);
-
- /* If the main map is libc.so, update the base namespace to
- refer to this map. If libc.so is loaded later, this happens
-diff --git a/elf/setup-vdso.h b/elf/setup-vdso.h
-index 86c491e49c..f44748bc98 100644
---- a/elf/setup-vdso.h
-+++ b/elf/setup-vdso.h
-@@ -33,8 +33,6 @@ setup_vdso (struct link_map *main_map __attribute__ ((unused)),
- 0, LM_ID_BASE);
- if (__glibc_likely (l != NULL))
- {
-- static ElfW(Dyn) dyn_temp[DL_RO_DYN_TEMP_CNT] attribute_relro;
--
- l->l_phdr = ((const void *) GLRO(dl_sysinfo_dso)
- + GLRO(dl_sysinfo_dso)->e_phoff);
- l->l_phnum = GLRO(dl_sysinfo_dso)->e_phnum;
-@@ -45,6 +43,7 @@ setup_vdso (struct link_map *main_map __attribute__ ((unused)),
- {
- l->l_ld = (void *) ph->p_vaddr;
- l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn));
-+ l->l_ld_readonly = (ph->p_flags & PF_W) == 0;
- }
- else if (ph->p_type == PT_LOAD)
- {
-@@ -65,7 +64,7 @@ setup_vdso (struct link_map *main_map __attribute__ ((unused)),
- l->l_map_end += l->l_addr;
- l->l_text_end += l->l_addr;
- l->l_ld = (void *) ((ElfW(Addr)) l->l_ld + l->l_addr);
-- elf_get_dynamic_info (l, dyn_temp);
-+ elf_get_dynamic_info (l);
- _dl_setup_hash (l);
- l->l_relocated = 1;
-
-diff --git a/elf/tst-ro-dynamic-mod.c b/elf/tst-ro-dynamic-mod.c
-new file mode 100644
-index 0000000000..6d99925964
---- /dev/null
-+++ b/elf/tst-ro-dynamic-mod.c
-@@ -0,0 +1,19 @@
-+/* Test case for DSO with readonly dynamic section.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+int foo = -1;
-diff --git a/elf/tst-ro-dynamic-mod.map b/elf/tst-ro-dynamic-mod.map
-new file mode 100644
-index 0000000000..2fe4a2998c
---- /dev/null
-+++ b/elf/tst-ro-dynamic-mod.map
-@@ -0,0 +1,16 @@
-+SECTIONS
-+{
-+ . = SIZEOF_HEADERS;
-+ .dynamic : { *(.dynamic) } :text :dynamic
-+ .rodata : { *(.data*) *(.bss*) } :text
-+ /DISCARD/ : {
-+ *(.note.gnu.property)
-+ }
-+ .note : { *(.note.*) } :text :note
-+}
-+PHDRS
-+{
-+ text PT_LOAD FLAGS(5) FILEHDR PHDRS;
-+ dynamic PT_DYNAMIC FLAGS(4);
-+ note PT_NOTE FLAGS(4);
-+}
-diff --git a/elf/tst-ro-dynamic.c b/elf/tst-ro-dynamic.c
-new file mode 100644
-index 0000000000..3a18f8789a
---- /dev/null
-+++ b/elf/tst-ro-dynamic.c
-@@ -0,0 +1,31 @@
-+/* Test case for DSO with readonly dynamic section.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <support/check.h>
-+#include <support/test-driver.h>
-+
-+extern int foo;
-+
-+static int
-+do_test (void)
-+{
-+ TEST_COMPARE (foo, -1);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/include/link.h b/include/link.h
-index 4af16cb596..c46aced9f7 100644
---- a/include/link.h
-+++ b/include/link.h
-@@ -205,6 +205,7 @@ struct link_map
- unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
- freed, ie. not allocated with
- the dummy malloc in ld.so. */
-+ unsigned int l_ld_readonly:1; /* Nonzero if dynamic section is readonly. */
-
- /* NODELETE status of the map. Only valid for maps of type
- lt_loaded. Lazy binding sets l_nodelete_active directly,
-@@ -342,6 +343,8 @@ struct link_map
- unsigned long long int l_serial;
- };
-
-+#include <dl-relocate-ld.h>
-+
- /* Information used by audit modules. For most link maps, this data
- immediate follows the link map in memory. For the dynamic linker,
- it is allocated separately. See link_map_audit_state in
-diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h
-new file mode 100644
-index 0000000000..5fae206db9
---- /dev/null
-+++ b/sysdeps/generic/dl-relocate-ld.h
-@@ -0,0 +1,32 @@
-+/* Check if dynamic section should be relocated. Generic version.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#ifndef _DL_RELOCATE_LD_H
-+#define _DL_RELOCATE_LD_H
-+
-+/* Return true if dynamic section in the shared library L should be
-+ relocated. */
-+
-+static inline bool
-+dl_relocate_ld (const struct link_map *l)
-+{
-+ /* Don't relocate dynamic section if it is readonly */
-+ return !l->l_ld_readonly;
-+}
-+
-+#endif /* _DL_RELOCATE_LD_H */
-diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
-index 1ceb9c3212..ed10953f34 100644
---- a/sysdeps/generic/ldsodefs.h
-+++ b/sysdeps/generic/ldsodefs.h
-@@ -75,11 +75,8 @@ __BEGIN_DECLS
- have to be accessed via the D_PTR macro. The macro is needed since for
- most architectures the entry is already relocated - but for some not
- and we need to relocate at access time. */
--#ifdef DL_RO_DYN_SECTION
--# define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr)
--#else
--# define D_PTR(map, i) (map)->i->d_un.d_ptr
--#endif
-+#define D_PTR(map, i) \
-+ ((map)->i->d_un.d_ptr + (dl_relocate_ld (map) ? 0 : (map)->l_addr))
-
- /* Result of the lookup functions and how to retrieve the base address. */
- typedef struct link_map *lookup_t;
-diff --git a/sysdeps/mips/dl-relocate-ld.h b/sysdeps/mips/dl-relocate-ld.h
-new file mode 100644
-index 0000000000..0c18d9a567
---- /dev/null
-+++ b/sysdeps/mips/dl-relocate-ld.h
-@@ -0,0 +1,32 @@
-+/* Check if dynamic section should be relocated. MIPS version.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#ifndef _DL_RELOCATE_LD_H
-+#define _DL_RELOCATE_LD_H
-+
-+/* Return true if dynamic section in the shared library L should be
-+ relocated. */
-+
-+static inline bool
-+dl_relocate_ld (const struct link_map *l)
-+{
-+ /* Never relocate dynamic section. */
-+ return false;
-+}
-+
-+#endif /* _DL_RELOCATE_LD_H */
-diff --git a/sysdeps/mips/ldsodefs.h b/sysdeps/mips/ldsodefs.h
-index 4db7c60e38..36fd09a8bd 100644
---- a/sysdeps/mips/ldsodefs.h
-+++ b/sysdeps/mips/ldsodefs.h
-@@ -75,10 +75,6 @@ struct La_mips_64_retval;
- struct La_mips_64_retval *, \
- const char *);
-
--/* The MIPS ABI specifies that the dynamic section has to be read-only. */
--
--#define DL_RO_DYN_SECTION 1
--
- #include_next <ldsodefs.h>
-
- /* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
-diff --git a/sysdeps/riscv/dl-relocate-ld.h b/sysdeps/riscv/dl-relocate-ld.h
-new file mode 100644
-index 0000000000..10327454b1
---- /dev/null
-+++ b/sysdeps/riscv/dl-relocate-ld.h
-@@ -0,0 +1,32 @@
-+/* Check if dynamic section should be relocated. RISC-V version.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#ifndef _DL_RELOCATE_LD_H
-+#define _DL_RELOCATE_LD_H
-+
-+/* Return true if dynamic section in the shared library L should be
-+ relocated. */
-+
-+static inline bool
-+dl_relocate_ld (const struct link_map *l)
-+{
-+ /* Never relocate dynamic section for ABI compatibility. */
-+ return false;
-+}
-+
-+#endif /* _DL_RELOCATE_LD_H */
-diff --git a/sysdeps/riscv/ldsodefs.h b/sysdeps/riscv/ldsodefs.h
-index 0c696714a7..8947ffe4b5 100644
---- a/sysdeps/riscv/ldsodefs.h
-+++ b/sysdeps/riscv/ldsodefs.h
-@@ -38,11 +38,6 @@ struct La_riscv_retval;
- struct La_riscv_retval *, \
- const char *);
-
--/* Although the RISC-V ABI does not specify that the dynamic section has
-- to be read-only, it needs to be kept for ABI compatibility. */
--
--#define DL_RO_DYN_SECTION 1
--
- #include_next <ldsodefs.h>
-
- #endif
---
-2.34.1
-
diff --git a/0042-ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch b/0042-ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch
deleted file mode 100644
index 4036856..0000000
--- a/0042-ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 5f36e5c70107ecb59281ef57f9f1c0e37ec3076d Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Thu, 23 Sep 2021 09:06:49 -0700
-Subject: [PATCH 42/66] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ
- #28340]
-
-1. Define DL_RO_DYN_SECTION to initalize bootstrap_map.l_ld_readonly
-before calling elf_get_dynamic_info to get dynamic info in bootstrap_map,
-2. Define a single
-
-static inline bool
-dl_relocate_ld (const struct link_map *l)
-{
- /* Don't relocate dynamic section if it is readonly */
- return !(l->l_ld_readonly || DL_RO_DYN_SECTION);
-}
-
-This updates BZ #28340 fix.
-
-(cherry picked from commit 2ec99d8c42b2ff1a1231e4df462a0910a9b7fdef)
----
- elf/rtld.c | 1 +
- sysdeps/generic/dl-relocate-ld.h | 11 ++---------
- sysdeps/generic/ldsodefs.h | 10 ++++++++++
- sysdeps/mips/dl-relocate-ld.h | 11 ++---------
- sysdeps/riscv/dl-relocate-ld.h | 11 ++---------
- 5 files changed, 17 insertions(+), 27 deletions(-)
-
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 405166d62b..d83ac1bdc4 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -548,6 +548,7 @@ _dl_start (void *arg)
-
- /* Read our own dynamic section and fill in the info array. */
- bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
-+ bootstrap_map.l_ld_readonly = DL_RO_DYN_SECTION;
- elf_get_dynamic_info (&bootstrap_map);
-
- #if NO_TLS_OFFSET != 0
-diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h
-index 5fae206db9..cfb86c2d6a 100644
---- a/sysdeps/generic/dl-relocate-ld.h
-+++ b/sysdeps/generic/dl-relocate-ld.h
-@@ -19,14 +19,7 @@
- #ifndef _DL_RELOCATE_LD_H
- #define _DL_RELOCATE_LD_H
-
--/* Return true if dynamic section in the shared library L should be
-- relocated. */
--
--static inline bool
--dl_relocate_ld (const struct link_map *l)
--{
-- /* Don't relocate dynamic section if it is readonly */
-- return !l->l_ld_readonly;
--}
-+/* The dynamic section is writable. */
-+#define DL_RO_DYN_SECTION 0
-
- #endif /* _DL_RELOCATE_LD_H */
-diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
-index ed10953f34..fcbbf69748 100644
---- a/sysdeps/generic/ldsodefs.h
-+++ b/sysdeps/generic/ldsodefs.h
-@@ -69,6 +69,16 @@ __BEGIN_DECLS
- `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
- #define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type)
-
-+/* Return true if dynamic section in the shared library L should be
-+ relocated. */
-+
-+static inline bool
-+dl_relocate_ld (const struct link_map *l)
-+{
-+ /* Don't relocate dynamic section if it is readonly */
-+ return !(l->l_ld_readonly || DL_RO_DYN_SECTION);
-+}
-+
- /* All references to the value of l_info[DT_PLTGOT],
- l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA],
- l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)]
-diff --git a/sysdeps/mips/dl-relocate-ld.h b/sysdeps/mips/dl-relocate-ld.h
-index 0c18d9a567..376ad75dd1 100644
---- a/sysdeps/mips/dl-relocate-ld.h
-+++ b/sysdeps/mips/dl-relocate-ld.h
-@@ -19,14 +19,7 @@
- #ifndef _DL_RELOCATE_LD_H
- #define _DL_RELOCATE_LD_H
-
--/* Return true if dynamic section in the shared library L should be
-- relocated. */
--
--static inline bool
--dl_relocate_ld (const struct link_map *l)
--{
-- /* Never relocate dynamic section. */
-- return false;
--}
-+/* The dynamic section is readonly. */
-+#define DL_RO_DYN_SECTION 1
-
- #endif /* _DL_RELOCATE_LD_H */
-diff --git a/sysdeps/riscv/dl-relocate-ld.h b/sysdeps/riscv/dl-relocate-ld.h
-index 10327454b1..2ab2b8ac6c 100644
---- a/sysdeps/riscv/dl-relocate-ld.h
-+++ b/sysdeps/riscv/dl-relocate-ld.h
-@@ -19,14 +19,7 @@
- #ifndef _DL_RELOCATE_LD_H
- #define _DL_RELOCATE_LD_H
-
--/* Return true if dynamic section in the shared library L should be
-- relocated. */
--
--static inline bool
--dl_relocate_ld (const struct link_map *l)
--{
-- /* Never relocate dynamic section for ABI compatibility. */
-- return false;
--}
-+/* The dynamic section is readonly for ABI compatibility. */
-+#define DL_RO_DYN_SECTION 1
-
- #endif /* _DL_RELOCATE_LD_H */
---
-2.34.1
-
diff --git a/0043-Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch b/0043-Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch
deleted file mode 100644
index 64c9e3b..0000000
--- a/0043-Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 6548a9bdba95b3e1fcdbd85445342467e4b0cd4f Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Fri, 24 Sep 2021 08:56:42 -0700
-Subject: [PATCH 43/66] Avoid warning: overriding recipe for
- .../tst-ro-dynamic-mod.so
-
-Add tst-ro-dynamic-mod to modules-names-nobuild to avoid
-
-../Makerules:767: warning: ignoring old recipe for target '.../elf/tst-ro-dynamic-mod.so'
-
-This updates BZ #28340 fix.
-
-(cherry picked from commit 15e6d6785ac2935bb963506b47a37b3d1f728952)
----
- elf/Makefile | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/elf/Makefile b/elf/Makefile
-index de854b4d1a..118d579c42 100644
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -399,8 +399,9 @@ endif
- modules-execstack-yes = tst-execstack-mod
- extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
-
--# filtmod1.so, tst-big-note-lib.so have special rules.
--modules-names-nobuild := filtmod1 tst-big-note-lib
-+# filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
-+# rules.
-+modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod
-
- tests += $(tests-static)
-
---
-2.34.1
-
diff --git a/0044-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch b/0044-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch
deleted file mode 100644
index a3f1aa0..0000000
--- a/0044-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-From f411207a833d0c49578ebe7062aee3660813ed5f Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npv1310@gmail.com>
-Date: Tue, 2 Nov 2021 13:21:42 +0500
-Subject: [PATCH 44/66] gconv: Do not emit spurious NUL character in
- ISO-2022-JP-3 (bug 28524)
-
-Bugfix 27256 has introduced another issue:
-In conversion from ISO-2022-JP-3 encoding, it is possible
-to force iconv to emit extra NUL character on internal state reset.
-To do this, it is sufficient to feed iconv with escape sequence
-which switches active character set.
-The simplified check 'data->__statep->__count != ASCII_set'
-introduced by the aforementioned bugfix picks that case and
-behaves as if '\0' character has been queued thus emitting it.
-
-To eliminate this issue, these steps are taken:
-* Restore original condition
-'(data->__statep->__count & ~7) != ASCII_set'.
-It is necessary since bits 0-2 may contain
-number of buffered input characters.
-* Check that queued character is not NUL.
-Similar step is taken for main conversion loop.
-
-Bundled test case follows following logic:
-* Try to convert ISO-2022-JP-3 escape sequence
-switching active character set
-* Reset internal state by providing NULL as input buffer
-* Ensure that nothing has been converted.
-
-Signed-off-by: Nikita Popov <npv1310@gmail.com>
-(cherry picked from commit ff012870b2c02a62598c04daa1e54632e020fd7d)
----
- NEWS | 3 +-
- iconvdata/Makefile | 5 +++-
- iconvdata/bug-iconv15.c | 60 +++++++++++++++++++++++++++++++++++++++
- iconvdata/iso-2022-jp-3.c | 28 ++++++++++++------
- 4 files changed, 86 insertions(+), 10 deletions(-)
- create mode 100644 iconvdata/bug-iconv15.c
-
-diff --git a/NEWS b/NEWS
-index cc5641e4da..b7a75cc2d4 100644
---- a/NEWS
-+++ b/NEWS
-@@ -14,10 +14,11 @@ The following bugs are resolved with this release:
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
- [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
-+ [28340] ld.so crashes while loading a DSO with a read-only dynamic section
- [28357] deadlock between pthread_create and ELF constructors
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
-- [28340] ld.so crashes while loading a DSO with a read-only dynamic section
-+ [28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NULs
-
-
- Version 2.34
-diff --git a/iconvdata/Makefile b/iconvdata/Makefile
-index c216f959df..d5507a048c 100644
---- a/iconvdata/Makefile
-+++ b/iconvdata/Makefile
-@@ -1,4 +1,5 @@
- # Copyright (C) 1997-2021 Free Software Foundation, Inc.
-+# Copyright (C) The GNU Toolchain Authors.
- # This file is part of the GNU C Library.
-
- # The GNU C Library is free software; you can redistribute it and/or
-@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared))
- tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
- tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
- bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
-- bug-iconv13 bug-iconv14
-+ bug-iconv13 bug-iconv14 bug-iconv15
- ifeq ($(have-thread-library),yes)
- tests += bug-iconv3
- endif
-@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $(objpfx), $(gconv-modules)) \
- $(addprefix $(objpfx),$(modules.so))
- $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \
- $(addprefix $(objpfx),$(modules.so))
-+$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \
-+ $(addprefix $(objpfx),$(modules.so))
-
- $(objpfx)iconv-test.out: run-iconv-test.sh \
- $(addprefix $(objpfx), $(gconv-modules)) \
-diff --git a/iconvdata/bug-iconv15.c b/iconvdata/bug-iconv15.c
-new file mode 100644
-index 0000000000..cc04bd0313
---- /dev/null
-+++ b/iconvdata/bug-iconv15.c
-@@ -0,0 +1,60 @@
-+/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv
-+ may emit spurious NUL character on state reset.
-+ Copyright (C) The GNU Toolchain Authors.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <stddef.h>
-+#include <iconv.h>
-+#include <support/check.h>
-+
-+static int
-+do_test (void)
-+{
-+ char in[] = "\x1b(I";
-+ char *inbuf = in;
-+ size_t inleft = sizeof (in) - 1;
-+ char out[1];
-+ char *outbuf = out;
-+ size_t outleft = sizeof (out);
-+ iconv_t cd;
-+
-+ cd = iconv_open ("UTF8", "ISO-2022-JP-3");
-+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
-+
-+ /* First call to iconv should alter internal state.
-+ Now, JISX0201_Kana_set is selected and
-+ state value != ASCII_set. */
-+ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1);
-+
-+ /* No bytes should have been added to
-+ the output buffer at this point. */
-+ TEST_VERIFY (outbuf == out);
-+ TEST_VERIFY (outleft == sizeof (out));
-+
-+ /* Second call shall emit spurious NUL character in unpatched glibc. */
-+ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1);
-+
-+ /* No characters are expected to be produced. */
-+ TEST_VERIFY (outbuf == out);
-+ TEST_VERIFY (outleft == sizeof (out));
-+
-+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
-index c8ba88cdc9..5fc0c0f739 100644
---- a/iconvdata/iso-2022-jp-3.c
-+++ b/iconvdata/iso-2022-jp-3.c
-@@ -1,5 +1,6 @@
- /* Conversion module for ISO-2022-JP-3.
- Copyright (C) 1998-2021 Free Software Foundation, Inc.
-+ Copyright (C) The GNU Toolchain Authors.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998,
- and Bruno Haible <bruno@clisp.org>, 2002.
-@@ -81,20 +82,31 @@ enum
- the output state to the initial state. This has to be done during the
- flushing. */
- #define EMIT_SHIFT_TO_INIT \
-- if (data->__statep->__count != ASCII_set) \
-+ if ((data->__statep->__count & ~7) != ASCII_set) \
- { \
- if (FROM_DIRECTION) \
- { \
-- if (__glibc_likely (outbuf + 4 <= outend)) \
-+ uint32_t ch = data->__statep->__count >> 6; \
-+ \
-+ if (__glibc_unlikely (ch != 0)) \
- { \
-- /* Write out the last character. */ \
-- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \
-- outbuf += sizeof (uint32_t); \
-- data->__statep->__count = ASCII_set; \
-+ if (__glibc_likely (outbuf + 4 <= outend)) \
-+ { \
-+ /* Write out the last character. */ \
-+ put32u (outbuf, ch); \
-+ outbuf += 4; \
-+ data->__statep->__count &= 7; \
-+ data->__statep->__count |= ASCII_set; \
-+ } \
-+ else \
-+ /* We don't have enough room in the output buffer. */ \
-+ status = __GCONV_FULL_OUTPUT; \
- } \
- else \
-- /* We don't have enough room in the output buffer. */ \
-- status = __GCONV_FULL_OUTPUT; \
-+ { \
-+ data->__statep->__count &= 7; \
-+ data->__statep->__count |= ASCII_set; \
-+ } \
- } \
- else \
- { \
---
-2.34.1
-
diff --git a/0045-elf-Earlier-missing-dynamic-segment-check-in-_dl_map.patch b/0045-elf-Earlier-missing-dynamic-segment-check-in-_dl_map.patch
deleted file mode 100644
index 457a141..0000000
--- a/0045-elf-Earlier-missing-dynamic-segment-check-in-_dl_map.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From cf8c6a634c0a04a9f5d198ef05310f85f7338839 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 5 Nov 2021 17:01:24 +0100
-Subject: [PATCH 45/66] elf: Earlier missing dynamic segment check in
- _dl_map_object_from_fd
-
-Separated debuginfo files have PT_DYNAMIC with p_filesz == 0. We
-need to check for that before the _dl_map_segments call because
-that could attempt to write to mappings that extend beyond the end
-of the file, resulting in SIGBUS.
-
-Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-(cherry picked from commit ea32ec354c65ddad11b82ca9d057010df13a9cea)
----
- elf/dl-load.c | 22 ++++++++++++----------
- 1 file changed, 12 insertions(+), 10 deletions(-)
-
-diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 4445c28ef3..0976977fbd 100644
---- a/elf/dl-load.c
-+++ b/elf/dl-load.c
-@@ -1130,6 +1130,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- struct loadcmd loadcmds[l->l_phnum];
- size_t nloadcmds = 0;
- bool has_holes = false;
-+ bool empty_dynamic = false;
-
- /* The struct is initialized to zero so this is not necessary:
- l->l_ld = 0;
-@@ -1142,7 +1143,9 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- segments are mapped in. We record the addresses it says
- verbatim, and later correct for the run-time load address. */
- case PT_DYNAMIC:
-- if (ph->p_filesz)
-+ if (ph->p_filesz == 0)
-+ empty_dynamic = true; /* Usually separate debuginfo. */
-+ else
- {
- /* Debuginfo only files from "objcopy --only-keep-debug"
- contain a PT_DYNAMIC segment with p_filesz == 0. Skip
-@@ -1265,6 +1268,13 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- goto lose;
- }
-
-+ /* This check recognizes most separate debuginfo files. */
-+ if (__glibc_unlikely ((l->l_ld == 0 && type == ET_DYN) || empty_dynamic))
-+ {
-+ errstring = N_("object file has no dynamic section");
-+ goto lose;
-+ }
-+
- /* Length of the sections to be loaded. */
- maplength = loadcmds[nloadcmds - 1].allocend - loadcmds[0].mapstart;
-
-@@ -1282,15 +1292,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
- }
- }
-
-- if (l->l_ld == 0)
-- {
-- if (__glibc_unlikely (type == ET_DYN))
-- {
-- errstring = N_("object file has no dynamic section");
-- goto lose;
-- }
-- }
-- else
-+ if (l->l_ld != 0)
- l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
-
- elf_get_dynamic_info (l);
---
-2.34.1
-
diff --git a/0046-s390-Use-long-branches-across-object-boundaries-jgh-.patch b/0046-s390-Use-long-branches-across-object-boundaries-jgh-.patch
deleted file mode 100644
index a227696..0000000
--- a/0046-s390-Use-long-branches-across-object-boundaries-jgh-.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From a4f3bc23461e3f9f6053e827715984ba0d2e589a Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Wed, 10 Nov 2021 15:21:37 +0100
-Subject: [PATCH 46/66] s390: Use long branches across object boundaries (jgh
- instead of jh)
-
-Depending on the layout chosen by the linker, the 16-bit displacement
-of the jh instruction is insufficient to reach the target label.
-
-Analysis of the linker failure was carried out by Nick Clifton.
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
-(cherry picked from commit 98966749f2b418825ff2ea496a0ee89fe63d2cc8)
----
- sysdeps/s390/memmem-arch13.S | 2 +-
- sysdeps/s390/strstr-arch13.S | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/s390/memmem-arch13.S b/sysdeps/s390/memmem-arch13.S
-index c5c8d8c97e..58df8cdb14 100644
---- a/sysdeps/s390/memmem-arch13.S
-+++ b/sysdeps/s390/memmem-arch13.S
-@@ -41,7 +41,7 @@ ENTRY(MEMMEM_ARCH13)
- # error The arch13 variant of memmem needs the z13 variant of memmem!
- # endif
- clgfi %r5,9
-- jh MEMMEM_Z13
-+ jgh MEMMEM_Z13
-
- aghik %r0,%r5,-1 /* vll needs highest index. */
- bc 4,0(%r14) /* cc==1: return if needle-len == 0. */
-diff --git a/sysdeps/s390/strstr-arch13.S b/sysdeps/s390/strstr-arch13.S
-index c7183e627c..222a6de91a 100644
---- a/sysdeps/s390/strstr-arch13.S
-+++ b/sysdeps/s390/strstr-arch13.S
-@@ -49,7 +49,7 @@ ENTRY(STRSTR_ARCH13)
- # error The arch13 variant of strstr needs the z13 variant of strstr!
- # endif
- clgfi %r4,9
-- jh STRSTR_Z13
-+ jgh STRSTR_Z13
-
- /* In case of a partial match, the vstrs instruction returns the index
- of the partial match in a vector-register. Then we have to
---
-2.34.1
-
diff --git a/0047-nptl-Do-not-set-signal-mask-on-second-setjmp-return-.patch b/0047-nptl-Do-not-set-signal-mask-on-second-setjmp-return-.patch
deleted file mode 100644
index caedaf7..0000000
--- a/0047-nptl-Do-not-set-signal-mask-on-second-setjmp-return-.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From bfe68fe3c475fe34bed4e017d6e63196c305c934 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Wed, 24 Nov 2021 08:59:54 +0100
-Subject: [PATCH 47/66] nptl: Do not set signal mask on second setjmp return
- [BZ #28607]
-
-__libc_signal_restore_set was in the wrong place: It also ran
-when setjmp returned the second time (after pthread_exit or
-pthread_cancel). This is observable with blocked pending
-signals during thread exit.
-
-Fixes commit b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8
-("nptl: Start new threads with all signals blocked [BZ #25098]").
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit e186fc5a31e46f2cbf5ea1a75223b4412907f3d8)
----
- NEWS | 1 +
- nptl/pthread_create.c | 4 +-
- sysdeps/pthread/Makefile | 1 +
- sysdeps/pthread/tst-pthread-exit-signal.c | 45 +++++++++++++++++++++++
- 4 files changed, 49 insertions(+), 2 deletions(-)
- create mode 100644 sysdeps/pthread/tst-pthread-exit-signal.c
-
-diff --git a/NEWS b/NEWS
-index b7a75cc2d4..b352a92704 100644
---- a/NEWS
-+++ b/NEWS
-@@ -19,6 +19,7 @@ The following bugs are resolved with this release:
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
- [28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NULs
-+ [28607] Masked signals are delivered on thread exit
-
-
- Version 2.34
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index bc213f0bc4..3db0c9fdf4 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -407,8 +407,6 @@ start_thread (void *arg)
- unwind_buf.priv.data.prev = NULL;
- unwind_buf.priv.data.cleanup = NULL;
-
-- __libc_signal_restore_set (&pd->sigmask);
--
- /* Allow setxid from now onwards. */
- if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
- futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
-@@ -418,6 +416,8 @@ start_thread (void *arg)
- /* Store the new cleanup handler info. */
- THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
-
-+ __libc_signal_restore_set (&pd->sigmask);
-+
- LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg);
-
- /* Run the code the user provided. */
-diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
-index df8943f486..c657101696 100644
---- a/sysdeps/pthread/Makefile
-+++ b/sysdeps/pthread/Makefile
-@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
- tst-unload \
- tst-unwind-thread \
- tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
-+ tst-pthread-exit-signal \
- tst-pthread-setuid-loop \
- tst-pthread_cancel-exited \
- tst-pthread_cancel-select-loop \
-diff --git a/sysdeps/pthread/tst-pthread-exit-signal.c b/sysdeps/pthread/tst-pthread-exit-signal.c
-new file mode 100644
-index 0000000000..b4526fe663
---- /dev/null
-+++ b/sysdeps/pthread/tst-pthread-exit-signal.c
-@@ -0,0 +1,45 @@
-+/* Test that pending signals are not delivered on thread exit (bug 28607).
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* Due to bug 28607, pthread_kill (or pthread_cancel) restored the
-+ signal mask during during thread exit, triggering the delivery of a
-+ blocked pending signal (SIGUSR1 in this test). */
-+
-+#include <support/xthread.h>
-+#include <support/xsignal.h>
-+
-+static void *
-+threadfunc (void *closure)
-+{
-+ sigset_t sigmask;
-+ sigfillset (&sigmask);
-+ xpthread_sigmask (SIG_SETMASK, &sigmask, NULL);
-+ xpthread_kill (pthread_self (), SIGUSR1);
-+ pthread_exit (NULL);
-+ return NULL;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ pthread_t thr = xpthread_create (NULL, threadfunc, NULL);
-+ xpthread_join (thr);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.34.1
-
diff --git a/0048-linux-Use-proc-stat-fallback-for-__get_nprocs_conf-B.patch b/0048-linux-Use-proc-stat-fallback-for-__get_nprocs_conf-B.patch
deleted file mode 100644
index bf4acd1..0000000
--- a/0048-linux-Use-proc-stat-fallback-for-__get_nprocs_conf-B.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From f988b7f228851370d1faa1e8f28d02f4b4e6dc46 Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Thu, 25 Nov 2021 09:12:00 -0300
-Subject: [PATCH 48/66] linux: Use /proc/stat fallback for __get_nprocs_conf
- (BZ #28624)
-
-The /proc/statm fallback was removed by f13fb81ad3159 if sysfs is
-not available, reinstate it.
-
-Checked on x86_64-linux-gnu.
-(cherry-picked from commit 137ed5ac440a4d3cf4178ce97f349b349a9c2c66)
----
- sysdeps/unix/sysv/linux/getsysstats.c | 60 ++++++++++++++++-----------
- 1 file changed, 35 insertions(+), 25 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
-index d70ed95869..7fc6521942 100644
---- a/sysdeps/unix/sysv/linux/getsysstats.c
-+++ b/sysdeps/unix/sysv/linux/getsysstats.c
-@@ -108,6 +108,37 @@ next_line (int fd, char *const buffer, char **cp, char **re,
- return res == *re ? NULL : res;
- }
-
-+static int
-+get_nproc_stat (char *buffer, size_t buffer_size)
-+{
-+ char *buffer_end = buffer + buffer_size;
-+ char *cp = buffer_end;
-+ char *re = buffer_end;
-+
-+ /* Default to an SMP system in case we cannot obtain an accurate
-+ number. */
-+ int result = 2;
-+
-+ const int flags = O_RDONLY | O_CLOEXEC;
-+ int fd = __open_nocancel ("/proc/stat", flags);
-+ if (fd != -1)
-+ {
-+ result = 0;
-+
-+ char *l;
-+ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
-+ /* The current format of /proc/stat has all the cpu* entries
-+ at the front. We assume here that stays this way. */
-+ if (strncmp (l, "cpu", 3) != 0)
-+ break;
-+ else if (isdigit (l[3]))
-+ ++result;
-+
-+ __close_nocancel_nostatus (fd);
-+ }
-+
-+ return result;
-+}
-
- int
- __get_nprocs (void)
-@@ -163,30 +194,7 @@ __get_nprocs (void)
- return result;
- }
-
-- cp = buffer_end;
-- re = buffer_end;
--
-- /* Default to an SMP system in case we cannot obtain an accurate
-- number. */
-- result = 2;
--
-- fd = __open_nocancel ("/proc/stat", flags);
-- if (fd != -1)
-- {
-- result = 0;
--
-- while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
-- /* The current format of /proc/stat has all the cpu* entries
-- at the front. We assume here that stays this way. */
-- if (strncmp (l, "cpu", 3) != 0)
-- break;
-- else if (isdigit (l[3]))
-- ++result;
--
-- __close_nocancel_nostatus (fd);
-- }
--
-- return result;
-+ return get_nproc_stat (buffer, buffer_size);
- }
- libc_hidden_def (__get_nprocs)
- weak_alias (__get_nprocs, get_nprocs)
-@@ -220,7 +228,9 @@ __get_nprocs_conf (void)
- return count;
- }
-
-- return 1;
-+ enum { buffer_size = 1024 };
-+ char buffer[buffer_size];
-+ return get_nproc_stat (buffer, buffer_size);
- }
- libc_hidden_def (__get_nprocs_conf)
- weak_alias (__get_nprocs_conf, get_nprocs_conf)
---
-2.34.1
-
diff --git a/0049-powerpc64-le-Fix-CFI-and-LR-save-address-for-asm-sys.patch b/0049-powerpc64-le-Fix-CFI-and-LR-save-address-for-asm-sys.patch
deleted file mode 100644
index d9b2b9b..0000000
--- a/0049-powerpc64-le-Fix-CFI-and-LR-save-address-for-asm-sys.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From 387bff63dc2dccd62b09aa26dccf8cdc5f3c985c Mon Sep 17 00:00:00 2001
-From: Matheus Castanho <msc@linux.ibm.com>
-Date: Tue, 26 Oct 2021 10:44:59 -0300
-Subject: [PATCH 49/66] powerpc64[le]: Fix CFI and LR save address for asm
- syscalls [BZ #28532]
-
-Syscalls based on the assembly templates are missing CFI for r31, which gets
-clobbered when scv is used, and info for LR is inaccurate, placed in the wrong
-LOC and not using the proper offset. LR was also being saved to the callee's
-frame, while the ABI mandates it to be saved to the caller's frame. These are
-fixed by this commit.
-
-After this change:
-
-$ readelf -wF libc.so.6 | grep 0004b9d4.. -A 7 && objdump --disassemble=kill libc.so.6
-00004a48 0000000000000020 00004a4c FDE cie=00000000 pc=000000000004b9d4..000000000004ba3c
- LOC CFA r31 ra
-000000000004b9d4 r1+0 u u
-000000000004b9e4 r1+48 u u
-000000000004b9e8 r1+48 c-16 u
-000000000004b9fc r1+48 c-16 c+16
-000000000004ba08 r1+48 c-16
-000000000004ba18 r1+48 u
-000000000004ba1c r1+0 u
-
-libc.so.6: file format elf64-powerpcle
-
-Disassembly of section .text:
-
-000000000004b9d4 <kill>:
- 4b9d4: 1f 00 4c 3c addis r2,r12,31
- 4b9d8: 2c c3 42 38 addi r2,r2,-15572
- 4b9dc: 25 00 00 38 li r0,37
- 4b9e0: d1 ff 21 f8 stdu r1,-48(r1)
- 4b9e4: 20 00 e1 fb std r31,32(r1)
- 4b9e8: 98 8f ed eb ld r31,-28776(r13)
- 4b9ec: 10 00 ff 77 andis. r31,r31,16
- 4b9f0: 1c 00 82 41 beq 4ba0c <kill+0x38>
- 4b9f4: a6 02 28 7d mflr r9
- 4b9f8: 40 00 21 f9 std r9,64(r1)
- 4b9fc: 01 00 00 44 scv 0
- 4ba00: 40 00 21 e9 ld r9,64(r1)
- 4ba04: a6 03 28 7d mtlr r9
- 4ba08: 08 00 00 48 b 4ba10 <kill+0x3c>
- 4ba0c: 02 00 00 44 sc
- 4ba10: 00 00 bf 2e cmpdi cr5,r31,0
- 4ba14: 20 00 e1 eb ld r31,32(r1)
- 4ba18: 30 00 21 38 addi r1,r1,48
- 4ba1c: 18 00 96 41 beq cr5,4ba34 <kill+0x60>
- 4ba20: 01 f0 20 39 li r9,-4095
- 4ba24: 40 48 23 7c cmpld r3,r9
- 4ba28: 20 00 e0 4d bltlr+
- 4ba2c: d0 00 63 7c neg r3,r3
- 4ba30: 08 00 00 48 b 4ba38 <kill+0x64>
- 4ba34: 20 00 e3 4c bnslr+
- 4ba38: c8 32 fe 4b b 2ed00 <__syscall_error>
- ...
- 4ba44: 40 20 0c 00 .long 0xc2040
- 4ba48: 68 00 00 00 .long 0x68
- 4ba4c: 06 00 5f 5f rlwnm r31,r26,r0,0,3
- 4ba50: 6b 69 6c 6c xoris r12,r3,26987
-
-(cherry picked from commit d120fb9941be1fb1934f0b50c6ad64e4c5e404fb)
----
- NEWS | 1 +
- sysdeps/powerpc/powerpc64/sysdep.h | 10 ++++++----
- 2 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index b352a92704..8c68273929 100644
---- a/NEWS
-+++ b/NEWS
-@@ -20,6 +20,7 @@ The following bugs are resolved with this release:
- [28407] pthread_kill assumes that kill and tgkill are equivalent
- [28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NULs
- [28607] Masked signals are delivered on thread exit
-+ [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
-
-
- Version 2.34
-diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
-index 589f7c8d18..cfcfa69f91 100644
---- a/sysdeps/powerpc/powerpc64/sysdep.h
-+++ b/sysdeps/powerpc/powerpc64/sysdep.h
-@@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \
- /* Allocate frame and save register */
- #define NVOLREG_SAVE \
- stdu r1,-SCV_FRAME_SIZE(r1); \
-+ cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \
- std r31,SCV_FRAME_NVOLREG_SAVE(r1); \
-- cfi_adjust_cfa_offset(SCV_FRAME_SIZE);
-+ cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE);
-
- /* Restore register and destroy frame */
- #define NVOLREG_RESTORE \
- ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \
-+ cfi_restore(r31); \
- addi r1,r1,SCV_FRAME_SIZE; \
- cfi_adjust_cfa_offset(-SCV_FRAME_SIZE);
-
-@@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \
-
- #define DO_CALL_SCV \
- mflr r9; \
-- std r9,FRAME_LR_SAVE(r1); \
-- cfi_offset(lr,FRAME_LR_SAVE); \
-+ std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \
-+ cfi_rel_offset(lr,SCV_FRAME_SIZE+FRAME_LR_SAVE); \
- .machine "push"; \
- .machine "power9"; \
- scv 0; \
- .machine "pop"; \
-- ld r9,FRAME_LR_SAVE(r1); \
-+ ld r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \
- mtlr r9; \
- cfi_restore(lr);
-
---
-2.34.1
-
diff --git a/0050-nptl-Add-one-more-barrier-to-nptl-tst-create1.patch b/0050-nptl-Add-one-more-barrier-to-nptl-tst-create1.patch
deleted file mode 100644
index 6efb235..0000000
--- a/0050-nptl-Add-one-more-barrier-to-nptl-tst-create1.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From e9f81c261a2ca74d31d07ff9c8e780ac8a25993c Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 10 Dec 2021 05:14:24 +0100
-Subject: [PATCH 50/66] nptl: Add one more barrier to nptl/tst-create1
-
-Without the bar_ctor_finish barrier, it was possible that thread2
-re-locked user_lock before ctor had a chance to lock it. ctor then
-blocked in its locking operation, xdlopen from the main thread
-did not return, and thread2 was stuck waiting in bar_dtor:
-
-thread 1: started.
-thread 2: started.
-thread 2: locked user_lock.
-constructor started: 0.
-thread 1: in ctor: started.
-thread 3: started.
-thread 3: done.
-thread 2: unlocked user_lock.
-thread 2: locked user_lock.
-
-Fixes the test in commit 83b5323261bb72313bffcf37476c1b8f0847c736
-("elf: Avoid deadlock between pthread_create and ctors [BZ #28357]").
-
-Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
-(cherry picked from commit 5cc338565479a620244c2f8ff35956629c4dbf81)
----
- NEWS | 1 +
- sysdeps/pthread/tst-create1.c | 4 ++++
- 2 files changed, 5 insertions(+)
-
-diff --git a/NEWS b/NEWS
-index 8c68273929..698964bb9e 100644
---- a/NEWS
-+++ b/NEWS
-@@ -21,6 +21,7 @@ The following bugs are resolved with this release:
- [28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NULs
- [28607] Masked signals are delivered on thread exit
- [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
-+ [28678] nptl/tst-create1 hangs sporadically
-
-
- Version 2.34
-diff --git a/sysdeps/pthread/tst-create1.c b/sysdeps/pthread/tst-create1.c
-index 932586c309..763ded8d79 100644
---- a/sysdeps/pthread/tst-create1.c
-+++ b/sysdeps/pthread/tst-create1.c
-@@ -33,6 +33,7 @@ thread 2: lock(user_lock) -> pthread_create
- */
-
- static pthread_barrier_t bar_ctor;
-+static pthread_barrier_t bar_ctor_finish;
- static pthread_barrier_t bar_dtor;
- static pthread_mutex_t user_lock = PTHREAD_MUTEX_INITIALIZER;
-
-@@ -46,6 +47,7 @@ ctor (void)
- xpthread_mutex_unlock (&user_lock);
- dprintf (1, "thread 1: in ctor: unlocked user_lock.\n");
- dprintf (1, "thread 1: in ctor: done.\n");
-+ xpthread_barrier_wait (&bar_ctor_finish);
- }
-
- void
-@@ -81,6 +83,7 @@ thread2 (void *a)
- xpthread_mutex_unlock (&user_lock);
- dprintf (1, "thread 2: unlocked user_lock.\n");
- xpthread_join (t3);
-+ xpthread_barrier_wait (&bar_ctor_finish);
-
- xpthread_mutex_lock (&user_lock);
- dprintf (1, "thread 2: locked user_lock.\n");
-@@ -99,6 +102,7 @@ thread1 (void)
- {
- dprintf (1, "thread 1: started.\n");
- xpthread_barrier_init (&bar_ctor, NULL, 2);
-+ xpthread_barrier_init (&bar_ctor_finish, NULL, 2);
- xpthread_barrier_init (&bar_dtor, NULL, 2);
- pthread_t t2 = xpthread_create (0, thread2, 0);
- void *p = xdlopen ("tst-create1mod.so", RTLD_NOW | RTLD_GLOBAL);
---
-2.34.1
-
diff --git a/0051-Run-conform-tests-using-newly-built-libc.patch b/0051-Run-conform-tests-using-newly-built-libc.patch
deleted file mode 100644
index 8402cda..0000000
--- a/0051-Run-conform-tests-using-newly-built-libc.patch
+++ /dev/null
@@ -1,198 +0,0 @@
-From 0dcbf4c8705309af8c8c1620491c60539901a3b0 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Fri, 17 Sep 2021 13:12:10 +0000
-Subject: [PATCH 51/66] Run conform/ tests using newly built libc
-
-Although the conform/ header tests are built using the headers of the
-glibc under test, the execution tests from conformtest (a few tests of
-the values of macros evaluating to string constants) are linked and
-run with system libc, not the newly built libc.
-
-Apart from preventing testing in cross environments, this can be a
-problem even for native testing. Specifically, it can be useful to do
-native testing when building with a cross compiler that links with a
-libc that is not the system libc; for example, on x86_64, you can test
-all three ABIs that way if the kernel support is present, even if the
-host OS lacks 32-bit or x32 libraries or they are older than the
-libraries in the sysroot used by the compiler used to build glibc.
-This works for almost all tests, but not for these conformtest tests.
-
-Arrange for conformtest to link and run test programs similarly to
-other tests, with consequent refactoring of various variables in
-Makeconfig to allow passing relevant parts of the link-time command
-lines down to conformtest. In general, the parts of the link command
-involving $@ or $^ are separated out from the parts that should be
-passed to conformtest (the variables passed to conformtest still
-involve various variables whose names involve $(@F), but those
-variables simply won't be defined for the conformtest makefile rules
-and I think their presence there is harmless).
-
-This is also most of the support that would be needed to allow running
-those tests of string constants for cross testing when test-wrapper is
-defined. That will also need changes to where conformtest.py puts the
-test executables, so it puts them in the main object directory
-(expected to be shared with a test system in cross testing) rather
-than /tmp (not expected to be shared) as at present.
-
-Tested for x86_64.
-
-(cherry picked from commit f3eef963902d0f54f68cffc74f79b97f4d6154b7)
----
- Makeconfig | 23 ++++++++++++++++-------
- conform/Makefile | 3 +++
- conform/conformtest.py | 20 +++++++++++++++++---
- 3 files changed, 36 insertions(+), 10 deletions(-)
-
-diff --git a/Makeconfig b/Makeconfig
-index 68663d984e..2fa0884b4e 100644
---- a/Makeconfig
-+++ b/Makeconfig
-@@ -412,12 +412,13 @@ link-extra-libs-tests = $(libsupport)
-
- # Command for linking PIE programs with the C library.
- ifndef +link-pie
--+link-pie-before-libc = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
-- -Wl,-O1 -nostdlib -nostartfiles -o $@ \
-++link-pie-before-inputs = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
-+ -Wl,-O1 -nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
-- $(+preinit) $(+prectorS) \
-+ $(+preinit) $(+prectorS)
-++link-pie-before-libc = -o $@ $(+link-pie-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- S$(start-installed-name))\
- $(+preinit) $(link-extra-libs) \
-@@ -442,11 +443,12 @@ endef
- endif
- # Command for statically linking programs with the C library.
- ifndef +link-static
--+link-static-before-libc = -nostdlib -nostartfiles -static -o $@ \
-++link-static-before-inputs = -nostdlib -nostartfiles -static \
- $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
-- $(+preinit) $(+prectorT) \
-+ $(+preinit) $(+prectorT)
-++link-static-before-libc = -o $@ $(+link-static-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- $(start-installed-name))\
- $(+preinit) $(link-extra-libs-static) \
-@@ -473,13 +475,16 @@ endif
- ifeq (yes,$(build-pie-default))
- +link = $(+link-pie)
- +link-tests = $(+link-pie-tests)
-++link-tests-before-inputs = $(+link-pie-before-inputs) $(rtld-tests-LDFLAGS)
-++link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
- +link-printers-tests = $(+link-pie-printers-tests)
- else # not build-pie-default
--+link-before-libc = -nostdlib -nostartfiles -o $@ \
-++link-before-inputs = -nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
- $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
- $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
-- $(+preinit) $(+prector) \
-+ $(+preinit) $(+prector)
-++link-before-libc = -o $@ $(+link-before-inputs) \
- $(filter-out $(addprefix $(csu-objpfx),start.o \
- $(start-installed-name))\
- $(+preinit) $(link-extra-libs) \
-@@ -491,6 +496,8 @@ $(CC) $(link-libc-rpath-link) $(+link-before-libc) $(rtld-LDFLAGS) \
- $(link-extra-flags) $(link-libc) $(+link-after-libc)
- $(call after-link,$@)
- endef
-++link-tests-before-inputs = $(+link-before-inputs) $(rtld-tests-LDFLAGS)
-++link-tests-after-inputs = $(link-libc-tests) $(+link-after-libc)
- define +link-tests
- $(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
- $(+link-after-libc)
-@@ -505,6 +512,8 @@ endif # build-pie-default
- else # build-static
- +link = $(+link-static)
- +link-tests = $(+link-static-tests)
-++link-tests-before-inputs = $(+link-static-before-inputs)
-++link-tests-after-inputs = $(link-libc-static-tests) $(+link-static-after-libc)
- +link-printers-tests = $(+link-static-tests)
- endif # build-shared
- endif # +link
-diff --git a/conform/Makefile b/conform/Makefile
-index c64a83a905..296db818f0 100644
---- a/conform/Makefile
-+++ b/conform/Makefile
-@@ -176,6 +176,9 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \
- (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
- mkdir -p $(@D); \
- $(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \
-+ --ldflags='$(+link-tests-before-inputs)' \
-+ --libs='$(+link-tests-after-inputs)' \
-+ --run-program-prefix='$(run-program-prefix)' \
- --standard=$$std --header=$$hdr $(conformtest-xfail) \
- $(conformtest-cross) \
- > $@ 2>&1); \
-diff --git a/conform/conformtest.py b/conform/conformtest.py
-index f0405b7186..4898e16c9f 100644
---- a/conform/conformtest.py
-+++ b/conform/conformtest.py
-@@ -381,12 +381,16 @@ class MacroStrTest(object):
- class HeaderTests(object):
- """The set of tests run for a header."""
-
-- def __init__(self, header, standard, cc, flags, cross, xfail):
-+ def __init__(self, header, standard, cc, flags, ldflags, libs,
-+ run_program_prefix, cross, xfail):
- """Initialize a HeaderTests object."""
- self.header = header
- self.standard = standard
- self.cc = cc
- self.flags = flags
-+ self.ldflags = ldflags
-+ self.libs = libs
-+ self.run_program_prefix = run_program_prefix
- self.cross = cross
- self.xfail_str = xfail
- self.cflags_namespace = ('%s -fno-builtin %s -D_ISOMAC'
-@@ -590,7 +594,8 @@ class HeaderTests(object):
- exe_file = os.path.join(self.temp_dir, 'test')
- with open(c_file, 'w') as c_file_out:
- c_file_out.write('#include <%s>\n%s' % (self.header, text))
-- cmd = ('%s %s %s -o %s' % (self.cc, self.cflags, c_file, exe_file))
-+ cmd = ('%s %s %s %s %s -o %s' % (self.cc, self.cflags, self.ldflags,
-+ c_file, self.libs, exe_file))
- try:
- subprocess.check_call(cmd, shell=True)
- except subprocess.CalledProcessError:
-@@ -600,7 +605,9 @@ class HeaderTests(object):
- self.note_skip(name)
- return
- try:
-- subprocess.check_call(exe_file, shell=True)
-+ subprocess.check_call('%s %s' % (self.run_program_prefix,
-+ exe_file),
-+ shell=True)
- except subprocess.CalledProcessError:
- self.note_error(name, self.group_xfail)
- return
-@@ -719,12 +726,19 @@ def main():
- help='C compiler to use')
- parser.add_argument('--flags', metavar='CFLAGS',
- help='Compiler flags to use with CC')
-+ parser.add_argument('--ldflags', metavar='LDFLAGS',
-+ help='Compiler arguments for linking before inputs')
-+ parser.add_argument('--libs', metavar='LIBS',
-+ help='Compiler arguments for linking after inputs')
-+ parser.add_argument('--run-program-prefix', metavar='RUN-PROGRAM-PREFIX',
-+ help='Wrapper for running newly built program')
- parser.add_argument('--cross', action='store_true',
- help='Do not run compiled test programs')
- parser.add_argument('--xfail', metavar='COND',
- help='Name of condition for XFAILs')
- args = parser.parse_args()
- tests = HeaderTests(args.header, args.standard, args.cc, args.flags,
-+ args.ldflags, args.libs, args.run_program_prefix,
- args.cross, args.xfail)
- tests.run()
-
---
-2.34.1
-
diff --git a/0052-Use-pie-default-with-conformtest.patch b/0052-Use-pie-default-with-conformtest.patch
deleted file mode 100644
index 2e90aca..0000000
--- a/0052-Use-pie-default-with-conformtest.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 1fe4b8d6937139faa47410552d4e21b356810d67 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Fri, 17 Sep 2021 19:24:14 +0000
-Subject: [PATCH 52/66] Use $(pie-default) with conformtest
-
-My glibc bot showed that my conformtest changes fail the build of the
-conformtest execution tests for x86_64-linux-gnu-static-pie, because
-linking the newly built object with the newly built libc and the
-associated options normally used for linking requires it to be built
-as PIE. Add $(pie-default) to the compiler command used so that PIE
-options are used when required.
-
-There's a case for using the whole of $(CFLAGS-.o) (which includes
-$(pie-default)), but that raises questions of any impact from using
-optimization flags from CFLAGS in these tests. So for now just use
-$(pie-default) as the key part of $(CFLAGS-.o) that's definitely
-needed.
-
-Tested with build-many-glibcs.py for x86_64-linux-gnu-static-pie.
-
-(cherry picked from commit 885762aa31d75de8b9fea4c0e2e372b582d4c548)
----
- conform/Makefile | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/conform/Makefile b/conform/Makefile
-index 296db818f0..27ad98caf8 100644
---- a/conform/Makefile
-+++ b/conform/Makefile
-@@ -175,7 +175,8 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \
- conformtest.py $(conformtest-headers-data)
- (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
- mkdir -p $(@D); \
-- $(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \
-+ $(PYTHON) $< --cc='$(CC) $(pie-default)' \
-+ --flags='$(conformtest-cc-flags)' \
- --ldflags='$(+link-tests-before-inputs)' \
- --libs='$(+link-tests-after-inputs)' \
- --run-program-prefix='$(run-program-prefix)' \
---
-2.34.1
-
diff --git a/0053-pthread-tst-cancel28-Fix-barrier-re-init-race-condit.patch b/0053-pthread-tst-cancel28-Fix-barrier-re-init-race-condit.patch
deleted file mode 100644
index 37bd70b..0000000
--- a/0053-pthread-tst-cancel28-Fix-barrier-re-init-race-condit.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 06865865151579d1aa17d38110060a68b85c5d90 Mon Sep 17 00:00:00 2001
-From: Stafford Horne <shorne@gmail.com>
-Date: Sat, 25 Sep 2021 17:02:06 +0900
-Subject: [PATCH 53/66] pthread/tst-cancel28: Fix barrier re-init race
- condition
-
-When running this test on the OpenRISC port I am working on this test
-fails with a timeout. The test passes when being straced or debugged.
-Looking at the code there seems to be a race condition in that:
-
- 1 main thread: calls xpthread_cancel
- 2 sub thread : receives cancel signal
- 3 sub thread : cleanup routine waits on barrier
- 4 main thread: re-inits barrier
- 5 main thread: waits on barrier
-
-After getting to 5 the main thread and sub thread wait forever as the 2
-barriers are no longer the same.
-
-Removing the barrier re-init seems to fix this issue. Also, the barrier
-does not need to be reinitialized as that is done by default.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 9874ca536b1d0662b1cea46af3ce09a4d42aeb32)
----
- sysdeps/pthread/tst-cancel28.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c
-index 627cbc8160..9286c159b3 100644
---- a/sysdeps/pthread/tst-cancel28.c
-+++ b/sysdeps/pthread/tst-cancel28.c
-@@ -69,7 +69,6 @@ do_test (void)
-
- xpthread_cancel (timer_thread);
-
-- xpthread_barrier_init (&barrier, NULL, 2);
- xpthread_barrier_wait (&barrier);
-
- return 0;
---
-2.34.1
-
diff --git a/0054-mips-align-stack-in-clone-BZ-28223.patch b/0054-mips-align-stack-in-clone-BZ-28223.patch
deleted file mode 100644
index 8bcda66..0000000
--- a/0054-mips-align-stack-in-clone-BZ-28223.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 7af07fe795f43e53d31be1c6f9adba7e05f87b0b Mon Sep 17 00:00:00 2001
-From: Xi Ruoyao <xry111@mengyan1223.wang>
-Date: Thu, 12 Aug 2021 20:31:59 +0000
-Subject: [PATCH 54/66] mips: align stack in clone [BZ #28223]
-
-The MIPS O32 ABI requires 4 byte aligned stack, and the MIPS N64 and N32
-ABI require 8 byte aligned stack. Previously if the caller passed an
-unaligned stack to clone the the child misbehaved.
-
-Fixes bug 28223.
-
-(cherry picked from commit 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe)
----
- NEWS | 1 +
- sysdeps/unix/sysv/linux/mips/clone.S | 7 +++++++
- 2 files changed, 8 insertions(+)
-
-diff --git a/NEWS b/NEWS
-index 698964bb9e..693ac78229 100644
---- a/NEWS
-+++ b/NEWS
-@@ -13,6 +13,7 @@ The following bugs are resolved with this release:
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
-+ [28223] mips: clone does not align stack
- [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
- [28340] ld.so crashes while loading a DSO with a read-only dynamic section
- [28357] deadlock between pthread_create and ELF constructors
-diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
-index 71d9dba8bd..43a5ad3a40 100644
---- a/sysdeps/unix/sysv/linux/mips/clone.S
-+++ b/sysdeps/unix/sysv/linux/mips/clone.S
-@@ -55,6 +55,13 @@ NESTED(__clone,4*SZREG,sp)
- .set at
- #endif
-
-+ /* Align stack to 4/8 bytes per the ABI. */
-+#if _MIPS_SIM == _ABIO32
-+ li t0,-4
-+#else
-+ li t0,-8
-+#endif
-+ and a1,a1,t0
-
- /* Sanity check arguments. */
- li v0,EINVAL
---
-2.34.1
-
diff --git a/0055-mips-increase-stack-alignment-in-clone-to-match-the-.patch b/0055-mips-increase-stack-alignment-in-clone-to-match-the-.patch
deleted file mode 100644
index 05bc4b3..0000000
--- a/0055-mips-increase-stack-alignment-in-clone-to-match-the-.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 4db172a54d43f9b7fd17e66fc44a34efb3cab1e1 Mon Sep 17 00:00:00 2001
-From: Xi Ruoyao <xry111@mengyan1223.wang>
-Date: Fri, 13 Aug 2021 16:01:14 +0000
-Subject: [PATCH 55/66] mips: increase stack alignment in clone to match the
- ABI
-
-In "mips: align stack in clone [BZ #28223]"
-(commit 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe) I made a mistake: I
-misbelieved one "word" was 2-byte and "doubleword" should be 4-byte.
-But in MIPS ABI one "word" is defined 32-bit (4-byte), so "doubleword" is
-8-byte [1], and "quadword" is 16-byte [2].
-
-[1]: "System V Application Binary Interface: MIPS(R) RISC Processor
- Supplement, 3rd edition", page 3-31
-[2]: "MIPSpro(TM) 64-Bit Porting and Transition Guide", page 23
-
-(cherry picked from commit 0f62fe053273ff6c62ac95c59b7687c964737b00)
----
- sysdeps/unix/sysv/linux/mips/clone.S | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
-index 43a5ad3a40..fd71b5ca2e 100644
---- a/sysdeps/unix/sysv/linux/mips/clone.S
-+++ b/sysdeps/unix/sysv/linux/mips/clone.S
-@@ -55,11 +55,11 @@ NESTED(__clone,4*SZREG,sp)
- .set at
- #endif
-
-- /* Align stack to 4/8 bytes per the ABI. */
-+ /* Align stack to 8/16 bytes per the ABI. */
- #if _MIPS_SIM == _ABIO32
-- li t0,-4
--#else
- li t0,-8
-+#else
-+ li t0,-16
- #endif
- and a1,a1,t0
-
---
-2.34.1
-
diff --git a/0056-arm-Guard-ucontext-_rtld_global_ro-access-by-SHARED-.patch b/0056-arm-Guard-ucontext-_rtld_global_ro-access-by-SHARED-.patch
deleted file mode 100644
index 99ef0a5..0000000
--- a/0056-arm-Guard-ucontext-_rtld_global_ro-access-by-SHARED-.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 93aabf891e96e93f100081ee07989c23d7107d17 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 17 Dec 2021 11:48:41 +0100
-Subject: [PATCH 56/66] arm: Guard ucontext _rtld_global_ro access by SHARED,
- not PIC macro
-
-Due to PIE-by-default, PIC is now defined in more cases. libc.a
-does not have _rtld_global_ro, and statically linking setcontext
-fails. SHARED is the right condition to use, so that libc.a
-references _dl_hwcap instead of _rtld_global_ro.
-
-For static PIE support, the !SHARED case would still have to be made
-PIC. This patch does not achieve that.
-
-Fixes commit 23645707f12f2dd9d80b51effb2d9618a7b65565
-("Replace --enable-static-pie with --disable-default-pie").
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
-(cherry picked from commit ce1e5b11229f19820b86f8b19d651f16009552b0)
----
- sysdeps/unix/sysv/linux/arm/getcontext.S | 4 ++--
- sysdeps/unix/sysv/linux/arm/setcontext.S | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/arm/getcontext.S b/sysdeps/unix/sysv/linux/arm/getcontext.S
-index 3aa581c4da..11bfcbe5f5 100644
---- a/sysdeps/unix/sysv/linux/arm/getcontext.S
-+++ b/sysdeps/unix/sysv/linux/arm/getcontext.S
-@@ -50,7 +50,7 @@ ENTRY(__getcontext)
-
- /* Store FP regs. Much of the FP code is copied from arm/setjmp.S. */
-
--#ifdef PIC
-+#ifdef SHARED
- ldr r2, 1f
- ldr r1, .Lrtld_global_ro
- 0: add r2, pc, r2
-@@ -102,7 +102,7 @@ ENTRY(__getcontext)
-
- END(__getcontext)
-
--#ifdef PIC
-+#ifdef SHARED
- 1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
- .Lrtld_global_ro:
- .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
-diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S
-index 8be8beefea..4c7c6e5509 100644
---- a/sysdeps/unix/sysv/linux/arm/setcontext.S
-+++ b/sysdeps/unix/sysv/linux/arm/setcontext.S
-@@ -32,7 +32,7 @@ ENTRY(__setcontext)
- add r0, r0, #UCONTEXT_REGSPACE
-
- /* Restore the VFP registers. Copied from arm/__longjmp.S. */
--#ifdef PIC
-+#ifdef SHARED
- ldr r2, 1f
- ldr r1, .Lrtld_global_ro
- 0: add r2, pc, r2
-@@ -101,7 +101,7 @@ ENTRY(__startcontext)
- .fnend
- END(__startcontext)
-
--#ifdef PIC
-+#ifdef SHARED
- 1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
- .Lrtld_global_ro:
- .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
---
-2.34.1
-
diff --git a/0057-nss-Use-files-dns-as-the-default-for-the-hosts-datab.patch b/0057-nss-Use-files-dns-as-the-default-for-the-hosts-datab.patch
deleted file mode 100644
index 454cdb9..0000000
--- a/0057-nss-Use-files-dns-as-the-default-for-the-hosts-datab.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From dc9b69d5331dcdca4547c0490cb9fefbd89e40f6 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Fri, 17 Dec 2021 12:01:20 +0100
-Subject: [PATCH 57/66] nss: Use "files dns" as the default for the hosts
- database (bug 28700)
-
-This matches what is currently in nss/nsswitch.conf. The new ordering
-matches what most distributions use in their installed configuration
-files.
-
-It is common to add localhost to /etc/hosts because the name does not
-exist in the DNS, but is commonly used as a host name.
-
-With the built-in "dns [!UNAVAIL=return] files" default, dns is
-searched first and provides an answer for "localhost" (NXDOMAIN).
-We never look at the files database as a result, so the contents of
-/etc/hosts is ignored. This means that "getent hosts localhost"
-fail without a /etc/nsswitch.conf file, even though the host name
-is listed in /etc/hosts.
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit b99b0f93ee8762fe53ff65802deb6f00700b9924)
----
- NEWS | 1 +
- manual/nss.texi | 5 ++---
- nss/XXX-lookup.c | 2 +-
- nss/nss_database.c | 4 ++--
- 4 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 693ac78229..6864af471c 100644
---- a/NEWS
-+++ b/NEWS
-@@ -23,6 +23,7 @@ The following bugs are resolved with this release:
- [28607] Masked signals are delivered on thread exit
- [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
- [28678] nptl/tst-create1 hangs sporadically
-+ [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
-
-
- Version 2.34
-diff --git a/manual/nss.texi b/manual/nss.texi
-index 3aaa7786f8..524d22ad1e 100644
---- a/manual/nss.texi
-+++ b/manual/nss.texi
-@@ -324,9 +324,8 @@ missing.
-
- @cindex default value, and NSS
- For the @code{hosts} and @code{networks} databases the default value is
--@code{dns [!UNAVAIL=return] files}. I.e., the system is prepared for
--the DNS service not to be available but if it is available the answer it
--returns is definitive.
-+@code{files dns}. I.e., local configuration will override the contents
-+of the domain name system (DNS).
-
- The @code{passwd}, @code{group}, and @code{shadow} databases was
- traditionally handled in a special way. The appropriate files in the
-diff --git a/nss/XXX-lookup.c b/nss/XXX-lookup.c
-index f1c97f7c8e..dbc87868dd 100644
---- a/nss/XXX-lookup.c
-+++ b/nss/XXX-lookup.c
-@@ -29,7 +29,7 @@
- |* ALTERNATE_NAME - name of another service which is examined in *|
- |* case DATABASE_NAME is not found *|
- |* *|
--|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *|
-+|* DEFAULT_CONFIG - string for default conf (e.g. "files dns") *|
- |* *|
- \*******************************************************************/
-
-diff --git a/nss/nss_database.c b/nss/nss_database.c
-index ab121cb371..54561f0328 100644
---- a/nss/nss_database.c
-+++ b/nss/nss_database.c
-@@ -80,7 +80,7 @@ enum nss_database_default
- {
- nss_database_default_defconfig = 0, /* "nis [NOTFOUND=return] files". */
- nss_database_default_compat, /* "compat [NOTFOUND=return] files". */
-- nss_database_default_dns, /* "dns [!UNAVAIL=return] files". */
-+ nss_database_default_dns, /* "files dns". */
- nss_database_default_files, /* "files". */
- nss_database_default_nis, /* "nis". */
- nss_database_default_nis_nisplus, /* "nis nisplus". */
-@@ -133,7 +133,7 @@ nss_database_select_default (struct nss_database_default_cache *cache,
- #endif
-
- case nss_database_default_dns:
-- line = "dns [!UNAVAIL=return] files";
-+ line = "files dns";
- break;
-
- case nss_database_default_files:
---
-2.34.1
-
diff --git a/0058-elf-Fix-tst-cpu-features-cpuinfo-for-KVM-guests-on-s.patch b/0058-elf-Fix-tst-cpu-features-cpuinfo-for-KVM-guests-on-s.patch
deleted file mode 100644
index 52ecbd2..0000000
--- a/0058-elf-Fix-tst-cpu-features-cpuinfo-for-KVM-guests-on-s.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 03de6917bd11c0591867607ce74ef658f76eabb9 Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Wed, 15 Dec 2021 23:46:19 +0100
-Subject: [PATCH 58/66] elf: Fix tst-cpu-features-cpuinfo for KVM guests on
- some AMD systems [BZ #28704]
-
-On KVM guests running on some AMD systems, the IBRS feature is reported
-as a synthetic feature using the Intel feature, while the cpuinfo entry
-keeps the same. Handle that by first checking the presence of the Intel
-feature on AMD systems.
-
-Fixes bug 28704.
-
-(cherry picked from commit 94058f6cde8b887178885954740ac6c866d25eab)
----
- NEWS | 1 +
- sysdeps/x86/tst-cpu-features-cpuinfo.c | 9 ++++++++-
- 2 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/NEWS b/NEWS
-index 6864af471c..1214ec4727 100644
---- a/NEWS
-+++ b/NEWS
-@@ -24,6 +24,7 @@ The following bugs are resolved with this release:
- [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
- [28678] nptl/tst-create1 hangs sporadically
- [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
-+ [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
-
-
- Version 2.34
-diff --git a/sysdeps/x86/tst-cpu-features-cpuinfo.c b/sysdeps/x86/tst-cpu-features-cpuinfo.c
-index 2d4927f5e5..830aaca2ec 100644
---- a/sysdeps/x86/tst-cpu-features-cpuinfo.c
-+++ b/sysdeps/x86/tst-cpu-features-cpuinfo.c
-@@ -169,7 +169,14 @@ do_test (int argc, char **argv)
- else if (cpu_features->basic.kind == arch_kind_amd)
- {
- fails += CHECK_PROC (ibpb, AMD_IBPB);
-- fails += CHECK_PROC (ibrs, AMD_IBRS);
-+
-+ /* The IBRS feature on AMD processors is reported using the Intel feature
-+ * on KVM guests (synthetic bit). In both cases the cpuinfo entry is the
-+ * same. */
-+ if (HAS_CPU_FEATURE (IBRS_IBPB))
-+ fails += CHECK_PROC (ibrs, IBRS_IBPB);
-+ else
-+ fails += CHECK_PROC (ibrs, AMD_IBRS);
- fails += CHECK_PROC (stibp, AMD_STIBP);
- }
- fails += CHECK_PROC (ibt, IBT);
---
-2.34.1
-
diff --git a/0059-powerpc64-le-Allocate-extra-stack-frame-on-syscall.S.patch b/0059-powerpc64-le-Allocate-extra-stack-frame-on-syscall.S.patch
deleted file mode 100644
index 2dc8a1a..0000000
--- a/0059-powerpc64-le-Allocate-extra-stack-frame-on-syscall.S.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 5daf13b1e637eec0f7a2de05b177cb0d76479aa2 Mon Sep 17 00:00:00 2001
-From: Matheus Castanho <msc@linux.ibm.com>
-Date: Wed, 1 Dec 2021 11:14:40 -0300
-Subject: [PATCH 59/66] powerpc64[le]: Allocate extra stack frame on syscall.S
-
-The syscall function does not allocate the extra stack frame for scv like other
-assembly syscalls using DO_CALL_SCV. So after commit d120fb9941 changed the
-offset that is used to save LR, syscall ended up using an invalid offset,
-causing regressions on powerpc64. So make sure the extra stack frame is
-allocated in syscall.S as well to make it consistent with other uses of
-DO_CALL_SCV and avoid similar issues in the future.
-
-Tested on powerpc, powerpc64, and powerpc64le (with and without scv)
-
-Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
-
-(cherry picked from commit ae91d3df24a4a1b1f264d101a71a298bff310d14)
----
- sysdeps/unix/sysv/linux/powerpc/syscall.S | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
-index a29652feaf..a5497c8370 100644
---- a/sysdeps/unix/sysv/linux/powerpc/syscall.S
-+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S
-@@ -27,7 +27,11 @@ ENTRY (syscall)
- mr r8,r9
- #if defined(USE_PPC_SCV) && !IS_IN(rtld) && (defined(__PPC64__) || defined(__powerpc64__))
- CHECK_SCV_SUPPORT r9 0f
-+ stdu r1,-SCV_FRAME_SIZE(r1)
-+ cfi_adjust_cfa_offset(SCV_FRAME_SIZE)
- DO_CALL_SCV
-+ addi r1,r1,SCV_FRAME_SIZE
-+ cfi_adjust_cfa_offset(-SCV_FRAME_SIZE)
- RET_SCV
- b 1f
- #endif
---
-2.34.1
-
diff --git a/0060-riscv-align-stack-in-clone-BZ-28702.patch b/0060-riscv-align-stack-in-clone-BZ-28702.patch
deleted file mode 100644
index 736f76f..0000000
--- a/0060-riscv-align-stack-in-clone-BZ-28702.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 9de8011c328021f10588a8acb418daf5121d5f3d Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Tue, 14 Dec 2021 22:44:35 +0100
-Subject: [PATCH 60/66] riscv: align stack in clone [BZ #28702]
-
-The RISC-V ABI [1] mandates that "the stack pointer shall be aligned to
-a 128-bit boundary upon procedure entry". This as not the case in clone.
-
-This fixes the misc/tst-misalign-clone-internal and
-misc/tst-misalign-clone tests.
-
-Fixes bug 28702.
-
-[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc
-
-(cherry picked from commit d2e594d71509faf36cf851a69370db34a4f5fa65)
----
- NEWS | 1 +
- sysdeps/unix/sysv/linux/riscv/clone.S | 3 +++
- 2 files changed, 4 insertions(+)
-
-diff --git a/NEWS b/NEWS
-index 1214ec4727..873491df1f 100644
---- a/NEWS
-+++ b/NEWS
-@@ -24,6 +24,7 @@ The following bugs are resolved with this release:
- [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
- [28678] nptl/tst-create1 hangs sporadically
- [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
-+ [28702] RISC-V: clone does not align stack
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
-
-
-diff --git a/sysdeps/unix/sysv/linux/riscv/clone.S b/sysdeps/unix/sysv/linux/riscv/clone.S
-index 12f91a20d3..161e83c7e3 100644
---- a/sysdeps/unix/sysv/linux/riscv/clone.S
-+++ b/sysdeps/unix/sysv/linux/riscv/clone.S
-@@ -32,6 +32,9 @@
- .text
- LEAF (__clone)
-
-+ /* Align stack to a 128-bit boundary as per RISC-V ABI. */
-+ andi a1,a1,ALMASK
-+
- /* Sanity check arguments. */
- beqz a0,L (invalid) /* No NULL function pointers. */
- beqz a1,L (invalid) /* No NULL stack pointers. */
---
-2.34.1
-
diff --git a/0061-riscv-align-stack-before-calling-_dl_init-BZ-28703.patch b/0061-riscv-align-stack-before-calling-_dl_init-BZ-28703.patch
deleted file mode 100644
index ceeeaa8..0000000
--- a/0061-riscv-align-stack-before-calling-_dl_init-BZ-28703.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From aa3a97496c82a8443039248ebee650322c9480f4 Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Thu, 16 Dec 2021 00:06:28 +0100
-Subject: [PATCH 61/66] riscv: align stack before calling _dl_init [BZ #28703]
-
-Align the stack pointer to 128 bits during the call to _dl_init() as
-specified by the RISC-V ABI [1]. This fixes the elf/tst-align2 test.
-
-Fixes bug 28703.
-
-[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc
-
-(cherry picked from commit 225da459cebef1037dcd78b56471edc0721e1c41)
----
- NEWS | 1 +
- sysdeps/riscv/dl-machine.h | 6 ++++++
- 2 files changed, 7 insertions(+)
-
-diff --git a/NEWS b/NEWS
-index 873491df1f..d9b344027b 100644
---- a/NEWS
-+++ b/NEWS
-@@ -25,6 +25,7 @@ The following bugs are resolved with this release:
- [28678] nptl/tst-create1 hangs sporadically
- [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
- [28702] RISC-V: clone does not align stack
-+ [28703] RISC-V: _dl_init might be called with unaligned stack
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
-
-
-diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
-index aedf69fcdd..951268923d 100644
---- a/sysdeps/riscv/dl-machine.h
-+++ b/sysdeps/riscv/dl-machine.h
-@@ -127,8 +127,14 @@ elf_machine_load_address (void)
- sll a3, a1, " STRINGXP (PTRLOG) "\n\
- add a3, a3, a2\n\
- add a3, a3, " STRINGXP (SZREG) "\n\
-+ # Stash the stack pointer in s1.\n\
-+ mv s1, sp\n\
-+ # Align stack to 128 bits for the _dl_init call.\n\
-+ andi sp, sp,-16\n\
- # Call the function to run the initializers.\n\
- jal _dl_init\n\
-+ # Restore the stack pointer for _start.\n\
-+ mv sp, s1\n\
- # Pass our finalizer function to _start.\n\
- lla a0, _dl_fini\n\
- # Jump to the user entry point.\n\
---
-2.34.1
-
diff --git a/0062-Update-hppa-libm-test-ulps.patch b/0062-Update-hppa-libm-test-ulps.patch
deleted file mode 100644
index b3f7bd5..0000000
--- a/0062-Update-hppa-libm-test-ulps.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 4029747c592cb2d59805b3a4e7a8963fcdcdbeb1 Mon Sep 17 00:00:00 2001
-From: John David Anglin <danglin@gcc.gnu.org>
-Date: Mon, 6 Sep 2021 17:37:29 +0000
-Subject: [PATCH 62/66] Update hppa libm-test-ulps
-
-(cherry picked from commit d8cf84ac7e504663dfeb2bb45d8d48ae81effe05)
----
- sysdeps/hppa/fpu/libm-test-ulps | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
-index 90e16a7269..3d60fc25a1 100644
---- a/sysdeps/hppa/fpu/libm-test-ulps
-+++ b/sysdeps/hppa/fpu/libm-test-ulps
-@@ -1104,7 +1104,7 @@ float: 8
- ldouble: 1
-
- Function: "tgamma_downward":
--double: 8
-+double: 9
- float: 7
-
- Function: "tgamma_towardzero":
---
-2.34.1
-
diff --git a/0063-Update-sparc-libm-test-ulps.patch b/0063-Update-sparc-libm-test-ulps.patch
deleted file mode 100644
index 404f627..0000000
--- a/0063-Update-sparc-libm-test-ulps.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From e94544c82f4ac37017589d8d83156d72388fc4af Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Wed, 4 Aug 2021 21:40:32 +0300
-Subject: [PATCH 63/66] Update sparc libm-test-ulps
-
-(cherry picked from commit c52eb066bc634a79e4194457362384abe5b43b3a)
----
- sysdeps/sparc/fpu/libm-test-ulps | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
-index c2e4649524..f34bbe6c59 100644
---- a/sysdeps/sparc/fpu/libm-test-ulps
-+++ b/sysdeps/sparc/fpu/libm-test-ulps
-@@ -1346,7 +1346,7 @@ float: 8
- ldouble: 4
-
- Function: "tgamma_downward":
--double: 8
-+double: 9
- float: 7
- ldouble: 5
-
---
-2.34.1
-
diff --git a/0064-linux-Add-sparck-brk-implementation.patch b/0064-linux-Add-sparck-brk-implementation.patch
deleted file mode 100644
index 7744213..0000000
--- a/0064-linux-Add-sparck-brk-implementation.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 1d9764aba8c00754fbf8299e48afbe222245ee3e Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Wed, 4 Aug 2021 21:34:12 +0300
-Subject: [PATCH 64/66] linux: Add sparck brk implementation
-
-It turned that the generic implementation of brk() does not work
-for sparc, since on failure kernel will just return the previous
-input value without setting the conditional register.
-
-This patches adds back a sparc32 and sparc64 implementation removed
-by 720480934ab9107.
-
-Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
-
-(cherry picked from commit 5b86241a032c50462988bdd1439e078384690d34)
----
- sysdeps/unix/sysv/linux/sparc/brk.c | 58 +++++++++++++++++++++++++++++
- 1 file changed, 58 insertions(+)
- create mode 100644 sysdeps/unix/sysv/linux/sparc/brk.c
-
-diff --git a/sysdeps/unix/sysv/linux/sparc/brk.c b/sysdeps/unix/sysv/linux/sparc/brk.c
-new file mode 100644
-index 0000000000..aafe9673e3
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/sparc/brk.c
-@@ -0,0 +1,58 @@
-+/* Change data segment. Linux SPARC version.
-+ Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library. If not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <unistd.h>
-+#include <sysdep.h>
-+
-+/* This must be initialized data because commons can't have aliases. */
-+void *__curbrk = 0;
-+
-+#if HAVE_INTERNAL_BRK_ADDR_SYMBOL
-+/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-+ to work around different old braindamage in the old Linux ELF dynamic
-+ linker. */
-+weak_alias (__curbrk, ___brk_addr)
-+#endif
-+
-+#ifdef __arch64__
-+# define SYSCALL_NUM "0x6d"
-+#else
-+# define SYSCALL_NUM "0x10"
-+#endif
-+
-+int
-+__brk (void *addr)
-+{
-+ register long int g1 asm ("g1") = __NR_brk;
-+ register long int o0 asm ("o0") = (long int) addr;
-+ asm volatile ("ta " SYSCALL_NUM
-+ : "=r"(o0)
-+ : "r"(g1), "0"(o0)
-+ : "cc");
-+ __curbrk = (void *) o0;
-+
-+ if (__curbrk < addr)
-+ {
-+ __set_errno (ENOMEM);
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+weak_alias (__brk, brk)
---
-2.34.1
-
diff --git a/0065-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch b/0065-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch
deleted file mode 100644
index a3ffd97..0000000
--- a/0065-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 8ad6d6d8ed33631bd2ca5d1112e6da2f92731432 Mon Sep 17 00:00:00 2001
-From: maminjie <maminjie2@huawei.com>
-Date: Mon, 20 Dec 2021 19:36:32 +0800
-Subject: [PATCH 65/66] Linux: Fix 32-bit vDSO for clock_gettime on powerpc32
-
-When the clock_id is CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID,
-on the 5.10 kernel powerpc 32-bit, the 32-bit vDSO is executed successfully (
-because the __kernel_clock_gettime in arch/powerpc/kernel/vdso32/gettimeofday.S
-does not support these two IDs, the 32-bit time_t syscall will be used),
-but tp32.tv_sec is equal to 0, causing the 64-bit time_t syscall to continue to be used,
-resulting in two system calls.
-
-Fix commit 72e84d1db22203e01a43268de71ea8669eca2863.
-
-Signed-off-by: maminjie <maminjie2@huawei.com>
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
-(cherry picked from commit e0fc721ce600038dd390e77cfe52440707ef574d)
----
- sysdeps/unix/sysv/linux/clock_gettime.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
-index 91df6b3d96..9c7d907325 100644
---- a/sysdeps/unix/sysv/linux/clock_gettime.c
-+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
-@@ -53,7 +53,7 @@ __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
- {
- struct timespec tp32;
- r = INTERNAL_VSYSCALL_CALL (vdso_time, 2, clock_id, &tp32);
-- if (r == 0 && tp32.tv_sec > 0)
-+ if (r == 0 && tp32.tv_sec >= 0)
- {
- *tp = valid_timespec_to_timespec64 (tp32);
- return 0;
---
-2.34.1
-
diff --git a/0066-intl-plural.y-Avoid-conflicting-declarations-of-yyer.patch b/0066-intl-plural.y-Avoid-conflicting-declarations-of-yyer.patch
deleted file mode 100644
index bfb7c76..0000000
--- a/0066-intl-plural.y-Avoid-conflicting-declarations-of-yyer.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 41fddc064ded5c9a36d8ffaad59a85407a22a535 Mon Sep 17 00:00:00 2001
-From: Andrea Monaco <andrea.monaco@autistici.org>
-Date: Sun, 12 Dec 2021 10:24:28 +0100
-Subject: [PATCH 66/66] intl/plural.y: Avoid conflicting declarations of
- yyerror and yylex
-
-bison-3.8 includes these lines in the generated intl/plural.c:
-
- #if !defined __gettexterror && !defined YYERROR_IS_DECLARED
- void __gettexterror (struct parse_args *arg, const char *msg);
- #endif
- #if !defined __gettextlex && !defined YYLEX_IS_DECLARED
- int __gettextlex (YYSTYPE *yylvalp, struct parse_args *arg);
- #endif
-
-Those default prototypes provided by bison conflict with the
-declarations later on in plural.y. This patch solves the issue.
-
-Reviewed-by: Arjun Shankar <arjun@redhat.com>
-(cherry picked from commit c6d7d6312c21bbcfb236d48bb7c11cedb234389f)
----
- intl/plural.y | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/intl/plural.y b/intl/plural.y
-index e02e74541c..2ee128ba01 100644
---- a/intl/plural.y
-+++ b/intl/plural.y
-@@ -40,6 +40,11 @@
- # define __gettextparse PLURAL_PARSE
- #endif
-
-+/* Later we provide those prototypes. Without these macros, bison may
-+ generate its own prototypes with possible conflicts. */
-+#define YYLEX_IS_DECLARED
-+#define YYERROR_IS_DECLARED
-+
- %}
- %parse-param {struct parse_args *arg}
- %lex-param {struct parse_args *arg}
---
-2.34.1
-
diff --git a/0067-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch b/0067-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch
deleted file mode 100644
index 60fe237..0000000
--- a/0067-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 217b84127b3a6590afcc7e198e6c3f665935e8f4 Mon Sep 17 00:00:00 2001
-From: Wilco Dijkstra <wdijkstr@arm.com>
-Date: Thu, 6 Jan 2022 14:36:28 +0000
-Subject: [PATCH 67/93] AArch64: Check for SVE in ifuncs [BZ #28744]
-
-Add a check for SVE in the A64FX ifuncs for memcpy, memset and memmove.
-This fixes BZ #28744.
-
-(cherry picked from commit e5fa62b8db546f8792ec9e5c61e6419f4f8e3f4d)
----
- NEWS | 1 +
- sysdeps/aarch64/multiarch/memcpy.c | 2 +-
- sysdeps/aarch64/multiarch/memmove.c | 2 +-
- sysdeps/aarch64/multiarch/memset.c | 2 +-
- 4 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index d9b344027b..2758ba644a 100644
---- a/NEWS
-+++ b/NEWS
-@@ -27,6 +27,7 @@ The following bugs are resolved with this release:
- [28702] RISC-V: clone does not align stack
- [28703] RISC-V: _dl_init might be called with unaligned stack
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
-+ [28744] A64FX string functions are selected without SVE HWCAP
-
-
- Version 2.34
-diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c
-index 25e0081eeb..b6703af44b 100644
---- a/sysdeps/aarch64/multiarch/memcpy.c
-+++ b/sysdeps/aarch64/multiarch/memcpy.c
-@@ -48,7 +48,7 @@ libc_ifunc (__libc_memcpy,
- || IS_NEOVERSE_V1 (midr)
- ? __memcpy_simd
- # if HAVE_AARCH64_SVE_ASM
-- : (IS_A64FX (midr)
-+ : (IS_A64FX (midr) && sve
- ? __memcpy_a64fx
- : __memcpy_generic))))));
- # else
-diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c
-index d0adefc547..d2339ff34f 100644
---- a/sysdeps/aarch64/multiarch/memmove.c
-+++ b/sysdeps/aarch64/multiarch/memmove.c
-@@ -48,7 +48,7 @@ libc_ifunc (__libc_memmove,
- || IS_NEOVERSE_V1 (midr)
- ? __memmove_simd
- # if HAVE_AARCH64_SVE_ASM
-- : (IS_A64FX (midr)
-+ : (IS_A64FX (midr) && sve
- ? __memmove_a64fx
- : __memmove_generic))))));
- # else
-diff --git a/sysdeps/aarch64/multiarch/memset.c b/sysdeps/aarch64/multiarch/memset.c
-index d7d9bbbda0..3d839bc02e 100644
---- a/sysdeps/aarch64/multiarch/memset.c
-+++ b/sysdeps/aarch64/multiarch/memset.c
-@@ -44,7 +44,7 @@ libc_ifunc (__libc_memset,
- : (IS_EMAG (midr) && zva_size == 64
- ? __memset_emag
- # if HAVE_AARCH64_SVE_ASM
-- : (IS_A64FX (midr)
-+ : (IS_A64FX (midr) && sve
- ? __memset_a64fx
- : __memset_generic))));
- # else
---
-2.35.0
-
diff --git a/0068-Fix-subscript-error-with-odd-TZif-file-BZ-28338.patch b/0068-Fix-subscript-error-with-odd-TZif-file-BZ-28338.patch
deleted file mode 100644
index 0a5e69a..0000000
--- a/0068-Fix-subscript-error-with-odd-TZif-file-BZ-28338.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 515a6f53cd984d5e6e374fbee52772f967fc3c73 Mon Sep 17 00:00:00 2001
-From: Paul Eggert <eggert@cs.ucla.edu>
-Date: Mon, 13 Sep 2021 22:49:45 -0700
-Subject: [PATCH 68/93] Fix subscript error with odd TZif file [BZ #28338]
-
-* time/tzfile.c (__tzfile_compute): Fix unlikely off-by-one bug
-that accessed before start of an array when an oddball-but-valid
-TZif file was queried with an unusual time_t value.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-(cherry picked from commit 645277434a42efc547d2cac8bfede4da10b4049f)
----
- NEWS | 3 ++-
- time/tzfile.c | 3 +--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 2758ba644a..2215408677 100644
---- a/NEWS
-+++ b/NEWS
-@@ -15,13 +15,14 @@ The following bugs are resolved with this release:
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
- [28223] mips: clone does not align stack
- [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
-+ [28338] undefined behavior in __tzfile_compute with oddball TZif file
- [28340] ld.so crashes while loading a DSO with a read-only dynamic section
- [28357] deadlock between pthread_create and ELF constructors
- [28361] nptl: Avoid setxid deadlock with blocked signals in thread exit
- [28407] pthread_kill assumes that kill and tgkill are equivalent
- [28524] Conversion from ISO-2022-JP-3 with iconv may emit spurious NULs
-- [28607] Masked signals are delivered on thread exit
- [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
-+ [28607] Masked signals are delivered on thread exit
- [28678] nptl/tst-create1 hangs sporadically
- [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
- [28702] RISC-V: clone does not align stack
-diff --git a/time/tzfile.c b/time/tzfile.c
-index 4377018a55..190a777152 100644
---- a/time/tzfile.c
-+++ b/time/tzfile.c
-@@ -765,8 +765,7 @@ __tzfile_compute (__time64_t timer, int use_localtime,
- *leap_correct = leaps[i].change;
-
- if (timer == leaps[i].transition /* Exactly at the transition time. */
-- && ((i == 0 && leaps[i].change > 0)
-- || leaps[i].change > leaps[i - 1].change))
-+ && (leaps[i].change > (i == 0 ? 0 : leaps[i - 1].change)))
- {
- *leap_hit = 1;
- while (i > 0
---
-2.35.0
-
diff --git a/0069-timezone-handle-truncated-timezones-from-tzcode-2021.patch b/0069-timezone-handle-truncated-timezones-from-tzcode-2021.patch
deleted file mode 100644
index 971109e..0000000
--- a/0069-timezone-handle-truncated-timezones-from-tzcode-2021.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 85b24f9694e21f1d2f2d8b80d3bf690687723347 Mon Sep 17 00:00:00 2001
-From: Hans-Peter Nilsson <hp@axis.com>
-Date: Fri, 17 Dec 2021 21:38:00 +0100
-Subject: [PATCH 69/93] timezone: handle truncated timezones from tzcode-2021d
- and later (BZ #28707)
-
-When using a timezone file with a truncated starting time,
-generated by the zic in IANA tzcode-2021d a.k.a. tzlib-2021d
-(also in tzlib-2021e; current as of this writing), glibc
-asserts in __tzfile_read (on e.g. tzset() for this file) and
-you may find lines matching "tzfile.c:435: __tzfile_read:
-Assertion `num_types == 1' failed" in your syslog.
-
-One example of such a file is the tzfile for Asuncion
-generated by tzlib-2021e as follows, using the tzlib-2021e zic:
-"zic -d DEST -r @1546300800 -L /dev/null -b slim
-SOURCE/southamerica". Note that in its type 2 header, it has
-two entries in its "time-types" array (types), but only one
-entry in its "transition types" array (type_idxs).
-
-This is valid and expected already in the published RFC8536, and
-not even frowned upon: "Local time for timestamps before the
-first transition is specified by the first time type (time type
-0)" ... "every nonzero local time type index SHOULD appear at
-least once in the transition type array". Note the "nonzero ...
-index". Until the 2021d zic, index 0 has been shared by the
-first valid transition but with 2021d it's separate, set apart
-as a placeholder and only "implicitly" indexed. (A draft update
-of the RFC mandates that the entry at index 0 is a placeholder
-in this case, hence can no longer be shared.)
-
- * time/tzfile.c (__tzfile_read): Don't assert when no transitions
- are found.
-
-Co-authored-by: Christopher Wong <Christopher.Wong@axis.com>
-(cherry picked from commit c36f64aa6dff13b12a1e03a185e75a50fa9f6a4c)
----
- NEWS | 1 +
- time/tzfile.c | 4 ++--
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 2215408677..5c253a4392 100644
---- a/NEWS
-+++ b/NEWS
-@@ -28,6 +28,7 @@ The following bugs are resolved with this release:
- [28702] RISC-V: clone does not align stack
- [28703] RISC-V: _dl_init might be called with unaligned stack
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
-+ [28707] assert in tzfile.c __tzfile_read striking with truncated timezones
- [28744] A64FX string functions are selected without SVE HWCAP
-
-
-diff --git a/time/tzfile.c b/time/tzfile.c
-index 190a777152..8668392ad3 100644
---- a/time/tzfile.c
-+++ b/time/tzfile.c
-@@ -431,8 +431,8 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
- if (__tzname[0] == NULL)
- {
- /* This should only happen if there are no transition rules.
-- In this case there should be only one single type. */
-- assert (num_types == 1);
-+ In this case there's usually only one single type, unless
-+ e.g. the data file has a truncated time-range. */
- __tzname[0] = __tzstring (zone_names);
- }
- if (__tzname[1] == NULL)
---
-2.35.0
-
diff --git a/0070-timezone-test-case-for-BZ-28707.patch b/0070-timezone-test-case-for-BZ-28707.patch
deleted file mode 100644
index 3fe8ec9..0000000
--- a/0070-timezone-test-case-for-BZ-28707.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From d5ba02f67dd62a63e29c29eebd6c543722aa6b5b Mon Sep 17 00:00:00 2001
-From: Hans-Peter Nilsson <hp@axis.com>
-Date: Fri, 17 Dec 2021 21:45:54 +0100
-Subject: [PATCH 70/93] timezone: test-case for BZ #28707
-
-This test-case is the tzfile for Asuncion generated by
-tzlib-2021e as follows, using the tzlib-2021e zic: "zic -d
-DEST -r @1546300800 -L /dev/null -b slim
-SOURCE/southamerica". Note that in its type 2 header, it
-has two entries in its "time-types" array (types), but only
-one entry in its "transition types" array (type_idxs).
-
- * timezone/Makefile, timezone/tst-pr28707.c,
- timezone/testdata/gen-XT5.sh: New test.
-
-Co-authored-by: Christopher Wong <Christopher.Wong@axis.com>
-(cherry picked from commit ebe899af0dc3215159a9c896ac6f35b72a18cb6e)
----
- timezone/Makefile | 8 ++++++-
- timezone/testdata/gen-XT5.sh | 16 +++++++++++++
- timezone/tst-bz28707.c | 46 ++++++++++++++++++++++++++++++++++++
- 3 files changed, 69 insertions(+), 1 deletion(-)
- create mode 100755 timezone/testdata/gen-XT5.sh
- create mode 100644 timezone/tst-bz28707.c
-
-diff --git a/timezone/Makefile b/timezone/Makefile
-index c624a189b3..f091663b8b 100644
---- a/timezone/Makefile
-+++ b/timezone/Makefile
-@@ -23,7 +23,7 @@ subdir := timezone
- include ../Makeconfig
-
- others := zdump zic
--tests := test-tz tst-timezone tst-tzset
-+tests := test-tz tst-timezone tst-tzset tst-bz28707
-
- generated-dirs += testdata
-
-@@ -85,10 +85,12 @@ $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
- America/Sao_Paulo Asia/Tokyo \
- Europe/London)
- $(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4)
-+$(objpfx)tst-bz28707.out: $(testdata)/XT5
-
- test-tz-ENV = TZDIR=$(testdata)
- tst-timezone-ENV = TZDIR=$(testdata)
- tst-tzset-ENV = TZDIR=$(testdata)
-+tst-bz28707-ENV = TZDIR=$(testdata)
-
- # Note this must come second in the deps list for $(built-program-cmd) to work.
- zic-deps = $(objpfx)zic $(leapseconds) yearistype
-@@ -122,6 +124,10 @@ $(testdata)/XT%: testdata/XT%
- $(make-target-directory)
- cp $< $@
-
-+$(testdata)/XT%: testdata/gen-XT%.sh
-+ $(SHELL) $< > $@.tmp
-+ mv $@.tmp $@
-+
- $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
- sed -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
- -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
-diff --git a/timezone/testdata/gen-XT5.sh b/timezone/testdata/gen-XT5.sh
-new file mode 100755
-index 0000000000..3cea0569eb
---- /dev/null
-+++ b/timezone/testdata/gen-XT5.sh
-@@ -0,0 +1,16 @@
-+#! /bin/sh
-+
-+# This test-case is the tzfile for America/Asuncion
-+# generated by tzlib-2021e as follows, using the tzlib-2021e
-+# zic: "zic -d DEST -r @1546300800 -L /dev/null -b slim
-+# SOURCE/southamerica". Note that in its type 2 header, it
-+# has two entries in its "time-types" array (types), but
-+# only one entry in its "transition types" array
-+# (type_idxs).
-+
-+printf \
-+'TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'\
-+'\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0TZif2\0\0\0\0\0\0\0\0'\
-+'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\2\0\0\0\b\0'\
-+'\0\0\0\*\255\200\1\0\0\0\0\0\0\377\377\325\320\1\4-00\0-03\0\n'\
-+'<-04>4<-03>,M10.1.0/0,M3.4.0/0\n'
-diff --git a/timezone/tst-bz28707.c b/timezone/tst-bz28707.c
-new file mode 100644
-index 0000000000..0a9df1e9a0
---- /dev/null
-+++ b/timezone/tst-bz28707.c
-@@ -0,0 +1,46 @@
-+/* Copyright (C) 2021 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <time.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+/* Test that we can use a truncated timezone-file, where the time-type
-+ at index 0 is not indexed by the transition-types array (and the
-+ transition-types array does not contain at least both one DST and one
-+ normal time members). */
-+
-+static int
-+do_test (void)
-+{
-+ if (setenv ("TZ", "XT5", 1))
-+ {
-+ puts ("setenv failed.");
-+ return 1;
-+ }
-+
-+ tzset ();
-+
-+ return
-+ /* Sanity-check that we got the right timezone-name for DST. For
-+ normal time, we're likely to get "-00" (the "unspecified" marker),
-+ even though the POSIX timezone string says "-04". Let's not test
-+ that. */
-+ !(strcmp (tzname[1], "-03") == 0);
-+}
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0071-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch b/0071-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
deleted file mode 100644
index 2b60758..0000000
--- a/0071-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From e64235ff4266e87b20505101877fe57350ab69ab Mon Sep 17 00:00:00 2001
-From: "Paul A. Clarke" <pc@us.ibm.com>
-Date: Tue, 14 Sep 2021 13:13:33 -0500
-Subject: [PATCH 71/93] powerpc: Fix unrecognized instruction errors with
- recent GCC
-
-Recent binutils commit b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a
-changes the behavior of `.machine` directives to override, rather
-than augment, the base CPU. This can result in _reduced_ functionality
-when, for example, compiling for default machine "power8", but explicitly
-asking for ".machine power5", which loses Altivec instructions.
-
-In tst-ucontext-ppc64-vscr.c, while the instructions provoking the new
-error messages are bracketed by ".machine power5", which is ostensibly
-Power ISA 2.03 (POWER5), the POWER5 processor did not support the
-VSX subset, so these instructions are not recognized as "power5".
-
-Error: unrecognized opcode: `vspltisb'
-Error: unrecognized opcode: `vpkuwus'
-Error: unrecognized opcode: `mfvscr'
-Error: unrecognized opcode: `stvx'
-
-Manually adding the VSX subset via ".machine altivec" is sufficient.
-
-Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
-(cherry picked from commit 064b475a2e5662b6b3973fabf505eade86e61510)
----
- sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c b/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
-index 28c87fcef7..d3fc4ab589 100644
---- a/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
-+++ b/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
-@@ -50,6 +50,7 @@ do_test (void)
- /* Set SAT bit in VSCR register. */
- asm volatile (".machine push;\n"
- ".machine \"power5\";\n"
-+ ".machine altivec;\n"
- "vspltisb %0,0;\n"
- "vspltisb %1,-1;\n"
- "vpkuwus %0,%0,%1;\n"
---
-2.35.0
-
diff --git a/0072-Update-syscall-lists-for-Linux-5.15.patch b/0072-Update-syscall-lists-for-Linux-5.15.patch
deleted file mode 100644
index b1e2b96..0000000
--- a/0072-Update-syscall-lists-for-Linux-5.15.patch
+++ /dev/null
@@ -1,409 +0,0 @@
-From 73558ffe841cf4c60ccb4c71cf6dcebf84f2b736 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Wed, 10 Nov 2021 15:21:19 +0000
-Subject: [PATCH 72/93] Update syscall lists for Linux 5.15
-
-Linux 5.15 has one new syscall, process_mrelease (and also enables the
-clone3 syscall for RV32). It also has a macro __NR_SYSCALL_MASK for
-Arm, which is not a syscall but matches the pattern used for syscall
-macro names.
-
-Add __NR_SYSCALL_MASK to the names filtered out in the code dealing
-with syscall lists, update syscall-names.list for the new syscall and
-regenerate the arch-syscall.h headers with build-many-glibcs.py
-update-syscalls.
-
-Tested with build-many-glibcs.py.
-
-(cherry picked from commit 3387c40a8bbad5faf85b1feb56429cb20feaa640)
----
- sysdeps/unix/sysv/linux/aarch64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/alpha/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arc/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arm/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/csky/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/filter-nr-syscalls.awk | 2 +-
- sysdeps/unix/sysv/linux/glibcsyscalls.py | 2 +-
- sysdeps/unix/sysv/linux/hppa/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/i386/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/ia64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/m68k/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/microblaze/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/nios2/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h | 2 ++
- sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sh/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/syscall-names.list | 5 +++--
- sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h | 1 +
- 28 files changed, 31 insertions(+), 4 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-index bedab1abba..74a809561a 100644
---- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-@@ -180,6 +180,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6 72
-diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-index 91354ed9e2..6fc0a23504 100644
---- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-@@ -328,6 +328,7 @@
- #define __NR_preadv2 520
- #define __NR_prlimit64 496
- #define __NR_process_madvise 550
-+#define __NR_process_mrelease 558
- #define __NR_process_vm_readv 504
- #define __NR_process_vm_writev 505
- #define __NR_pselect6 463
-diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-index ff5c7eb36d..0c66762bf8 100644
---- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-@@ -182,6 +182,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6_time64 413
-diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-index 5772333cee..c41a864c6d 100644
---- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-@@ -235,6 +235,7 @@
- #define __NR_preadv2 392
- #define __NR_prlimit64 369
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 376
- #define __NR_process_vm_writev 377
- #define __NR_pselect6 335
-diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-index 4af6d6202f..863ffa3e0c 100644
---- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-@@ -190,6 +190,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6 72
-diff --git a/sysdeps/unix/sysv/linux/filter-nr-syscalls.awk b/sysdeps/unix/sysv/linux/filter-nr-syscalls.awk
-index dddfd51747..85b017918e 100644
---- a/sysdeps/unix/sysv/linux/filter-nr-syscalls.awk
-+++ b/sysdeps/unix/sysv/linux/filter-nr-syscalls.awk
-@@ -22,7 +22,7 @@
- }
-
- # Skip pseudo-system calls which describe ranges.
--/^#define __NR_(syscalls|arch_specific_syscall|(OABI_)?SYSCALL_BASE) / {
-+/^#define __NR_(syscalls|arch_specific_syscall|(OABI_)?SYSCALL_BASE|SYSCALL_MASK) / {
- next;
- }
- /^#define __NR_(|64_|[NO]32_)Linux(_syscalls)? / {
-diff --git a/sysdeps/unix/sysv/linux/glibcsyscalls.py b/sysdeps/unix/sysv/linux/glibcsyscalls.py
-index 621a202ed7..fe7896eebe 100644
---- a/sysdeps/unix/sysv/linux/glibcsyscalls.py
-+++ b/sysdeps/unix/sysv/linux/glibcsyscalls.py
-@@ -41,7 +41,7 @@ RE_PSEUDO_SYSCALL = re.compile(r"""__NR_(
- (unused|reserved)[0-9]+
-
- # Pseudo-system call which describes a range.
-- |(syscalls|arch_specific_syscall|(OABI_)?SYSCALL_BASE)
-+ |(syscalls|arch_specific_syscall|(OABI_)?SYSCALL_BASE|SYSCALL_MASK)
- |(|64_|[NO]32_)Linux(_syscalls)?
- )""", re.X)
-
-diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-index b07fc8549d..6cf27cd17c 100644
---- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-@@ -222,6 +222,7 @@
- #define __NR_preadv2 347
- #define __NR_prlimit64 321
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 330
- #define __NR_process_vm_writev 331
- #define __NR_pselect6 273
-diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-index 6e4264698b..2512508b7d 100644
---- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-@@ -254,6 +254,7 @@
- #define __NR_preadv2 378
- #define __NR_prlimit64 340
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 347
- #define __NR_process_vm_writev 348
- #define __NR_prof 44
-diff --git a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-index 1ca706d721..4a0c737369 100644
---- a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-@@ -209,6 +209,7 @@
- #define __NR_preadv2 1348
- #define __NR_prlimit64 1325
- #define __NR_process_madvise 1464
-+#define __NR_process_mrelease 1472
- #define __NR_process_vm_readv 1332
- #define __NR_process_vm_writev 1333
- #define __NR_pselect6 1294
-diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-index 2f10f71f90..e310eb5075 100644
---- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-@@ -243,6 +243,7 @@
- #define __NR_preadv2 377
- #define __NR_prlimit64 339
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 345
- #define __NR_process_vm_writev 346
- #define __NR_pselect6 301
-diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-index 0607a4dfa6..b4ecad010c 100644
---- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-@@ -253,6 +253,7 @@
- #define __NR_preadv2 393
- #define __NR_prlimit64 370
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 377
- #define __NR_process_vm_writev 378
- #define __NR_prof 44
-diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-index 0055eec0b1..7e3d138ba9 100644
---- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-@@ -238,6 +238,7 @@
- #define __NR_preadv2 4361
- #define __NR_prlimit64 4338
- #define __NR_process_madvise 4440
-+#define __NR_process_mrelease 4448
- #define __NR_process_vm_readv 4345
- #define __NR_process_vm_writev 4346
- #define __NR_prof 4044
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-index 8e8e9f91cc..7e9e232e52 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-@@ -221,6 +221,7 @@
- #define __NR_preadv2 6325
- #define __NR_prlimit64 6302
- #define __NR_process_madvise 6440
-+#define __NR_process_mrelease 6448
- #define __NR_process_vm_readv 6309
- #define __NR_process_vm_writev 6310
- #define __NR_pselect6 6264
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-index ebd1545f80..f9e7ef72b0 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-@@ -209,6 +209,7 @@
- #define __NR_preadv2 5321
- #define __NR_prlimit64 5297
- #define __NR_process_madvise 5440
-+#define __NR_process_mrelease 5448
- #define __NR_process_vm_readv 5304
- #define __NR_process_vm_writev 5305
- #define __NR_pselect6 5260
-diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-index 2b530b1f88..afd73fc1da 100644
---- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-@@ -189,6 +189,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6 72
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-index a32984a9c1..0ac2992028 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-@@ -247,6 +247,7 @@
- #define __NR_preadv2 380
- #define __NR_prlimit64 325
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 351
- #define __NR_process_vm_writev 352
- #define __NR_prof 44
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-index b01e464fb9..c890bc644e 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-@@ -231,6 +231,7 @@
- #define __NR_preadv2 380
- #define __NR_prlimit64 325
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 351
- #define __NR_process_vm_writev 352
- #define __NR_prof 44
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-index 24d0a2c455..cd336d755a 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-@@ -16,6 +16,7 @@
- #define __NR_clock_nanosleep_time64 407
- #define __NR_clock_settime64 404
- #define __NR_clone 220
-+#define __NR_clone3 435
- #define __NR_close 57
- #define __NR_close_range 436
- #define __NR_connect 203
-@@ -171,6 +172,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6_time64 413
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-index e526c89ae7..8edd21620b 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-@@ -179,6 +179,7 @@
- #define __NR_preadv2 286
- #define __NR_prlimit64 261
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 270
- #define __NR_process_vm_writev 271
- #define __NR_pselect6 72
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-index d4c7b101b6..1a4873f505 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-@@ -240,6 +240,7 @@
- #define __NR_preadv2 376
- #define __NR_prlimit64 334
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 340
- #define __NR_process_vm_writev 341
- #define __NR_pselect6 301
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-index bd8c78d705..2af4607c1d 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-@@ -211,6 +211,7 @@
- #define __NR_preadv2 376
- #define __NR_prlimit64 334
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 340
- #define __NR_process_vm_writev 341
- #define __NR_pselect6 301
-diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-index 3b6ac3d084..7b422ce268 100644
---- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-@@ -237,6 +237,7 @@
- #define __NR_preadv2 381
- #define __NR_prlimit64 339
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 365
- #define __NR_process_vm_writev 366
- #define __NR_pselect6 308
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-index 35221a707e..77c3cc64f9 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-@@ -242,6 +242,7 @@
- #define __NR_preadv2 358
- #define __NR_prlimit64 331
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 338
- #define __NR_process_vm_writev 339
- #define __NR_pselect6 297
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-index 5ba2b20509..7ad50bc4ad 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-@@ -222,6 +222,7 @@
- #define __NR_preadv2 358
- #define __NR_prlimit64 331
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 338
- #define __NR_process_vm_writev 339
- #define __NR_pselect6 297
-diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
-index fd98893b0e..1a74d090b7 100644
---- a/sysdeps/unix/sysv/linux/syscall-names.list
-+++ b/sysdeps/unix/sysv/linux/syscall-names.list
-@@ -21,8 +21,8 @@
- # This file can list all potential system calls. The names are only
- # used if the installed kernel headers also provide them.
-
--# The list of system calls is current as of Linux 5.14.
--kernel 5.14
-+# The list of system calls is current as of Linux 5.15.
-+kernel 5.15
-
- FAST_atomic_update
- FAST_cmpxchg
-@@ -440,6 +440,7 @@ preadv
- preadv2
- prlimit64
- process_madvise
-+process_mrelease
- process_vm_readv
- process_vm_writev
- prof
-diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-index 26d6ac68a6..3ce2a1fcfc 100644
---- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-@@ -215,6 +215,7 @@
- #define __NR_preadv2 327
- #define __NR_prlimit64 302
- #define __NR_process_madvise 440
-+#define __NR_process_mrelease 448
- #define __NR_process_vm_readv 310
- #define __NR_process_vm_writev 311
- #define __NR_pselect6 270
-diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-index 36847783f6..9e87e89bac 100644
---- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-@@ -208,6 +208,7 @@
- #define __NR_preadv2 1073742370
- #define __NR_prlimit64 1073742126
- #define __NR_process_madvise 1073742264
-+#define __NR_process_mrelease 1073742272
- #define __NR_process_vm_readv 1073742363
- #define __NR_process_vm_writev 1073742364
- #define __NR_pselect6 1073742094
---
-2.35.0
-
diff --git a/0073-i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch b/0073-i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch
deleted file mode 100644
index cf6ae50..0000000
--- a/0073-i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch
+++ /dev/null
@@ -1,464 +0,0 @@
-From 2fe2af88abd13ae5636881da2e26f461ecb7dfb5 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Thu, 13 Jan 2022 14:59:29 +0100
-Subject: [PATCH 73/93] i386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug
- 28771)
-
-The configure check for CAN_USE_REGISTER_ASM_EBP tried to compile a
-simple function that uses %ebp as an inline assembly operand. If
-compilation failed, CAN_USE_REGISTER_ASM_EBP was set 0, which
-eventually had these consequences:
-
-(1) %ebx was avoided as an inline assembly operand, with an
- assembler macro hack to avoid unnecessary register moves.
-(2) %ebp was avoided as an inline assembly operand, using an
- out-of-line syscall function for 6-argument system calls.
-
-(1) is no longer needed for any GCC version that is supported for
-building glibc. %ebx can be used directly as a register operand.
-Therefore, this commit removes the %ebx avoidance completely. This
-avoids the assembler macro hack, which turns out to be incompatible
-with the current Systemtap probe macros (which switch to .altmacro
-unconditionally).
-
-(2) is still needed in many build configurations. The existing
-configure check cannot really capture that because the simple function
-succeeds to compile, while the full glibc build still fails.
-Therefore, this commit removes the check, the CAN_USE_REGISTER_ASM_EBP
-macro, and uses the out-of-line syscall function for 6-argument system
-calls unconditionally.
-
-Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-(cherry picked from commit a78e6a10d0b50d0ca80309775980fc99944b1727)
----
- NEWS | 1 +
- config.h.in | 4 -
- sysdeps/unix/sysv/linux/i386/configure | 39 ----
- sysdeps/unix/sysv/linux/i386/configure.ac | 17 --
- sysdeps/unix/sysv/linux/i386/sysdep.h | 222 +++-------------------
- 5 files changed, 28 insertions(+), 255 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 5c253a4392..759a80b1b5 100644
---- a/NEWS
-+++ b/NEWS
-@@ -30,6 +30,7 @@ The following bugs are resolved with this release:
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
- [28707] assert in tzfile.c __tzfile_read striking with truncated timezones
- [28744] A64FX string functions are selected without SVE HWCAP
-+ [28771] %ebx optimization macros are incompatible with .altmacro
-
-
- Version 2.34
-diff --git a/config.h.in b/config.h.in
-index 8b45a3a61d..37207df94f 100644
---- a/config.h.in
-+++ b/config.h.in
-@@ -283,10 +283,6 @@
- /* Define if static PIE is enabled. */
- #define ENABLE_STATIC_PIE 0
-
--/* Some compiler options may now allow to use ebp in __asm__ (used mainly
-- in i386 6 argument syscall issue). */
--#define CAN_USE_REGISTER_ASM_EBP 0
--
- /* The default value of x86 CET control. */
- #define DEFAULT_DL_X86_CET_CONTROL cet_elf_property
-
-diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure
-index 0327590486..f119e62fc3 100644
---- a/sysdeps/unix/sysv/linux/i386/configure
-+++ b/sysdeps/unix/sysv/linux/i386/configure
-@@ -1,44 +1,5 @@
- # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
- # Local configure fragment for sysdeps/unix/sysv/linux/i386.
-
--# Check if CFLAGS allows compiler to use ebp register in inline assembly.
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler flags allows ebp in inline assembly" >&5
--$as_echo_n "checking if compiler flags allows ebp in inline assembly... " >&6; }
--if ${libc_cv_can_use_register_asm_ebp+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
-- void foo (int i)
-- {
-- register int reg asm ("ebp") = i;
-- asm ("# %0" : : "r" (reg));
-- }
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- libc_cv_can_use_register_asm_ebp=yes
--else
-- libc_cv_can_use_register_asm_ebp=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_can_use_register_asm_ebp" >&5
--$as_echo "$libc_cv_can_use_register_asm_ebp" >&6; }
--if test $libc_cv_can_use_register_asm_ebp = yes; then
-- $as_echo "#define CAN_USE_REGISTER_ASM_EBP 1" >>confdefs.h
--
--fi
--
- libc_cv_gcc_unwind_find_fde=yes
- ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
-diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac
-index 9e980784bb..64ab2cc2c8 100644
---- a/sysdeps/unix/sysv/linux/i386/configure.ac
-+++ b/sysdeps/unix/sysv/linux/i386/configure.ac
-@@ -1,22 +1,5 @@
- GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
- # Local configure fragment for sysdeps/unix/sysv/linux/i386.
-
--# Check if CFLAGS allows compiler to use ebp register in inline assembly.
--AC_CACHE_CHECK([if compiler flags allows ebp in inline assembly],
-- libc_cv_can_use_register_asm_ebp, [
--AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([
-- void foo (int i)
-- {
-- register int reg asm ("ebp") = i;
-- asm ("# %0" : : "r" (reg));
-- }])],
-- [libc_cv_can_use_register_asm_ebp=yes],
-- [libc_cv_can_use_register_asm_ebp=no])
--])
--if test $libc_cv_can_use_register_asm_ebp = yes; then
-- AC_DEFINE(CAN_USE_REGISTER_ASM_EBP)
--fi
--
- libc_cv_gcc_unwind_find_fde=yes
- ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
-diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
-index 8a9911b7ac..39d6a3c134 100644
---- a/sysdeps/unix/sysv/linux/i386/sysdep.h
-+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
-@@ -43,15 +43,6 @@
- # endif
- #endif
-
--/* Since GCC 5 and above can properly spill %ebx with PIC when needed,
-- we can inline syscalls with 6 arguments if GCC 5 or above is used
-- to compile glibc. Disable GCC 5 optimization when compiling for
-- profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
-- can't be used to put the 6th argument in %ebp for syscall. */
--#if !defined PROF && CAN_USE_REGISTER_ASM_EBP
--# define OPTIMIZE_FOR_GCC_5
--#endif
--
- #ifdef __ASSEMBLER__
-
- /* Linux uses a negative return value to indicate syscall errors,
-@@ -239,36 +230,6 @@
- extern int __syscall_error (int)
- attribute_hidden __attribute__ ((__regparm__ (1)));
-
--#ifndef OPTIMIZE_FOR_GCC_5
--/* We need some help from the assembler to generate optimal code. We
-- define some macros here which later will be used. */
--asm (".L__X'%ebx = 1\n\t"
-- ".L__X'%ecx = 2\n\t"
-- ".L__X'%edx = 2\n\t"
-- ".L__X'%eax = 3\n\t"
-- ".L__X'%esi = 3\n\t"
-- ".L__X'%edi = 3\n\t"
-- ".L__X'%ebp = 3\n\t"
-- ".L__X'%esp = 3\n\t"
-- ".macro bpushl name reg\n\t"
-- ".if 1 - \\name\n\t"
-- ".if 2 - \\name\n\t"
-- "error\n\t"
-- ".else\n\t"
-- "xchgl \\reg, %ebx\n\t"
-- ".endif\n\t"
-- ".endif\n\t"
-- ".endm\n\t"
-- ".macro bpopl name reg\n\t"
-- ".if 1 - \\name\n\t"
-- ".if 2 - \\name\n\t"
-- "error\n\t"
-- ".else\n\t"
-- "xchgl \\reg, %ebx\n\t"
-- ".endif\n\t"
-- ".endif\n\t"
-- ".endm\n\t");
--
- /* Six-argument syscalls use an out-of-line helper, because an inline
- asm using all registers apart from %esp cannot work reliably and
- the assembler does not support describing an asm that saves and
-@@ -279,7 +240,6 @@ struct libc_do_syscall_args
- {
- int ebx, edi, ebp;
- };
--#endif
-
- # define VDSO_NAME "LINUX_2.6"
- # define VDSO_HASH 61765110
-@@ -332,14 +292,8 @@ struct libc_do_syscall_args
-
- /* Each object using 6-argument inline syscalls must include a
- definition of __libc_do_syscall. */
--#ifdef OPTIMIZE_FOR_GCC_5
--# define INTERNAL_SYSCALL_MAIN_6(name, args...) \
-- INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
--# define INTERNAL_SYSCALL_MAIN_NCS_6(name, args...) \
-- INTERNAL_SYSCALL_MAIN_NCS(name, 6, args)
--#else /* GCC 5 */
--# define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \
-- arg4, arg5, arg6) \
-+#define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \
-+ arg4, arg5, arg6) \
- struct libc_do_syscall_args _xv = \
- { \
- (int) (arg1), \
-@@ -352,8 +306,8 @@ struct libc_do_syscall_args
- : "=a" (resultvar) \
- : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
- : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3, \
-- arg4, arg5, arg6) \
-+#define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3, \
-+ arg4, arg5, arg6) \
- struct libc_do_syscall_args _xv = \
- { \
- (int) (arg1), \
-@@ -366,7 +320,6 @@ struct libc_do_syscall_args
- : "=a" (resultvar) \
- : "a" (name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
- : "memory", "cc")
--#endif /* GCC 5 */
-
- #define INTERNAL_SYSCALL(name, nr, args...) \
- ({ \
-@@ -380,193 +333,72 @@ struct libc_do_syscall_args
- (int) resultvar; })
-
- #if I386_USE_SYSENTER
--# ifdef OPTIMIZE_FOR_GCC_5
--# ifdef PIC
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-+# ifdef PIC
-+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "call *%%gs:%P2" \
- : "=a" (resultvar) \
- : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
- ASMARGS_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "call *%%gs:%P2" \
- : "=a" (resultvar) \
- : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
- ASMARGS_##nr(args) : "memory", "cc")
--# else
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-+# else /* I386_USE_SYSENTER && !PIC */
-+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "call *_dl_sysinfo" \
- : "=a" (resultvar) \
- : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "call *_dl_sysinfo" \
- : "=a" (resultvar) \
- : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
--# endif
--# else /* GCC 5 */
--# ifdef PIC
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "movl %1, %%eax\n\t" \
-- "call *%%gs:%P2\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
-- ASMFMT_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "call *%%gs:%P2\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
-- ASMFMT_##nr(args) : "memory", "cc")
--# else
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "movl %1, %%eax\n\t" \
-- "call *_dl_sysinfo\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "call *_dl_sysinfo\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
--# endif
--# endif /* GCC 5 */
--#else
--# ifdef OPTIMIZE_FOR_GCC_5
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-+# endif /* I386_USE_SYSENTER && !PIC */
-+#else /* !I386_USE_SYSENTER */
-+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "int $0x80" \
- : "=a" (resultvar) \
- : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
- LOADREGS_##nr(args) \
- asm volatile ( \
- "int $0x80" \
- : "=a" (resultvar) \
- : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
--# else /* GCC 5 */
--# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "movl %1, %%eax\n\t" \
-- "int $0x80\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
--# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
-- EXTRAVAR_##nr \
-- asm volatile ( \
-- LOADARGS_##nr \
-- "int $0x80\n\t" \
-- RESTOREARGS_##nr \
-- : "=a" (resultvar) \
-- : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
--# endif /* GCC 5 */
--#endif
--
--#define LOADARGS_0
--#ifdef __PIC__
--# if I386_USE_SYSENTER && defined PIC
--# define LOADARGS_1 \
-- "bpushl .L__X'%k3, %k3\n\t"
--# define LOADARGS_5 \
-- "movl %%ebx, %4\n\t" \
-- "movl %3, %%ebx\n\t"
--# else
--# define LOADARGS_1 \
-- "bpushl .L__X'%k2, %k2\n\t"
--# define LOADARGS_5 \
-- "movl %%ebx, %3\n\t" \
-- "movl %2, %%ebx\n\t"
--# endif
--# define LOADARGS_2 LOADARGS_1
--# define LOADARGS_3 \
-- "xchgl %%ebx, %%edi\n\t"
--# define LOADARGS_4 LOADARGS_3
--#else
--# define LOADARGS_1
--# define LOADARGS_2
--# define LOADARGS_3
--# define LOADARGS_4
--# define LOADARGS_5
--#endif
--
--#define RESTOREARGS_0
--#ifdef __PIC__
--# if I386_USE_SYSENTER && defined PIC
--# define RESTOREARGS_1 \
-- "bpopl .L__X'%k3, %k3\n\t"
--# define RESTOREARGS_5 \
-- "movl %4, %%ebx"
--# else
--# define RESTOREARGS_1 \
-- "bpopl .L__X'%k2, %k2\n\t"
--# define RESTOREARGS_5 \
-- "movl %3, %%ebx"
--# endif
--# define RESTOREARGS_2 RESTOREARGS_1
--# define RESTOREARGS_3 \
-- "xchgl %%edi, %%ebx\n\t"
--# define RESTOREARGS_4 RESTOREARGS_3
--#else
--# define RESTOREARGS_1
--# define RESTOREARGS_2
--# define RESTOREARGS_3
--# define RESTOREARGS_4
--# define RESTOREARGS_5
--#endif
-+#endif /* !I386_USE_SYSENTER */
-
--#ifdef OPTIMIZE_FOR_GCC_5
--# define LOADREGS_0()
--# define ASMARGS_0()
--# define LOADREGS_1(arg1) \
-+#define LOADREGS_0()
-+#define ASMARGS_0()
-+#define LOADREGS_1(arg1) \
- LOADREGS_0 ()
--# define ASMARGS_1(arg1) \
-+#define ASMARGS_1(arg1) \
- ASMARGS_0 (), "b" ((unsigned int) (arg1))
--# define LOADREGS_2(arg1, arg2) \
-+#define LOADREGS_2(arg1, arg2) \
- LOADREGS_1 (arg1)
--# define ASMARGS_2(arg1, arg2) \
-+#define ASMARGS_2(arg1, arg2) \
- ASMARGS_1 (arg1), "c" ((unsigned int) (arg2))
--# define LOADREGS_3(arg1, arg2, arg3) \
-+#define LOADREGS_3(arg1, arg2, arg3) \
- LOADREGS_2 (arg1, arg2)
--# define ASMARGS_3(arg1, arg2, arg3) \
-+#define ASMARGS_3(arg1, arg2, arg3) \
- ASMARGS_2 (arg1, arg2), "d" ((unsigned int) (arg3))
--# define LOADREGS_4(arg1, arg2, arg3, arg4) \
-+#define LOADREGS_4(arg1, arg2, arg3, arg4) \
- LOADREGS_3 (arg1, arg2, arg3)
--# define ASMARGS_4(arg1, arg2, arg3, arg4) \
-+#define ASMARGS_4(arg1, arg2, arg3, arg4) \
- ASMARGS_3 (arg1, arg2, arg3), "S" ((unsigned int) (arg4))
--# define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \
-+#define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \
- LOADREGS_4 (arg1, arg2, arg3, arg4)
--# define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \
-+#define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \
- ASMARGS_4 (arg1, arg2, arg3, arg4), "D" ((unsigned int) (arg5))
--# define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-- register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); \
-- LOADREGS_5 (arg1, arg2, arg3, arg4, arg5)
--# define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-- ASMARGS_5 (arg1, arg2, arg3, arg4, arg5), "r" (_a6)
--#endif /* GCC 5 */
-
- #define ASMFMT_0()
- #ifdef __PIC__
---
-2.35.0
-
diff --git a/0074-Update-syscall-lists-for-Linux-5.16.patch b/0074-Update-syscall-lists-for-Linux-5.16.patch
deleted file mode 100644
index 4902de5..0000000
--- a/0074-Update-syscall-lists-for-Linux-5.16.patch
+++ /dev/null
@@ -1,367 +0,0 @@
-From 705f1e4606aa78f4e861b4e3346725bf5f083a56 Mon Sep 17 00:00:00 2001
-From: Joseph Myers <joseph@codesourcery.com>
-Date: Thu, 13 Jan 2022 22:18:13 +0000
-Subject: [PATCH 74/93] Update syscall lists for Linux 5.16
-
-Linux 5.16 has one new syscall, futex_waitv. Update
-syscall-names.list and regenerate the arch-syscall.h headers with
-build-many-glibcs.py update-syscalls.
-
-Tested with build-many-glibcs.py.
-
-(cherry picked from commit 4997a533ae4b51ef66a6b68862b7578a7acb82df)
----
- sysdeps/unix/sysv/linux/aarch64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/alpha/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arc/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/arm/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/csky/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/hppa/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/i386/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/ia64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/m68k/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/microblaze/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/nios2/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sh/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/syscall-names.list | 5 +++--
- sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h | 1 +
- sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h | 1 +
- 26 files changed, 28 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-index 74a809561a..9905ebedf2 100644
---- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
-@@ -62,6 +62,7 @@
- #define __NR_fsync 82
- #define __NR_ftruncate 46
- #define __NR_futex 98
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-index 6fc0a23504..ee8085be69 100644
---- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
-@@ -78,6 +78,7 @@
- #define __NR_fsync 95
- #define __NR_ftruncate 130
- #define __NR_futex 394
-+#define __NR_futex_waitv 559
- #define __NR_futimesat 454
- #define __NR_get_kernel_syms 309
- #define __NR_get_mempolicy 430
-diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-index 0c66762bf8..1b626d9770 100644
---- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
-@@ -65,6 +65,7 @@
- #define __NR_fsync 82
- #define __NR_ftruncate64 46
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-index c41a864c6d..96ef8db936 100644
---- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
-@@ -90,6 +90,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 240
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 326
- #define __NR_get_mempolicy 320
- #define __NR_get_robust_list 339
-diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-index 863ffa3e0c..96910154ed 100644
---- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
-@@ -70,6 +70,7 @@
- #define __NR_ftruncate64 46
- #define __NR_futex 98
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-index 6cf27cd17c..36675fd48e 100644
---- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
-@@ -87,6 +87,7 @@
- #define __NR_ftruncate64 200
- #define __NR_futex 210
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 279
- #define __NR_get_mempolicy 261
- #define __NR_get_robust_list 290
-diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-index 2512508b7d..c86ccbda46 100644
---- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
-@@ -94,6 +94,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 240
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 299
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 275
-diff --git a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-index 4a0c737369..d898bce404 100644
---- a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
-@@ -74,6 +74,7 @@
- #define __NR_fsync 1051
- #define __NR_ftruncate 1098
- #define __NR_futex 1230
-+#define __NR_futex_waitv 1473
- #define __NR_futimesat 1285
- #define __NR_get_mempolicy 1260
- #define __NR_get_robust_list 1299
-diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-index e310eb5075..fe721b8090 100644
---- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
-@@ -93,6 +93,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 235
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 292
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 269
-diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-index b4ecad010c..6e10c3661d 100644
---- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
-@@ -94,6 +94,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 240
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 299
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 275
-diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-index 7e3d138ba9..26a6d594a2 100644
---- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
-@@ -93,6 +93,7 @@
- #define __NR_ftruncate64 4212
- #define __NR_futex 4238
- #define __NR_futex_time64 4422
-+#define __NR_futex_waitv 4449
- #define __NR_futimesat 4292
- #define __NR_get_kernel_syms 4130
- #define __NR_get_mempolicy 4269
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-index 7e9e232e52..83e0d49c5e 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
-@@ -86,6 +86,7 @@
- #define __NR_ftruncate 6075
- #define __NR_futex 6194
- #define __NR_futex_time64 6422
-+#define __NR_futex_waitv 6449
- #define __NR_futimesat 6255
- #define __NR_get_kernel_syms 6170
- #define __NR_get_mempolicy 6232
-diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-index f9e7ef72b0..d6747c542f 100644
---- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
-@@ -78,6 +78,7 @@
- #define __NR_fsync 5072
- #define __NR_ftruncate 5075
- #define __NR_futex 5194
-+#define __NR_futex_waitv 5449
- #define __NR_futimesat 5251
- #define __NR_get_kernel_syms 5170
- #define __NR_get_mempolicy 5228
-diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-index afd73fc1da..4ee209bc44 100644
---- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
-@@ -69,6 +69,7 @@
- #define __NR_ftruncate64 46
- #define __NR_futex 98
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-index 0ac2992028..497299fbc4 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
-@@ -92,6 +92,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 221
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 290
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 260
-diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-index c890bc644e..e840279f17 100644
---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
-@@ -81,6 +81,7 @@
- #define __NR_ftime 35
- #define __NR_ftruncate 93
- #define __NR_futex 221
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 290
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 260
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-index cd336d755a..73ef74c005 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
-@@ -60,6 +60,7 @@
- #define __NR_fsync 82
- #define __NR_ftruncate64 46
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-index 8edd21620b..919a79ee91 100644
---- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
-@@ -62,6 +62,7 @@
- #define __NR_fsync 82
- #define __NR_ftruncate 46
- #define __NR_futex 98
-+#define __NR_futex_waitv 449
- #define __NR_get_mempolicy 236
- #define __NR_get_robust_list 100
- #define __NR_getcpu 168
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-index 1a4873f505..005c0ada7a 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
-@@ -91,6 +91,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 238
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 292
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 269
-diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-index 2af4607c1d..9131fddcc1 100644
---- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
-@@ -76,6 +76,7 @@
- #define __NR_fsync 118
- #define __NR_ftruncate 93
- #define __NR_futex 238
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 292
- #define __NR_get_kernel_syms 130
- #define __NR_get_mempolicy 269
-diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-index 7b422ce268..d8fb041568 100644
---- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
-@@ -90,6 +90,7 @@
- #define __NR_ftruncate64 194
- #define __NR_futex 240
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 299
- #define __NR_get_mempolicy 275
- #define __NR_get_robust_list 312
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-index 77c3cc64f9..2bc014fe6a 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
-@@ -92,6 +92,7 @@
- #define __NR_ftruncate64 84
- #define __NR_futex 142
- #define __NR_futex_time64 422
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 288
- #define __NR_get_kernel_syms 223
- #define __NR_get_mempolicy 304
-diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-index 7ad50bc4ad..76dbbe595f 100644
---- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
-@@ -82,6 +82,7 @@
- #define __NR_fsync 95
- #define __NR_ftruncate 130
- #define __NR_futex 142
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 288
- #define __NR_get_kernel_syms 223
- #define __NR_get_mempolicy 304
-diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
-index 1a74d090b7..0bc2af37df 100644
---- a/sysdeps/unix/sysv/linux/syscall-names.list
-+++ b/sysdeps/unix/sysv/linux/syscall-names.list
-@@ -21,8 +21,8 @@
- # This file can list all potential system calls. The names are only
- # used if the installed kernel headers also provide them.
-
--# The list of system calls is current as of Linux 5.15.
--kernel 5.15
-+# The list of system calls is current as of Linux 5.16.
-+kernel 5.16
-
- FAST_atomic_update
- FAST_cmpxchg
-@@ -146,6 +146,7 @@ ftruncate
- ftruncate64
- futex
- futex_time64
-+futex_waitv
- futimesat
- get_kernel_syms
- get_mempolicy
-diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-index 3ce2a1fcfc..28558279b4 100644
---- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
-@@ -78,6 +78,7 @@
- #define __NR_fsync 74
- #define __NR_ftruncate 77
- #define __NR_futex 202
-+#define __NR_futex_waitv 449
- #define __NR_futimesat 261
- #define __NR_get_kernel_syms 177
- #define __NR_get_mempolicy 239
-diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-index 9e87e89bac..c1ab8ec45e 100644
---- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
-@@ -74,6 +74,7 @@
- #define __NR_fsync 1073741898
- #define __NR_ftruncate 1073741901
- #define __NR_futex 1073742026
-+#define __NR_futex_waitv 1073742273
- #define __NR_futimesat 1073742085
- #define __NR_get_mempolicy 1073742063
- #define __NR_get_robust_list 1073742355
---
-2.35.0
-
diff --git a/0075-Disable-debuginfod-in-printer-tests-BZ-28757.patch b/0075-Disable-debuginfod-in-printer-tests-BZ-28757.patch
deleted file mode 100644
index 28348fa..0000000
--- a/0075-Disable-debuginfod-in-printer-tests-BZ-28757.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 03e6e02e6a216cfb913f49b3be80d5088603864f Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sun, 9 Jan 2022 09:06:15 -0800
-Subject: [PATCH 75/93] Disable debuginfod in printer tests [BZ #28757]
-
-With gdb-11.1-6.fc35.x86_64, I got
-
-FAIL: nptl/test-cond-printers
-FAIL: nptl/test-condattr-printers
-FAIL: nptl/test-mutex-printers
-FAIL: nptl/test-mutexattr-printers
-FAIL: nptl/test-rwlock-printers
-FAIL: nptl/test-rwlockattr-printers
-
-$ cat nptl/test-condattr-printers.out
-Error: Response does not match the expected pattern.
-Command: start
-Expected pattern: main
-Response: Temporary breakpoint 1 at 0x11d5: file test-condattr-printers.c, line 43.
-Starting program: /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/nptl/test-condattr-printers
-
-This GDB supports auto-downloading debuginfo from the following URLs:
-https://debuginfod.fedoraproject.org/
-Enable debuginfod for this session? (y or [n])
-
-Disable debuginfod to avoid GDB messages. This fixes BZ #28757.
-
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit 7de501f9418bf099e7104b63b0e4423257981b14)
----
- scripts/test_printers_common.py | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py
-index 34a3df6e6b..53b6d30d40 100644
---- a/scripts/test_printers_common.py
-+++ b/scripts/test_printers_common.py
-@@ -161,6 +161,17 @@ def init_test(test_bin, printer_files, printer_names):
- printer files.
- """
-
-+ # Disable debuginfod to avoid GDB messages like:
-+ #
-+ # This GDB supports auto-downloading debuginfo from the following URLs:
-+ # https://debuginfod.fedoraproject.org/
-+ # Enable debuginfod for this session? (y or [n])
-+ #
-+ try:
-+ test('set debuginfod enabled off')
-+ except Exception:
-+ pass
-+
- # Load all the pretty printer files. We're assuming these are safe.
- for printer_file in printer_files:
- test('source {0}'.format(printer_file))
---
-2.35.0
-
diff --git a/0076-socket-Add-the-__sockaddr_un_set-function.patch b/0076-socket-Add-the-__sockaddr_un_set-function.patch
deleted file mode 100644
index a51ab66..0000000
--- a/0076-socket-Add-the-__sockaddr_un_set-function.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-From 5575daae5099e779bb860b566b4d608418a5b832 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 17 Jan 2022 10:21:34 +0100
-Subject: [PATCH 76/93] socket: Add the __sockaddr_un_set function
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit e368b12f6c16b6888dda99ba641e999b9c9643c8)
----
- include/sys/un.h | 12 +++++++
- socket/Makefile | 6 +++-
- socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++
- socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++
- 4 files changed, 120 insertions(+), 1 deletion(-)
- create mode 100644 socket/sockaddr_un_set.c
- create mode 100644 socket/tst-sockaddr_un_set.c
-
-diff --git a/include/sys/un.h b/include/sys/un.h
-index bdbee99980..152afd9fc7 100644
---- a/include/sys/un.h
-+++ b/include/sys/un.h
-@@ -1 +1,13 @@
- #include <socket/sys/un.h>
-+
-+#ifndef _ISOMAC
-+
-+/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME.
-+ Return 0 on success or -1 on failure (due to overlong PATHNAME).
-+ The caller should always use sizeof (struct sockaddr_un) as the
-+ socket address length, disregaring the length of PATHNAME.
-+ Only concrete (non-abstract) pathnames are supported. */
-+int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
-+ attribute_hidden;
-+
-+#endif /* _ISOMAC */
-diff --git a/socket/Makefile b/socket/Makefile
-index 3759576010..c2de11d73c 100644
---- a/socket/Makefile
-+++ b/socket/Makefile
-@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
- routines := accept bind connect getpeername getsockname getsockopt \
- listen recv recvfrom recvmsg send sendmsg sendto \
- setsockopt shutdown socket socketpair isfdtype opensock \
-- sockatmark accept4 recvmmsg sendmmsg
-+ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set
-
- tests := \
- tst-accept4 \
- tst-sockopt \
- # tests
-
-+tests-internal := \
-+ tst-sockaddr_un_set \
-+ # tests-internal
-+
- tests-time64 := \
- tst-sockopt-time64 \
- # tests
-diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c
-new file mode 100644
-index 0000000000..0bd40dc34e
---- /dev/null
-+++ b/socket/sockaddr_un_set.c
-@@ -0,0 +1,41 @@
-+/* Set the sun_path member of struct sockaddr_un.
-+ Copyright (C) 2022 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <string.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+
-+int
-+__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
-+{
-+ size_t name_length = strlen (pathname);
-+
-+ /* The kernel supports names of exactly sizeof (addr->sun_path)
-+ bytes, without a null terminator, but userspace does not; see the
-+ SUN_LEN macro. */
-+ if (name_length >= sizeof (addr->sun_path))
-+ {
-+ __set_errno (EINVAL); /* Error code used by the kernel. */
-+ return -1;
-+ }
-+
-+ addr->sun_family = AF_UNIX;
-+ memcpy (addr->sun_path, pathname, name_length + 1);
-+ return 0;
-+}
-diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c
-new file mode 100644
-index 0000000000..29c2a81afd
---- /dev/null
-+++ b/socket/tst-sockaddr_un_set.c
-@@ -0,0 +1,62 @@
-+/* Test the __sockaddr_un_set function.
-+ Copyright (C) 2022 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+/* Re-compile the function because the version in libc is not
-+ exported. */
-+#include "sockaddr_un_set.c"
-+
-+#include <support/check.h>
-+
-+static int
-+do_test (void)
-+{
-+ struct sockaddr_un sun;
-+
-+ memset (&sun, 0xcc, sizeof (sun));
-+ __sockaddr_un_set (&sun, "");
-+ TEST_COMPARE (sun.sun_family, AF_UNIX);
-+ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0);
-+
-+ memset (&sun, 0xcc, sizeof (sun));
-+ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0);
-+ TEST_COMPARE_STRING (sun.sun_path, "/example");
-+
-+ {
-+ char pathname[108]; /* Length of sun_path (ABI constant). */
-+ memset (pathname, 'x', sizeof (pathname));
-+ pathname[sizeof (pathname) - 1] = '\0';
-+ memset (&sun, 0xcc, sizeof (sun));
-+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0);
-+ TEST_COMPARE (sun.sun_family, AF_UNIX);
-+ TEST_COMPARE_STRING (sun.sun_path, pathname);
-+ }
-+
-+ {
-+ char pathname[109];
-+ memset (pathname, 'x', sizeof (pathname));
-+ pathname[sizeof (pathname) - 1] = '\0';
-+ memset (&sun, 0xcc, sizeof (sun));
-+ errno = 0;
-+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1);
-+ TEST_COMPARE (errno, EINVAL);
-+ }
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0077-CVE-2022-23219-Buffer-overflow-in-sunrpc-clnt_create.patch b/0077-CVE-2022-23219-Buffer-overflow-in-sunrpc-clnt_create.patch
deleted file mode 100644
index 4461ecc..0000000
--- a/0077-CVE-2022-23219-Buffer-overflow-in-sunrpc-clnt_create.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 7b5d433fd097b8ed74e458eca33597290e07b974 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 17 Jan 2022 10:21:34 +0100
-Subject: [PATCH 77/93] CVE-2022-23219: Buffer overflow in sunrpc clnt_create
- for "unix" (bug 22542)
-
-Processing an overlong pathname in the sunrpc clnt_create function
-results in a stack-based buffer overflow.
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 226b46770c82899b555986583294b049c6ec9b40)
----
- NEWS | 7 +++++++
- sunrpc/clnt_gen.c | 10 +++++++---
- 2 files changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 759a80b1b5..1b8c871de1 100644
---- a/NEWS
-+++ b/NEWS
-@@ -7,10 +7,17 @@ using `glibc' in the "product" field.
-
- Version 2.34.1
-
-+Security related changes:
-+
-+ CVE-2022-23219: Passing an overlong file name to the clnt_create
-+ legacy function could result in a stack-based buffer overflow when
-+ using the "unix" protocol. Reported by Martin Sebor.
-+
- The following bugs are resolved with this release:
-
- [12889] nptl: Fix race between pthread_kill and thread exit
- [19193] nptl: pthread_kill, pthread_cancel should not fail after exit
-+ [22542] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix"
- [28036] Incorrect types for pthread_mutexattr_set/getrobust_np
- [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
- [28223] mips: clone does not align stack
-diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
-index 13ced8994e..b44357cd88 100644
---- a/sunrpc/clnt_gen.c
-+++ b/sunrpc/clnt_gen.c
-@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
-
- if (strcmp (proto, "unix") == 0)
- {
-- memset ((char *)&sun, 0, sizeof (sun));
-- sun.sun_family = AF_UNIX;
-- strcpy (sun.sun_path, hostname);
-+ if (__sockaddr_un_set (&sun, hostname) < 0)
-+ {
-+ struct rpc_createerr *ce = &get_rpc_createerr ();
-+ ce->cf_stat = RPC_SYSTEMERROR;
-+ ce->cf_error.re_errno = errno;
-+ return NULL;
-+ }
- sock = RPC_ANYSOCK;
- client = clntunix_create (&sun, prog, vers, &sock, 0, 0);
- if (client == NULL)
---
-2.35.0
-
diff --git a/0078-sunrpc-Test-case-for-clnt_create-unix-buffer-overflo.patch b/0078-sunrpc-Test-case-for-clnt_create-unix-buffer-overflo.patch
deleted file mode 100644
index e1ff3f9..0000000
--- a/0078-sunrpc-Test-case-for-clnt_create-unix-buffer-overflo.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 1081f1d3dd7c84ba3416b5198d47a4df2b70185d Mon Sep 17 00:00:00 2001
-From: Martin Sebor <msebor@redhat.com>
-Date: Mon, 17 Jan 2022 10:21:34 +0100
-Subject: [PATCH 78/93] sunrpc: Test case for clnt_create "unix" buffer
- overflow (bug 22542)
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit ef972a4c50014a16132b5c75571cfb6b30bef136)
----
- sunrpc/Makefile | 5 ++++-
- sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 48 insertions(+), 1 deletion(-)
- create mode 100644 sunrpc/tst-bug22542.c
-
-diff --git a/sunrpc/Makefile b/sunrpc/Makefile
-index 7e5bbfd951..a4281b18d0 100644
---- a/sunrpc/Makefile
-+++ b/sunrpc/Makefile
-@@ -65,7 +65,8 @@ shared-only-routines = $(routines)
- endif
-
- tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
-- tst-udp-nonblocking
-+ tst-udp-nonblocking tst-bug22542
-+
- xtests := tst-getmyaddr
-
- ifeq ($(have-thread-library),yes)
-@@ -110,6 +111,8 @@ $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
- $(objpfx)tst-udp-garbage: \
- $(common-objpfx)linkobj/libc.so $(shared-thread-library)
-
-+$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so
-+
- else # !have-GLIBC_2.31
-
- routines = $(routines-for-nss)
-diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c
-new file mode 100644
-index 0000000000..d6cd79787b
---- /dev/null
-+++ b/sunrpc/tst-bug22542.c
-@@ -0,0 +1,44 @@
-+/* Test to verify that overlong hostname is rejected by clnt_create
-+ and doesn't cause a buffer overflow (bug 22542).
-+
-+ Copyright (C) 2022 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <rpc/clnt.h>
-+#include <string.h>
-+#include <support/check.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+
-+static int
-+do_test (void)
-+{
-+ /* Create an arbitrary hostname that's longer than fits in sun_path. */
-+ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2];
-+ memset (name, 'x', sizeof name - 1);
-+ name [sizeof name - 1] = '\0';
-+
-+ errno = 0;
-+ CLIENT *clnt = clnt_create (name, 0, 0, "unix");
-+
-+ TEST_VERIFY (clnt == NULL);
-+ TEST_COMPARE (errno, EINVAL);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0079-CVE-2022-23218-Buffer-overflow-in-sunrpc-svcunix_cre.patch b/0079-CVE-2022-23218-Buffer-overflow-in-sunrpc-svcunix_cre.patch
deleted file mode 100644
index 92efea3..0000000
--- a/0079-CVE-2022-23218-Buffer-overflow-in-sunrpc-svcunix_cre.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From 6890b8a3ae40ab9d4c96024ab95b04816fcc8a4a Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 17 Jan 2022 11:49:25 +0100
-Subject: [PATCH 79/93] CVE-2022-23218: Buffer overflow in sunrpc
- svcunix_create (bug 28768)
-
-The sunrpc function svcunix_create suffers from a stack-based buffer
-overflow with overlong pathname arguments.
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit f545ad4928fa1f27a3075265182b38a4f939a5f7)
----
- NEWS | 4 ++++
- sunrpc/Makefile | 2 +-
- sunrpc/svc_unix.c | 11 ++++-------
- sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 51 insertions(+), 8 deletions(-)
- create mode 100644 sunrpc/tst-bug28768.c
-
-diff --git a/NEWS b/NEWS
-index 1b8c871de1..58c6ae84fb 100644
---- a/NEWS
-+++ b/NEWS
-@@ -13,6 +13,9 @@ Security related changes:
- legacy function could result in a stack-based buffer overflow when
- using the "unix" protocol. Reported by Martin Sebor.
-
-+ CVE-2022-23218: Passing an overlong file name to the svcunix_create
-+ legacy function could result in a stack-based buffer overflow.
-+
- The following bugs are resolved with this release:
-
- [12889] nptl: Fix race between pthread_kill and thread exit
-@@ -38,6 +41,7 @@ The following bugs are resolved with this release:
- [28707] assert in tzfile.c __tzfile_read striking with truncated timezones
- [28744] A64FX string functions are selected without SVE HWCAP
- [28771] %ebx optimization macros are incompatible with .altmacro
-+ [28768] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create
-
-
- Version 2.34
-diff --git a/sunrpc/Makefile b/sunrpc/Makefile
-index a4281b18d0..6408ab5c07 100644
---- a/sunrpc/Makefile
-+++ b/sunrpc/Makefile
-@@ -65,7 +65,7 @@ shared-only-routines = $(routines)
- endif
-
- tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
-- tst-udp-nonblocking tst-bug22542
-+ tst-udp-nonblocking tst-bug22542 tst-bug28768
-
- xtests := tst-getmyaddr
-
-diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
-index 679fbe9cb6..46f8d16fe9 100644
---- a/sunrpc/svc_unix.c
-+++ b/sunrpc/svc_unix.c
-@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
- SVCXPRT *xprt;
- struct unix_rendezvous *r;
- struct sockaddr_un addr;
-- socklen_t len = sizeof (struct sockaddr_in);
-+ socklen_t len = sizeof (addr);
-+
-+ if (__sockaddr_un_set (&addr, path) < 0)
-+ return NULL;
-
- if (sock == RPC_ANYSOCK)
- {
-@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
- }
- madesock = TRUE;
- }
-- memset (&addr, '\0', sizeof (addr));
-- addr.sun_family = AF_UNIX;
-- len = strlen (path) + 1;
-- memcpy (addr.sun_path, path, len);
-- len += sizeof (addr.sun_family);
--
- __bind (sock, (struct sockaddr *) &addr, len);
-
- if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
-diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c
-new file mode 100644
-index 0000000000..35a4b7b0b3
---- /dev/null
-+++ b/sunrpc/tst-bug28768.c
-@@ -0,0 +1,42 @@
-+/* Test to verify that long path is rejected by svcunix_create (bug 28768).
-+ Copyright (C) 2022 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <rpc/svc.h>
-+#include <shlib-compat.h>
-+#include <string.h>
-+#include <support/check.h>
-+
-+/* svcunix_create does not have a default version in linkobj/libc.so. */
-+compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1);
-+
-+static int
-+do_test (void)
-+{
-+ char pathname[109];
-+ memset (pathname, 'x', sizeof (pathname));
-+ pathname[sizeof (pathname) - 1] = '\0';
-+
-+ errno = 0;
-+ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL);
-+ TEST_COMPARE (errno, EINVAL);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0080-x86-use-default-cache-size-if-it-cannot-be-determine.patch b/0080-x86-use-default-cache-size-if-it-cannot-be-determine.patch
deleted file mode 100644
index f0205ee..0000000
--- a/0080-x86-use-default-cache-size-if-it-cannot-be-determine.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 1d401d1fccb85046402089268b94d86d822070e6 Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Mon, 17 Jan 2022 19:41:40 +0100
-Subject: [PATCH 80/93] x86: use default cache size if it cannot be determined
- [BZ #28784]
-
-In some cases (e.g QEMU, non-Intel/AMD CPU) the cache information can
-not be retrieved and the corresponding values are set to 0.
-
-Commit 2d651eb9265d ("x86: Move x86 processor cache info to
-cpu_features") changed the behaviour in such case by defining the
-__x86_shared_cache_size and __x86_data_cache_size variables to 0 instead
-of using the default values. This cause an issue with the i686 SSE2
-optimized bzero/routine which assumes that the cache size is at least
-128 bytes, and otherwise tries to zero/set the whole address space minus
-128 bytes.
-
-Fix that by restoring the original code to only update
-__x86_shared_cache_size and __x86_data_cache_size variables if the
-corresponding cache sizes are not zero.
-
-Fixes bug 28784
-Fixes commit 2d651eb9265d
-
-Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-(cherry picked from commit c242fcce06e3102ca663b2f992611d0bda4f2668)
----
- NEWS | 1 +
- sysdeps/x86/cacheinfo.h | 14 ++++++++++----
- 2 files changed, 11 insertions(+), 4 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index 58c6ae84fb..7e773bd005 100644
---- a/NEWS
-+++ b/NEWS
-@@ -42,6 +42,7 @@ The following bugs are resolved with this release:
- [28744] A64FX string functions are selected without SVE HWCAP
- [28771] %ebx optimization macros are incompatible with .altmacro
- [28768] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create
-+ [28784] x86: crash in 32bit memset-sse2.s when the cache size can not be determined
-
-
- Version 2.34
-diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
-index 41d2c81369..63f36877e3 100644
---- a/sysdeps/x86/cacheinfo.h
-+++ b/sysdeps/x86/cacheinfo.h
-@@ -61,14 +61,20 @@ init_cacheinfo (void)
- long int data = cpu_features->data_cache_size;
- /* Round data cache size to multiple of 256 bytes. */
- data = data & ~255L;
-- __x86_data_cache_size_half = data / 2;
-- __x86_data_cache_size = data;
-+ if (data > 0)
-+ {
-+ __x86_data_cache_size_half = data / 2;
-+ __x86_data_cache_size = data;
-+ }
-
- long int shared = cpu_features->shared_cache_size;
- /* Round shared cache size to multiple of 256 bytes. */
- shared = shared & ~255L;
-- __x86_shared_cache_size_half = shared / 2;
-- __x86_shared_cache_size = shared;
-+ if (shared > 0)
-+ {
-+ __x86_shared_cache_size_half = shared / 2;
-+ __x86_shared_cache_size = shared;
-+ }
-
- __x86_shared_non_temporal_threshold
- = cpu_features->non_temporal_threshold;
---
-2.35.0
-
diff --git a/0081-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch b/0081-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
deleted file mode 100644
index 755d009..0000000
--- a/0081-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 82b1acd9de9796298a230d7484f26fe9a7756d18 Mon Sep 17 00:00:00 2001
-From: "Paul A. Clarke" <pc@us.ibm.com>
-Date: Sat, 25 Sep 2021 09:57:15 -0500
-Subject: [PATCH 81/93] powerpc: Fix unrecognized instruction errors with
- recent binutils
-
-Recent versions of binutils (with commit
-b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a) stopped preserving "sticky"
-options across a base `.machine` directive, nullifying the use of
-passing "-many" through GCC to the assembler. As a result, some
-instructions which were recognized even under older, more stringent
-`.machine` directives become unrecognized instructions in that
-context.
-
-In `sysdeps/powerpc/tst-set_ppr.c`, the use of the `mfppr32` extended
-mnemonic became unrecognized, as the default compilation with GCC for
-32bit powerpc adds a `.machine ppc` in the resulting assembly, so the
-command line option `-Wa,-many` is essentially ignored, and the ISA 2.06
-instructions and mnemonics, like `mfppr32`, are unrecognized.
-
-The compilation of `sysdeps/powerpc/tst-set_ppr.c` fails with:
-Error: unrecognized opcode: `mfppr32'
-
-Add appropriate `.machine` directives in the assembly to bracket the
-`mfppr32` instruction.
-
-Part of a 2019 fix (commit 9250e6610fdb0f3a6f238d2813e319a41fb7a810) to
-the above test's Makefile to add `-many` to the compilation when GCC
-itself stopped passing `-many` to the assember no longer has any effect,
-so remove that.
-
-Reported-by: Joseph Myers <joseph@codesourcery.com>
-(cherry picked from commit ee874f44fd55988808a4a162ef21bfa2cc8dc6f7)
----
- sysdeps/powerpc/Makefile | 5 -----
- sysdeps/powerpc/tst-set_ppr.c | 3 ++-
- 2 files changed, 2 insertions(+), 6 deletions(-)
-
-diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
-index 09860ffc01..5e6cb07ce6 100644
---- a/sysdeps/powerpc/Makefile
-+++ b/sysdeps/powerpc/Makefile
-@@ -61,11 +61,6 @@ ifeq ($(subdir),misc)
- sysdep_headers += sys/platform/ppc.h
- tests += test-gettimebase
- tests += tst-set_ppr
--
--# This test is expected to run and exit with EXIT_UNSUPPORTED on
--# processors that do not implement the Power ISA 2.06 or greater.
--# But the test makes use of instructions from Power ISA 2.06 and 2.07.
--CFLAGS-tst-set_ppr.c += -Wa,-many
- endif
-
- ifeq ($(subdir),wcsmbs)
-diff --git a/sysdeps/powerpc/tst-set_ppr.c b/sysdeps/powerpc/tst-set_ppr.c
-index 7684f5d6ea..e80da15320 100644
---- a/sysdeps/powerpc/tst-set_ppr.c
-+++ b/sysdeps/powerpc/tst-set_ppr.c
-@@ -44,7 +44,8 @@ get_thread_priority (void)
- {
- /* Read the PPR. */
- ppr_t ppr;
-- asm volatile (MFPPR" %0" : "=r"(ppr));
-+ asm volatile (".machine push; .machine power7; "MFPPR" %0; .machine pop"
-+ : "=r"(ppr));
- /* Return the thread priority value. */
- return EXTRACT_THREAD_PRIORITY (ppr);
- }
---
-2.35.0
-
diff --git a/0082-support-Add-helpers-to-create-paths-longer-than-PATH.patch b/0082-support-Add-helpers-to-create-paths-longer-than-PATH.patch
deleted file mode 100644
index b1e93c5..0000000
--- a/0082-support-Add-helpers-to-create-paths-longer-than-PATH.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-From 062ff490c1467059f6cd64bb9c3d85f6cc6cf97a Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Tue, 18 Jan 2022 13:29:36 +0530
-Subject: [PATCH 82/93] support: Add helpers to create paths longer than
- PATH_MAX
-
-Add new helpers support_create_and_chdir_toolong_temp_directory and
-support_chdir_toolong_temp_directory to create and descend into
-directory trees longer than PATH_MAX.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit fb7bff12e81c677a6622f724edd4d4987dd9d971)
----
- support/temp_file.c | 161 +++++++++++++++++++++++++++++++++++++++++---
- support/temp_file.h | 9 +++
- 2 files changed, 160 insertions(+), 10 deletions(-)
-
-diff --git a/support/temp_file.c b/support/temp_file.c
-index c6df641876..e41128c2d4 100644
---- a/support/temp_file.c
-+++ b/support/temp_file.c
-@@ -1,5 +1,6 @@
- /* Temporary file handling for tests.
-- Copyright (C) 1998-2021 Free Software Foundation, Inc.
-+ Copyright (C) 1998-2022 Free Software Foundation, Inc.
-+ Copyright The GNU Tools Authors.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
-@@ -20,15 +21,17 @@
- some 32-bit platforms. */
- #define _FILE_OFFSET_BITS 64
-
-+#include <support/check.h>
- #include <support/temp_file.h>
- #include <support/temp_file-internal.h>
- #include <support/support.h>
-
-+#include <errno.h>
- #include <paths.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
--#include <unistd.h>
-+#include <xunistd.h>
-
- /* List of temporary files. */
- static struct temp_name_list
-@@ -36,14 +39,20 @@ static struct temp_name_list
- struct temp_name_list *next;
- char *name;
- pid_t owner;
-+ bool toolong;
- } *temp_name_list;
-
- /* Location of the temporary files. Set by the test skeleton via
- support_set_test_dir. The string is not be freed. */
- static const char *test_dir = _PATH_TMP;
-
--void
--add_temp_file (const char *name)
-+/* Name of subdirectories in a too long temporary directory tree. */
-+static char toolong_subdir[NAME_MAX + 1];
-+static bool toolong_initialized;
-+static size_t toolong_path_max;
-+
-+static void
-+add_temp_file_internal (const char *name, bool toolong)
- {
- struct temp_name_list *newp
- = (struct temp_name_list *) xcalloc (sizeof (*newp), 1);
-@@ -53,12 +62,19 @@ add_temp_file (const char *name)
- newp->name = newname;
- newp->next = temp_name_list;
- newp->owner = getpid ();
-+ newp->toolong = toolong;
- temp_name_list = newp;
- }
- else
- free (newp);
- }
-
-+void
-+add_temp_file (const char *name)
-+{
-+ add_temp_file_internal (name, false);
-+}
-+
- int
- create_temp_file_in_dir (const char *base, const char *dir, char **filename)
- {
-@@ -90,8 +106,8 @@ create_temp_file (const char *base, char **filename)
- return create_temp_file_in_dir (base, test_dir, filename);
- }
-
--char *
--support_create_temp_directory (const char *base)
-+static char *
-+create_temp_directory_internal (const char *base, bool toolong)
- {
- char *path = xasprintf ("%s/%sXXXXXX", test_dir, base);
- if (mkdtemp (path) == NULL)
-@@ -99,16 +115,132 @@ support_create_temp_directory (const char *base)
- printf ("error: mkdtemp (\"%s\"): %m", path);
- exit (1);
- }
-- add_temp_file (path);
-+ add_temp_file_internal (path, toolong);
- return path;
- }
-
--/* Helper functions called by the test skeleton follow. */
-+char *
-+support_create_temp_directory (const char *base)
-+{
-+ return create_temp_directory_internal (base, false);
-+}
-+
-+static void
-+ensure_toolong_initialized (void)
-+{
-+ if (!toolong_initialized)
-+ FAIL_EXIT1 ("uninitialized toolong directory tree\n");
-+}
-+
-+static void
-+initialize_toolong (const char *base)
-+{
-+ long name_max = pathconf (base, _PC_NAME_MAX);
-+ name_max = (name_max < 0 ? 64
-+ : (name_max < sizeof (toolong_subdir) ? name_max
-+ : sizeof (toolong_subdir) - 1));
-+
-+ long path_max = pathconf (base, _PC_PATH_MAX);
-+ path_max = (path_max < 0 ? 1024
-+ : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX);
-+
-+ /* Sanity check to ensure that the test does not create temporary directories
-+ in different filesystems because this API doesn't support it. */
-+ if (toolong_initialized)
-+ {
-+ if (name_max != strlen (toolong_subdir))
-+ FAIL_UNSUPPORTED ("name_max: Temporary directories in different"
-+ " filesystems not supported yet\n");
-+ if (path_max != toolong_path_max)
-+ FAIL_UNSUPPORTED ("path_max: Temporary directories in different"
-+ " filesystems not supported yet\n");
-+ return;
-+ }
-+
-+ toolong_path_max = path_max;
-+
-+ size_t len = name_max;
-+ memset (toolong_subdir, 'X', len);
-+ toolong_initialized = true;
-+}
-+
-+char *
-+support_create_and_chdir_toolong_temp_directory (const char *basename)
-+{
-+ char *base = create_temp_directory_internal (basename, true);
-+ xchdir (base);
-+
-+ initialize_toolong (base);
-+
-+ size_t sz = strlen (toolong_subdir);
-+
-+ /* Create directories and descend into them so that the final path is larger
-+ than PATH_MAX. */
-+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
-+ {
-+ int ret = mkdir (toolong_subdir, S_IRWXU);
-+ if (ret != 0 && errno == ENAMETOOLONG)
-+ FAIL_UNSUPPORTED ("Filesystem does not support creating too long "
-+ "directory trees\n");
-+ else if (ret != 0)
-+ FAIL_EXIT1 ("Failed to create directory tree: %m\n");
-+ xchdir (toolong_subdir);
-+ }
-+ return base;
-+}
-
- void
--support_set_test_dir (const char *path)
-+support_chdir_toolong_temp_directory (const char *base)
- {
-- test_dir = path;
-+ ensure_toolong_initialized ();
-+
-+ xchdir (base);
-+
-+ size_t sz = strlen (toolong_subdir);
-+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
-+ xchdir (toolong_subdir);
-+}
-+
-+/* Helper functions called by the test skeleton follow. */
-+
-+static void
-+remove_toolong_subdirs (const char *base)
-+{
-+ ensure_toolong_initialized ();
-+
-+ if (chdir (base) != 0)
-+ {
-+ printf ("warning: toolong cleanup base failed: chdir (\"%s\"): %m\n",
-+ base);
-+ return;
-+ }
-+
-+ /* Descend. */
-+ int levels = 0;
-+ size_t sz = strlen (toolong_subdir);
-+ for (levels = 0; levels <= toolong_path_max / sz; levels++)
-+ if (chdir (toolong_subdir) != 0)
-+ {
-+ printf ("warning: toolong cleanup failed: chdir (\"%s\"): %m\n",
-+ toolong_subdir);
-+ break;
-+ }
-+
-+ /* Ascend and remove. */
-+ while (--levels >= 0)
-+ {
-+ if (chdir ("..") != 0)
-+ {
-+ printf ("warning: toolong cleanup failed: chdir (\"..\"): %m\n");
-+ return;
-+ }
-+ if (remove (toolong_subdir) != 0)
-+ {
-+ printf ("warning: could not remove subdirectory: %s: %m\n",
-+ toolong_subdir);
-+ return;
-+ }
-+ }
- }
-
- void
-@@ -123,6 +255,9 @@ support_delete_temp_files (void)
- around, to prevent PID reuse.) */
- if (temp_name_list->owner == pid)
- {
-+ if (temp_name_list->toolong)
-+ remove_toolong_subdirs (temp_name_list->name);
-+
- if (remove (temp_name_list->name) != 0)
- printf ("warning: could not remove temporary file: %s: %m\n",
- temp_name_list->name);
-@@ -147,3 +282,9 @@ support_print_temp_files (FILE *f)
- fprintf (f, ")\n");
- }
- }
-+
-+void
-+support_set_test_dir (const char *path)
-+{
-+ test_dir = path;
-+}
-diff --git a/support/temp_file.h b/support/temp_file.h
-index f3a7fb6f9c..a22964c6fa 100644
---- a/support/temp_file.h
-+++ b/support/temp_file.h
-@@ -44,6 +44,15 @@ int create_temp_file_in_dir (const char *base, const char *dir,
- returns. The caller should free this string. */
- char *support_create_temp_directory (const char *base);
-
-+/* Create a temporary directory tree that is longer than PATH_MAX and schedule
-+ it for deletion. BASENAME is used as a prefix for the unique directory
-+ name, which the function returns. The caller should free this string. */
-+char *support_create_and_chdir_toolong_temp_directory (const char *basename);
-+
-+/* Change into the innermost directory of the directory tree BASE, which was
-+ created using support_create_and_chdir_toolong_temp_directory. */
-+void support_chdir_toolong_temp_directory (const char *base);
-+
- __END_DECLS
-
- #endif /* SUPPORT_TEMP_FILE_H */
---
-2.35.0
-
diff --git a/0083-stdlib-Sort-tests-in-Makefile.patch b/0083-stdlib-Sort-tests-in-Makefile.patch
deleted file mode 100644
index 349c28a..0000000
--- a/0083-stdlib-Sort-tests-in-Makefile.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From 269eb9d930546ce57e83b56c44c430f154684a23 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Thu, 13 Jan 2022 10:34:37 +0530
-Subject: [PATCH 83/93] stdlib: Sort tests in Makefile
-
-Put one test per line and sort them.
-
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 5b766603efa727c236a5f0cdcf09b71ff60b7584)
----
- stdlib/Makefile | 99 +++++++++++++++++++++++++++++++++++++------------
- 1 file changed, 75 insertions(+), 24 deletions(-)
-
-diff --git a/stdlib/Makefile b/stdlib/Makefile
-index 7c15549caf..6a1c3580bd 100644
---- a/stdlib/Makefile
-+++ b/stdlib/Makefile
-@@ -65,30 +65,81 @@ aux = grouping groupingwc tens_in_limb
- static-only-routines = atexit at_quick_exit
-
- test-srcs := tst-fmtmsg
--tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
-- test-canon test-canon2 tst-strtoll tst-environ \
-- tst-xpg-basename tst-random tst-random2 tst-bsearch \
-- tst-limits tst-rand48 bug-strtod tst-setcontext \
-- tst-setcontext2 test-a64l tst-qsort testmb2 \
-- bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 \
-- tst-rand48-2 tst-makecontext tst-strtod5 \
-- tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1 \
-- tst-makecontext3 bug-getcontext bug-fmtmsg1 \
-- tst-secure-getenv tst-strtod-overflow tst-strtod-round \
-- tst-tininess tst-strtod-underflow tst-setcontext3 \
-- tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l \
-- tst-quick_exit tst-thread-quick_exit tst-width \
-- tst-width-stdint tst-strfrom tst-strfrom-locale \
-- tst-getrandom tst-atexit tst-at_quick_exit \
-- tst-cxa_atexit tst-on_exit test-atexit-race \
-- test-at_quick_exit-race test-cxa_atexit-race \
-- test-cxa_atexit-race2 \
-- test-on_exit-race test-dlclose-exit-race \
-- tst-makecontext-align test-bz22786 tst-strtod-nan-sign \
-- tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
-- tst-setcontext6 tst-setcontext7 tst-setcontext8 \
-- tst-setcontext9 tst-bz20544 tst-canon-bz26341 \
-- tst-realpath
-+tests := bug-fmtmsg1 \
-+ bug-getcontext \
-+ bug-strtod \
-+ bug-strtod2 \
-+ test-a64l \
-+ test-at_quick_exit-race \
-+ test-atexit-race \
-+ test-bz22786 \
-+ test-canon \
-+ test-canon2 \
-+ test-cxa_atexit-race \
-+ test-cxa_atexit-race2 \
-+ test-dlclose-exit-race \
-+ test-on_exit-race \
-+ testdiv \
-+ testmb \
-+ testmb2 \
-+ testrand \
-+ testsort \
-+ tst-at_quick_exit \
-+ tst-atexit \
-+ tst-atof1 \
-+ tst-atof2 \
-+ tst-bsearch \
-+ tst-bz20544 \
-+ tst-canon-bz26341 \
-+ tst-cxa_atexit \
-+ tst-environ \
-+ tst-getrandom \
-+ tst-limits \
-+ tst-makecontext \
-+ tst-makecontext-align \
-+ tst-makecontext2 \
-+ tst-makecontext3 \
-+ tst-on_exit \
-+ tst-qsort \
-+ tst-qsort2 \
-+ tst-quick_exit \
-+ tst-rand48 \
-+ tst-rand48-2 \
-+ tst-random \
-+ tst-random2 \
-+ tst-realpath \
-+ tst-secure-getenv \
-+ tst-setcontext \
-+ tst-setcontext2 \
-+ tst-setcontext3 \
-+ tst-setcontext4 \
-+ tst-setcontext5 \
-+ tst-setcontext6 \
-+ tst-setcontext7 \
-+ tst-setcontext8 \
-+ tst-setcontext9 \
-+ tst-strfmon_l \
-+ tst-strfrom \
-+ tst-strfrom-locale \
-+ tst-strtod \
-+ tst-strtod-nan-locale \
-+ tst-strtod-nan-sign \
-+ tst-strtod-overflow \
-+ tst-strtod-round \
-+ tst-strtod-underflow \
-+ tst-strtod2 \
-+ tst-strtod5 \
-+ tst-strtod6 \
-+ tst-strtol \
-+ tst-strtol-locale \
-+ tst-strtoll \
-+ tst-swapcontext1 \
-+ tst-thread-quick_exit \
-+ tst-tininess \
-+ tst-unsetenv1 \
-+ tst-width \
-+ tst-width-stdint \
-+ tst-xpg-basename
-
- tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
- tst-tls-atexit tst-tls-atexit-nodelete
---
-2.35.0
-
diff --git a/0084-stdlib-Fix-formatting-of-tests-list-in-Makefile.patch b/0084-stdlib-Fix-formatting-of-tests-list-in-Makefile.patch
deleted file mode 100644
index b1baf32..0000000
--- a/0084-stdlib-Fix-formatting-of-tests-list-in-Makefile.patch
+++ /dev/null
@@ -1,178 +0,0 @@
-From 73c362840c4efde45125a6c27bf41726397f4038 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Thu, 13 Jan 2022 18:50:55 +0530
-Subject: [PATCH 84/93] stdlib: Fix formatting of tests list in Makefile
-
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Reviewed-by: Florian Weimer <fweimer@redhat.com>
-(cherry picked from commit f9dab1b5f23d0fb008a56c7c6c8919adb49d3611)
----
- stdlib/Makefile | 152 ++++++++++++++++++++++++------------------------
- 1 file changed, 77 insertions(+), 75 deletions(-)
-
-diff --git a/stdlib/Makefile b/stdlib/Makefile
-index 6a1c3580bd..9bb5c221e8 100644
---- a/stdlib/Makefile
-+++ b/stdlib/Makefile
-@@ -65,81 +65,83 @@ aux = grouping groupingwc tens_in_limb
- static-only-routines = atexit at_quick_exit
-
- test-srcs := tst-fmtmsg
--tests := bug-fmtmsg1 \
-- bug-getcontext \
-- bug-strtod \
-- bug-strtod2 \
-- test-a64l \
-- test-at_quick_exit-race \
-- test-atexit-race \
-- test-bz22786 \
-- test-canon \
-- test-canon2 \
-- test-cxa_atexit-race \
-- test-cxa_atexit-race2 \
-- test-dlclose-exit-race \
-- test-on_exit-race \
-- testdiv \
-- testmb \
-- testmb2 \
-- testrand \
-- testsort \
-- tst-at_quick_exit \
-- tst-atexit \
-- tst-atof1 \
-- tst-atof2 \
-- tst-bsearch \
-- tst-bz20544 \
-- tst-canon-bz26341 \
-- tst-cxa_atexit \
-- tst-environ \
-- tst-getrandom \
-- tst-limits \
-- tst-makecontext \
-- tst-makecontext-align \
-- tst-makecontext2 \
-- tst-makecontext3 \
-- tst-on_exit \
-- tst-qsort \
-- tst-qsort2 \
-- tst-quick_exit \
-- tst-rand48 \
-- tst-rand48-2 \
-- tst-random \
-- tst-random2 \
-- tst-realpath \
-- tst-secure-getenv \
-- tst-setcontext \
-- tst-setcontext2 \
-- tst-setcontext3 \
-- tst-setcontext4 \
-- tst-setcontext5 \
-- tst-setcontext6 \
-- tst-setcontext7 \
-- tst-setcontext8 \
-- tst-setcontext9 \
-- tst-strfmon_l \
-- tst-strfrom \
-- tst-strfrom-locale \
-- tst-strtod \
-- tst-strtod-nan-locale \
-- tst-strtod-nan-sign \
-- tst-strtod-overflow \
-- tst-strtod-round \
-- tst-strtod-underflow \
-- tst-strtod2 \
-- tst-strtod5 \
-- tst-strtod6 \
-- tst-strtol \
-- tst-strtol-locale \
-- tst-strtoll \
-- tst-swapcontext1 \
-- tst-thread-quick_exit \
-- tst-tininess \
-- tst-unsetenv1 \
-- tst-width \
-- tst-width-stdint \
-- tst-xpg-basename
-+tests := \
-+ bug-fmtmsg1 \
-+ bug-getcontext \
-+ bug-strtod \
-+ bug-strtod2 \
-+ test-a64l \
-+ test-at_quick_exit-race \
-+ test-atexit-race \
-+ test-bz22786 \
-+ test-canon \
-+ test-canon2 \
-+ test-cxa_atexit-race \
-+ test-cxa_atexit-race2 \
-+ test-dlclose-exit-race \
-+ test-on_exit-race \
-+ testdiv \
-+ testmb \
-+ testmb2 \
-+ testrand \
-+ testsort \
-+ tst-at_quick_exit \
-+ tst-atexit \
-+ tst-atof1 \
-+ tst-atof2 \
-+ tst-bsearch \
-+ tst-bz20544 \
-+ tst-canon-bz26341 \
-+ tst-cxa_atexit \
-+ tst-environ \
-+ tst-getrandom \
-+ tst-limits \
-+ tst-makecontext \
-+ tst-makecontext-align \
-+ tst-makecontext2 \
-+ tst-makecontext3 \
-+ tst-on_exit \
-+ tst-qsort \
-+ tst-qsort2 \
-+ tst-quick_exit \
-+ tst-rand48 \
-+ tst-rand48-2 \
-+ tst-random \
-+ tst-random2 \
-+ tst-realpath \
-+ tst-secure-getenv \
-+ tst-setcontext \
-+ tst-setcontext2 \
-+ tst-setcontext3 \
-+ tst-setcontext4 \
-+ tst-setcontext5 \
-+ tst-setcontext6 \
-+ tst-setcontext7 \
-+ tst-setcontext8 \
-+ tst-setcontext9 \
-+ tst-strfmon_l \
-+ tst-strfrom \
-+ tst-strfrom-locale \
-+ tst-strtod \
-+ tst-strtod-nan-locale \
-+ tst-strtod-nan-sign \
-+ tst-strtod-overflow \
-+ tst-strtod-round \
-+ tst-strtod-underflow \
-+ tst-strtod2 \
-+ tst-strtod5 \
-+ tst-strtod6 \
-+ tst-strtol \
-+ tst-strtol-locale \
-+ tst-strtoll \
-+ tst-swapcontext1 \
-+ tst-thread-quick_exit \
-+ tst-tininess \
-+ tst-unsetenv1 \
-+ tst-width \
-+ tst-width-stdint \
-+ tst-xpg-basename \
-+# tests
-
- tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
- tst-tls-atexit tst-tls-atexit-nodelete
---
-2.35.0
-
diff --git a/0085-realpath-Set-errno-to-ENAMETOOLONG-for-result-larger.patch b/0085-realpath-Set-errno-to-ENAMETOOLONG-for-result-larger.patch
deleted file mode 100644
index f2173a2..0000000
--- a/0085-realpath-Set-errno-to-ENAMETOOLONG-for-result-larger.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Thu, 13 Jan 2022 11:28:36 +0530
-Subject: [PATCH 85/93] realpath: Set errno to ENAMETOOLONG for result larger
- than PATH_MAX [BZ #28770]
-
-realpath returns an allocated string when the result exceeds PATH_MAX,
-which is unexpected when its second argument is not NULL. This results
-in the second argument (resolved) being uninitialized and also results
-in a memory leak since the caller expects resolved to be the same as the
-returned value.
-
-Return NULL and set errno to ENAMETOOLONG if the result exceeds
-PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998.
-
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit ee8d5e33adb284601c00c94687bc907e10aec9bb)
----
- NEWS | 4 +++
- stdlib/Makefile | 1 +
- stdlib/canonicalize.c | 12 +++++++--
- stdlib/tst-realpath-toolong.c | 49 +++++++++++++++++++++++++++++++++++
- 4 files changed, 64 insertions(+), 2 deletions(-)
- create mode 100644 stdlib/tst-realpath-toolong.c
-
-diff --git a/NEWS b/NEWS
-index 7e773bd005..b4f81c2668 100644
---- a/NEWS
-+++ b/NEWS
-@@ -16,6 +16,10 @@ Security related changes:
- CVE-2022-23218: Passing an overlong file name to the svcunix_create
- legacy function could result in a stack-based buffer overflow.
-
-+ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath
-+ function could result in a memory leak and potential access of
-+ uninitialized memory. Reported by Qualys.
-+
- The following bugs are resolved with this release:
-
- [12889] nptl: Fix race between pthread_kill and thread exit
-diff --git a/stdlib/Makefile b/stdlib/Makefile
-index 9bb5c221e8..a4ac30d1f6 100644
---- a/stdlib/Makefile
-+++ b/stdlib/Makefile
-@@ -109,6 +109,7 @@ tests := \
- tst-random \
- tst-random2 \
- tst-realpath \
-+ tst-realpath-toolong \
- tst-secure-getenv \
- tst-setcontext \
- tst-setcontext2 \
-diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
-index 698f9ede25..7a23a51b3a 100644
---- a/stdlib/canonicalize.c
-+++ b/stdlib/canonicalize.c
-@@ -400,8 +400,16 @@ realpath_stk (const char *name, char *resolved,
-
- error:
- *dest++ = '\0';
-- if (resolved != NULL && dest - rname <= get_path_max ())
-- rname = strcpy (resolved, rname);
-+ if (resolved != NULL)
-+ {
-+ if (dest - rname <= get_path_max ())
-+ rname = strcpy (resolved, rname);
-+ else
-+ {
-+ failed = true;
-+ __set_errno (ENAMETOOLONG);
-+ }
-+ }
-
- error_nomem:
- scratch_buffer_free (&extra_buffer);
-diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
-new file mode 100644
-index 0000000000..8bed772460
---- /dev/null
-+++ b/stdlib/tst-realpath-toolong.c
-@@ -0,0 +1,49 @@
-+/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
-+ NAME_MAX.
-+ Copyright The GNU Toolchain Authors.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <limits.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <support/check.h>
-+#include <support/temp_file.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+
-+#define BASENAME "tst-realpath-toolong."
-+
-+int
-+do_test (void)
-+{
-+ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME);
-+
-+ char buf[PATH_MAX + 1];
-+ const char *res = realpath (".", buf);
-+
-+ /* canonicalize.c states that if the real path is >= PATH_MAX, then
-+ realpath returns NULL and sets ENAMETOOLONG. */
-+ TEST_VERIFY (res == NULL);
-+ TEST_VERIFY (errno == ENAMETOOLONG);
-+
-+ free (base);
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0086-tst-realpath-toolong-Fix-hurd-build.patch b/0086-tst-realpath-toolong-Fix-hurd-build.patch
deleted file mode 100644
index 0f7774d..0000000
--- a/0086-tst-realpath-toolong-Fix-hurd-build.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 8c8a71c85f2ed5cc90d08d82ce645513fc907cb6 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Mon, 24 Jan 2022 10:57:09 +0530
-Subject: [PATCH 86/93] tst-realpath-toolong: Fix hurd build
-
-Define PATH_MAX to a constant if it isn't already defined, like in hurd.
-
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 976db046bc3a3738f69255ae00b0a09b8e77fd9c)
----
- stdlib/tst-realpath-toolong.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
-index 8bed772460..4388890294 100644
---- a/stdlib/tst-realpath-toolong.c
-+++ b/stdlib/tst-realpath-toolong.c
-@@ -29,6 +29,10 @@
-
- #define BASENAME "tst-realpath-toolong."
-
-+#ifndef PATH_MAX
-+# define PATH_MAX 1024
-+#endif
-+
- int
- do_test (void)
- {
---
-2.35.0
-
diff --git a/0087-getcwd-Set-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch b/0087-getcwd-Set-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch
deleted file mode 100644
index a70b885..0000000
--- a/0087-getcwd-Set-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch
+++ /dev/null
@@ -1,356 +0,0 @@
-From 472e799a5f2102bc0c3206dbd5a801765fceb39c Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Fri, 21 Jan 2022 23:32:56 +0530
-Subject: [PATCH 87/93] getcwd: Set errno to ERANGE for size == 1
- (CVE-2021-3999)
-
-No valid path returned by getcwd would fit into 1 byte, so reject the
-size early and return NULL with errno set to ERANGE. This change is
-prompted by CVE-2021-3999, which describes a single byte buffer
-underflow and overflow when all of the following conditions are met:
-
-- The buffer size (i.e. the second argument of getcwd) is 1 byte
-- The current working directory is too long
-- '/' is also mounted on the current working directory
-
-Sequence of events:
-
-- In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG
- because the linux kernel checks for name length before it checks
- buffer size
-
-- The code falls back to the generic getcwd in sysdeps/posix
-
-- In the generic func, the buf[0] is set to '\0' on line 250
-
-- this while loop on line 262 is bypassed:
-
- while (!(thisdev == rootdev && thisino == rootino))
-
- since the rootfs (/) is bind mounted onto the directory and the flow
- goes on to line 449, where it puts a '/' in the byte before the
- buffer.
-
-- Finally on line 458, it moves 2 bytes (the underflowed byte and the
- '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow.
-
-- buf is returned on line 469 and errno is not set.
-
-This resolves BZ #28769.
-
-Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
-Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Signed-off-by: Qualys Security Advisory <qsa@qualys.com>
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 23e0e8f5f1fb5ed150253d986ecccdc90c2dcd5e)
----
- NEWS | 6 +
- sysdeps/posix/getcwd.c | 7 +
- sysdeps/unix/sysv/linux/Makefile | 7 +-
- .../unix/sysv/linux/tst-getcwd-smallbuff.c | 241 ++++++++++++++++++
- 4 files changed, 260 insertions(+), 1 deletion(-)
- create mode 100644 sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-
-diff --git a/NEWS b/NEWS
-index b4f81c2668..8d7467d2c1 100644
---- a/NEWS
-+++ b/NEWS
-@@ -20,6 +20,12 @@ Security related changes:
- function could result in a memory leak and potential access of
- uninitialized memory. Reported by Qualys.
-
-+ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd
-+ function may result in an off-by-one buffer underflow and overflow
-+ when the current working directory is longer than PATH_MAX and also
-+ corresponds to the / directory through an unprivileged mount
-+ namespace. Reported by Qualys.
-+
- The following bugs are resolved with this release:
-
- [12889] nptl: Fix race between pthread_kill and thread exit
-diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
-index 13680026ff..b6984a382c 100644
---- a/sysdeps/posix/getcwd.c
-+++ b/sysdeps/posix/getcwd.c
-@@ -187,6 +187,13 @@ __getcwd_generic (char *buf, size_t size)
- size_t allocated = size;
- size_t used;
-
-+ /* A size of 1 byte is never useful. */
-+ if (allocated == 1)
-+ {
-+ __set_errno (ERANGE);
-+ return NULL;
-+ }
-+
- #if HAVE_MINIMALLY_WORKING_GETCWD
- /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
- this is much slower than the system getcwd (at least on
-diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
-index 76ad06361c..9380d3848d 100644
---- a/sysdeps/unix/sysv/linux/Makefile
-+++ b/sysdeps/unix/sysv/linux/Makefile
-@@ -331,7 +331,12 @@ sysdep_routines += xstatconv internal_statvfs \
-
- sysdep_headers += bits/fcntl-linux.h
-
--tests += tst-fallocate tst-fallocate64 tst-o_path-locks
-+tests += \
-+ tst-fallocate \
-+ tst-fallocate64 \
-+ tst-getcwd-smallbuff \
-+ tst-o_path-locks \
-+# tests
- endif
-
- ifeq ($(subdir),elf)
-diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-new file mode 100644
-index 0000000000..d460d6e766
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-@@ -0,0 +1,241 @@
-+/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow
-+ buffer when the CWD is too long and is also a mount target of /. See bug
-+ #28769 or CVE-2021-3999 for more context.
-+ Copyright The GNU Toolchain Authors.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <https://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <intprops.h>
-+#include <limits.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <sys/mount.h>
-+#include <sys/stat.h>
-+#include <sys/types.h>
-+#include <sys/wait.h>
-+
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+#include <support/check.h>
-+#include <support/temp_file.h>
-+#include <support/xsched.h>
-+#include <support/xunistd.h>
-+
-+static char *base;
-+#define BASENAME "tst-getcwd-smallbuff"
-+#define MOUNT_NAME "mpoint"
-+static int sockfd[2];
-+
-+static void
-+do_cleanup (void)
-+{
-+ support_chdir_toolong_temp_directory (base);
-+ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0);
-+ free (base);
-+}
-+
-+static void
-+send_fd (const int sock, const int fd)
-+{
-+ struct msghdr msg = {0};
-+ union
-+ {
-+ struct cmsghdr hdr;
-+ char buf[CMSG_SPACE (sizeof (int))];
-+ } cmsgbuf = {0};
-+ struct cmsghdr *cmsg;
-+ struct iovec vec;
-+ char ch = 'A';
-+ ssize_t n;
-+
-+ msg.msg_control = &cmsgbuf.buf;
-+ msg.msg_controllen = sizeof (cmsgbuf.buf);
-+
-+ cmsg = CMSG_FIRSTHDR (&msg);
-+ cmsg->cmsg_len = CMSG_LEN (sizeof (int));
-+ cmsg->cmsg_level = SOL_SOCKET;
-+ cmsg->cmsg_type = SCM_RIGHTS;
-+ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd));
-+
-+ vec.iov_base = &ch;
-+ vec.iov_len = 1;
-+ msg.msg_iov = &vec;
-+ msg.msg_iovlen = 1;
-+
-+ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR);
-+
-+ TEST_VERIFY_EXIT (n == 1);
-+}
-+
-+static int
-+recv_fd (const int sock)
-+{
-+ struct msghdr msg = {0};
-+ union
-+ {
-+ struct cmsghdr hdr;
-+ char buf[CMSG_SPACE(sizeof(int))];
-+ } cmsgbuf = {0};
-+ struct cmsghdr *cmsg;
-+ struct iovec vec;
-+ ssize_t n;
-+ char ch = '\0';
-+ int fd = -1;
-+
-+ vec.iov_base = &ch;
-+ vec.iov_len = 1;
-+ msg.msg_iov = &vec;
-+ msg.msg_iovlen = 1;
-+
-+ msg.msg_control = &cmsgbuf.buf;
-+ msg.msg_controllen = sizeof (cmsgbuf.buf);
-+
-+ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR);
-+ if (n != 1 || ch != 'A')
-+ return -1;
-+
-+ cmsg = CMSG_FIRSTHDR (&msg);
-+ if (cmsg == NULL)
-+ return -1;
-+ if (cmsg->cmsg_type != SCM_RIGHTS)
-+ return -1;
-+ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd));
-+ if (fd < 0)
-+ return -1;
-+ return fd;
-+}
-+
-+static int
-+child_func (void * const arg)
-+{
-+ xclose (sockfd[0]);
-+ const int sock = sockfd[1];
-+ char ch;
-+
-+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
-+ TEST_VERIFY_EXIT (ch == '1');
-+
-+ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL))
-+ FAIL_EXIT1 ("mount failed: %m\n");
-+ const int fd = xopen ("mpoint",
-+ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0);
-+
-+ send_fd (sock, fd);
-+ xclose (fd);
-+
-+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
-+ TEST_VERIFY_EXIT (ch == 'a');
-+
-+ xclose (sock);
-+ return 0;
-+}
-+
-+static void
-+update_map (char * const mapping, const char * const map_file)
-+{
-+ const size_t map_len = strlen (mapping);
-+
-+ const int fd = xopen (map_file, O_WRONLY, 0);
-+ xwrite (fd, mapping, map_len);
-+ xclose (fd);
-+}
-+
-+static void
-+proc_setgroups_write (const long child_pid, const char * const str)
-+{
-+ const size_t str_len = strlen(str);
-+
-+ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)];
-+
-+ snprintf (setgroups_path, sizeof (setgroups_path),
-+ "/proc/%ld/setgroups", child_pid);
-+
-+ const int fd = open (setgroups_path, O_WRONLY);
-+
-+ if (fd < 0)
-+ {
-+ TEST_VERIFY_EXIT (errno == ENOENT);
-+ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid);
-+ }
-+
-+ xwrite (fd, str, str_len);
-+ xclose(fd);
-+}
-+
-+static char child_stack[1024 * 1024];
-+
-+int
-+do_test (void)
-+{
-+ base = support_create_and_chdir_toolong_temp_directory (BASENAME);
-+
-+ xmkdir (MOUNT_NAME, S_IRWXU);
-+ atexit (do_cleanup);
-+
-+ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0);
-+ pid_t child_pid = xclone (child_func, NULL, child_stack,
-+ sizeof (child_stack),
-+ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD);
-+
-+ xclose (sockfd[1]);
-+ const int sock = sockfd[0];
-+
-+ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)];
-+ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)];
-+
-+ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map",
-+ (long) child_pid);
-+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid());
-+ update_map (map_buf, map_path);
-+
-+ proc_setgroups_write ((long) child_pid, "deny");
-+ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map",
-+ (long) child_pid);
-+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid());
-+ update_map (map_buf, map_path);
-+
-+ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1);
-+ const int fd = recv_fd (sock);
-+ TEST_VERIFY_EXIT (fd >= 0);
-+ TEST_VERIFY_EXIT (fchdir (fd) == 0);
-+
-+ static char buf[2 * 10 + 1];
-+ memset (buf, 'A', sizeof (buf));
-+
-+ /* Finally, call getcwd and check if it resulted in a buffer underflow. */
-+ char * cwd = getcwd (buf + sizeof (buf) / 2, 1);
-+ TEST_VERIFY (cwd == NULL);
-+ TEST_VERIFY (errno == ERANGE);
-+
-+ for (int i = 0; i < sizeof (buf); i++)
-+ if (buf[i] != 'A')
-+ {
-+ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]);
-+ support_record_failure ();
-+ }
-+
-+ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1);
-+ xclose (sock);
-+ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid);
-+
-+ return 0;
-+}
-+
-+#define CLEANUP_HANDLER do_cleanup
-+#include <support/test-driver.c>
---
-2.35.0
-
diff --git a/0088-realpath-Avoid-overwriting-preexisting-error-CVE-202.patch b/0088-realpath-Avoid-overwriting-preexisting-error-CVE-202.patch
deleted file mode 100644
index 6b619b7..0000000
--- a/0088-realpath-Avoid-overwriting-preexisting-error-CVE-202.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From d084965adc7baa8ea804427cccf973cea556d697 Mon Sep 17 00:00:00 2001
-From: Siddhesh Poyarekar <siddhesh@sourceware.org>
-Date: Mon, 24 Jan 2022 21:36:41 +0530
-Subject: [PATCH 88/93] realpath: Avoid overwriting preexisting error
- (CVE-2021-3998)
-
-Set errno and failure for paths that are too long only if no other error
-occurred earlier.
-
-Related: BZ #28770
-
-Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
-Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 84d2d0fe20bdf94feed82b21b4d7d136db471f03)
----
- stdlib/canonicalize.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
-index 7a23a51b3a..e2d4244fc7 100644
---- a/stdlib/canonicalize.c
-+++ b/stdlib/canonicalize.c
-@@ -404,7 +404,7 @@ error:
- {
- if (dest - rname <= get_path_max ())
- rname = strcpy (resolved, rname);
-- else
-+ else if (!failed)
- {
- failed = true;
- __set_errno (ENAMETOOLONG);
---
-2.35.0
-
diff --git a/0089-Linux-Detect-user-namespace-support-in-io-tst-getcwd.patch b/0089-Linux-Detect-user-namespace-support-in-io-tst-getcwd.patch
deleted file mode 100644
index 5d34722..0000000
--- a/0089-Linux-Detect-user-namespace-support-in-io-tst-getcwd.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 3438bbca90895d32825a52e31a77dc44d273c1c1 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 24 Jan 2022 18:14:24 +0100
-Subject: [PATCH 89/93] Linux: Detect user namespace support in
- io/tst-getcwd-smallbuff
-
-Otherwise the test fails with certain container runtimes.
-
-Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
-(cherry picked from commit 5b8e7980c5dabd9aaefeba4f0208baa8cf7653ee)
----
- sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
-diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-index d460d6e766..55362f6060 100644
---- a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-+++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
-@@ -34,6 +34,7 @@
- #include <sys/un.h>
- #include <support/check.h>
- #include <support/temp_file.h>
-+#include <support/test-driver.h>
- #include <support/xsched.h>
- #include <support/xunistd.h>
-
-@@ -188,6 +189,23 @@ do_test (void)
- xmkdir (MOUNT_NAME, S_IRWXU);
- atexit (do_cleanup);
-
-+ /* Check whether user namespaces are supported. */
-+ {
-+ pid_t pid = xfork ();
-+ if (pid == 0)
-+ {
-+ if (unshare (CLONE_NEWUSER | CLONE_NEWNS) != 0)
-+ _exit (EXIT_UNSUPPORTED);
-+ else
-+ _exit (0);
-+ }
-+ int status;
-+ xwaitpid (pid, &status, 0);
-+ TEST_VERIFY_EXIT (WIFEXITED (status));
-+ if (WEXITSTATUS (status) != 0)
-+ return WEXITSTATUS (status);
-+ }
-+
- TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0);
- pid_t child_pid = xclone (child_func, NULL, child_stack,
- sizeof (child_stack),
---
-2.35.0
-
diff --git a/0090-NEWS-add-bug-entry-for-BZ-28769-and-BZ-28770.patch b/0090-NEWS-add-bug-entry-for-BZ-28769-and-BZ-28770.patch
deleted file mode 100644
index 6594d8a..0000000
--- a/0090-NEWS-add-bug-entry-for-BZ-28769-and-BZ-28770.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 1b9cd6a7214db1812a20eb3591cf42f9190a5d1a Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Mon, 24 Jan 2022 23:45:03 +0100
-Subject: [PATCH 90/93] NEWS: add bug entry for BZ #28769 and BZ #28770
-
----
- NEWS | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/NEWS b/NEWS
-index 8d7467d2c1..c063c78b15 100644
---- a/NEWS
-+++ b/NEWS
-@@ -52,6 +52,8 @@ The following bugs are resolved with this release:
- [28744] A64FX string functions are selected without SVE HWCAP
- [28771] %ebx optimization macros are incompatible with .altmacro
- [28768] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create
-+ [28769] CVE-2021-3999: Off-by-one buffer overflow/underflow in getcwd()
-+ [28770] CVE-2021-3998: Unexpected return value from realpath() for too long results
- [28784] x86: crash in 32bit memset-sse2.s when the cache size can not be determined
-
-
---
-2.35.0
-
diff --git a/0091-x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch b/0091-x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch
deleted file mode 100644
index 10a0d17..0000000
--- a/0091-x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From b50d5b746cc0af5ad52164dcb0d3628f08b05a0d Mon Sep 17 00:00:00 2001
-From: Noah Goldstein <goldstein.w.n@gmail.com>
-Date: Sun, 9 Jan 2022 16:02:21 -0600
-Subject: [PATCH 91/93] x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
-
-Fixes [BZ# 28755] for wcsncmp by redirecting length >= 2^56 to
-__wcscmp_avx2. For x86_64 this covers the entire address range so any
-length larger could not possibly be used to bound `s1` or `s2`.
-
-test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass.
-
-Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
-(cherry picked from commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87)
----
- sysdeps/x86_64/multiarch/strcmp-avx2.S | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
-index 40333010a6..3dfcb1bf80 100644
---- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
-+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
-@@ -87,6 +87,16 @@ ENTRY (STRCMP)
- je L(char0)
- jb L(zero)
- # ifdef USE_AS_WCSCMP
-+# ifndef __ILP32__
-+ movq %rdx, %rcx
-+ /* Check if length could overflow when multiplied by
-+ sizeof(wchar_t). Checking top 8 bits will cover all potential
-+ overflow cases as well as redirect cases where its impossible to
-+ length to bound a valid memory region. In these cases just use
-+ 'wcscmp'. */
-+ shrq $56, %rcx
-+ jnz __wcscmp_avx2
-+# endif
- /* Convert units: from wide to byte char. */
- shl $2, %RDX_LP
- # endif
---
-2.35.0
-
diff --git a/0092-x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch b/0092-x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch
deleted file mode 100644
index a2e069a..0000000
--- a/0092-x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 08beb3a3f4f46e306fffe184a08c5664bf0e13d6 Mon Sep 17 00:00:00 2001
-From: Noah Goldstein <goldstein.w.n@gmail.com>
-Date: Sun, 9 Jan 2022 16:02:28 -0600
-Subject: [PATCH 92/93] x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
-
-Fixes [BZ# 28755] for wcsncmp by redirecting length >= 2^56 to
-__wcscmp_evex. For x86_64 this covers the entire address range so any
-length larger could not possibly be used to bound `s1` or `s2`.
-
-test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass.
-
-Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
-(cherry picked from commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b)
----
- sysdeps/x86_64/multiarch/strcmp-evex.S | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/sysdeps/x86_64/multiarch/strcmp-evex.S b/sysdeps/x86_64/multiarch/strcmp-evex.S
-index 459eeed09f..d5aa6daa46 100644
---- a/sysdeps/x86_64/multiarch/strcmp-evex.S
-+++ b/sysdeps/x86_64/multiarch/strcmp-evex.S
-@@ -97,6 +97,16 @@ ENTRY (STRCMP)
- je L(char0)
- jb L(zero)
- # ifdef USE_AS_WCSCMP
-+# ifndef __ILP32__
-+ movq %rdx, %rcx
-+ /* Check if length could overflow when multiplied by
-+ sizeof(wchar_t). Checking top 8 bits will cover all potential
-+ overflow cases as well as redirect cases where its impossible to
-+ length to bound a valid memory region. In these cases just use
-+ 'wcscmp'. */
-+ shrq $56, %rcx
-+ jnz __wcscmp_evex
-+# endif
- /* Convert units: from wide to byte char. */
- shl $2, %RDX_LP
- # endif
---
-2.35.0
-
diff --git a/0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch b/0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch
deleted file mode 100644
index 2e6afe5..0000000
--- a/0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 72123e1b56f53f9205bb105f8a62d0869b837b22 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Wed, 26 Jan 2022 20:20:43 -0800
-Subject: [PATCH 93/93] NEWS: Add a bug entry for BZ #28755
-
----
- NEWS | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/NEWS b/NEWS
-index c063c78b15..daeb066419 100644
---- a/NEWS
-+++ b/NEWS
-@@ -50,6 +50,7 @@ The following bugs are resolved with this release:
- [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
- [28707] assert in tzfile.c __tzfile_read striking with truncated timezones
- [28744] A64FX string functions are selected without SVE HWCAP
-+ [28755] overflow bug in wcsncmp_avx2 and wcsncmp_evex
- [28771] %ebx optimization macros are incompatible with .altmacro
- [28768] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create
- [28769] CVE-2021-3999: Off-by-one buffer overflow/underflow in getcwd()
---
-2.35.0
-
diff --git a/4483f2500825a84382c2a6a9ac60fc77954533d7.patch b/4483f2500825a84382c2a6a9ac60fc77954533d7.patch
index d724c40..a3d30b0 100644
--- a/4483f2500825a84382c2a6a9ac60fc77954533d7.patch
+++ b/4483f2500825a84382c2a6a9ac60fc77954533d7.patch
@@ -1,6 +1,6 @@
-diff -up glibc-2.34/nptl/pthread_mutex_lock_any.c.47~ glibc-2.34/nptl/pthread_mutex_lock_any.c
---- glibc-2.34/nptl/pthread_mutex_lock_any.c.47~ 2021-08-02 10:48:50.506481059 +0200
-+++ glibc-2.34/nptl/pthread_mutex_lock_any.c 2021-08-02 10:48:50.506481059 +0200
+diff -up glibc-2.35/nptl/pthread_mutex_lock_any.c.46~ glibc-2.35/nptl/pthread_mutex_lock_any.c
+--- glibc-2.35/nptl/pthread_mutex_lock_any.c.46~ 2022-02-03 11:21:15.315282335 +0100
++++ glibc-2.35/nptl/pthread_mutex_lock_any.c 2022-02-03 11:21:15.315282335 +0100
@@ -0,0 +1,37 @@
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
@@ -39,9 +39,9 @@ diff -up glibc-2.34/nptl/pthread_mutex_lock_any.c.47~ glibc-2.34/nptl/pthread_mu
+}
+
+weak_alias (__pthread_mutex_lock_any, pthread_mutex_lock_any)
-diff -up glibc-2.34/nptl/pthread_mutex_timedlock_any.c.47~ glibc-2.34/nptl/pthread_mutex_timedlock_any.c
---- glibc-2.34/nptl/pthread_mutex_timedlock_any.c.47~ 2021-08-02 10:48:50.506481059 +0200
-+++ glibc-2.34/nptl/pthread_mutex_timedlock_any.c 2021-08-02 10:48:50.506481059 +0200
+diff -up glibc-2.35/nptl/pthread_mutex_timedlock_any.c.46~ glibc-2.35/nptl/pthread_mutex_timedlock_any.c
+--- glibc-2.35/nptl/pthread_mutex_timedlock_any.c.46~ 2022-02-03 11:21:15.316282339 +0100
++++ glibc-2.35/nptl/pthread_mutex_timedlock_any.c 2022-02-03 11:21:15.316282339 +0100
@@ -0,0 +1,193 @@
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
@@ -236,18 +236,18 @@ diff -up glibc-2.34/nptl/pthread_mutex_timedlock_any.c.47~ glibc-2.34/nptl/pthre
+}
+
+weak_alias (__pthread_mutex_timedlock_any, pthread_mutex_timedlock_any)
-diff -up glibc-2.34/sysdeps/nptl/lowlevellock-futex.h.47~ glibc-2.34/sysdeps/nptl/lowlevellock-futex.h
---- glibc-2.34/sysdeps/nptl/lowlevellock-futex.h.47~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/sysdeps/nptl/lowlevellock-futex.h 2021-08-02 10:48:50.506481059 +0200
-@@ -38,6 +38,7 @@
- #define FUTEX_WAKE_BITSET 10
+diff -up glibc-2.35/sysdeps/nptl/lowlevellock-futex.h.46~ glibc-2.35/sysdeps/nptl/lowlevellock-futex.h
+--- glibc-2.35/sysdeps/nptl/lowlevellock-futex.h.46~ 2022-02-03 06:27:54.000000000 +0100
++++ glibc-2.35/sysdeps/nptl/lowlevellock-futex.h 2022-02-03 11:25:49.314310869 +0100
+@@ -39,6 +39,7 @@
#define FUTEX_WAIT_REQUEUE_PI 11
#define FUTEX_CMP_REQUEUE_PI 12
-+#define FUTEX_WAIT_MULTIPLE 13
+ #define FUTEX_LOCK_PI2 13
++#define FUTEX_WAIT_MULTIPLE 14
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
-@@ -61,6 +62,14 @@
+@@ -62,6 +63,14 @@
? -INTERNAL_SYSCALL_ERRNO (__ret) : 0); \
})
@@ -262,7 +262,7 @@ diff -up glibc-2.34/sysdeps/nptl/lowlevellock-futex.h.47~ glibc-2.34/sysdeps/npt
/* For most of these macros, the return value is never really used.
Nevertheless, the protocol is that each one returns a negated errno
code for failure or zero for success. (Note that the corresponding
-@@ -77,6 +86,11 @@
+@@ -78,6 +87,11 @@
__lll_private_flag (FUTEX_WAIT, private), \
val, timeout)
@@ -274,9 +274,9 @@ diff -up glibc-2.34/sysdeps/nptl/lowlevellock-futex.h.47~ glibc-2.34/sysdeps/npt
/* Verify whether the supplied clockid is supported by
lll_futex_clock_wait_bitset. */
# define lll_futex_supported_clockid(clockid) \
-diff -up glibc-2.34/sysdeps/nptl/pthread.h.47~ glibc-2.34/sysdeps/nptl/pthread.h
---- glibc-2.34/sysdeps/nptl/pthread.h.47~ 2021-08-02 10:48:50.506481059 +0200
-+++ glibc-2.34/sysdeps/nptl/pthread.h 2021-08-02 10:55:47.587063427 +0200
+diff -up glibc-2.35/sysdeps/nptl/pthread.h.46~ glibc-2.35/sysdeps/nptl/pthread.h
+--- glibc-2.35/sysdeps/nptl/pthread.h.46~ 2022-02-03 06:27:54.000000000 +0100
++++ glibc-2.35/sysdeps/nptl/pthread.h 2022-02-03 11:21:15.316282339 +0100
@@ -794,7 +794,17 @@ extern int pthread_mutex_trylock (pthrea
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
@@ -295,4 +295,3 @@ diff -up glibc-2.34/sysdeps/nptl/pthread.h.47~ glibc-2.34/sysdeps/nptl/pthread.h
/* Wait until lock becomes available, or specified time passes. */
# ifndef __USE_TIME_BITS64
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
-diff -up glibc-2.34/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist.47~ glibc-2.34/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
diff --git a/alternate_trim.patch b/alternate_trim.patch
deleted file mode 100644
index d3bae7a..0000000
--- a/alternate_trim.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/malloc/malloc.c b/malloc/malloc.c
-index f8e7250..de6d7fa 100644
---- a/malloc/malloc.c
-+++ b/malloc/malloc.c
-@@ -4146,6 +4146,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
- mchunkptr bck; /* misc temp for linking */
- mchunkptr fwd; /* misc temp for linking */
-
-+ static int alternate;
- size = chunksize (p);
-
- /* Little security check which won't hurt performance: the
-@@ -4364,8 +4365,14 @@ _int_free (mstate av, mchunkptr p, int have_lock)
- if (av == &main_arena) {
- #ifndef MORECORE_CANNOT_TRIM
- if ((unsigned long)(chunksize(av->top)) >=
-- (unsigned long)(mp_.trim_threshold))
-- systrim(mp_.top_pad, av);
-+ (unsigned long)(mp_.trim_threshold)) {
-+ if (alternate) {
-+ systrim(mp_.top_pad, av);
-+ alternate = 0;
-+ } else {
-+ alternate = 1;
-+ }
-+ }
- #endif
- } else {
- /* Always try heap_trim(), even if the top chunk is not
diff --git a/eglibc-fedora-strict-aliasing.patch b/eglibc-fedora-strict-aliasing.patch
deleted file mode 100644
index c02b4f5..0000000
--- a/eglibc-fedora-strict-aliasing.patch
+++ /dev/null
@@ -1,76 +0,0 @@
---- libc/elf/Makefile.aliasing~ 2012-12-02 22:11:45.000000000 +0100
-+++ libc/elf/Makefile 2012-12-27 19:46:13.396658450 +0100
-@@ -53,6 +53,7 @@ CFLAGS-dl-iterate-phdr.c = $(uses-callba
- ifeq ($(unwind-find-fde),yes)
- routines += unwind-dw2-fde-glibc
- shared-only-routines += unwind-dw2-fde-glibc
-+CFLAGS-unwind-dw2-fde-glibc.c += -fno-strict-aliasing
- endif
-
- before-compile = $(objpfx)trusted-dirs.h
---- libc/inet/Makefile.aliasing~ 2012-08-28 16:14:43.000000000 +0200
-+++ libc/inet/Makefile 2012-12-27 19:48:23.933089723 +0100
-@@ -62,6 +62,8 @@ tests-$(OPTION_EGLIBC_ADVANCED_INET6) +=
-
- include ../Rules
-
-+CFLAGS-tst-inet6_rth.c += -fno-strict-aliasing
-+
- ifeq ($(have-thread-library),yes)
-
- CFLAGS-gethstbyad_r.c = -fexceptions
---- libc/nis/Makefile.aliasing~ 2012-05-12 17:44:41.000000000 +0200
-+++ libc/nis/Makefile 2012-12-27 19:46:13.396658450 +0100
-@@ -80,6 +80,8 @@ libnss_nisplus-inhibit-o = $(filter-out
-
- include ../Rules
-
-+CFLAGS-nis_findserv.c += -fno-strict-aliasing
-+CFLAGS-ypclnt.c += -fno-strict-aliasing
-
- $(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
- $(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
---- libc/nss/Makefile.aliasing~ 2012-10-10 17:35:46.000000000 +0200
-+++ libc/nss/Makefile 2012-12-27 19:46:13.396658450 +0100
-@@ -147,6 +147,7 @@ $(libnss_db-dbs:%=$(objpfx)%.c): $(objpf
- echo '#include "$<"') > $@.new
- mv -f $@.new $@
-
-+CFLAGS-files-hosts.c += -fno-strict-aliasing
-
- $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
-
---- libc/resolv/Makefile.aliasing~ 2012-10-25 19:18:12.000000000 +0200
-+++ libc/resolv/Makefile 2012-12-27 19:46:13.396658450 +0100
-@@ -83,6 +83,7 @@ ifeq (yes,$(have-ssp))
- CFLAGS-libresolv += -fstack-protector
- endif
- CFLAGS-res_hconf.c = -fexceptions
-+CFLAGS-res_send.c += -fno-strict-aliasing
-
- # The BIND code elicits some harmless warnings.
- +cflags += -Wno-strict-prototypes -Wno-write-strings
---- libc/sunrpc/Makefile.aliasing~ 2012-05-26 19:46:57.000000000 +0200
-+++ libc/sunrpc/Makefile 2012-12-27 19:46:13.397658439 +0100
-@@ -164,6 +164,10 @@ sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
- CPPFLAGS += $(sunrpc-CPPFLAGS)
- BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS)
-
-+CFLAGS-clnt_tcp.c += -fno-strict-aliasing
-+CFLAGS-clnt_udp.c += -fno-strict-aliasing
-+CFLAGS-clnt_unix.c += -fno-strict-aliasing
-+
- $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
- $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
- $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
---- libc/sysdeps/powerpc/powerpc64/Makefile.aliasing~ 2012-12-27 19:46:13.392658496 +0100
-+++ libc/sysdeps/powerpc/powerpc64/Makefile 2012-12-27 19:46:13.397658439 +0100
-@@ -37,6 +37,8 @@ CFLAGS-rtld-strnlen.os = $(no-special-re
-
- CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
-
-+CFLAGS-gmon-start.c += -fno-strict-aliasing
-+
- ifeq ($(subdir),csu)
- sysdep_routines += hp-timing
- elide-routines.os += hp-timing
diff --git a/eglibc-mandriva-ENOTTY-fr-translation.patch b/eglibc-mandriva-ENOTTY-fr-translation.patch
deleted file mode 100644
index e92b43f..0000000
--- a/eglibc-mandriva-ENOTTY-fr-translation.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up glibc-2.33/po/fr.po.37~ glibc-2.33/po/fr.po
---- glibc-2.33/po/fr.po.37~ 2021-02-02 00:15:42.693990072 +0100
-+++ glibc-2.33/po/fr.po 2021-02-02 00:17:05.609964010 +0100
-@@ -5651,7 +5651,7 @@ msgstr "Trop de fichiers ouverts dans le
- #. TRANS modes on an ordinary file.
- #: sysdeps/gnu/errlist.h:170
- msgid "Inappropriate ioctl for device"
--msgstr "Ioctl() inappropré pour un périphérique"
-+msgstr "Ioctl() inapproprié pour un périphérique"
-
- #. TRANS An attempt to execute a file that is currently open for writing, or
- #. TRANS write to a file that is currently being executed. Often using a
diff --git a/eglibc-mandriva-localedef-archive-follow-symlinks.patch b/eglibc-mandriva-localedef-archive-follow-symlinks.patch
deleted file mode 100644
index 1185402..0000000
--- a/eglibc-mandriva-localedef-archive-follow-symlinks.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- glibc-2.27/locale/programs/locarchive.c.0100~ 2018-02-02 20:28:32.043266608 +0100
-+++ glibc-2.27/locale/programs/locarchive.c 2018-02-02 20:29:20.894352169 +0100
-@@ -1391,7 +1391,7 @@ add_locales_to_archive (size_t nlist, ch
- {
- char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
-
-- if (d_type == DT_UNKNOWN)
-+ if (d_type == DT_UNKNOWN || d_type == DT_LNK)
- {
- strcpy (stpcpy (stpcpy (fullname, fname), "/"),
- d->d_name);
diff --git a/eglibc-mandriva-string-format-fixes.patch b/eglibc-mandriva-string-format-fixes.patch
deleted file mode 100644
index 80f21c6..0000000
--- a/eglibc-mandriva-string-format-fixes.patch
+++ /dev/null
@@ -1,44 +0,0 @@
---- glibc-2.16.90-97bc38d7/misc/tst-error1.c.orig 2012-09-26 15:21:29.672179348 -0300
-+++ glibc-2.16.90-97bc38d7/misc/tst-error1.c 2012-09-26 15:21:59.422180301 -0300
-@@ -16,8 +16,8 @@ do_test (int argc, char *argv[])
- for (int i = 0; i < 1000; ++i)
- memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
- error (0, 0, str);
-- error (0, 0, buf);
-- error (0, 0, buf);
-+ error (0, 0, "%s", buf);
-+ error (0, 0, "%s", buf);
- error (0, 0, str);
- return 0;
- }
---- glibc-2.16.90-97bc38d7/posix/regexbug1.c.orig 2012-09-26 15:23:13.175182590 -0300
-+++ glibc-2.16.90-97bc38d7/posix/regexbug1.c 2012-09-26 15:23:32.198183235 -0300
-@@ -18,7 +18,7 @@ main (void)
- {
- char buf[100];
- regerror (reerr, &re, buf, sizeof buf);
-- error (EXIT_FAILURE, 0, buf);
-+ error (EXIT_FAILURE, 0, "%s", buf);
- }
-
- if (regexec (&re, "002", 2, ma, 0) != 0)
-@@ -35,7 +35,7 @@ main (void)
- {
- char buf[100];
- regerror (reerr, &re, buf, sizeof buf);
-- error (EXIT_FAILURE, 0, buf);
-+ error (EXIT_FAILURE, 0, "%s", buf);
- }
-
- if (regexec (&re, "002", 2, ma, 0) != 0)
---- glibc-2.16.90-97bc38d7/stdio-common/test-vfprintf.c.orig 2012-09-26 15:23:52.887183970 -0300
-+++ glibc-2.16.90-97bc38d7/stdio-common/test-vfprintf.c 2012-09-26 15:24:13.870184603 -0300
-@@ -92,7 +92,7 @@ main (void)
- fprintf (fp, "%s", large);
- fprintf (fp, "%.*s", 30000, large);
- large[20000] = '\0';
-- fprintf (fp, large);
-+ fprintf (fp, "%s", large);
- fprintf (fp, "%-1.300000000s", "hello");
-
- if (fflush (fp) != 0 || ferror (fp) != 0 || fclose (fp) != 0)
diff --git a/glibc-2.25-force-use-ld-bfd.patch b/glibc-2.25-force-use-ld-bfd.patch
index 504b142..f670dd7 100644
--- a/glibc-2.25-force-use-ld-bfd.patch
+++ b/glibc-2.25-force-use-ld-bfd.patch
@@ -1,6 +1,15 @@
---- glibc-2.27/Makeconfig.0133~ 2018-02-02 20:36:50.869704855 +0100
-+++ glibc-2.27/Makeconfig 2018-02-02 20:37:32.598866637 +0100
-@@ -360,6 +360,10 @@ else
+diff -up glibc-2.36/Makeconfig.35~ glibc-2.36/Makeconfig
+--- glibc-2.36/Makeconfig.35~ 2022-08-02 13:08:59.219749575 +0200
++++ glibc-2.36/Makeconfig 2022-08-02 13:11:51.923013290 +0200
+@@ -109,7 +109,6 @@ endif
+ #### Do NOT edit this file.
+ ####
+
+-
+ # Common prefix for machine-independent installation directories.
+ ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
+ prefix = /usr/local
+@@ -358,6 +357,10 @@ else
real-static-start-installed-name = $(static-start-installed-name)
endif
@@ -8,6 +17,6 @@
+LDFLAGS.so += -fuse-ld=bfd
+LDFLAGS-rtld += -fuse-ld=bfd
+
- ifeq (yesyes,$(build-shared)$(have-z-combreloc))
- combreloc-LDFLAGS = -Wl,-z,combreloc
- LDFLAGS.so += $(combreloc-LDFLAGS)
+ relro-LDFLAGS = -Wl,-z,relro
+ LDFLAGS.so += $(relro-LDFLAGS)
+ LDFLAGS-rtld += $(relro-LDFLAGS)
diff --git a/glibc-2.29-strict-aliasing.patch b/glibc-2.29-strict-aliasing.patch
index efdfbe4..957c200 100644
--- a/glibc-2.29-strict-aliasing.patch
+++ b/glibc-2.29-strict-aliasing.patch
@@ -1,7 +1,7 @@
-diff -up glibc-2.34/csu/Makefile.44~ glibc-2.34/csu/Makefile
---- glibc-2.34/csu/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/csu/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -108,7 +108,7 @@ endif
+diff -up glibc-2.39/csu/Makefile.34~ glibc-2.39/csu/Makefile
+--- glibc-2.39/csu/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/csu/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -121,7 +121,7 @@ endif
asm-CPPFLAGS += -I$(objpfx).
# Enable unwinding so backtrace unwinds to __libc_start_main
@@ -10,22 +10,21 @@ diff -up glibc-2.34/csu/Makefile.44~ glibc-2.34/csu/Makefile
include ../Rules
-diff -up glibc-2.34/debug/Makefile.44~ glibc-2.34/debug/Makefile
---- glibc-2.34/debug/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/debug/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -109,6 +109,8 @@ CPPFLAGS-tst-longjmp_chk2.c += -D_FORTIF
- CFLAGS-tst-longjmp_chk3.c += -fexceptions -fasynchronous-unwind-tables
- CPPFLAGS-tst-longjmp_chk3.c += -D_FORTIFY_SOURCE=1
-
+diff -up glibc-2.39/debug/Makefile.34~ glibc-2.39/debug/Makefile
+--- glibc-2.39/debug/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/debug/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -166,6 +166,7 @@ CFLAGS-pread_chk.c += -fexceptions -fasy
+ CFLAGS-pread64_chk.c += -fexceptions -fasynchronous-unwind-tables
+ CFLAGS-recv_chk.c += -fexceptions -fasynchronous-unwind-tables
+ CFLAGS-recvfrom_chk.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-longjmp_chk.c += -fno-strict-aliasing
-+
- # We know these tests have problems with format strings, this is what
- # we are testing. Disable that warning. They are also testing
- # deprecated functions (notably gets) so disable that warning as well.
-diff -up glibc-2.34/inet/Makefile.44~ glibc-2.34/inet/Makefile
---- glibc-2.34/inet/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/inet/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -110,6 +110,20 @@ CFLAGS-getnetgrent_r.c += -fexceptions
+
+ # Need to make sure the settings here override what configure might have
+ # set up for us, so keep the CFLAGS/CPPFLAGS split logical as the order is:
+diff -up glibc-2.39/inet/Makefile.34~ glibc-2.39/inet/Makefile
+--- glibc-2.39/inet/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/inet/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -128,6 +128,20 @@ CFLAGS-ifaddrs.c += $(config-cflags-wno-
CFLAGS-tst-checks-posix.c += -std=c99
CFLAGS-tst-sockaddr.c += -fno-strict-aliasing
@@ -46,10 +45,32 @@ diff -up glibc-2.34/inet/Makefile.44~ glibc-2.34/inet/Makefile
endif
# Install the rpc database file.
-diff -up glibc-2.34/libio/libioP.h.44~ glibc-2.34/libio/libioP.h
---- glibc-2.34/libio/libioP.h.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/libio/libioP.h 2021-08-02 10:36:15.550773510 +0200
-@@ -841,8 +841,8 @@ extern struct _IO_FILE_plus _IO_stderr_;
+diff -up glibc-2.39/libio/Makefile.34~ glibc-2.39/libio/Makefile
+--- glibc-2.39/libio/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/libio/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -179,6 +179,18 @@ CFLAGS-putc_u.c += $(config-cflags-wno-i
+ CFLAGS-iofgets_u.c += $(config-cflags-wno-ignored-attributes)
+ CFLAGS-iofputs_u.c += $(config-cflags-wno-ignored-attributes)
+ # XXX Do we need filedoalloc and wfiledoalloc? Others?
++CFLAGS-iofopncook.c += -fno-strict-aliasing
++CFLAGS-iopopen.c += -fno-strict-aliasing
++CFLAGS-vswprintf.c += -fno-strict-aliasing
++CFLAGS-wmemstream.c += -fno-strict-aliasing
++CFLAGS-memstream.c += -fno-strict-aliasing
++CFLAGS-obprintf.c += -fno-strict-aliasing
++CFLAGS-stdfiles.c += -fno-strict-aliasing
++CFLAGS-stdio.c += -fno-strict-aliasing
++CFLAGS-oldiofopen.c += -fno-strict-aliasing
++CFLAGS-oldiofdopen.c += -fno-strict-aliasing
++CFLAGS-oldiopopen.c += -fno-strict-aliasing
++CFLAGS-oldstdfiles.c += -fno-strict-aliasing
+
+ # Prevent fortification as these are built with -O0
+ CFLAGS-tst-bz24051.c += $(no-fortify-source)
+diff -up glibc-2.39/libio/libioP.h.34~ glibc-2.39/libio/libioP.h
+--- glibc-2.39/libio/libioP.h.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/libio/libioP.h 2024-01-31 23:44:39.572509209 +0100
+@@ -937,8 +937,8 @@ extern struct _IO_FILE_plus _IO_stderr_;
static inline bool
_IO_legacy_file (FILE *fp)
{
@@ -60,7 +81,7 @@ diff -up glibc-2.34/libio/libioP.h.44~ glibc-2.34/libio/libioP.h
}
#endif
-@@ -852,8 +852,8 @@ static inline void
+@@ -948,8 +948,8 @@ static inline void
_IO_deallocate_file (FILE *fp)
{
/* The current stream variables. */
@@ -71,33 +92,10 @@ diff -up glibc-2.34/libio/libioP.h.44~ glibc-2.34/libio/libioP.h
return;
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
if (_IO_legacy_file (fp))
-diff -up glibc-2.34/libio/Makefile.44~ glibc-2.34/libio/Makefile
---- glibc-2.34/libio/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/libio/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -154,6 +154,19 @@ CFLAGS-iofopen.c += -fexceptions
- CFLAGS-iofopen64.c += -fexceptions
- CFLAGS-oldtmpfile.c += -fexceptions
- # XXX Do we need filedoalloc and wfiledoalloc? Others?
-+#
-+CFLAGS-iofopncook.c += -fno-strict-aliasing
-+CFLAGS-iopopen.c += -fno-strict-aliasing
-+CFLAGS-vswprintf.c += -fno-strict-aliasing
-+CFLAGS-wmemstream.c += -fno-strict-aliasing
-+CFLAGS-memstream.c += -fno-strict-aliasing
-+CFLAGS-obprintf.c += -fno-strict-aliasing
-+CFLAGS-stdfiles.c += -fno-strict-aliasing
-+CFLAGS-stdio.c += -fno-strict-aliasing
-+CFLAGS-oldiofopen.c += -fno-strict-aliasing
-+CFLAGS-oldiofdopen.c += -fno-strict-aliasing
-+CFLAGS-oldiopopen.c += -fno-strict-aliasing
-+CFLAGS-oldstdfiles.c += -fno-strict-aliasing
-
- CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
-
-diff -up glibc-2.34/locale/Makefile.44~ glibc-2.34/locale/Makefile
---- glibc-2.34/locale/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/locale/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -106,6 +106,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
+diff -up glibc-2.39/locale/Makefile.34~ glibc-2.39/locale/Makefile
+--- glibc-2.39/locale/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/locale/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -172,6 +172,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
CFLAGS-charmap.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c += -Wno-write-strings
@@ -105,21 +103,21 @@ diff -up glibc-2.34/locale/Makefile.44~ glibc-2.34/locale/Makefile
# Set libof-* for each routine.
cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
-diff -up glibc-2.34/misc/Makefile.44~ glibc-2.34/misc/Makefile
---- glibc-2.34/misc/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/misc/Makefile 2021-08-02 10:36:15.550773510 +0200
-@@ -149,6 +149,8 @@ CFLAGS-sbrk.op = $(no-stack-protector)
- CFLAGS-brk.o = $(no-stack-protector)
- CFLAGS-brk.op = $(no-stack-protector)
+diff -up glibc-2.39/misc/Makefile.34~ glibc-2.39/misc/Makefile
+--- glibc-2.39/misc/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/misc/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -335,6 +335,8 @@ CFLAGS-mmap.op = $(no-stack-protector)
+ CFLAGS-mmap64.o = $(no-stack-protector)
+ CFLAGS-mmap64.op = $(no-stack-protector)
+CFLAGS-tsearch.c += -fno-strict-aliasing
+
include ../Rules
$(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
-diff -up glibc-2.34/nis/Makefile.44~ glibc-2.34/nis/Makefile
---- glibc-2.34/nis/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/nis/Makefile 2021-08-02 10:36:15.551773516 +0200
+diff -up glibc-2.39/nis/Makefile.34~ glibc-2.39/nis/Makefile
+--- glibc-2.39/nis/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/nis/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -52,6 +52,7 @@ endif # have-GLIBC_2.28
include ../Rules
@@ -128,10 +126,10 @@ diff -up glibc-2.34/nis/Makefile.44~ glibc-2.34/nis/Makefile
libnsl-libc = $(common-objpfx)linkobj/libc.so
# Target-specific variable setting to link objects using deprecated
-diff -up glibc-2.34/nptl/Makefile.44~ glibc-2.34/nptl/Makefile
---- glibc-2.34/nptl/Makefile.44~ 2021-08-02 10:36:15.551773516 +0200
-+++ glibc-2.34/nptl/Makefile 2021-08-02 10:37:30.043241660 +0200
-@@ -257,6 +257,22 @@ CFLAGS-sem_clockwait.c = -fexceptions -f
+diff -up glibc-2.39/nptl/Makefile.34~ glibc-2.39/nptl/Makefile
+--- glibc-2.39/nptl/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/nptl/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -263,6 +263,22 @@ CFLAGS-sem_clockwait.c = -fexceptions -f
CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
@@ -154,9 +152,9 @@ diff -up glibc-2.34/nptl/Makefile.44~ glibc-2.34/nptl/Makefile
LDLIBS-tst-once5 = -lstdc++
CFLAGS-tst-thread_local1.o = -std=gnu++11
LDLIBS-tst-thread_local1 = -lstdc++
-diff -up glibc-2.34/nscd/Makefile.44~ glibc-2.34/nscd/Makefile
---- glibc-2.34/nscd/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/nscd/Makefile 2021-08-02 10:36:15.551773516 +0200
+diff -up glibc-2.39/nscd/Makefile.34~ glibc-2.39/nscd/Makefile
+--- glibc-2.39/nscd/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/nscd/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -79,6 +79,14 @@ CFLAGS-nscd_gethst_r.c += -fexceptions
CFLAGS-nscd_getai.c += -fexceptions
CFLAGS-nscd_initgroups.c += -fexceptions
@@ -169,43 +167,45 @@ diff -up glibc-2.34/nscd/Makefile.44~ glibc-2.34/nscd/Makefile
+CFLAGS-aicache.c += -fno-strict-aliasing
+CFLAGS-gai.c += -fno-strict-aliasing
+
- CPPFLAGS-nscd += -D_FORTIFY_SOURCE=2
-
ifeq (yesyes,$(have-fpie)$(build-shared))
-diff -up glibc-2.34/nss/Makefile.44~ glibc-2.34/nss/Makefile
---- glibc-2.34/nss/Makefile.44~ 2021-08-02 10:36:15.551773516 +0200
-+++ glibc-2.34/nss/Makefile 2021-08-02 10:37:59.210424651 +0200
-@@ -189,3 +189,6 @@ endif
+ CFLAGS-nscd += $(pie-ccflag)
+ endif
+diff -up glibc-2.39/nss/Makefile.34~ glibc-2.39/nss/Makefile
+--- glibc-2.39/nss/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/nss/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -520,6 +520,9 @@ $(objpfx)mtrace-tst-nss-gai-hv2-canonnam
+ $(objpfx)tst-nss-gai-hv2-canonname.mtrace; } > $@; \
+ $(evaluate-test)
- $(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so
- $(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so
-+
+CFLAGS-getnssent_r.c += -fno-strict-aliasing
+CFLAGS-digits_dots.c += -fno-strict-aliasing
-diff -up glibc-2.34/posix/Makefile.44~ glibc-2.34/posix/Makefile
---- glibc-2.34/posix/Makefile.44~ 2021-08-02 10:36:15.551773516 +0200
-+++ glibc-2.34/posix/Makefile 2021-08-02 10:38:34.738647320 +0200
-@@ -269,6 +269,13 @@ CFLAGS-execlp.os = -fomit-frame-pointer
++
+ # Disable DT_RUNPATH on NSS tests so that the glibc internal NSS
+ # functions can load testing NSS modules via DT_RPATH.
+ LDFLAGS-tst-nss-test1 = -Wl,--disable-new-dtags
+diff -up glibc-2.39/posix/Makefile.34~ glibc-2.39/posix/Makefile
+--- glibc-2.39/posix/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/posix/Makefile 2024-01-31 23:44:39.572509209 +0100
+@@ -581,6 +581,12 @@ CFLAGS-execvp.os = -fomit-frame-pointer
+ CFLAGS-execlp.os = -fomit-frame-pointer
CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables
- CFLAGS-fork.c = $(libio-mtsafe)
-
+ CFLAGS-fork.c = $(libio-mtsafe) $(config-cflags-wno-ignored-attributes)
+CFLAGS-glob.c += -fno-strict-aliasing
+CFLAGS-glob-lstat-compat.c += -fno-strict-aliasing
+CFLAGS-glob64.c += -fno-strict-aliasing
+CFLAGS-glob64-lstat-compat.c += -fno-strict-aliasing
+CFLAGS-oldglob.c += -fno-strict-aliasing
+CFLAGS-getaddrinfo.c += -fno-strict-aliasing
-+
+
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
-
-diff -up glibc-2.34/resolv/Makefile.44~ glibc-2.34/resolv/Makefile
---- glibc-2.34/resolv/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/resolv/Makefile 2021-08-02 10:36:15.551773516 +0200
-@@ -205,6 +205,19 @@ include ../gen-locales.mk
+diff -up glibc-2.39/resolv/Makefile.34~ glibc-2.39/resolv/Makefile
+--- glibc-2.39/resolv/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/resolv/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -237,6 +237,18 @@ include ../gen-locales.mk
CFLAGS-res_hconf.c += -fexceptions
-
+ CFLAGS-inet_pton.c += $(config-cflags-wno-ignored-attributes)
+CFLAGS-gethstbyad_r.c += -fno-strict-aliasing
+CFLAGS-res-close.c += -fno-strict-aliasing
+CFLAGS-resolv_context.c += -fno-strict-aliasing
@@ -218,39 +218,39 @@ diff -up glibc-2.34/resolv/Makefile.44~ glibc-2.34/resolv/Makefile
+CFLAGS-dns-host.c += -fno-strict-aliasing
+CFLAGS-dns-network.c += -fno-strict-aliasing
+CFLAGS-dns-canon.c += -fno-strict-aliasing
-+
+
# The DNS NSS modules needs the resolver.
$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
-
-diff -up glibc-2.34/rt/Makefile.44~ glibc-2.34/rt/Makefile
---- glibc-2.34/rt/Makefile.44~ 2021-08-02 10:36:15.551773516 +0200
-+++ glibc-2.34/rt/Makefile 2021-08-02 10:39:17.082912434 +0200
-@@ -99,6 +99,8 @@ CFLAGS-aio_suspend.c += -fexceptions
+diff -up glibc-2.39/rt/Makefile.34~ glibc-2.39/rt/Makefile
+--- glibc-2.39/rt/Makefile.34~ 2024-01-31 23:44:39.540508898 +0100
++++ glibc-2.39/rt/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -100,6 +100,8 @@ CFLAGS-aio_suspend.c += -fexceptions
CFLAGS-mq_timedreceive.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-mq_timedsend.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-timer_create.c += -fno-strict-aliasing
+
- LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
+ # Exclude fortified routines from being built with _FORTIFY_SOURCE
+ routines_no_fortify += \
+ mq_open \
+diff -up glibc-2.39/setjmp/Makefile.34~ glibc-2.39/setjmp/Makefile
+--- glibc-2.39/setjmp/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/setjmp/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -36,6 +36,10 @@ tests-internal := \
- $(objpfx)librt.so: $(shared-thread-library)
-diff -up glibc-2.34/setjmp/Makefile.44~ glibc-2.34/setjmp/Makefile
---- glibc-2.34/setjmp/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/setjmp/Makefile 2021-08-02 10:36:15.552773523 +0200
-@@ -32,6 +32,9 @@ tests := tst-setjmp jmpbug bug269-setjm
- tst-sigsetjmp tst-setjmp-static
- tests-static := tst-setjmp-static
+ gen-as-const-headers += jmp_buf-macros.sym
+CFLAGS-sigjmp.c += -fno-strict-aliasing
+CFLAGS-longjmp.c += -fno-strict-aliasing
+CFLAGS-longjmp_chk.c += -fno-strict-aliasing
-
++
include ../Rules
-diff -up glibc-2.34/stdio-common/Makefile.44~ glibc-2.34/stdio-common/Makefile
---- glibc-2.34/stdio-common/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/stdio-common/Makefile 2021-08-02 10:36:15.552773523 +0200
-@@ -158,6 +158,10 @@ $(objpfx)tst-errno-manual.out: tst-errno
+ # This test messes the stack on purpose, which triggers longjump fortify
+diff -up glibc-2.39/stdio-common/Makefile.34~ glibc-2.39/stdio-common/Makefile
+--- glibc-2.39/stdio-common/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/stdio-common/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -436,6 +436,10 @@ $(objpfx)tst-errno-manual.out: tst-errno
CFLAGS-vfprintf.c += -Wno-uninitialized
CFLAGS-vfwprintf.c += -Wno-uninitialized
@@ -261,10 +261,10 @@ diff -up glibc-2.34/stdio-common/Makefile.44~ glibc-2.34/stdio-common/Makefile
CFLAGS-tmpfile.c += -fexceptions
CFLAGS-tmpfile64.c += -fexceptions
-diff -up glibc-2.34/sunrpc/Makefile.44~ glibc-2.34/sunrpc/Makefile
---- glibc-2.34/sunrpc/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/sunrpc/Makefile 2021-08-02 10:36:15.552773523 +0200
-@@ -96,6 +96,21 @@ CFLAGS-pmap_rmt.c += -fexceptions
+diff -up glibc-2.39/sunrpc/Makefile.34~ glibc-2.39/sunrpc/Makefile
+--- glibc-2.39/sunrpc/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/sunrpc/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -97,6 +97,21 @@ CFLAGS-pmap_rmt.c += -fexceptions
CFLAGS-clnt_perr.c += -fexceptions
CFLAGS-openchild.c += -fexceptions
@@ -286,10 +286,10 @@ diff -up glibc-2.34/sunrpc/Makefile.44~ glibc-2.34/sunrpc/Makefile
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
-diff -up glibc-2.34/support/Makefile.44~ glibc-2.34/support/Makefile
---- glibc-2.34/support/Makefile.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/support/Makefile 2021-08-02 10:36:15.552773523 +0200
-@@ -209,6 +209,8 @@ ifeq ($(build-shared),yes)
+diff -up glibc-2.39/support/Makefile.34~ glibc-2.39/support/Makefile
+--- glibc-2.39/support/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/support/Makefile 2024-01-31 23:44:39.576509248 +0100
+@@ -227,6 +227,8 @@ ifeq ($(build-shared),yes)
libsupport-inhibit-o += .o
endif
@@ -298,15 +298,16 @@ diff -up glibc-2.34/support/Makefile.44~ glibc-2.34/support/Makefile
CFLAGS-support_paths.c = \
-DSRCDIR_PATH=\"`cd .. ; pwd`\" \
-DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
-diff -up glibc-2.34/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.44~ glibc-2.34/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
---- glibc-2.34/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.44~ 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h 2021-08-02 10:36:15.552773523 +0200
-@@ -17,6 +17,8 @@
+diff -up glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.34~ glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
+--- glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.34~ 2024-01-31 23:44:39.576509248 +0100
++++ glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h 2024-01-31 23:45:21.024911385 +0100
+@@ -16,6 +16,9 @@
+ <https://www.gnu.org/licenses/>. */
#include <ldsodefs.h>
-
++
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+
+ #include <cpu-features.h>
+
/* The code checks if _rtld_global_ro was realocated before trying to access
- the dl_hwcap field. The assembly is to make the compiler not optimize the
- test (&_rtld_global_ro != NULL), which is always true in ISO C (but not
diff --git a/glibc-2.33-clang-_Float32-_Float64.patch b/glibc-2.33-clang-_Float32-_Float64.patch
index d2cb2c8..936bda7 100644
--- a/glibc-2.33-clang-_Float32-_Float64.patch
+++ b/glibc-2.33-clang-_Float32-_Float64.patch
@@ -1,12 +1,12 @@
-diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
---- glibc-2.33/bits/floatn-common.h.92~ 2021-02-01 18:15:33.000000000 +0100
-+++ glibc-2.33/bits/floatn-common.h 2021-07-10 03:25:10.190826118 +0200
+diff -up glibc-2.37/bits/floatn-common.h.41~ glibc-2.37/bits/floatn-common.h
+--- glibc-2.37/bits/floatn-common.h.41~ 2023-02-02 13:58:17.080273993 +0100
++++ glibc-2.37/bits/floatn-common.h 2023-02-02 14:14:11.952491495 +0100
@@ -145,7 +145,7 @@ typedef _Complex float __cfloat16 __attr
# endif
# if __HAVE_FLOAT32
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# define __CFLOAT32 _Complex float
# else
# define __CFLOAT32 _Complex _Float32
@@ -14,8 +14,8 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# endif
# if __HAVE_FLOAT64
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# ifdef __NO_LONG_DOUBLE_MATH
# define __CFLOAT64 _Complex long double
# else
@@ -23,8 +23,8 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# endif
# if __HAVE_FLOAT32X
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# define __CFLOAT32X _Complex double
# else
# define __CFLOAT32X _Complex _Float32x
@@ -32,8 +32,8 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# endif
# if __HAVE_FLOAT64X
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# if __HAVE_FLOAT64X_LONG_DOUBLE
# define __CFLOAT64X _Complex long double
# else
@@ -41,13 +41,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# if __HAVE_FLOAT32
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef float _Float32;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf32() (__builtin_huge_valf ())
# define __builtin_inff32() (__builtin_inff ())
# define __builtin_nanf32(x) (__builtin_nanf (x))
@@ -55,13 +55,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# ifdef __NO_LONG_DOUBLE_MATH
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef long double _Float64;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf64() (__builtin_huge_vall ())
# define __builtin_inff64() (__builtin_infl ())
# define __builtin_nanf64(x) (__builtin_nanl (x))
@@ -69,13 +69,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# else
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef double _Float64;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf64() (__builtin_huge_val ())
# define __builtin_inff64() (__builtin_inf ())
# define __builtin_nanf64(x) (__builtin_nan (x))
@@ -83,13 +83,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# if __HAVE_FLOAT32X
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef double _Float32x;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf32x() (__builtin_huge_val ())
# define __builtin_inff32x() (__builtin_inf ())
# define __builtin_nanf32x(x) (__builtin_nan (x))
@@ -97,13 +97,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# if __HAVE_FLOAT64X_LONG_DOUBLE
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef long double _Float64x;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf64x() (__builtin_huge_vall ())
# define __builtin_inff64x() (__builtin_infl ())
# define __builtin_nanf64x(x) (__builtin_nanl (x))
@@ -111,13 +111,13 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# else
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef _Float128 _Float64x;
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf64x() (__builtin_huge_valf128 ())
# define __builtin_inff64x() (__builtin_inff128 ())
# define __builtin_nanf64x(x) (__builtin_nanf128 (x))
@@ -125,25 +125,25 @@ diff -up glibc-2.33/bits/floatn-common.h.92~ glibc-2.33/bits/floatn-common.h
# if __HAVE_FLOAT128X
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# error "_Float128x supported but no type"
# endif
-# if !__GNUC_PREREQ (7, 0)
-+# if !__GNUC_PREREQ (7, 0) || defined(__clang__)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
# define __builtin_huge_valf128x() ((_Float128x) __builtin_huge_val ())
# define __builtin_inff128x() ((_Float128x) __builtin_inf ())
# define __builtin_nanf128x(x) ((_Float128x) __builtin_nan (x))
-diff -up glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h.92~ glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h
---- glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h.92~ 2021-02-01 18:15:33.000000000 +0100
-+++ glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h 2021-07-10 03:24:05.274345249 +0200
+diff -up glibc-2.37/sysdeps/ieee754/ldbl-128/bits/floatn.h.41~ glibc-2.37/sysdeps/ieee754/ldbl-128/bits/floatn.h
+--- glibc-2.37/sysdeps/ieee754/ldbl-128/bits/floatn.h.41~ 2023-02-02 13:58:17.080273993 +0100
++++ glibc-2.37/sysdeps/ieee754/ldbl-128/bits/floatn.h 2023-02-02 14:15:35.199544628 +0100
@@ -55,7 +55,7 @@
/* Defined to concatenate the literal suffix to be used with _Float128
types, if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
/* The literal suffix f128 exists only since GCC 7.0. */
# define __f128(x) x##l
# else
@@ -151,8 +151,8 @@ diff -up glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h.92~ glibc-2.33/sysdep
/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
# define __CFLOAT128 _Complex long double
# else
# define __CFLOAT128 _Complex _Float128
@@ -160,20 +160,20 @@ diff -up glibc-2.33/sysdeps/ieee754/ldbl-128/bits/floatn.h.92~ glibc-2.33/sysdep
# if __HAVE_FLOAT128
/* The type _Float128 exists only since GCC 7.0. */
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef long double _Float128;
# endif
-diff -up glibc-2.33/sysdeps/x86/bits/floatn.h.92~ glibc-2.33/sysdeps/x86/bits/floatn.h
---- glibc-2.33/sysdeps/x86/bits/floatn.h.92~ 2021-02-01 18:15:33.000000000 +0100
-+++ glibc-2.33/sysdeps/x86/bits/floatn.h 2021-07-10 03:24:05.274345249 +0200
+diff -up glibc-2.37/sysdeps/x86/bits/floatn.h.41~ glibc-2.37/sysdeps/x86/bits/floatn.h
+--- glibc-2.37/sysdeps/x86/bits/floatn.h.41~ 2023-02-01 04:27:45.000000000 +0100
++++ glibc-2.37/sysdeps/x86/bits/floatn.h 2023-02-02 14:16:58.816595696 +0100
@@ -58,7 +58,7 @@
/* Defined to concatenate the literal suffix to be used with _Float128
types, if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
/* The literal suffix f128 exists only since GCC 7.0. */
# define __f128(x) x##q
# else
@@ -181,20 +181,26 @@ diff -up glibc-2.33/sysdeps/x86/bits/floatn.h.92~ glibc-2.33/sysdeps/x86/bits/fl
/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
/* Add a typedef for older GCC compilers which don't natively support
_Complex _Float128. */
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
-@@ -82,7 +82,7 @@ typedef _Complex float __cfloat128 __att
+@@ -82,12 +82,12 @@ typedef _Complex float __cfloat128 __att
# if __HAVE_FLOAT128
/* The type _Float128 exists only since GCC 7.0. */
--# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
-+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined(__clang__)
+-# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
++# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) || defined __clang__
typedef __float128 _Float128;
# endif
+ /* __builtin_huge_valf128 doesn't exist before GCC 7.0. */
+-# if !__GNUC_PREREQ (7, 0)
++# if !__GNUC_PREREQ (7, 0) || defined __clang__
+ # define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
+ # endif
+
@@ -108,7 +108,7 @@ typedef __float128 _Float128;
e.g.: __builtin_signbitf128, before GCC 6. However, there has never
been a __builtin_signbitf128 in GCC and the type-generic builtin is
@@ -204,3 +210,42 @@ diff -up glibc-2.33/sysdeps/x86/bits/floatn.h.92~ glibc-2.33/sysdeps/x86/bits/fl
# define __builtin_signbitf128 __signbitf128
# endif
+diff -up glibc-2.37/math/math.h.omv~ glibc-2.37/math/math.h
+--- glibc-2.37/math/math.h.omv~ 2023-06-16 17:01:19.091562898 +0200
++++ glibc-2.37/math/math.h 2023-06-16 17:02:00.575945197 +0200
+@@ -1391,7 +1391,7 @@ template<> struct __iseqsig_type<long do
+ }
+ };
+
+-# if __HAVE_FLOAT32 && __GNUC_PREREQ (13, 0)
++# if __HAVE_FLOAT32 && __GNUC_PREREQ (13, 0) && !defined(__clang__)
+ template<> struct __iseqsig_type<_Float32>
+ {
+ static int __call (_Float32 __x, _Float32 __y) throw ()
+@@ -1401,7 +1401,7 @@ template<> struct __iseqsig_type<_Float3
+ };
+ # endif
+
+-# if __HAVE_FLOAT64 && __GNUC_PREREQ (13, 0)
++# if __HAVE_FLOAT64 && __GNUC_PREREQ (13, 0) && !defined(__clang__)
+ template<> struct __iseqsig_type<_Float64>
+ {
+ static int __call (_Float64 __x, _Float64 __y) throw ()
+@@ -1427,7 +1427,7 @@ template<> struct __iseqsig_type<_Float1
+ };
+ # endif
+
+-# if __HAVE_FLOAT32X && __GNUC_PREREQ (13, 0)
++# if __HAVE_FLOAT32X && __GNUC_PREREQ (13, 0) && !defined(__clang__)
+ template<> struct __iseqsig_type<_Float32x>
+ {
+ static int __call (_Float32x __x, _Float32x __y) throw ()
+@@ -1437,7 +1437,7 @@ template<> struct __iseqsig_type<_Float3
+ };
+ # endif
+
+-# if __HAVE_FLOAT64X && __GNUC_PREREQ (13, 0)
++# if __HAVE_FLOAT64X && __GNUC_PREREQ (13, 0) && !defined(__clang__)
+ template<> struct __iseqsig_type<_Float64x>
+ {
+ static int __call (_Float64x __x, _Float64x __y) throw ()
diff --git a/glibc-2.33-compile.patch b/glibc-2.33-compile.patch
deleted file mode 100644
index 32f9930..0000000
--- a/glibc-2.33-compile.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff -up glibc-2.33/stdlib/canonicalize.c.omv~ glibc-2.33/stdlib/canonicalize.c
---- glibc-2.33/stdlib/canonicalize.c.omv~ 2021-02-02 01:00:04.338272299 +0100
-+++ glibc-2.33/stdlib/canonicalize.c 2021-02-02 00:56:17.245117135 +0100
-@@ -413,7 +413,10 @@ error_nomem:
- return failed ? NULL : resolved;
- }
-
-+#pragma GCC diagnostic push
-+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
- return scratch_buffer_dupfree (rname_buf, dest - rname);
-+#pragma GCC diagnostic pop
- }
-
- /* Return the canonical absolute name of file NAME. A canonical name
-diff -up glibc-2.33/elf/cache.c.omv~ glibc-2.33/elf/cache.c
---- glibc-2.33/elf/cache.c.omv~ 2021-02-02 01:12:23.403424474 +0100
-+++ glibc-2.33/elf/cache.c 2021-02-02 01:18:28.015783023 +0100
-@@ -756,6 +756,7 @@ save_cache (const char *cache_name)
- /* Align file position to 4. */
- off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET);
- assert ((unsigned long long int) (extension_offset - old_offset) < 4);
-+ (void)old_offset; /* Prevent unused variable warning with NDEBUG --> assert = nothing */
- write_extensions (fd, str_offset, extension_offset);
- }
-
diff --git a/glibc-2.33-gcc-11.1.patch b/glibc-2.33-gcc-11.1.patch
deleted file mode 100644
index fa5a90b..0000000
--- a/glibc-2.33-gcc-11.1.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -up glibc-2.33/sunrpc/netname.c.omv~ glibc-2.33/sunrpc/netname.c
---- glibc-2.33/sunrpc/netname.c.omv~ 2021-05-11 21:34:01.180317491 +0200
-+++ glibc-2.33/sunrpc/netname.c 2021-05-11 21:36:17.125314747 +0200
-@@ -49,7 +49,12 @@ user2netname (char netname[MAXNETNAMELEN
- if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN)
- return 0;
-
-+ /* The check above makes sure the line below is actually ok, but
-+ * gcc 11.1 spews a warning... */
-+#pragma GCC diagnostic push
-+#pragma GCC diagnostic ignored "-Wformat-overflow"
- sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
-+#pragma GCC diagnostic pop
- i = strlen (netname);
- if (netname[i - 1] == '.')
- netname[i - 1] = '\0';
diff --git a/glibc-2.33-no-x86-isa-level.patch b/glibc-2.33-no-x86-isa-level.patch
index cdb4ca8..675172f 100644
--- a/glibc-2.33-no-x86-isa-level.patch
+++ b/glibc-2.33-no-x86-isa-level.patch
@@ -1,24 +1,24 @@
-diff -up glibc-2.33/sysdeps/x86/configure.62~ glibc-2.33/sysdeps/x86/configure
---- glibc-2.33/sysdeps/x86/configure.62~ 2021-03-11 00:59:44.937644191 +0100
-+++ glibc-2.33/sysdeps/x86/configure 2021-03-11 01:04:04.372479500 +0100
-@@ -136,7 +136,7 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS
+diff -up glibc-2.35/sysdeps/x86/configure.48~ glibc-2.35/sysdeps/x86/configure
+--- glibc-2.35/sysdeps/x86/configure.48~ 2022-02-03 11:26:20.165426217 +0100
++++ glibc-2.35/sysdeps/x86/configure 2022-02-03 11:27:41.422729679 +0100
+@@ -134,7 +134,7 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS
test $ac_status = 0; }; }; then
count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
if test "$count" = 1; then
- libc_cv_include_x86_isa_level=yes
+ libc_cv_include_x86_isa_level=no # workaround for vbox bug https://forums.gentoo.org/viewtopic-p-8568765.html?sid=563ab671df23b2a550273edc2dea30a2
- cat > conftest.c <<EOF
- EOF
- if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c'
-diff -up glibc-2.33/sysdeps/x86/configure.ac.62~ glibc-2.33/sysdeps/x86/configure.ac
---- glibc-2.33/sysdeps/x86/configure.ac.62~ 2021-03-11 00:59:44.937644191 +0100
-+++ glibc-2.33/sysdeps/x86/configure.ac 2021-03-11 01:03:29.158938280 +0100
-@@ -103,7 +103,7 @@ libc_cv_have_x86_movbe=no
+ fi
+ fi
+ rm -f conftest*
+diff -up glibc-2.35/sysdeps/x86/configure.ac.48~ glibc-2.35/sysdeps/x86/configure.ac
+--- glibc-2.35/sysdeps/x86/configure.ac.48~ 2022-02-03 11:26:20.165426217 +0100
++++ glibc-2.35/sysdeps/x86/configure.ac 2022-02-03 11:28:02.375807855 +0100
+@@ -101,7 +101,7 @@ libc_cv_include_x86_isa_level=no
if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S); then
count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
if test "$count" = 1; then
- libc_cv_include_x86_isa_level=yes
+ libc_cv_include_x86_isa_level=no # workaround for vbox bug https://forums.gentoo.org/viewtopic-p-8568765.html?sid=563ab671df23b2a550273edc2dea30a2
- cat > conftest.c <<EOF
- EOF
- if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c) | grep -q "\-msahf"; then
+ fi
+ fi
+ rm -f conftest*])
diff --git a/glibc-2.34-headers-clang.patch b/glibc-2.34-headers-clang.patch
index 2dda74e..b3c0fa3 100644
--- a/glibc-2.34-headers-clang.patch
+++ b/glibc-2.34-headers-clang.patch
@@ -1,8 +1,7 @@
-diff -up glibc-2.34/include/sys/cdefs.h.omv~ glibc-2.34/include/sys/cdefs.h
-diff -up glibc-2.34/misc/sys/cdefs.h.omv~ glibc-2.34/misc/sys/cdefs.h
---- glibc-2.34/misc/sys/cdefs.h.omv~ 2021-08-14 03:10:05.421588243 +0200
-+++ glibc-2.34/misc/sys/cdefs.h 2021-08-14 03:13:30.178192179 +0200
-@@ -465,7 +465,7 @@
+diff -up glibc-2.39/misc/sys/cdefs.h.21~ glibc-2.39/misc/sys/cdefs.h
+--- glibc-2.39/misc/sys/cdefs.h.21~ 2024-01-31 01:34:58.000000000 +0100
++++ glibc-2.39/misc/sys/cdefs.h 2024-01-31 23:43:38.315917000 +0100
+@@ -542,7 +542,7 @@
# endif
#endif
@@ -11,7 +10,7 @@ diff -up glibc-2.34/misc/sys/cdefs.h.omv~ glibc-2.34/misc/sys/cdefs.h
/* 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. */
-@@ -476,7 +476,7 @@
+@@ -553,7 +553,7 @@
/* Undefine (also defined in libc-symbols.h). */
#undef __attribute_copy__
@@ -20,7 +19,7 @@ diff -up glibc-2.34/misc/sys/cdefs.h.omv~ glibc-2.34/misc/sys/cdefs.h
/* Copies attributes from the declaration or type referenced by
the argument. */
# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
-@@ -596,7 +596,7 @@ _Static_assert (0, "IEEE 128-bits long d
+@@ -674,7 +674,7 @@ _Static_assert (0, "IEEE 128-bits long d
# define __HAVE_GENERIC_SELECTION 0
#endif
@@ -29,7 +28,7 @@ diff -up glibc-2.34/misc/sys/cdefs.h.omv~ glibc-2.34/misc/sys/cdefs.h
/* Designates a 1-based positional argument ref-index of pointer type
that can be used to access size-index elements of the pointed-to
array according to access mode, or at least one element when
-@@ -613,7 +613,7 @@ _Static_assert (0, "IEEE 128-bits long d
+@@ -701,7 +701,7 @@ _Static_assert (0, "IEEE 128-bits long d
# define __attr_access_none(argno)
#endif
@@ -38,3 +37,15 @@ diff -up glibc-2.34/misc/sys/cdefs.h.omv~ glibc-2.34/misc/sys/cdefs.h
/* Designates dealloc as a function to call to deallocate objects
allocated by the declared function. */
# define __attr_dealloc(dealloc, argno) \
+diff -up glibc-2.39/sysdeps/aarch64/fpu/bits/math-vector.h.21~ glibc-2.39/sysdeps/aarch64/fpu/bits/math-vector.h
+--- glibc-2.39/sysdeps/aarch64/fpu/bits/math-vector.h.21~ 2024-01-31 23:43:38.315917000 +0100
++++ glibc-2.39/sysdeps/aarch64/fpu/bits/math-vector.h 2024-01-31 23:44:19.720316997 +0100
+@@ -91,7 +91,7 @@
+ # define __DECL_SIMD_tanf __DECL_SIMD_aarch64
+ #endif
+
+-#if __GNUC_PREREQ(9, 0)
++#if __GNUC_PREREQ(9, 0) && !defined(__clang__)
+ # define __ADVSIMD_VEC_MATH_SUPPORTED
+ typedef __Float32x4_t __f32x4_t;
+ typedef __Float64x2_t __f64x2_t;
diff --git a/glibc-2.37-aarch64-clang++-16.0.6.patch b/glibc-2.37-aarch64-clang++-16.0.6.patch
new file mode 100644
index 0000000..67e279e
--- /dev/null
+++ b/glibc-2.37-aarch64-clang++-16.0.6.patch
@@ -0,0 +1,12 @@
+diff -up glibc-2.37/math/math.h.omv~ glibc-2.37/math/math.h
+--- glibc-2.37/math/math.h.omv~ 2023-07-19 14:17:16.802541037 +0200
++++ glibc-2.37/math/math.h 2023-07-19 14:17:31.472700094 +0200
+@@ -1411,7 +1411,7 @@ template<> struct __iseqsig_type<_Float6
+ };
+ # endif
+
+-# if __HAVE_FLOAT128_UNLIKE_LDBL || (__HAVE_FLOAT128 && __GNUC_PREREQ (13, 0))
++# if __HAVE_FLOAT128_UNLIKE_LDBL || (__HAVE_FLOAT128 && __GNUC_PREREQ (13, 0)) && (!defined(__clang__) || !defined(__cplusplus) || (!defined(__aarch64__) && !defined(__riscv)))
+ /* When using an IEEE 128-bit long double, _Float128 is defined as long double
+ in C++. */
+ template<> struct __iseqsig_type<_Float128>
diff --git a/glibc-2.37-lld-detection.patch b/glibc-2.37-lld-detection.patch
new file mode 100644
index 0000000..4f8132e
--- /dev/null
+++ b/glibc-2.37-lld-detection.patch
@@ -0,0 +1,12 @@
+diff -up glibc-2.37/configure.ac.omv~ glibc-2.37/configure.ac
+--- glibc-2.37/configure.ac.omv~ 2023-04-01 15:43:26.408120040 +0200
++++ glibc-2.37/configure.ac 2023-04-01 15:43:31.969153196 +0200
+@@ -579,7 +579,7 @@ case $($LD --version) in
+ [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing GNU gold")
+ ;;
+- "LLD"*)
++ "LLD"*|OpenMandriva*)
+ # Accept LLD 13.0.0 or higher
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
diff --git a/glibc-bench-build.patch b/glibc-bench-build.patch
deleted file mode 100644
index a982eef..0000000
--- a/glibc-bench-build.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git a/Makefile.in b/Makefile.in
-index 710ce7e..3fe9e73 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -12,7 +12,7 @@ install:
- LC_ALL=C; export LC_ALL; \
- $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
-
--bench bench-clean:
-+bench bench-clean bench-build:
- $(MAKE) -C $(srcdir)/benchtests $(PARALLELMFLAGS) objdir=`pwd` $@
-
- # Convenience target to rebuild ULPs for all math tests.
-diff --git a/Rules b/Rules
-index 4f9cdf3..42d0368 100644
---- a/Rules
-+++ b/Rules
-@@ -83,7 +83,7 @@ common-generated += dummy.o dummy.c
-
- # This makes all the auxiliary and test programs.
-
--.PHONY: others tests bench
-+.PHONY: others tests bench bench-build
-
- ifeq ($(build-programs),yes)
- others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
-diff --git a/benchtests/Makefile b/benchtests/Makefile
-index fd3036d..7cbceaa 100644
---- a/benchtests/Makefile
-+++ b/benchtests/Makefile
-@@ -103,6 +103,10 @@ bench-clean:
-
- bench: $(timing-type) $(gen-locales) bench-set bench-func bench-malloc
-
-+bench-build: bench-set-build bench-func-build
-+bench-set-build: $(binaries-benchset)
-+bench-func-build: $(binaries-bench) $(binaries-bench-malloc)
-+
- bench-set: $(binaries-benchset)
- for run in $^; do \
- echo "Running $${run}"; \
diff --git a/glibc-c-utf8-locale.patch b/glibc-c-utf8-locale.patch
deleted file mode 100644
index 7fabf30..0000000
--- a/glibc-c-utf8-locale.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001
-From: Mike FABIAN <mfabian@redhat.com>
-Date: Mon, 10 Aug 2015 15:58:12 +0200
-Subject: [PATCH] Add a C.UTF-8 locale
-
----
- localedata/SUPPORTED | 1 +
- localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 239 insertions(+)
- create mode 100644 localedata/locales/C
-
-diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
-index 8ca023e..2a78391 100644
---- a/localedata/SUPPORTED
-+++ b/localedata/SUPPORTED
-@@ -1,6 +1,7 @@
- # This file names the currently supported and somewhat tested locales.
- # If you have any additions please file a glibc bug report.
- SUPPORTED-LOCALES=\
-+C.UTF-8/UTF-8 \
- aa_DJ.UTF-8/UTF-8 \
- aa_DJ/ISO-8859-1 \
- aa_ER/UTF-8 \
-diff --git a/localedata/locales/C b/localedata/locales/C
-new file mode 100644
-index 0000000..fdf460e
---- /dev/null
-+++ b/localedata/locales/C
-@@ -0,0 +1,238 @@
-+escape_char /
-+comment_char %
-+% Locale for C locale in UTF-8
-+
-+LC_IDENTIFICATION
-+title "C locale"
-+source ""
-+address ""
-+contact ""
-+email "mfabian@redhat.com"
-+tel ""
-+fax ""
-+language "C"
-+territory ""
-+revision "1.0"
-+date "2015-08-10"
-+%
-+category "i18n:2012";LC_IDENTIFICATION
-+category "i18n:2012";LC_CTYPE
-+category "i18n:2012";LC_COLLATE
-+category "i18n:2012";LC_TIME
-+category "i18n:2012";LC_NUMERIC
-+category "i18n:2012";LC_MONETARY
-+category "i18n:2012";LC_MESSAGES
-+category "i18n:2012";LC_PAPER
-+category "i18n:2012";LC_NAME
-+category "i18n:2012";LC_ADDRESS
-+category "i18n:2012";LC_TELEPHONE
-+category "i18n:2012";LC_MEASUREMENT
-+END LC_IDENTIFICATION
-+
-+LC_CTYPE
-+copy "i18n"
-+
-+translit_start
-+include "translit_combining";""
-+translit_end
-+
-+END LC_CTYPE
-+
-+LC_COLLATE
-+order_start forward
-+<U0000>
-+..
-+<UFFFF>
-+<U10000>
-+..
-+<U1FFFF>
-+<U20000>
-+..
-+<U2FFFF>
-+<UE0000>
-+..
-+<UEFFFF>
-+<UF0000>
-+..
-+<UFFFFF>
-+<U100000>
-+..
-+<U10FFFF>
-+UNDEFINED
-+order_end
-+END LC_COLLATE
-+
-+LC_MONETARY
-+% This is the 14652 i18n fdcc-set definition for
-+% the LC_MONETARY category
-+% (except for the int_curr_symbol and currency_symbol, they are empty in
-+% the 14652 i18n fdcc-set definition and also empty in
-+% glibc/locale/C-monetary.c. But localedef complains in that case).
-+%
-+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
-+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
-+int_curr_symbol "<U0055><U0053><U0044><U0020>"
-+% Using "$" for currency_symbol. But maybe <U00A4> would be better?
-+% U+00A4 is the "generic currency symbol"
-+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
-+currency_symbol "<U0024>"
-+mon_decimal_point "<U002E>"
-+mon_thousands_sep ""
-+mon_grouping -1
-+positive_sign ""
-+negative_sign "<U002D>"
-+int_frac_digits -1
-+frac_digits -1
-+p_cs_precedes -1
-+int_p_sep_by_space -1
-+p_sep_by_space -1
-+n_cs_precedes -1
-+int_n_sep_by_space -1
-+n_sep_by_space -1
-+p_sign_posn -1
-+n_sign_posn -1
-+%
-+END LC_MONETARY
-+
-+LC_NUMERIC
-+% This is the POSIX Locale definition for
-+% the LC_NUMERIC category.
-+%
-+decimal_point "<U002E>"
-+thousands_sep ""
-+grouping -1
-+END LC_NUMERIC
-+
-+LC_TIME
-+% This is the POSIX Locale definition for
-+% the LC_TIME category.
-+%
-+% Abbreviated weekday names (%a)
-+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
-+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
-+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
-+ "<U0053><U0061><U0074>"
-+
-+% Full weekday names (%A)
-+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
-+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
-+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
-+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
-+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
-+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
-+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
-+
-+% Abbreviated month names (%b)
-+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
-+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
-+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
-+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
-+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
-+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
-+
-+% Full month names (%B)
-+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
-+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
-+ "<U004D><U0061><U0072><U0063><U0068>";/
-+ "<U0041><U0070><U0072><U0069><U006C>";/
-+ "<U004D><U0061><U0079>";/
-+ "<U004A><U0075><U006E><U0065>";/
-+ "<U004A><U0075><U006C><U0079>";/
-+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
-+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
-+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
-+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
-+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
-+
-+% Week description, consists of three fields:
-+% 1. Number of days in a week.
-+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
-+% 3. The weekday number to be contained in the first week of the year.
-+%
-+% ISO 8601 conforming applications should use the values 7, 19971201 (a
-+% Monday), and 4 (Thursday), respectively.
-+week 7;19971201;4
-+first_weekday 1
-+first_workday 1
-+
-+% Appropriate date and time representation (%c)
-+% "%a %b %e %H:%M:%S %Y"
-+d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
-+
-+% Appropriate date representation (%x)
-+% "%m/%d/%y"
-+d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
-+
-+% Appropriate time representation (%X)
-+% "%H:%M:%S"
-+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
-+
-+% Appropriate AM/PM time representation (%r)
-+% "%I:%M:%S %p"
-+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
-+
-+% Equivalent of AM/PM (%p) "AM"/"PM"
-+%
-+am_pm "<U0041><U004D>";"<U0050><U004D>"
-+
-+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
-+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
-+END LC_TIME
-+
-+LC_MESSAGES
-+% This is the POSIX Locale definition for
-+% the LC_NUMERIC category.
-+%
-+yesexpr "<U005E><U005B><U0079><U0059><U005D>"
-+noexpr "<U005E><U005B><U006E><U004E><U005D>"
-+yesstr "<U0059><U0065><U0073>"
-+nostr "<U004E><U006F>"
-+END LC_MESSAGES
-+
-+LC_PAPER
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_PAPER category.
-+% (A4 paper, this is also used in the built in C/POSIX
-+% locale in glibc/locale/C-paper.c)
-+height 297
-+width 210
-+END LC_PAPER
-+
-+LC_NAME
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_NAME category.
-+% "%p%t%g%t%m%t%f"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
-+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
-+<U0025><U006D><U0025><U0074><U0025><U0066>"
-+END LC_NAME
-+
-+LC_ADDRESS
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_ADDRESS category.
-+% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
-+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
-+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
-+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
-+<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
-+<U004E><U0025><U0063><U0025><U004E>"
-+END LC_ADDRESS
-+
-+LC_TELEPHONE
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_TELEPHONE category.
-+% "+%c %a %l"
-+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
-+<U006C>"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
-+END LC_TELEPHONE
-+
-+LC_MEASUREMENT
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_MEASUREMENT category.
-+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
-+%metric
-+measurement 1
-+END LC_MEASUREMENT
-+
---
-2.4.3
-
diff --git a/glibc-c_stubs.patch b/glibc-c_stubs.patch
deleted file mode 100644
index 934f0d0..0000000
--- a/glibc-c_stubs.patch
+++ /dev/null
@@ -1,754 +0,0 @@
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/Banner glibc-2.17-931-g30bbc0c.new/c_stubs/Banner
---- glibc-2.17-931-g30bbc0c/c_stubs/Banner 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/Banner 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1 @@
-+The C stubs add-on version 2.1.2.
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/ChangeLog glibc-2.17-931-g30bbc0c.new/c_stubs/ChangeLog
---- glibc-2.17-931-g30bbc0c/c_stubs/ChangeLog 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/ChangeLog 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,46 @@
-+2006-03-01 Jakub Jelinek <jakub@redhat.com>
-+
-+ * configure (libc_add_on_canonical, libc_add_on_subdir): Set.
-+
-+2001-08-07 Jakub Jelinek <jakub@redhat.com>
-+
-+ * gconv_stubs.c (__gconv_lookup_alias): Remove.
-+ (__gconv_NOOP, __gconv_compare_alias, __gconv_release_cache,
-+ __gconv_release_step): New.
-+
-+2001-06-07 Jakub Jelinek <jakub@redhat.com>
-+
-+ * gconv_stubs.c (__gconv_lookup_alias): New.
-+
-+2000-02-27 Cristian Gafton <gafton@redhat.com>
-+
-+ * gconv_stubs.c: Return __gconv_OK for:
-+ __gconv_transform_ascii_internal
-+ __gconv_transform_ucs2little_internal
-+ __gconv_transform_utf16_internal
-+ __gconv_transform_utf8_internal
-+ __gconv_transform_ucs2_internal
-+
-+2000-02-25 Cristian Gafton <gafton@redhat.com>
-+
-+ * gconv_stubs.c: add __c_stubs_is_compiled_in so we can detect when
-+ the library is linked in.
-+
-+Wed Dec 8 13:47:25 1999 Ivan Brunello <ivan.brunello@tiscalinet.it>
-+
-+ * Makefile (extra-objs): Changed stubs.o to gconv_stubs.o.
-+
-+Sun Dec 5 11:32:17 1999 H.J. Lu <hjl@gnu.org>
-+
-+ * gconv_stubs.c: Renamed from stubs.c.
-+ Support glibc 2.1.x.
-+
-+Mon Aug 23 16:42:05 1999 H.J. Lu <hjl@gnu.org>
-+
-+ * Banner: New.
-+ * COPYING.LIB: Likewise.
-+ * Makefile: Likewise.
-+ * README: Likewise.
-+ * configure: Likewise.
-+ * stubs.c: Likewise.
-+ * test-stdio.c: Likewise.
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/configure glibc-2.17-931-g30bbc0c.new/c_stubs/configure
---- glibc-2.17-931-g30bbc0c/c_stubs/configure 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/configure 2013-08-16 16:26:11.637020805 +0530
-@@ -0,0 +1,5 @@
-+# This is only to keep the GNU C library configure mechanism happy.
-+# This is a shell script fragment sourced by the main configure script.
-+
-+libc_add_on_canonical=
-+libc_add_on_subdirs=.
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/COPYING.LIB glibc-2.17-931-g30bbc0c.new/c_stubs/COPYING.LIB
---- glibc-2.17-931-g30bbc0c/c_stubs/COPYING.LIB 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/COPYING.LIB 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,482 @@
-+ GNU LIBRARY GENERAL PUBLIC LICENSE
-+ Version 2, June 1991
-+
-+ Copyright (C) 1991 Free Software Foundation, Inc.
-+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-+ Everyone is permitted to copy and distribute verbatim copies
-+ of this license document, but changing it is not allowed.
-+
-+[This is the first released version of the library GPL. It is
-+ numbered 2 because it goes with version 2 of the ordinary GPL.]
-+
-+ Preamble
-+
-+ The licenses for most software are designed to take away your
-+freedom to share and change it. By contrast, the GNU General Public
-+Licenses are intended to guarantee your freedom to share and change
-+free software--to make sure the software is free for all its users.
-+
-+ This license, the Library General Public License, applies to some
-+specially designated Free Software Foundation software, and to any
-+other libraries whose authors decide to use it. You can use it for
-+your libraries, too.
-+
-+ When we speak of free software, we are referring to freedom, not
-+price. Our General Public Licenses are designed to make sure that you
-+have the freedom to distribute copies of free software (and charge for
-+this service if you wish), that you receive source code or can get it
-+if you want it, that you can change the software or use pieces of it
-+in new free programs; and that you know you can do these things.
-+
-+ To protect your rights, we need to make restrictions that forbid
-+anyone to deny you these rights or to ask you to surrender the rights.
-+These restrictions translate to certain responsibilities for you if
-+you distribute copies of the library, or if you modify it.
-+
-+ For example, if you distribute copies of the library, whether gratis
-+or for a fee, you must give the recipients all the rights that we gave
-+you. You must make sure that they, too, receive or can get the source
-+code. If you link a program with the library, you must provide
-+complete object files to the recipients so that they can relink them
-+with the library, after making changes to the library and recompiling
-+it. And you must show them these terms so they know their rights.
-+
-+ Our method of protecting your rights has two steps: (1) copyright
-+the library, and (2) offer you this license which gives you legal
-+permission to copy, distribute and/or modify the library.
-+
-+ Also, for each distributor's protection, we want to make certain
-+that everyone understands that there is no warranty for this free
-+library. If the library is modified by someone else and passed on, we
-+want its recipients to know that what they have is not the original
-+version, so that any problems introduced by others will not reflect on
-+the original authors' reputations.
-+
-+ Finally, any free program is threatened constantly by software
-+patents. We wish to avoid the danger that companies distributing free
-+software will individually obtain patent licenses, thus in effect
-+transforming the program into proprietary software. To prevent this,
-+we have made it clear that any patent must be licensed for everyone's
-+free use or not licensed at all.
-+
-+ Most GNU software, including some libraries, is covered by the ordinary
-+GNU General Public License, which was designed for utility programs. This
-+license, the GNU Library General Public License, applies to certain
-+designated libraries. This license is quite different from the ordinary
-+one; be sure to read it in full, and don't assume that anything in it is
-+the same as in the ordinary license.
-+
-+ The reason we have a separate public license for some libraries is that
-+they blur the distinction we usually make between modifying or adding to a
-+program and simply using it. Linking a program with a library, without
-+changing the library, is in some sense simply using the library, and is
-+analogous to running a utility program or application program. However, in
-+a textual and legal sense, the linked executable is a combined work, a
-+derivative of the original library, and the ordinary General Public License
-+treats it as such.
-+
-+ Because of this blurred distinction, using the ordinary General
-+Public License for libraries did not effectively promote software
-+sharing, because most developers did not use the libraries. We
-+concluded that weaker conditions might promote sharing better.
-+
-+ However, unrestricted linking of non-free programs would deprive the
-+users of those programs of all benefit from the free status of the
-+libraries themselves. This Library General Public License is intended to
-+permit developers of non-free programs to use free libraries, while
-+preserving your freedom as a user of such programs to change the free
-+libraries that are incorporated in them. (We have not seen how to achieve
-+this as regards changes in header files, but we have achieved it as regards
-+changes in the actual functions of the Library.) The hope is that this
-+will lead to faster development of free libraries.
-+
-+ The precise terms and conditions for copying, distribution and
-+modification follow. Pay close attention to the difference between a
-+"work based on the library" and a "work that uses the library". The
-+former contains code derived from the library, while the latter only
-+works together with the library.
-+
-+ Note that it is possible for a library to be covered by the ordinary
-+General Public License rather than by this special one.
-+
-+ GNU LIBRARY GENERAL PUBLIC LICENSE
-+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-+
-+ 0. This License Agreement applies to any software library which
-+contains a notice placed by the copyright holder or other authorized
-+party saying it may be distributed under the terms of this Library
-+General Public License (also called "this License"). Each licensee is
-+addressed as "you".
-+
-+ A "library" means a collection of software functions and/or data
-+prepared so as to be conveniently linked with application programs
-+(which use some of those functions and data) to form executables.
-+
-+ The "Library", below, refers to any such software library or work
-+which has been distributed under these terms. A "work based on the
-+Library" means either the Library or any derivative work under
-+copyright law: that is to say, a work containing the Library or a
-+portion of it, either verbatim or with modifications and/or translated
-+straightforwardly into another language. (Hereinafter, translation is
-+included without limitation in the term "modification".)
-+
-+ "Source code" for a work means the preferred form of the work for
-+making modifications to it. For a library, complete source code means
-+all the source code for all modules it contains, plus any associated
-+interface definition files, plus the scripts used to control compilation
-+and installation of the library.
-+
-+ Activities other than copying, distribution and modification are not
-+covered by this License; they are outside its scope. The act of
-+running a program using the Library is not restricted, and output from
-+such a program is covered only if its contents constitute a work based
-+on the Library (independent of the use of the Library in a tool for
-+writing it). Whether that is true depends on what the Library does
-+and what the program that uses the Library does.
-+
-+ 1. You may copy and distribute verbatim copies of the Library's
-+complete source code as you receive it, in any medium, provided that
-+you conspicuously and appropriately publish on each copy an
-+appropriate copyright notice and disclaimer of warranty; keep intact
-+all the notices that refer to this License and to the absence of any
-+warranty; and distribute a copy of this License along with the
-+Library.
-+
-+ You may charge a fee for the physical act of transferring a copy,
-+and you may at your option offer warranty protection in exchange for a
-+fee.
-+
-+ 2. You may modify your copy or copies of the Library or any portion
-+of it, thus forming a work based on the Library, and copy and
-+distribute such modifications or work under the terms of Section 1
-+above, provided that you also meet all of these conditions:
-+
-+ a) The modified work must itself be a software library.
-+
-+ b) You must cause the files modified to carry prominent notices
-+ stating that you changed the files and the date of any change.
-+
-+ c) You must cause the whole of the work to be licensed at no
-+ charge to all third parties under the terms of this License.
-+
-+ d) If a facility in the modified Library refers to a function or a
-+ table of data to be supplied by an application program that uses
-+ the facility, other than as an argument passed when the facility
-+ is invoked, then you must make a good faith effort to ensure that,
-+ in the event an application does not supply such function or
-+ table, the facility still operates, and performs whatever part of
-+ its purpose remains meaningful.
-+
-+ (For example, a function in a library to compute square roots has
-+ a purpose that is entirely well-defined independent of the
-+ application. Therefore, Subsection 2d requires that any
-+ application-supplied function or table used by this function must
-+ be optional: if the application does not supply it, the square
-+ root function must still compute square roots.)
-+
-+These requirements apply to the modified work as a whole. If
-+identifiable sections of that work are not derived from the Library,
-+and can be reasonably considered independent and separate works in
-+themselves, then this License, and its terms, do not apply to those
-+sections when you distribute them as separate works. But when you
-+distribute the same sections as part of a whole which is a work based
-+on the Library, the distribution of the whole must be on the terms of
-+this License, whose permissions for other licensees extend to the
-+entire whole, and thus to each and every part regardless of who wrote
-+it.
-+
-+Thus, it is not the intent of this section to claim rights or contest
-+your rights to work written entirely by you; rather, the intent is to
-+exercise the right to control the distribution of derivative or
-+collective works based on the Library.
-+
-+In addition, mere aggregation of another work not based on the Library
-+with the Library (or with a work based on the Library) on a volume of
-+a storage or distribution medium does not bring the other work under
-+the scope of this License.
-+
-+ 3. You may opt to apply the terms of the ordinary GNU General Public
-+License instead of this License to a given copy of the Library. To do
-+this, you must alter all the notices that refer to this License, so
-+that they refer to the ordinary GNU General Public License, version 2,
-+instead of to this License. (If a newer version than version 2 of the
-+ordinary GNU General Public License has appeared, then you can specify
-+that version instead if you wish.) Do not make any other change in
-+these notices.
-+
-+ Once this change is made in a given copy, it is irreversible for
-+that copy, so the ordinary GNU General Public License applies to all
-+subsequent copies and derivative works made from that copy.
-+
-+ This option is useful when you wish to copy part of the code of
-+the Library into a program that is not a library.
-+
-+ 4. You may copy and distribute the Library (or a portion or
-+derivative of it, under Section 2) in object code or executable form
-+under the terms of Sections 1 and 2 above provided that you accompany
-+it with the complete corresponding machine-readable source code, which
-+must be distributed under the terms of Sections 1 and 2 above on a
-+medium customarily used for software interchange.
-+
-+ If distribution of object code is made by offering access to copy
-+from a designated place, then offering equivalent access to copy the
-+source code from the same place satisfies the requirement to
-+distribute the source code, even though third parties are not
-+compelled to copy the source along with the object code.
-+
-+ 5. A program that contains no derivative of any portion of the
-+Library, but is designed to work with the Library by being compiled or
-+linked with it, is called a "work that uses the Library". Such a
-+work, in isolation, is not a derivative work of the Library, and
-+therefore falls outside the scope of this License.
-+
-+ However, linking a "work that uses the Library" with the Library
-+creates an executable that is a derivative of the Library (because it
-+contains portions of the Library), rather than a "work that uses the
-+library". The executable is therefore covered by this License.
-+Section 6 states terms for distribution of such executables.
-+
-+ When a "work that uses the Library" uses material from a header file
-+that is part of the Library, the object code for the work may be a
-+derivative work of the Library even though the source code is not.
-+Whether this is true is especially significant if the work can be
-+linked without the Library, or if the work is itself a library. The
-+threshold for this to be true is not precisely defined by law.
-+
-+ If such an object file uses only numerical parameters, data
-+structure layouts and accessors, and small macros and small inline
-+functions (ten lines or less in length), then the use of the object
-+file is unrestricted, regardless of whether it is legally a derivative
-+work. (Executables containing this object code plus portions of the
-+Library will still fall under Section 6.)
-+
-+ Otherwise, if the work is a derivative of the Library, you may
-+distribute the object code for the work under the terms of Section 6.
-+Any executables containing that work also fall under Section 6,
-+whether or not they are linked directly with the Library itself.
-+
-+ 6. As an exception to the Sections above, you may also compile or
-+link a "work that uses the Library" with the Library to produce a
-+work containing portions of the Library, and distribute that work
-+under terms of your choice, provided that the terms permit
-+modification of the work for the customer's own use and reverse
-+engineering for debugging such modifications.
-+
-+ You must give prominent notice with each copy of the work that the
-+Library is used in it and that the Library and its use are covered by
-+this License. You must supply a copy of this License. If the work
-+during execution displays copyright notices, you must include the
-+copyright notice for the Library among them, as well as a reference
-+directing the user to the copy of this License. Also, you must do one
-+of these things:
-+
-+ a) Accompany the work with the complete corresponding
-+ machine-readable source code for the Library including whatever
-+ changes were used in the work (which must be distributed under
-+ Sections 1 and 2 above); and, if the work is an executable linked
-+ with the Library, with the complete machine-readable "work that
-+ uses the Library", as object code and/or source code, so that the
-+ user can modify the Library and then relink to produce a modified
-+ executable containing the modified Library. (It is understood
-+ that the user who changes the contents of definitions files in the
-+ Library will not necessarily be able to recompile the application
-+ to use the modified definitions.)
-+
-+ b) Accompany the work with a written offer, valid for at
-+ least three years, to give the same user the materials
-+ specified in Subsection 6a, above, for a charge no more
-+ than the cost of performing this distribution.
-+
-+ c) If distribution of the work is made by offering access to copy
-+ from a designated place, offer equivalent access to copy the above
-+ specified materials from the same place.
-+
-+ d) Verify that the user has already received a copy of these
-+ materials or that you have already sent this user a copy.
-+
-+ For an executable, the required form of the "work that uses the
-+Library" must include any data and utility programs needed for
-+reproducing the executable from it. However, as a special exception,
-+the source code distributed need not include anything that is normally
-+distributed (in either source or binary form) with the major
-+components (compiler, kernel, and so on) of the operating system on
-+which the executable runs, unless that component itself accompanies
-+the executable.
-+
-+ It may happen that this requirement contradicts the license
-+restrictions of other proprietary libraries that do not normally
-+accompany the operating system. Such a contradiction means you cannot
-+use both them and the Library together in an executable that you
-+distribute.
-+
-+ 7. You may place library facilities that are a work based on the
-+Library side-by-side in a single library together with other library
-+facilities not covered by this License, and distribute such a combined
-+library, provided that the separate distribution of the work based on
-+the Library and of the other library facilities is otherwise
-+permitted, and provided that you do these two things:
-+
-+ a) Accompany the combined library with a copy of the same work
-+ based on the Library, uncombined with any other library
-+ facilities. This must be distributed under the terms of the
-+ Sections above.
-+
-+ b) Give prominent notice with the combined library of the fact
-+ that part of it is a work based on the Library, and explaining
-+ where to find the accompanying uncombined form of the same work.
-+
-+ 8. You may not copy, modify, sublicense, link with, or distribute
-+the Library except as expressly provided under this License. Any
-+attempt otherwise to copy, modify, sublicense, link with, or
-+distribute the Library is void, and will automatically terminate your
-+rights under this License. However, parties who have received copies,
-+or rights, from you under this License will not have their licenses
-+terminated so long as such parties remain in full compliance.
-+
-+ 9. You are not required to accept this License, since you have not
-+signed it. However, nothing else grants you permission to modify or
-+distribute the Library or its derivative works. These actions are
-+prohibited by law if you do not accept this License. Therefore, by
-+modifying or distributing the Library (or any work based on the
-+Library), you indicate your acceptance of this License to do so, and
-+all its terms and conditions for copying, distributing or modifying
-+the Library or works based on it.
-+
-+ 10. Each time you redistribute the Library (or any work based on the
-+Library), the recipient automatically receives a license from the
-+original licensor to copy, distribute, link with or modify the Library
-+subject to these terms and conditions. You may not impose any further
-+restrictions on the recipients' exercise of the rights granted herein.
-+You are not responsible for enforcing compliance by third parties to
-+this License.
-+
-+ 11. If, as a consequence of a court judgment or allegation of patent
-+infringement or for any other reason (not limited to patent issues),
-+conditions are imposed on you (whether by court order, agreement or
-+otherwise) that contradict the conditions of this License, they do not
-+excuse you from the conditions of this License. If you cannot
-+distribute so as to satisfy simultaneously your obligations under this
-+License and any other pertinent obligations, then as a consequence you
-+may not distribute the Library at all. For example, if a patent
-+license would not permit royalty-free redistribution of the Library by
-+all those who receive copies directly or indirectly through you, then
-+the only way you could satisfy both it and this License would be to
-+refrain entirely from distribution of the Library.
-+
-+If any portion of this section is held invalid or unenforceable under any
-+particular circumstance, the balance of the section is intended to apply,
-+and the section as a whole is intended to apply in other circumstances.
-+
-+It is not the purpose of this section to induce you to infringe any
-+patents or other property right claims or to contest validity of any
-+such claims; this section has the sole purpose of protecting the
-+integrity of the free software distribution system which is
-+implemented by public license practices. Many people have made
-+generous contributions to the wide range of software distributed
-+through that system in reliance on consistent application of that
-+system; it is up to the author/donor to decide if he or she is willing
-+to distribute software through any other system and a licensee cannot
-+impose that choice.
-+
-+This section is intended to make thoroughly clear what is believed to
-+be a consequence of the rest of this License.
-+
-+ 12. If the distribution and/or use of the Library is restricted in
-+certain countries either by patents or by copyrighted interfaces, the
-+original copyright holder who places the Library under this License may add
-+an explicit geographical distribution limitation excluding those countries,
-+so that distribution is permitted only in or among countries not thus
-+excluded. In such case, this License incorporates the limitation as if
-+written in the body of this License.
-+
-+ 13. The Free Software Foundation may publish revised and/or new
-+versions of the Library General Public License from time to time.
-+Such new versions will be similar in spirit to the present version,
-+but may differ in detail to address new problems or concerns.
-+
-+Each version is given a distinguishing version number. If the Library
-+specifies a version number of this License which applies to it and
-+"any later version", you have the option of following the terms and
-+conditions either of that version or of any later version published by
-+the Free Software Foundation. If the Library does not specify a
-+license version number, you may choose any version ever published by
-+the Free Software Foundation.
-+
-+ 14. If you wish to incorporate parts of the Library into other free
-+programs whose distribution conditions are incompatible with these,
-+write to the author to ask for permission. For software which is
-+copyrighted by the Free Software Foundation, write to the Free
-+Software Foundation; we sometimes make exceptions for this. Our
-+decision will be guided by the two goals of preserving the free status
-+of all derivatives of our free software and of promoting the sharing
-+and reuse of software generally.
-+
-+ NO WARRANTY
-+
-+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-+
-+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-+DAMAGES.
-+
-+ END OF TERMS AND CONDITIONS
-+
-+ Appendix: How to Apply These Terms to Your New Libraries
-+
-+ If you develop a new library, and you want it to be of the greatest
-+possible use to the public, we recommend making it free software that
-+everyone can redistribute and change. You can do so by permitting
-+redistribution under these terms (or, alternatively, under the terms of the
-+ordinary General Public License).
-+
-+ To apply these terms, attach the following notices to the library. It is
-+safest to attach them to the start of each source file to most effectively
-+convey the exclusion of warranty; and each file should have at least the
-+"copyright" line and a pointer to where the full notice is found.
-+
-+ <one line to give the library's name and a brief idea of what it does.>
-+ Copyright (C) <year> <name of author>
-+
-+ This library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Library General Public
-+ License as published by the Free Software Foundation; either
-+ version 2 of the License, or (at your option) any later version.
-+
-+ This library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Library General Public License for more details.
-+
-+ You should have received a copy of the GNU Library General Public
-+ License along with this library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-+ MA 02111-1307, USA
-+
-+Also add information on how to contact you by electronic and paper mail.
-+
-+You should also get your employer (if you work as a programmer) or your
-+school, if any, to sign a "copyright disclaimer" for the library, if
-+necessary. Here is a sample; alter the names:
-+
-+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
-+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-+
-+ <signature of Ty Coon>, 1 April 1990
-+ Ty Coon, President of Vice
-+
-+That's all there is to it!
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/gconv_stubs.c glibc-2.17-931-g30bbc0c.new/c_stubs/gconv_stubs.c
---- glibc-2.17-931-g30bbc0c/c_stubs/gconv_stubs.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/gconv_stubs.c 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,126 @@
-+/* Provide gconv stub functions for the minimum static binaries.
-+ Copyright (C) 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Library General Public License as
-+ published by the Free Software Foundation; either version 2 of the
-+ License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Library General Public License for more details.
-+
-+ You should have received a copy of the GNU Library General Public
-+ License along with the GNU C Library; see the file COPYING.LIB. If not,
-+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA. */
-+
-+#include <features.h>
-+#include <string.h>
-+#include <wchar.h>
-+#include <bits/libc-lock.h>
-+#if __GNUC_PREREQ(3, 3)
-+# include <gconv_int.h>
-+#else
-+# include <gconv.h>
-+#endif
-+
-+__libc_lock_define_initialized (, __gconv_lock)
-+
-+/* hack for self identification */
-+int __c_stubs_is_compiled_in;
-+
-+/* Don't drag in the dynamic linker. */
-+void *__libc_stack_end;
-+
-+int attribute_hidden
-+__gconv_OK (void)
-+{
-+#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
-+ return __GCONV_OK;
-+#else
-+ return GCONV_OK;
-+#endif
-+}
-+
-+int attribute_hidden
-+__gconv_NOCONV (void)
-+{
-+#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
-+ return __GCONV_NOCONV;
-+#else
-+ return GCONV_NOCONV;
-+#endif
-+}
-+
-+void attribute_hidden
-+__gconv_NOOP (void)
-+{
-+}
-+
-+int
-+internal_function
-+__gconv_compare_alias (const char *name1, const char *name2)
-+{
-+ return strcmp (name1, name2);
-+}
-+
-+wint_t
-+__gconv_btwoc_ascii (struct __gconv_step *step, unsigned char c)
-+{
-+ if (c < 0x80)
-+ return c;
-+ else
-+ return WEOF;
-+}
-+
-+
-+#if __GNUC_PREREQ(3, 3)
-+# undef strong_alias
-+# define strong_alias(impl, name) \
-+ __typeof (name) name __attribute__ ((alias (#impl)))
-+#endif
-+
-+strong_alias (__gconv_OK,
-+ __gconv_close_transform);
-+strong_alias (__gconv_OK,
-+ __gconv_close);
-+
-+strong_alias (__gconv_NOCONV,
-+ __gconv);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_find_transform);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_open);
-+
-+/* These transformations should not fail in normal conditions */
-+strong_alias (__gconv_OK,
-+ __gconv_transform_ascii_internal);
-+strong_alias (__gconv_OK,
-+ __gconv_transform_utf16_internal);
-+strong_alias (__gconv_OK,
-+ __gconv_transform_utf8_internal);
-+strong_alias (__gconv_OK,
-+ __gconv_transform_ucs2_internal);
-+
-+/* We can assume no conversion for these ones */
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transform_internal_ascii);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transform_internal_ucs2);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transform_internal_ucs4);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transform_internal_utf16);
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transform_internal_utf8);
-+
-+strong_alias (__gconv_NOCONV,
-+ __gconv_transliterate);
-+
-+strong_alias (__gconv_NOOP,
-+ __gconv_release_cache);
-+strong_alias (__gconv_NOOP,
-+ __gconv_release_step);
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/Makefile glibc-2.17-931-g30bbc0c.new/c_stubs/Makefile
---- glibc-2.17-931-g30bbc0c/c_stubs/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/Makefile 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,46 @@
-+# Copyright (C) 1999 Free Software Foundation, Inc.
-+# This file is part of the GNU C Library.
-+
-+# The GNU C Library is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU Library General Public License as
-+# published by the Free Software Foundation; either version 2 of the
-+# License, or (at your option) any later version.
-+
-+# The GNU C Library is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# Library General Public License for more details.
-+
-+# You should have received a copy of the GNU Library General Public
-+# License along with the GNU C Library; see the file COPYING.LIB. If not,
-+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+# Boston, MA 02111-1307, USA.
-+
-+#
-+# Sub-makefile for the C stub add-on library.
-+#
-+subdir := c_stubs
-+
-+tests-static := test-stdio
-+tests := $(tests-static)
-+
-+libc_stubs-objs := gconv_stubs.o
-+
-+install-lib := libc_stubs.a
-+non-lib.a := libc_stubs.a
-+
-+extra-objs := gconv_stubs.o libc_stubs.a
-+
-+include ../Makeconfig
-+
-+CPPFLAGS += -I../iconv
-+
-+include ../Rules
-+
-+$(objpfx)libc_stubs.a: $(addprefix $(objpfx), $(libc_stubs-objs))
-+ -rm -f $@
-+ $(CC) -nostdlib -nostartfiles -r -o $@ $^
-+
-+lib: $(objpfx)libc_stubs.a
-+
-+$(objpfx)test-stdio: $(objpfx)libc_stubs.a
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/README glibc-2.17-931-g30bbc0c.new/c_stubs/README
---- glibc-2.17-931-g30bbc0c/c_stubs/README 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/README 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,8 @@
-+This is a stub add-on library for the GNU C library version 2.1.2 and
-+above. It is used to create the smaller static binaries by stubbing
-+out the gconv related functions. The resulting binaries may not have
-+all the functionalities.
-+
-+H.J. Lu
-+hjl@gnu.org
-+12/05/1999
-diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/test-stdio.c glibc-2.17-931-g30bbc0c.new/c_stubs/test-stdio.c
---- glibc-2.17-931-g30bbc0c/c_stubs/test-stdio.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/c_stubs/test-stdio.c 2011-10-19 16:34:41.000000000 +0530
-@@ -0,0 +1,8 @@
-+#include <stdio.h>
-+
-+int
-+main (void)
-+{
-+ printf ("Hello world\n");
-+ return 0;
-+}
diff --git a/glibc-fedora-getrlimit-PLT.patch b/glibc-fedora-getrlimit-PLT.patch
deleted file mode 100644
index bd77bb3..0000000
--- a/glibc-fedora-getrlimit-PLT.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 70d0a630700f602a457832383161d261fe222db5 Mon Sep 17 00:00:00 2001
-From: Andreas Schwab <schwab@redhat.com>
-Date: Thu, 1 Jul 2010 13:14:26 +0200
-Subject: [PATCH] Fix PLT reference
-
-* include/sys/resource.h (__getrlimit): Add hidden proto.
-* sysdeps/unix/sysv/linux/i386/getrlimit.c: Add libc_hidden_weak.
-* sysdeps/mach/hurd/getrlimit.c: Add libc_hidden_def.
-* resource/getrlimit.c: Likewise.
-
----
- ChangeLog | 7 +++++++
- include/sys/resource.h | 1 +
- resource/getrlimit.c | 1 +
- sysdeps/mach/hurd/getrlimit.c | 1 +
- sysdeps/unix/sysv/linux/i386/getrlimit.c | 1 +
- 5 files changed, 11 insertions(+), 0 deletions(-)
-
---- a/include/sys/resource.h
-+++ b/include/sys/resource.h
-@@ -14,5 +14,6 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
-
- extern int __setrlimit (enum __rlimit_resource __resource,
- const struct rlimit *__rlimits);
-+libc_hidden_proto (__getrlimit)
- #endif
- #endif
---- a/resource/getrlimit.c
-+++ b/resource/getrlimit.c
-@@ -27,6 +27,7 @@ __getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
- __set_errno (ENOSYS);
- return -1;
- }
-+libc_hidden_def (__getrlimit)
- weak_alias (__getrlimit, getrlimit)
-
- stub_warning (getrlimit)
---- a/sysdeps/mach/hurd/getrlimit.c
-+++ b/sysdeps/mach/hurd/getrlimit.c
-@@ -43,4 +43,5 @@ __getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
-
- return 0;
- }
-+libc_hidden_def (__getrlimit)
- weak_alias (__getrlimit, getrlimit)
diff --git a/glibc-fedora-localedata-rh61908.patch b/glibc-fedora-localedata-rh61908.patch
index c8fee0f..d62d7a2 100644
--- a/glibc-fedora-localedata-rh61908.patch
+++ b/glibc-fedora-localedata-rh61908.patch
@@ -1,10 +1,22 @@
+Short description: Add 4 ISO-8859-15 locales to SUPPORTED for Euro symbol.
+Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
+Origin: PATCH
+Bug-RHEL: #61908
+Upstream status: not-needed
+
+Very early RHL 7.3 requirement to add these locales so users can
+get access to Euro symbol. We should review this bug and decide if
+the UTF-8 locales are now serving the same purpose and drop the
+additional locales.
+
* Tue Mar 26 2002 Jakub Jelinek <jakub@redhat.com> 2.2.5-28
- add a couple of .ISO-8859-15 locales (#61908)
-diff -Nrup a/localedata/SUPPORTED b/localedata/SUPPORTED
---- a/localedata/SUPPORTED 2012-11-25 12:59:31.000000000 -0700
-+++ b/localedata/SUPPORTED 2012-11-26 12:58:43.298223018 -0700
-@@ -89,6 +89,7 @@ cy_GB.UTF-8/UTF-8 \
+diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
+index c8b63cc2fe2b4547..32088fdef06a14a3 100644
+--- a/localedata/SUPPORTED
++++ b/localedata/SUPPORTED
+@@ -103,6 +103,7 @@ cy_GB.UTF-8/UTF-8 \
cy_GB/ISO-8859-14 \
da_DK.UTF-8/UTF-8 \
da_DK/ISO-8859-1 \
@@ -12,7 +24,7 @@ diff -Nrup a/localedata/SUPPORTED b/localedata/SUPPORTED
de_AT.UTF-8/UTF-8 \
de_AT/ISO-8859-1 \
de_AT@euro/ISO-8859-15 \
-@@ -121,6 +122,7 @@ en_DK.UTF-8/UTF-8 \
+@@ -140,6 +141,7 @@ en_DK.UTF-8/UTF-8 \
en_DK/ISO-8859-1 \
en_GB.UTF-8/UTF-8 \
en_GB/ISO-8859-1 \
@@ -20,7 +32,7 @@ diff -Nrup a/localedata/SUPPORTED b/localedata/SUPPORTED
en_HK.UTF-8/UTF-8 \
en_HK/ISO-8859-1 \
en_IE.UTF-8/UTF-8 \
-@@ -136,6 +138,7 @@ en_SG.UTF-8/UTF-8 \
+@@ -157,6 +159,7 @@ en_SG.UTF-8/UTF-8 \
en_SG/ISO-8859-1 \
en_US.UTF-8/UTF-8 \
en_US/ISO-8859-1 \
@@ -28,11 +40,11 @@ diff -Nrup a/localedata/SUPPORTED b/localedata/SUPPORTED
en_ZA.UTF-8/UTF-8 \
en_ZA/ISO-8859-1 \
en_ZM/UTF-8 \
-@@ -385,6 +388,7 @@ sv_FI/ISO-8859-1 \
+@@ -425,6 +428,7 @@ sv_FI/ISO-8859-1 \
sv_FI@euro/ISO-8859-15 \
sv_SE.UTF-8/UTF-8 \
sv_SE/ISO-8859-1 \
+sv_SE.ISO-8859-15/ISO-8859-15 \
sw_KE/UTF-8 \
sw_TZ/UTF-8 \
- szl_PL/UTF-8 \
+ syr/UTF-8 \
diff --git a/glibc-fedora-uname-getrlimit.patch b/glibc-fedora-uname-getrlimit.patch
deleted file mode 100644
index dedb836..0000000
--- a/glibc-fedora-uname-getrlimit.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From cde99cd2b7b16a6113acb054e89d490047932a9f Mon Sep 17 00:00:00 2001
-From: Andreas Schwab <schwab@redhat.com>
-Date: Thu, 8 Apr 2010 11:18:26 +0200
-Subject: [PATCH] Don't call uname or getrlimit in libpthread init function
-
-* sysdeps/unix/sysv/linux/i386/Versions: Export __uname under
-GLIBC_PRIVATE.
-* nptl/Versions: Export __getrlimit under GLIBC_PRIVATE.
-* sysdeps/unix/sysv/linux/i386/smp.h: Call __uname instead of uname.
-* nptl/nptl-init.c: Call __getrlimit instead of getrlimit.
-
----
- ChangeLog | 8 ++++++++
- nptl/Versions | 1 +
- nptl/nptl-init.c | 2 +-
- sysdeps/unix/sysv/linux/i386/Versions | 6 ++++++
- sysdeps/unix/sysv/linux/i386/smp.h | 2 +-
- 5 files changed, 17 insertions(+), 2 deletions(-)
- create mode 100644 sysdeps/unix/sysv/linux/i386/Versions
-
---- a/nptl/Version
-+++ b/nptl/Versions
-@@ -30,6 +30,7 @@ libc {
- __libc_pthread_init;
- __libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
- __libc_allocate_rtsig_private;
-+ __getrlimit;
- }
- }
-
---- a/sysdeps/unix/sysv/linux/i386/Versions
-+++ b/sysdeps/unix/sysv/linux/i386/Versions
-@@ -53,5 +53,6 @@
- }
- GLIBC_PRIVATE {
- __modify_ldt;
-+ __uname;
- }
- }
---- a/sysdeps/unix/sysv/linux/i386/smp.h
-+++ b/sysdeps/unix/sysv/linux/i386/smp.h
-@@ -36,7 +36,7 @@ is_smp_system (void)
- char *cp;
-
- /* Try reading the number using `sysctl' first. */
-- if (uname (&u.uts) == 0)
-+ if (__uname (&u.uts) == 0)
- cp = u.uts.version;
- else
- {
diff --git a/glibc-new-condvar.patch b/glibc-new-condvar.patch
deleted file mode 100644
index 747bf0d..0000000
--- a/glibc-new-condvar.patch
+++ /dev/null
@@ -1,6264 +0,0 @@
-commit db7d3860a02a6617d4d77324185aa0547cc58391
-Author: Torvald Riegel <triegel@redhat.com>
-Date: Sun Nov 10 15:43:14 2013 +0100
-
- New condvar implementation that provides stronger ordering guarantees.
-
-diff --git a/nptl/DESIGN-condvar.txt b/nptl/DESIGN-condvar.txt
-deleted file mode 100644
-index 4845251..0000000
---- a/nptl/DESIGN-condvar.txt
-+++ /dev/null
-@@ -1,134 +0,0 @@
--Conditional Variable pseudocode.
--================================
--
-- int pthread_cond_timedwait (pthread_cond_t *cv, pthread_mutex_t *mutex);
-- int pthread_cond_signal (pthread_cond_t *cv);
-- int pthread_cond_broadcast (pthread_cond_t *cv);
--
--struct pthread_cond_t {
--
-- unsigned int cond_lock;
--
-- internal mutex
--
-- uint64_t total_seq;
--
-- Total number of threads using the conditional variable.
--
-- uint64_t wakeup_seq;
--
-- sequence number for next wakeup.
--
-- uint64_t woken_seq;
--
-- sequence number of last woken thread.
--
-- uint32_t broadcast_seq;
--
--}
--
--
--struct cv_data {
--
-- pthread_cond_t *cv;
--
-- uint32_t bc_seq
--
--}
--
--
--
--cleanup_handler(cv_data)
--{
-- cv = cv_data->cv;
-- lll_lock(cv->lock);
--
-- if (cv_data->bc_seq == cv->broadcast_seq) {
-- ++cv->wakeup_seq;
-- ++cv->woken_seq;
-- }
--
-- /* make sure no signal gets lost. */
-- FUTEX_WAKE(cv->wakeup_seq, ALL);
--
-- lll_unlock(cv->lock);
--}
--
--
--cond_timedwait(cv, mutex, timeout):
--{
-- lll_lock(cv->lock);
-- mutex_unlock(mutex);
--
-- cleanup_push
--
-- ++cv->total_seq;
-- val = seq = cv->wakeup_seq;
-- cv_data.bc = cv->broadcast_seq;
-- cv_data.cv = cv;
--
-- while (1) {
--
-- lll_unlock(cv->lock);
--
-- enable_async(&cv_data);
--
-- ret = FUTEX_WAIT(cv->wakeup_seq, val, timeout);
--
-- restore_async
--
-- lll_lock(cv->lock);
--
-- if (bc != cv->broadcast_seq)
-- goto bc_out;
--
-- val = cv->wakeup_seq;
--
-- if (val != seq && cv->woken_seq != val) {
-- ret = 0;
-- break;
-- }
--
-- if (ret == TIMEDOUT) {
-- ++cv->wakeup_seq;
-- break;
-- }
-- }
--
-- ++cv->woken_seq;
--
-- bc_out:
-- lll_unlock(cv->lock);
--
-- cleanup_pop
--
-- mutex_lock(mutex);
--
-- return ret;
--}
--
--cond_signal(cv)
--{
-- lll_lock(cv->lock);
--
-- if (cv->total_seq > cv->wakeup_seq) {
-- ++cv->wakeup_seq;
-- FUTEX_WAKE(cv->wakeup_seq, 1);
-- }
--
-- lll_unlock(cv->lock);
--}
--
--cond_broadcast(cv)
--{
-- lll_lock(cv->lock);
--
-- if (cv->total_seq > cv->wakeup_seq) {
-- cv->wakeup_seq = cv->total_seq;
-- cv->woken_seq = cv->total_seq;
-- ++cv->broadcast_seq;
-- FUTEX_WAKE(cv->wakeup_seq, ALL);
-- }
--
-- lll_unlock(cv->lock);
--}
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 89fdc8b..50a85a6 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -71,7 +71,7 @@ libpthread-routines = nptl-init vars events version \
- pthread_rwlockattr_getkind_np \
- pthread_rwlockattr_setkind_np \
- pthread_cond_init pthread_cond_destroy \
-- pthread_cond_wait pthread_cond_timedwait \
-+ pthread_cond_wait \
- pthread_cond_signal pthread_cond_broadcast \
- old_pthread_cond_init old_pthread_cond_destroy \
- old_pthread_cond_wait old_pthread_cond_timedwait \
-@@ -178,7 +178,6 @@ CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
- -fasynchronous-unwind-tables
- CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
--CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
-
-@@ -216,7 +215,7 @@ tests = tst-typesizes \
- tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
- tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
- tst-cond20 tst-cond21 tst-cond22 tst-cond23 tst-cond24 tst-cond25 \
-- tst-cond-except \
-+ tst-cond26 tst-cond27 tst-cond28 tst-cond-except \
- tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
- tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
- tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
-@@ -280,8 +279,7 @@ test-srcs = tst-oddstacklimit
- # Files which must not be linked with libpthread.
- tests-nolibpthread = tst-unload
-
--gen-as-const-headers = pthread-errnos.sym \
-- lowlevelcond.sym lowlevelrwlock.sym \
-+gen-as-const-headers = pthread-errnos.sym lowlevelrwlock.sym \
- lowlevelbarrier.sym unwindbuf.sym \
- lowlevelrobustlock.sym pthread-pi-defines.sym
-
-diff --git a/nptl/lowlevelcond.sym b/nptl/lowlevelcond.sym
-deleted file mode 100644
-index 18e1ada..0000000
---- a/nptl/lowlevelcond.sym
-+++ /dev/null
-@@ -1,16 +0,0 @@
--#include <stddef.h>
--#include <sched.h>
--#include <bits/pthreadtypes.h>
--#include <internaltypes.h>
--
----
--
--cond_lock offsetof (pthread_cond_t, __data.__lock)
--cond_futex offsetof (pthread_cond_t, __data.__futex)
--cond_nwaiters offsetof (pthread_cond_t, __data.__nwaiters)
--total_seq offsetof (pthread_cond_t, __data.__total_seq)
--wakeup_seq offsetof (pthread_cond_t, __data.__wakeup_seq)
--woken_seq offsetof (pthread_cond_t, __data.__woken_seq)
--dep_mutex offsetof (pthread_cond_t, __data.__mutex)
--broadcast_seq offsetof (pthread_cond_t, __data.__broadcast_seq)
--nwaiters_shift COND_NWAITERS_SHIFT
-diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
-index 881d098..6848d61 100644
---- a/nptl/pthread_cond_broadcast.c
-+++ b/nptl/pthread_cond_broadcast.c
-@@ -23,69 +23,74 @@
- #include <pthread.h>
- #include <pthreadP.h>
- #include <stap-probe.h>
-+#include <atomic.h>
-
- #include <shlib-compat.h>
- #include <kernel-features.h>
-
-
-+/* See __pthread_cond_wait for a high-level description of the algorithm. */
- int
--__pthread_cond_broadcast (cond)
-- pthread_cond_t *cond;
-+__pthread_cond_broadcast (pthread_cond_t *cond)
- {
-- LIBC_PROBE (cond_broadcast, 1, cond);
-+ unsigned int gen, wseq, ssent;
-
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-+ /* See comment in __pthread_cond_signal. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Are there any waiters to be woken? */
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-- {
-- /* Yes. Mark them all as woken. */
-- cond->__data.__wakeup_seq = cond->__data.__total_seq;
-- cond->__data.__woken_seq = cond->__data.__total_seq;
-- cond->__data.__futex = (unsigned int) cond->__data.__total_seq * 2;
-- int futex_val = cond->__data.__futex;
-- /* Signal that a broadcast happened. */
-- ++cond->__data.__broadcast_seq;
--
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
-
-- /* Wake everybody. */
-- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
--
-- /* Do not use requeue for pshared condvars. */
-- if (mut == (void *) ~0l
-- || PTHREAD_MUTEX_PSHARED (mut) & PTHREAD_MUTEX_PSHARED_BIT)
-- goto wake_all;
-+ LIBC_PROBE (cond_broadcast, 1, cond);
-
--#if (defined lll_futex_cmp_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (USE_REQUEUE_PI (mut))
-- {
-- if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
-- &mut->__data.__lock, futex_val,
-- LLL_PRIVATE) == 0)
-- return 0;
-- }
-- else
--#endif
-- /* lll_futex_requeue returns 0 for success and non-zero
-- for errors. */
-- if (!__builtin_expect (lll_futex_requeue (&cond->__data.__futex, 1,
-- INT_MAX, &mut->__data.__lock,
-- futex_val, LLL_PRIVATE), 0))
-- return 0;
-+ /* We use the same approach for broadcasts as for normal signals but wake
-+ all waiters (i.e., we try to set SIGNALS_SENT to WSEQ). However, to
-+ prevent an excessive number of spurious wake-ups, we need to check
-+ whether we read values for SIGNALS_SENT and WSEQ that are from one
-+ generation; otherwise, we could read a not-yet-reset WSEQ and a reset
-+ SIGNAL_SENT, resulting in a very large number of spurious wake-ups that
-+ we make available. Checking the generation won't prevent an ABA problem
-+ for the CAS in the loop below when the generation changes between our
-+ generation check and the CAS; however, in this case, we just add a still
-+ reasonable number of spurious wake-ups (i.e., equal to the number of
-+ waiters than were actually blocked on the condvar at some point in the
-+ past). Therefore, we first load the current generation. We need
-+ acquire MO here to make sure that we next read values for WSEQ and
-+ SIGNALS_SENT from this or a later generation (see the matching release
-+ MOs in __pthread_cond_wait). */
-+ gen = atomic_load_acquire (&cond->__data.__generation);
-+ wseq = atomic_load_relaxed (&cond->__data.__wseq);
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
-+ do
-+ {
-
--wake_all:
-- lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared);
-- return 0;
-+ /* If the generation changed concurrently, then we could have been
-+ positioned in the earlier generation; thus, all waiters we must wake
-+ have been or will be woken during the quiescence period. The other
-+ conditions are the same as in __pthread_cond_signal.
-+ We add an acquire-MO fence to ensure that loading the stores to WSEQ
-+ and SIGNALS_SENT that we read from above happened before we read
-+ GENERATION a second time, which allows us to detect if we read
-+ partially reset state or state from a new generation (see
-+ __pthread_cond_wait and the matching release MO stores there). */
-+ atomic_thread_fence_acquire ();
-+ if (gen != atomic_load_relaxed (&cond->__data.__generation)
-+ || ssent >= wseq || wseq >= __PTHREAD_COND_WSEQ_THRESHOLD)
-+ return 0;
- }
--
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
-+ while (!atomic_compare_exchange_weak_relaxed (&cond->__data.__signals_sent,
-+ &ssent, wseq));
-+
-+ /* XXX Could we skip the futex_wake if not necessary (eg, if there are just
-+ spinning waiters)? This would need additional communication but could it
-+ be more efficient than the kernel-side communication? Should we spin for
-+ a while to see if our signal was consumed in the meantime? */
-+ /* TODO Use futex_requeue on the mutex? Could increase broadcast scalability
-+ if there are many waiters, but this depends on the scalability of the
-+ mutex. It also prevents use of lock elision, and requires all waiters
-+ to put the mutex in contended state when they re-acquire it, independent
-+ of whether they were woken by a broadcast or not. Notes that we can only
-+ requeue if the mutex is set already (ie, we had waiters already). */
-+ /* XXX Really INT_MAX? Would WSEQ-SIGNALS_SENT be possible? Useful? */
-+ lll_futex_wake (&cond->__data.__signals_sent, INT_MAX, pshared);
-
- return 0;
- }
-diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
-index 410e52d..7c9cf13 100644
---- a/nptl/pthread_cond_destroy.c
-+++ b/nptl/pthread_cond_destroy.c
-@@ -20,67 +20,94 @@
- #include <shlib-compat.h>
- #include "pthreadP.h"
- #include <stap-probe.h>
--
--
-+#include <atomic.h>
-+
-+
-+/* See __pthread_cond_wait for a high-level description of the algorithm.
-+
-+ A correct program must make sure that no waiters are blocked on the condvar
-+ when it is destroyed, and that there are no concurrent signals or
-+ broadcasts. To wake waiters reliably, the program must signal or
-+ broadcast while holding the mutex or after having held the mutex. It must
-+ also ensure that no signal or broadcast are still pending to unblock
-+ waiters; IOW, because waiters can wake up spuriously, the program must
-+ effectively ensure that destruction happens after the execution of those
-+ signal or broadcast calls.
-+ Thus, we can assume that any waiters that are still accessing the condvar
-+ will either (1) have been woken but not yet confirmed that they woke up or
-+ (2) wait for quiescence to finish (i.e., the only steps they will perform
-+ are waiting on GENERATION and then decrementing QUIESCENCE_WAITERS; all
-+ other steps related to quiescence are performed by waiters before they
-+ release the mutex).
-+ Thus, if we are not yet in an ongoing quiescence state, we just make
-+ the last concurrently confirming waiter believe we are so that it notifies
-+ us; then we wait for QUIESCENCE_WAITERS to finish waiting for the end of
-+ the quiescence state. */
- int
--__pthread_cond_destroy (cond)
-- pthread_cond_t *cond;
-+__pthread_cond_destroy (pthread_cond_t *cond)
- {
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-+ unsigned int wseq, val;
-+
-+ /* See comment in __pthread_cond_signal. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
-
- LIBC_PROBE (cond_destroy, 1, cond);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-- {
-- /* If there are still some waiters which have not been
-- woken up, this is an application bug. */
-- lll_unlock (cond->__data.__lock, pshared);
-- return EBUSY;
-- }
--
-- /* Tell pthread_cond_*wait that this condvar is being destroyed. */
-- cond->__data.__total_seq = -1ULL;
--
-- /* If there are waiters which have been already signalled or
-- broadcasted, but still are using the pthread_cond_t structure,
-- pthread_cond_destroy needs to wait for them. */
-- unsigned int nwaiters = cond->__data.__nwaiters;
--
-- if (nwaiters >= (1 << COND_NWAITERS_SHIFT))
-+ /* If we are already in the quiescence state, then signals and broadcasts
-+ will not modify SIGNALS_SENT anymore because all waiters will wake up
-+ anyway (and we don't have to synchronize between signal/broadcast and the
-+ reset of SIGNALS_SENT when quiescence is finished). Thus, never do the
-+ following check in this case; it cannot be reliably anyway, and is also
-+ just recommended by POSIX. */
-+ wseq = atomic_load_relaxed (&cond->__data.__wseq);
-+ if (wseq != __PTHREAD_COND_WSEQ_THRESHOLD
-+ && wseq > atomic_load_relaxed (&cond->__data.__signals_sent))
-+ return EBUSY;
-+
-+ /* Waiters can either be (1) pending to confirm that they have been woken
-+ or (2) spinning/blocking on GENERATION to become odd. Thus, we first
-+ need to make sure that any waiter woken by the program has finished the
-+ condvar-internal synchronization (i.e., it has confirmed the wake-up).
-+ We use the quiescence mechanism to get notified when all of them are
-+ finished by adding the right amount of artificial confirmed waiters.
-+ XXX Or is just relaxed MO sufficient because happens-before is
-+ established through the total modification order on CONFIRMED? */
-+ if (atomic_fetch_add_acq_rel (&cond->__data.__confirmed,
-+ __PTHREAD_COND_WSEQ_THRESHOLD - wseq)
-+ < wseq)
- {
-- /* Wake everybody on the associated mutex in case there are
-- threads that have been requeued to it.
-- Without this, pthread_cond_destroy could block potentially
-- for a long time or forever, as it would depend on other
-- thread's using the mutex.
-- When all threads waiting on the mutex are woken up, pthread_cond_wait
-- only waits for threads to acquire and release the internal
-- condvar lock. */
-- if (cond->__data.__mutex != NULL
-- && cond->__data.__mutex != (void *) ~0l)
-+ /* There are waiters that haven't yet confirmed. If we have an even
-+ number for generation, wait until it is changed by the last waiter
-+ to confirm. (The last waiter will increase to WSEQ_THRESHOLD, so
-+ it will increase GENERATION to an odd value.) We need acquire MO
-+ to make any waiters' accesses to the condvar happen before we
-+ destroy it.*/
-+ while (1)
- {
-- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
-- lll_futex_wake (&mut->__data.__lock, INT_MAX,
-- PTHREAD_MUTEX_PSHARED (mut));
-+ val = atomic_load_acquire (&cond->__data.__generation);
-+ if ((val & 1) != 1)
-+ lll_futex_wait (&cond->__data.__generation, val, pshared);
-+ else
-+ break;
- }
-+ }
-
-- do
-- {
-- lll_unlock (cond->__data.__lock, pshared);
--
-- lll_futex_wait (&cond->__data.__nwaiters, nwaiters, pshared);
--
-- lll_lock (cond->__data.__lock, pshared);
--
-- nwaiters = cond->__data.__nwaiters;
-- }
-- while (nwaiters >= (1 << COND_NWAITERS_SHIFT));
-+ /* If we are in a quiescence period, we also need to wait for those waiters
-+ that are waiting for quiescence to finish. Note that we cannot have
-+ pushed waiters into this state by artificially introducing quiescence
-+ above, so we also do not wake any such waiters. As above, we need
-+ acquire MO. */
-+ while (1)
-+ {
-+ val = atomic_load_acquire (&cond->__data.__quiescence_waiters);
-+ if (val > 0)
-+ lll_futex_wait (&cond->__data.__quiescence_waiters, val, pshared);
-+ else
-+ break;
- }
-
-+ /* The memory the condvar occupies can now be reused. */
- return 0;
- }
- versioned_symbol (libpthread, __pthread_cond_destroy,
-diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c
-index ce954c7..b3aa779 100644
---- a/nptl/pthread_cond_init.c
-+++ b/nptl/pthread_cond_init.c
-@@ -28,18 +28,17 @@ __pthread_cond_init (cond, cond_attr)
- {
- struct pthread_condattr *icond_attr = (struct pthread_condattr *) cond_attr;
-
-- cond->__data.__lock = LLL_LOCK_INITIALIZER;
-- cond->__data.__futex = 0;
-- cond->__data.__nwaiters = (icond_attr != NULL
-- ? ((icond_attr->value >> 1)
-- & ((1 << COND_NWAITERS_SHIFT) - 1))
-- : CLOCK_REALTIME);
-- cond->__data.__total_seq = 0;
-- cond->__data.__wakeup_seq = 0;
-- cond->__data.__woken_seq = 0;
-+ cond->__data.__wseq = 0;
-+ cond->__data.__signals_sent = 0;
-+ cond->__data.__confirmed = 0;
-+ cond->__data.__generation = 0;
- cond->__data.__mutex = (icond_attr == NULL || (icond_attr->value & 1) == 0
- ? NULL : (void *) ~0l);
-- cond->__data.__broadcast_seq = 0;
-+ cond->__data.__quiescence_waiters = 0;
-+ cond->__data.__clockid = (icond_attr != NULL
-+ ? ((icond_attr->value >> 1)
-+ & ((1 << COND_CLOCK_BITS) - 1))
-+ : CLOCK_REALTIME);
-
- LIBC_PROBE (cond_init, 2, cond, cond_attr);
-
-diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
-index ba32f40..86968e9 100644
---- a/nptl/pthread_cond_signal.c
-+++ b/nptl/pthread_cond_signal.c
-@@ -22,60 +22,88 @@
- #include <lowlevellock.h>
- #include <pthread.h>
- #include <pthreadP.h>
-+#include <atomic.h>
-
- #include <shlib-compat.h>
- #include <kernel-features.h>
- #include <stap-probe.h>
-
-
-+/* See __pthread_cond_wait for a high-level description of the algorithm. */
- int
--__pthread_cond_signal (cond)
-- pthread_cond_t *cond;
-+__pthread_cond_signal (pthread_cond_t *cond)
- {
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-+ unsigned int wseq, ssent;
-+
-+ /* MUTEX might get modified concurrently, but relaxed memory order is fine:
-+ In case of a shared condvar, the field will be set to value ~0l during
-+ initialization of the condvar (which happens before any signaling) and
-+ is immutable afterwards; otherwise, the field will never be set to a
-+ value of ~0l. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
- ? LLL_SHARED : LLL_PRIVATE;
-
- LIBC_PROBE (cond_signal, 1, cond);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Are there any waiters to be woken? */
-- if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
-+ /* Load the waiter sequence number, which represents our relative ordering
-+ to any waiters. Also load the number of signals sent so far.
-+ We do not need stronger MOs for both loads nor an atomic snapshot of both
-+ because:
-+ 1) We can pick any position that is allowed by external happens-before
-+ constraints. In particular, if another __pthread_cond_wait call
-+ happened before us, this waiter must be eligible for being woken by
-+ us. The only way do establish such a happens-before is by signaling
-+ while holding the mutex associated with the condvar and ensuring that
-+ the signal's critical section happens after the waiter. Thus, the
-+ mutex ensures that we see this waiter's wseq increase.
-+ 2) Once we pick a position, we do not need to communicate this to the
-+ program via a happens-before that we set up: First, any wake-up could
-+ be a spurious wake-up, so the program must not interpret a wake-up as
-+ an indication that the waiter happened before a particular signal;
-+ second, a program cannot detect whether a waiter has not yet been
-+ woken (i.e., it cannot distinguish between a non-woken waiter and one
-+ that has been woken but hasn't resumed execution yet), and thus it
-+ cannot try to deduce that a signal happened before a particular
-+ waiter.
-+ 3) The load of WSEQ does not need to constrain which value we load for
-+ SIGNALS_SENT: If we read an older value for SIGNALS_SENT (compared to
-+ what would have been current if we had an atomic snapshot of both),
-+ we might send a signal even if we don't need to; thus, we just get a
-+ spurious wakeup. If we read a more recent value (again, compared to
-+ an atomic snapshot), then some other signal interfered and might have
-+ taken "our" position in the waiter/wake-up sequence; thus the waiters
-+ we had to wake will get woken either way.
-+ Note that we do not need to check whether the generation changed
-+ concurrently: If it would change, we would just skip any signaling
-+ because we could have been positioned in the earlier generation -- all
-+ the waiters we would have to wake will have been woken during the
-+ quiescence period. Thus, at worst we will cause one additional spurious
-+ wake-up if we don't detect this. */
-+ wseq = atomic_load_relaxed (&cond->__data.__wseq);
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
-+ do
- {
-- /* Yes. Mark one of them as woken. */
-- ++cond->__data.__wakeup_seq;
-- ++cond->__data.__futex;
--
--#if (defined lll_futex_cmp_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- pthread_mutex_t *mut = cond->__data.__mutex;
--
-- if (USE_REQUEUE_PI (mut)
-- /* This can only really fail with a ENOSYS, since nobody can modify
-- futex while we have the cond_lock. */
-- && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,
-- &mut->__data.__lock,
-- cond->__data.__futex, pshared) == 0)
-- {
-- lll_unlock (cond->__data.__lock, pshared);
-- return 0;
-- }
-- else
--#endif
-- /* Wake one. */
-- if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex,
-- 1, 1,
-- &cond->__data.__lock,
-- pshared), 0))
-- return 0;
--
-- /* Fallback if neither of them work. */
-- lll_futex_wake (&cond->__data.__futex, 1, pshared);
-+ /* If we don't have more waiters than signals or are in a quiescence
-+ period, just return because all waiters we must wake have been or
-+ will be woken. See above for further details. */
-+ if (ssent >= wseq || wseq >= __PTHREAD_COND_WSEQ_THRESHOLD)
-+ return 0;
- }
--
-- /* We are done. */
-- lll_unlock (cond->__data.__lock, pshared);
-+ /* Using a CAS loop here instead of a fetch-and-increment avoids one source
-+ of spurious wake-ups, namely several signalers racing to wake up a fewer
-+ number of waiters and thus also waking subsequent waiters spuriously.
-+ The cost of this is somewhat more contention on SIGNALS_SENT on archs
-+ that offer atomic fetch-and-increment.
-+ TODO Relaxed MO is sufficient here.
-+ */
-+ while (!atomic_compare_exchange_weak_relaxed (&cond->__data.__signals_sent,
-+ &ssent, ssent + 1));
-+
-+ /* XXX Could we skip the futex_wake if not necessary (eg, if there are just
-+ spinning waiters)? This would need additional communication but could it
-+ be more efficient than the kernel-side communication? Should we spin for
-+ a while to see if our signal was consumed in the meantime? */
-+ lll_futex_wake (&cond->__data.__signals_sent, 1, pshared);
-
- return 0;
- }
-diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c
-deleted file mode 100644
-index bf80467..0000000
---- a/nptl/pthread_cond_timedwait.c
-+++ /dev/null
-@@ -1,268 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <endian.h>
--#include <errno.h>
--#include <sysdep.h>
--#include <lowlevellock.h>
--#include <pthread.h>
--#include <pthreadP.h>
--#include <sys/time.h>
--#include <kernel-features.h>
--
--#include <shlib-compat.h>
--
--#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
--# undef INTERNAL_VSYSCALL
--# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
--# undef INLINE_VSYSCALL
--# define INLINE_VSYSCALL INLINE_SYSCALL
--#else
--# include <libc-vdso.h>
--#endif
--
--/* Cleanup handler, defined in pthread_cond_wait.c. */
--extern void __condvar_cleanup (void *arg)
-- __attribute__ ((visibility ("hidden")));
--
--struct _condvar_cleanup_buffer
--{
-- int oldtype;
-- pthread_cond_t *cond;
-- pthread_mutex_t *mutex;
-- unsigned int bc_seq;
--};
--
--int
--__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime)
--{
-- struct _pthread_cleanup_buffer buffer;
-- struct _condvar_cleanup_buffer cbuffer;
-- int result = 0;
--
-- /* Catch invalid parameters. */
-- if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
-- return EINVAL;
--
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- int pi_flag = 0;
--#endif
--
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* Now we can release the mutex. */
-- int err = __pthread_mutex_unlock_usercnt (mutex, 0);
-- if (err)
-- {
-- lll_unlock (cond->__data.__lock, pshared);
-- return err;
-- }
--
-- /* We have one new user of the condvar. */
-- ++cond->__data.__total_seq;
-- ++cond->__data.__futex;
-- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT;
--
-- /* Work around the fact that the kernel rejects negative timeout values
-- despite them being valid. */
-- if (__glibc_unlikely (abstime->tv_sec < 0))
-- goto timeout;
--
-- /* Remember the mutex we are using here. If there is already a
-- different address store this is a bad user bug. Do not store
-- anything for pshared condvars. */
-- if (cond->__data.__mutex != (void *) ~0l)
-- cond->__data.__mutex = mutex;
--
-- /* Prepare structure passed to cancellation handler. */
-- cbuffer.cond = cond;
-- cbuffer.mutex = mutex;
--
-- /* Before we block we enable cancellation. Therefore we have to
-- install a cancellation handler. */
-- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
--
-- /* The current values of the wakeup counter. The "woken" counter
-- must exceed this value. */
-- unsigned long long int val;
-- unsigned long long int seq;
-- val = seq = cond->__data.__wakeup_seq;
-- /* Remember the broadcast counter. */
-- cbuffer.bc_seq = cond->__data.__broadcast_seq;
--
-- while (1)
-- {
--#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-- || !defined lll_futex_timed_wait_bitset)
-- struct timespec rt;
-- {
--# ifdef __NR_clock_gettime
-- INTERNAL_SYSCALL_DECL (err);
-- (void) INTERNAL_VSYSCALL (clock_gettime, err, 2,
-- (cond->__data.__nwaiters
-- & ((1 << COND_NWAITERS_SHIFT) - 1)),
-- &rt);
-- /* Convert the absolute timeout value to a relative timeout. */
-- rt.tv_sec = abstime->tv_sec - rt.tv_sec;
-- rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
--# else
-- /* Get the current time. So far we support only one clock. */
-- struct timeval tv;
-- (void) __gettimeofday (&tv, NULL);
--
-- /* Convert the absolute timeout value to a relative timeout. */
-- rt.tv_sec = abstime->tv_sec - tv.tv_sec;
-- rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
--# endif
-- }
-- if (rt.tv_nsec < 0)
-- {
-- rt.tv_nsec += 1000000000;
-- --rt.tv_sec;
-- }
-- /* Did we already time out? */
-- if (__glibc_unlikely (rt.tv_sec < 0))
-- {
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
--
-- goto timeout;
-- }
--#endif
--
-- unsigned int futex_val = cond->__data.__futex;
--
-- /* Prepare to wait. Release the condvar futex. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* Enable asynchronous cancellation. Required by the standard. */
-- cbuffer.oldtype = __pthread_enable_asynccancel ();
--
--/* REQUEUE_PI was implemented after FUTEX_CLOCK_REALTIME, so it is sufficient
-- to check just the former. */
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- /* If pi_flag remained 1 then it means that we had the lock and the mutex
-- but a spurious waker raced ahead of us. Give back the mutex before
-- going into wait again. */
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- __pthread_mutex_unlock_usercnt (mutex, 0);
-- }
-- pi_flag = USE_REQUEUE_PI (mutex);
--
-- if (pi_flag)
-- {
-- unsigned int clockbit = (cond->__data.__nwaiters & 1
-- ? 0 : FUTEX_CLOCK_REALTIME);
-- err = lll_futex_timed_wait_requeue_pi (&cond->__data.__futex,
-- futex_val, abstime, clockbit,
-- &mutex->__data.__lock,
-- pshared);
-- pi_flag = (err == 0);
-- }
-- else
--#endif
--
-- {
--#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-- || !defined lll_futex_timed_wait_bitset)
-- /* Wait until woken by signal or broadcast. */
-- err = lll_futex_timed_wait (&cond->__data.__futex,
-- futex_val, &rt, pshared);
--#else
-- unsigned int clockbit = (cond->__data.__nwaiters & 1
-- ? 0 : FUTEX_CLOCK_REALTIME);
-- err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val,
-- abstime, clockbit, pshared);
--#endif
-- }
--
-- /* Disable asynchronous cancellation. */
-- __pthread_disable_asynccancel (cbuffer.oldtype);
--
-- /* We are going to look at shared data again, so get the lock. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* If a broadcast happened, we are done. */
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
--
-- /* Check whether we are eligible for wakeup. */
-- val = cond->__data.__wakeup_seq;
-- if (val != seq && cond->__data.__woken_seq != val)
-- break;
--
-- /* Not woken yet. Maybe the time expired? */
-- if (__glibc_unlikely (err == -ETIMEDOUT))
-- {
-- timeout:
-- /* Yep. Adjust the counters. */
-- ++cond->__data.__wakeup_seq;
-- ++cond->__data.__futex;
--
-- /* The error value. */
-- result = ETIMEDOUT;
-- break;
-- }
-- }
--
-- /* Another thread woken up. */
-- ++cond->__data.__woken_seq;
--
-- bc_out:
--
-- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
--
-- /* If pthread_cond_destroy was called on this variable already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- if (cond->__data.__total_seq == -1ULL
-- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared);
--
-- /* We are done with the condvar. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* The cancellation handling is back to normal, remove the handler. */
-- __pthread_cleanup_pop (&buffer, 0);
--
-- /* Get the mutex before returning. */
--#if (defined lll_futex_timed_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- err = 0;
-- }
-- else
--#endif
-- err = __pthread_mutex_cond_lock (mutex);
--
-- return err ?: result;
--}
--
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2);
-diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
-index 0d6558b..2106bf6 100644
---- a/nptl/pthread_cond_wait.c
-+++ b/nptl/pthread_cond_wait.c
-@@ -22,216 +22,555 @@
- #include <lowlevellock.h>
- #include <pthread.h>
- #include <pthreadP.h>
--#include <kernel-features.h>
-+#include <sys/time.h>
-+#include <atomic.h>
-
- #include <shlib-compat.h>
- #include <stap-probe.h>
-+#include <kernel-features.h>
-+
-+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
-+# undef INTERNAL_VSYSCALL
-+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
-+# undef INLINE_VSYSCALL
-+# define INLINE_VSYSCALL INLINE_SYSCALL
-+#else
-+# include <libc-vdso.h>
-+#endif
-
- struct _condvar_cleanup_buffer
- {
- int oldtype;
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
-- unsigned int bc_seq;
- };
-
--
--void
--__attribute__ ((visibility ("hidden")))
--__condvar_cleanup (void *arg)
-+static __always_inline void
-+__condvar_confirm_wakeup (pthread_cond_t *cond, int pshared)
- {
-- struct _condvar_cleanup_buffer *cbuffer =
-- (struct _condvar_cleanup_buffer *) arg;
-- unsigned int destroying;
-- int pshared = (cbuffer->cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
--
-- /* We are going to modify shared data. */
-- lll_lock (cbuffer->cond->__data.__lock, pshared);
--
-- if (cbuffer->bc_seq == cbuffer->cond->__data.__broadcast_seq)
-+ /* Confirm that we have been woken. If the number of confirmations reaches
-+ WSEQ_THRESHOLD, we must be in a quiescence period (i.e., WSEQ must be
-+ equal to WSEQ_THRESHOLD).
-+ We use acquire-release MO to ensure that accesses to this generation's
-+ condvar state happen before any reset of the condvar.
-+ XXX Or is just relaxed MO sufficient because happens-before is
-+ established through the total modification order on CONFIRMED? */
-+ if (atomic_fetch_add_acq_rel (&cond->__data.__confirmed, 1)
-+ == __PTHREAD_COND_WSEQ_THRESHOLD - 1)
- {
-- /* This thread is not waiting anymore. Adjust the sequence counters
-- appropriately. We do not increment WAKEUP_SEQ if this would
-- bump it over the value of TOTAL_SEQ. This can happen if a thread
-- was woken and then canceled. */
-- if (cbuffer->cond->__data.__wakeup_seq
-- < cbuffer->cond->__data.__total_seq)
-- {
-- ++cbuffer->cond->__data.__wakeup_seq;
-- ++cbuffer->cond->__data.__futex;
-- }
-- ++cbuffer->cond->__data.__woken_seq;
-+ /* Need release MO to make our accesses to the condvar happen before
-+ the reset that some other thread will execute. */
-+ atomic_fetch_add_release (&cond->__data.__generation, 1);
-+ lll_futex_wake (&cond->__data.__generation, INT_MAX, pshared);
- }
-
-- cbuffer->cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
-+}
-+
-+/* Cancel waiting after having registered as a waiter already.
-+ We must not consume another waiter's signal, so we must add an artificial
-+ signal. If we are the first blocked waiter (i.e., SEQ == SIGNALS_SENT,
-+ SEQ being our position in WSEQ), then an artificial signal is obviously
-+ fine. If we are blocked (i.e., SEQ > SIGNALS_SENT), then a fake signal
-+ might lead to spurious wake-ups of waiters with a smaller position in WSEQ;
-+ however, not adding the artificial signal could prevent wake-up of waiters
-+ with a larger position in WSEQ because we weren't actually waiting yet
-+ effectively consume a signal because we have reserved a slot in WSEQ. If
-+ we are not blocked anymore (i.e., SEQ < SIGNALS_SENT), we still have to
-+ add the artificial signal if there are still unblocked threads (i.e.,
-+ SIGNALS_SENT < WSEQ). */
-+static __always_inline void
-+__condvar_cancel_waiting (pthread_cond_t *cond, int pshared)
-+{
-+ unsigned int wseq, ssent;
-
-- /* If pthread_cond_destroy was called on this variable already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- destroying = 0;
-- if (cbuffer->cond->__data.__total_seq == -1ULL
-- && cbuffer->cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-+ /* Add an artificial signal. See __pthread_cond_signal. */
-+ wseq = atomic_load_relaxed (&cond->__data.__wseq);
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
-+ do
- {
-- lll_futex_wake (&cbuffer->cond->__data.__nwaiters, 1, pshared);
-- destroying = 1;
-+ if (ssent >= wseq || wseq >= __PTHREAD_COND_WSEQ_THRESHOLD)
-+ break;
- }
-+ while (!atomic_compare_exchange_weak_relaxed (&cond->__data.__signals_sent,
-+ &ssent, ssent + 1));
-+}
-
-- /* We are done. */
-- lll_unlock (cbuffer->cond->__data.__lock, pshared);
--
-- /* Wake everybody to make sure no condvar signal gets lost. */
-- if (! destroying)
-- lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX, pshared);
--
-- /* Get the mutex before returning unless asynchronous cancellation
-- is in effect. We don't try to get the mutex if we already own it. */
-- if (!(USE_REQUEUE_PI (cbuffer->mutex))
-- || ((cbuffer->mutex->__data.__lock & FUTEX_TID_MASK)
-- != THREAD_GETMEM (THREAD_SELF, tid)))
-- {
-- __pthread_mutex_cond_lock (cbuffer->mutex);
-- }
-- else
-- __pthread_mutex_cond_lock_adjust (cbuffer->mutex);
-+/* Clean-up for cancellation of waiters waiting for normal signals. We cancel
-+ our registration as a waiter, confirm we have woken up, and re-acquire the
-+ mutex. */
-+static void
-+__condvar_cleanup_waiting (void *arg)
-+{
-+ struct _condvar_cleanup_buffer *cbuffer =
-+ (struct _condvar_cleanup_buffer *) arg;
-+ pthread_cond_t *cond = cbuffer->cond;
-+ /* See comment in __pthread_cond_signal. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
-+ ? LLL_SHARED : LLL_PRIVATE;
-+
-+ __condvar_cancel_waiting (cond, pshared);
-+ __condvar_confirm_wakeup (cond, pshared);
-+
-+ /* Cancellation can happen after we have been woken by a signal's
-+ futex_wake (unlike when we cancel waiting due to a timeout on futex_wait,
-+ for example). We do provide an artificial signal in
-+ __condvar_cancel_waiting, but we still can have consumed a futex_wake
-+ that should have woken another waiter. We cannot reliably wake this
-+ waiter because there might be other, non-eligible waiters that started
-+ to block after we have been cancelled; therefore, we need to wake all
-+ blocked waiters to really undo our consumption of the futex_wake. */
-+ /* XXX Once we have implemented a form of cancellation that is just enabled
-+ during futex_wait, we can try to optimize this. */
-+ lll_futex_wake (&cond->__data.__signals_sent, INT_MAX, pshared);
-+
-+ /* XXX If locking the mutex fails, should we just stop execution? This
-+ might be better than silently ignoring the error. */
-+ __pthread_mutex_cond_lock (cbuffer->mutex);
- }
-
-+/* Clean-up for cancellation of waiters waiting on quiescence to finish. */
-+static void
-+__condvar_cleanup_quiescence (void *arg)
-+{
-+ struct _condvar_cleanup_buffer *cbuffer =
-+ (struct _condvar_cleanup_buffer *) arg;
-+ pthread_cond_t *cond = cbuffer->cond;
-+ /* See comment in __pthread_cond_signal. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
-+ ? LLL_SHARED : LLL_PRIVATE;
-
--int
--__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-+ /* See __pthread_cond_wait. */
-+ if (atomic_fetch_add_release (&cond->__data.__quiescence_waiters, -1) == 1)
-+ lll_futex_wake (&cond->__data.__quiescence_waiters, INT_MAX,
-+ pshared);
-+
-+ /* XXX If locking the mutex fails, should we just stop execution? This
-+ might be better than silently ignoring the error. */
-+ __pthread_mutex_cond_lock (cbuffer->mutex);
-+}
-+
-+/* This condvar implementation guarantees that all calls to signal and
-+ broadcast and all of the three virtually atomic parts of each call to wait
-+ (i.e., (1) releasing the mutex and blocking, (2) unblocking, and (3) re-
-+ acquiring the mutex) happen in some total order that is consistent with the
-+ happens-before relations in the calling program. However, this order does
-+ not necessarily result in additional happens-before relations being
-+ established (which aligns well with spurious wake-ups being allowed).
-+
-+ All waiters acquire a certain position in a waiter sequence, WSEQ. Signals
-+ and broadcasts acquire a position or a whole interval in the SIGNALS_SENT
-+ sequence. Waiters are allowed to wake up if either SIGNALS_SENT is larger
-+ or equal to their position in WSEQ, or if they have been blocked on a
-+ certain futex and selected by the kernel to wake up after a signal or
-+ broadcast woke threads that were blocked on this futex. This is also the
-+ primary source for spurious wake-ups: For waiters W1 and W2 with W2's
-+ position in WSEQ larger than W1's, if W2 blocks earlier than W1 using this
-+ futex, then a signal will wake both W1 and W2. However, having the
-+ possibility of waking waiters spuriously simplifies the algorithm and
-+ allows for a lean implementation.
-+
-+ Futexes only compare 32b values when deciding whether to block a thread,
-+ but we need to distinguish more than 1<<32 states for the condvar. Unlike
-+ mutexes, which are just free/acquired/contended, the position of waiters
-+ and signals matters because of the requirement of them forming a total
-+ order. Therefore, to avoid ABA issues and prevent potential lost wake-ups,
-+ we need to safely reset WSEQ and SIGNALS_SENT. We do so by quiescing the
-+ condvar once WSEQ reaches a threshold (WSEQ_THRESHOLD): We wait for all
-+ waiters to confirm that they have woken up by incrementing the CONFIRMED
-+ counter, and then reset the condvar state. Waiters arriving in this
-+ quiescence period (i.e., the time between WSEQ reaching WSEQ_THRESHOLD and
-+ the reset being complete) will wake up spuriously.
-+ To avoid ABA issues for broadcasts that could lead to excessive numbers of
-+ spurious wake-ups, we maintain a GENERATION counter that increases
-+ whenever we enter and exit a quiescence period; waiters also use this
-+ counter to communicate when the quiescence period can be finished by
-+ incrementing GENERATION to an odd value.
-+ When waiters wait for quiescence to finish, they will have pending accesses
-+ to the condvar even though they are not registered as waiters. Therefore,
-+ we count this number of waiters in QUIESCENCE_WAITERS; destruction of the
-+ condvar will not take place until there are no such waiters anymore.
-+
-+ WSEQ is only modified while holding MUTEX, but signals and broadcasts read
-+ it without holding the mutex (see both functions for an explanation why
-+ this is safe). SIGNALS_SENT is only modified with CAS operations by
-+ signals and broadcast; the only exception is the reset of the condvar
-+ during quiescence (but this is fine due to how signals and broadcasts
-+ update SIGNALS_SENT). CONFIRMED is accessed by just waiters with atomic
-+ operations, and reset during quiescence. GENERATION is modified by waiters
-+ during quiescence handling, and used by broadcasts to check whether a
-+ snapshot of WSEQ and SIGNALS_SENT happened within a single generation.
-+ QUIESCENCE_WAITERS is only modified by waiters that wait for quiescence to
-+ finish.
-+
-+ The common-case state is WSEQ < WSEQ_THRESHOLD and GENERATION being even.
-+ CONFIRMED is always smaller or equal to WSEQ except during reset.
-+ SIGNALS_SENT can be larger than WSEQ, but this happens just during reset
-+ or if a signal or broadcast tripped over a reset or the hardware reordered
-+ in a funny way, in which case we just get a few more spurious wake-ups
-+ (see __pthread_cond_broadcast for details on how we minimize that).
-+ If WSEQ equals WSEQ_THRESHOLD, then incoming waiters will wait for all
-+ waiters in the current generation to finish, or they will reset the condvar
-+ and start a new generation. If GENERATION is odd, the condvar state is
-+ ready for being reset.
-+
-+ Limitations:
-+ * This condvar isn't designed to allow for more than
-+ WSEQ_THRESHOLD * (1 << (sizeof(GENERATION) * 8 - 1)) calls to
-+ __pthread_cond_wait. It probably only suffers from potential ABA issues
-+ afterwards, but this hasn't been checked nor tested.
-+ * More than (1 << (sizeof(QUIESCENCE_WAITERS) * 8) -1 concurrent waiters
-+ are not supported.
-+ * Beyond what is allowed as errors by POSIX or documented, we can also
-+ return the following errors:
-+ * EPERM if MUTEX is a recursive mutex and the caller doesn't own it.
-+ * EOWNERDEAD or ENOTRECOVERABLE when using robust mutexes. Unlike
-+ for other errors, this can happen when we re-acquire the mutex; this
-+ isn't allowed by POSIX (which requires all errors to virtually happen
-+ before we release the mutex or change the condvar state), but there's
-+ nothing we can do really.
-+ * EAGAIN if MUTEX is a recursive mutex and trying to lock it exceeded
-+ the maximum number of recursive locks. The caller cannot expect to own
-+ MUTEX.
-+ * When using PTHREAD_MUTEX_PP_* mutexes, we can also return all errors
-+ returned by __pthread_tpp_change_priority. We will already have
-+ released the mutex in such cases, so the caller cannot expect to own
-+ MUTEX.
-+
-+ Other notes:
-+ * Instead of the normal mutex unlock / lock functions, we use
-+ __pthread_mutex_unlock_usercnt(m, 0) / __pthread_mutex_cond_lock(m)
-+ because those will not change the mutex-internal users count, so that it
-+ can be detected when a condvar is still associated with a particular
-+ mutex because there is a waiter blocked on this condvar using this mutex.
-+*/
-+static __always_inline int
-+__pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex,
-+ const struct timespec *abstime)
- {
- struct _pthread_cleanup_buffer buffer;
- struct _condvar_cleanup_buffer cbuffer;
-+ const int maxspin = 0;
- int err;
-- int pshared = (cond->__data.__mutex == (void *) ~0l)
-- ? LLL_SHARED : LLL_PRIVATE;
-+ int result = 0;
-+ unsigned int spin, seq, gen, ssent;
-
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- int pi_flag = 0;
--#endif
-+ /* We (can assume to) hold the mutex, so there are no concurrent
-+ modifications. */
-+ int pshared = (atomic_load_relaxed (&cond->__data.__mutex) == (void *) ~0l)
-+ ? LLL_SHARED : LLL_PRIVATE;
-
- LIBC_PROBE (cond_wait, 2, cond, mutex);
-
-- /* Make sure we are alone. */
-- lll_lock (cond->__data.__lock, pshared);
-+ /* Remember the mutex we are using here, unless it's a pshared condvar.
-+ Users must ensure that a condvar is associated with exactly one mutex,
-+ so we cannot store an incorrect address if the program is correct. */
-+ if (pshared != LLL_SHARED)
-+ atomic_store_relaxed (&cond->__data.__mutex, mutex);
-+
-+ /* Acquire a position (SEQ) in the waiter sequence (WSEQ) iff this will not
-+ cause overflow. We use an an atomic operation because signals and
-+ broadcasts may read while not holding the mutex. We do not need release
-+ MO here because we do not need to establish any happens-before relation
-+ with signalers (see __pthread_cond_signal). */
-+ seq = atomic_load_relaxed (&cond->__data.__wseq);
-+ if (__glibc_likely (seq < __PTHREAD_COND_WSEQ_THRESHOLD))
-+ atomic_store_relaxed (&cond->__data.__wseq, seq + 1);
-+
-+ /* If we reached WSEQ_THRESHOLD, we need to quiesce the condvar. */
-+ if (seq >= __PTHREAD_COND_WSEQ_THRESHOLD - 1)
-+ {
-+ /* If we are the waiter that triggered quiescence, we need to still
-+ confirm that we have woken up (which can update GENERATION if we are
-+ the last one active).
-+ XXX We probably do not need to wake anyone because we still hold the
-+ mutex so no other waiter can observe that we started quiescence. */
-+ if (seq == __PTHREAD_COND_WSEQ_THRESHOLD - 1)
-+ __condvar_confirm_wakeup (cond, pshared);
-+ /* Check whether all waiters in the current generation have confirmed
-+ that they do not wait anymore (and thus don't use the condvar state
-+ anymore), and either reset or wait for this to happen. We do that
-+ while holding the mutex so we will never see WSEQ==WSEQ_THRESHOLD and
-+ an even value for GENERATION that is already a new generation. We
-+ need acquire MO on the load to ensure that we happen after the last
-+ of the current generation's waiters confirmed that it isn't using the
-+ condvar anymore (see below).
-+ Note that in both cases, we must not actually wait for any signal to
-+ arrive but wake up spuriously. This allows signalers to not take
-+ actively part in quiescence because they can assume that if they
-+ hit a quiescence period, all waiters they might have to wake will
-+ wake up on their own. */
-+ gen = atomic_load_acquire (&cond->__data.__generation);
-+ if ((gen & 1) != 0)
-+ {
-+ /* No waiter uses the condvar currently, so we can reset.
-+ This barrier / release-MO fence is necessary to match the
-+ acquire-MO fence in __pthread_cond_broadcast. It makes sure that
-+ if a broadcast sees one of the values stored during reset, it
-+ will also observe an even value for GENERATION (i.e., broadcast
-+ can check whether it read condvar state that was from different
-+ generations or partially reset). We store atomically because
-+ the fence, according to the memory model, only has the desired
-+ effect in combination with atomic operations. */
-+ atomic_thread_fence_release ();
-+ atomic_store_relaxed (&cond->__data.__wseq, 0);
-+ atomic_store_relaxed (&cond->__data.__signals_sent, 0);
-+ atomic_store_relaxed (&cond->__data.__confirmed, 0);
-+ /* Need release MO to make sure that if a broadcast loads the new
-+ generation, it will also observe a fully reset condvar. */
-+ atomic_fetch_add_release (&cond->__data.__generation, 1);
-+ /* TODO Discuss issues around PI support on quiescence. */
-+ lll_futex_wake (&cond->__data.__generation, INT_MAX, pshared);
-+ /* We haven't released the mutex, so we can just return. */
-+ return 0;
-+ }
-+ else
-+ {
-+ /* There are still some waiters that haven't yet confirmed to not be
-+ using the condvar anymore. Wake all of them if this hasn't
-+ happened yet. Relaxed MO is sufficient because we only need to
-+ max out SIGNALS_SENT and we still hold the mutex, so a new
-+ generation cannot have been started concurrently. */
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
-+ while (1)
-+ {
-+ if (ssent == __PTHREAD_COND_WSEQ_THRESHOLD)
-+ break;
-+ if (atomic_compare_exchange_weak_relaxed (
-+ &cond->__data.__signals_sent, &ssent,
-+ __PTHREAD_COND_WSEQ_THRESHOLD))
-+ {
-+ /* If we made any signals available, wake up all waiters
-+ blocked on the futex. */
-+ lll_futex_wake (&cond->__data.__signals_sent, INT_MAX,
-+ pshared);
-+ break;
-+ }
-+ }
-+ /* Now wait until no waiter is using the condvar anymore, and wake
-+ up spuriously. Don't hold the mutex while we wait. We also
-+ need to tell __pthread_cond_destroy that we will have pending
-+ accesses to the condvar state; we do so before we release the
-+ mutex to make sure that this is visible to destruction. */
-+ atomic_fetch_add_relaxed (&cond->__data.__quiescence_waiters, 1);
-+ err = __pthread_mutex_unlock_usercnt (mutex, 0);
-+
-+ if (__glibc_likely (err == 0))
-+ {
-+ /* Enable asynchronous cancellation before we block, as required
-+ by the standard. In the cancellation handler, we just do
-+ the same steps as after a normal futex wake-up. */
-+ cbuffer.cond = cond;
-+ cbuffer.mutex = mutex;
-+ __pthread_cleanup_push (&buffer, __condvar_cleanup_quiescence,
-+ &cbuffer);
-+ cbuffer.oldtype = __pthread_enable_asynccancel ();
-+
-+ /* We don't really need to care whether the futex_wait fails
-+ because a spurious wake-up is just fine. */
-+ /* TODO Spin on generation (with acquire MO)? */
-+ /* TODO Discuss issues around PI support on quiescence. */
-+ lll_futex_wait (&cond->__data.__generation, gen, pshared);
-+
-+ /* Stopped blocking; disable cancellation. */
-+ __pthread_disable_asynccancel (cbuffer.oldtype);
-+ __pthread_cleanup_pop (&buffer, 0);
-+ }
-+ /* Notify __pthread_cond_destroy that we won't access the condvar
-+ anymore. Release MO to make our accesses happen before
-+ destruction. */
-+ if (atomic_fetch_add_release (&cond->__data.__quiescence_waiters, -1)
-+ == 1)
-+ lll_futex_wake (&cond->__data.__quiescence_waiters, INT_MAX,
-+ pshared);
-+
-+ /* If unlocking the mutex returned an error, we haven't released it.
-+ We have decremented QUIESCENCE_WAITERS already, so we can just
-+ return here. */
-+ if (__glibc_unlikely (err != 0))
-+ return err;
-+
-+ /* Re-acquire the mutex, and just wake up spuriously. */
-+ /* XXX Rather abort on errors that are disallowed by POSIX? */
-+ return __pthread_mutex_cond_lock (mutex);
-+ }
-+ }
-
-- /* Now we can release the mutex. */
-+ /* Now that we are registered as a waiter, we can release the mutex.
-+ Waiting on the condvar must be atomic with releasing the mutex, so if
-+ the mutex is used to establish a happens-before relation with any
-+ signaler, the waiter must be visible to the latter; thus, we release the
-+ mutex after registering as waiter.
-+ If releasing the mutex fails, we just cancel our registration as a
-+ waiter and confirm that we have woken up. */
- err = __pthread_mutex_unlock_usercnt (mutex, 0);
-- if (__glibc_unlikely (err))
-+ if (__glibc_unlikely (err != 0))
- {
-- lll_unlock (cond->__data.__lock, pshared);
-+ __condvar_cancel_waiting (cond, pshared);
-+ __condvar_confirm_wakeup (cond, pshared);
- return err;
- }
-
-- /* We have one new user of the condvar. */
-- ++cond->__data.__total_seq;
-- ++cond->__data.__futex;
-- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT;
--
-- /* Remember the mutex we are using here. If there is already a
-- different address store this is a bad user bug. Do not store
-- anything for pshared condvars. */
-- if (cond->__data.__mutex != (void *) ~0l)
-- cond->__data.__mutex = mutex;
--
-- /* Prepare structure passed to cancellation handler. */
-+ /* We might block on a futex, so push the cancellation handler. */
- cbuffer.cond = cond;
- cbuffer.mutex = mutex;
--
-- /* Before we block we enable cancellation. Therefore we have to
-- install a cancellation handler. */
-- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer);
--
-- /* The current values of the wakeup counter. The "woken" counter
-- must exceed this value. */
-- unsigned long long int val;
-- unsigned long long int seq;
-- val = seq = cond->__data.__wakeup_seq;
-- /* Remember the broadcast counter. */
-- cbuffer.bc_seq = cond->__data.__broadcast_seq;
--
-- do
-+ __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer);
-+
-+ /* Loop until we might have been woken, which is the case if either (1) more
-+ signals have been sent than what is our position in the waiter sequence
-+ or (2) the kernel woke us after we blocked in a futex_wait operation. We
-+ have to consider the latter independently of the former because the
-+ kernel might wake in an order that is different from the waiter sequence
-+ we determined (and we don't know in which order the individual waiters'
-+ futex_wait calls were actually processed in the kernel).
-+ We do not need acquire MO for the load from SIGNALS_SENT because we do
-+ not need to establish a happens-before with the sender of the signal;
-+ because every wake-up could be spurious, the program has to check its
-+ condition associated with the condvar anyway and must use suitable
-+ synchronization to do so. IOW, we ensure that the virtual ordering of
-+ waiters and signalers is consistent with happens-before, but we do not
-+ transfer this order back into happens-before. Also see the comments
-+ in __pthread_cond_signal. */
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
-+ spin = maxspin;
-+ while (ssent <= seq)
- {
-- unsigned int futex_val = cond->__data.__futex;
-- /* Prepare to wait. Release the condvar futex. */
-- lll_unlock (cond->__data.__lock, pshared);
--
-- /* Enable asynchronous cancellation. Required by the standard. */
-- cbuffer.oldtype = __pthread_enable_asynccancel ();
--
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- /* If pi_flag remained 1 then it means that we had the lock and the mutex
-- but a spurious waker raced ahead of us. Give back the mutex before
-- going into wait again. */
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- __pthread_mutex_unlock_usercnt (mutex, 0);
-- }
-- pi_flag = USE_REQUEUE_PI (mutex);
--
-- if (pi_flag)
-- {
-- err = lll_futex_wait_requeue_pi (&cond->__data.__futex,
-- futex_val, &mutex->__data.__lock,
-- pshared);
--
-- pi_flag = (err == 0);
-- }
-+ if (spin > 0)
-+ spin--;
- else
-+ {
-+ if (abstime == NULL)
-+ {
-+ /* Enable asynchronous cancellation before we block, as required
-+ by the standard. */
-+ cbuffer.oldtype = __pthread_enable_asynccancel ();
-+ /* Block using SIGNALS_SENT as futex. If we get woken due to a
-+ concurrent change to the number of signals sent (i.e.,
-+ EAGAIN is returned), we fall back to spinning and
-+ eventually will try to block again. All other possible
-+ errors returned from the futex_wait call are either
-+ programming errors, or similar to EAGAIN (i.e., EINTR
-+ on a spurious wake-up by the futex). Otherwise, we have
-+ been woken by a real signal, so the kernel picked us for the
-+ wake-up, and we can stop waiting. */
-+ err = lll_futex_wait (&cond->__data.__signals_sent, ssent,
-+ pshared);
-+ /* Stopped blocking; disable cancellation. */
-+ __pthread_disable_asynccancel (cbuffer.oldtype);
-+ if (err == 0)
-+ break;
-+ }
-+ else
-+ {
-+ /* Block, but with a timeout. */
-+ /* Work around the fact that the kernel rejects negative timeout
-+ values despite them being valid. */
-+ if (__glibc_unlikely (abstime->tv_sec < 0))
-+ goto timeout;
-+
-+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-+ || !defined lll_futex_timed_wait_bitset)
-+ struct timespec rt;
-+ {
-+# ifdef __NR_clock_gettime
-+ INTERNAL_SYSCALL_DECL (err);
-+ (void) INTERNAL_VSYSCALL (clock_gettime, err, 2,
-+ cond->__data.__clockid, &rt);
-+ /* Convert the absolute timeout value to a relative
-+ timeout. */
-+ rt.tv_sec = abstime->tv_sec - rt.tv_sec;
-+ rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
-+# else
-+ /* Get the current time. So far, we support only one
-+ clock. */
-+ struct timeval tv;
-+ (void) __gettimeofday (&tv, NULL);
-+ /* Convert the absolute timeout value to a relative
-+ timeout. */
-+ rt.tv_sec = abstime->tv_sec - tv.tv_sec;
-+ rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
-+# endif
-+ }
-+ if (rt.tv_nsec < 0)
-+ {
-+ rt.tv_nsec += 1000000000;
-+ --rt.tv_sec;
-+ }
-+ /* Did we already time out? */
-+ if (__glibc_unlikely (rt.tv_sec < 0))
-+ goto timeout;
-+
-+ /* Enable asynchronous cancellation before we block, as required
-+ by the standard. */
-+ cbuffer.oldtype = __pthread_enable_asynccancel ();
-+ err = lll_futex_timed_wait (&cond->__data.__signals_sent, ssent,
-+ &rt, pshared);
-+
-+#else
-+ unsigned int clockbit = (cond->__data.__clockid == 1
-+ ? 0 : FUTEX_CLOCK_REALTIME);
-+ /* Enable asynchronous cancellation before we block, as required
-+ by the standard. */
-+ cbuffer.oldtype = __pthread_enable_asynccancel ();
-+ err = lll_futex_timed_wait_bitset (&cond->__data.__signals_sent,
-+ ssent, abstime, clockbit, pshared);
- #endif
-- /* Wait until woken by signal or broadcast. */
-- lll_futex_wait (&cond->__data.__futex, futex_val, pshared);
--
-- /* Disable asynchronous cancellation. */
-- __pthread_disable_asynccancel (cbuffer.oldtype);
--
-- /* We are going to look at shared data again, so get the lock. */
-- lll_lock (cond->__data.__lock, pshared);
--
-- /* If a broadcast happened, we are done. */
-- if (cbuffer.bc_seq != cond->__data.__broadcast_seq)
-- goto bc_out;
-+ /* Stopped blocking; disable cancellation. */
-+ __pthread_disable_asynccancel (cbuffer.oldtype);
-+
-+ if (err == 0)
-+ break;
-+ else if (__glibc_unlikely (err == -ETIMEDOUT))
-+ {
-+ timeout:
-+ /* When we timed out, we effectively cancel waiting. */
-+ __condvar_cancel_waiting (cond, pshared);
-+ result = ETIMEDOUT;
-+ break;
-+ }
-+ }
-+
-+ spin = maxspin;
-+ }
-
-- /* Check whether we are eligible for wakeup. */
-- val = cond->__data.__wakeup_seq;
-+ /* (Spin-)Wait until enough signals have been sent. */
-+ ssent = atomic_load_relaxed (&cond->__data.__signals_sent);
- }
-- while (val == seq || cond->__data.__woken_seq == val);
--
-- /* Another thread woken up. */
-- ++cond->__data.__woken_seq;
--
-- bc_out:
--
-- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT;
-
-- /* If pthread_cond_destroy was called on this varaible already,
-- notify the pthread_cond_destroy caller all waiters have left
-- and it can be successfully destroyed. */
-- if (cond->__data.__total_seq == -1ULL
-- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT))
-- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared);
-+ /* We won't block on a futex anymore. */
-+ __pthread_cleanup_pop (&buffer, 0);
-
-- /* We are done with the condvar. */
-- lll_unlock (cond->__data.__lock, pshared);
-+ /* Confirm that we have been woken. We do that before acquiring the mutex
-+ to reduce the latency of dealing with quiescence, and to allow that
-+ pthread_cond_destroy can be executed while having acquired the mutex.
-+ Neither signalers nor waiters will wait for quiescence to complete
-+ while they hold the mutex. */
-+ __condvar_confirm_wakeup (cond, pshared);
-+
-+ /* Woken up; now re-acquire the mutex. If this doesn't fail, return RESULT,
-+ which is set to ETIMEDOUT if a timeout occured, or zero otherwise. */
-+ err = __pthread_mutex_cond_lock (mutex);
-+ /* XXX Rather abort on errors that are disallowed by POSIX? */
-+ return (err != 0) ? err : result;
-+}
-
-- /* The cancellation handling is back to normal, remove the handler. */
-- __pthread_cleanup_pop (&buffer, 0);
-+int
-+__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-+{
-+ return __pthread_cond_wait_common (cond, mutex, NULL);
-+}
-
-- /* Get the mutex before returning. Not needed for PI. */
--#if (defined lll_futex_wait_requeue_pi \
-- && defined __ASSUME_REQUEUE_PI)
-- if (pi_flag)
-- {
-- __pthread_mutex_cond_lock_adjust (mutex);
-- return 0;
-- }
-- else
--#endif
-- return __pthread_mutex_cond_lock (mutex);
-+int
-+__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-+ const struct timespec *abstime)
-+{
-+ /* Check parameter validity. This should also tell the compiler that
-+ it can assume that abstime is not NULL. */
-+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
-+ return EINVAL;
-+ return __pthread_cond_wait_common (cond, mutex, abstime);
- }
-
- versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-+versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-+ GLIBC_2_3_2);
-diff --git a/nptl/pthread_condattr_getclock.c b/nptl/pthread_condattr_getclock.c
-index 020d21a..2ad585b 100644
---- a/nptl/pthread_condattr_getclock.c
-+++ b/nptl/pthread_condattr_getclock.c
-@@ -25,6 +25,6 @@ pthread_condattr_getclock (attr, clock_id)
- clockid_t *clock_id;
- {
- *clock_id = (((((const struct pthread_condattr *) attr)->value) >> 1)
-- & ((1 << COND_NWAITERS_SHIFT) - 1));
-+ & ((1 << COND_CLOCK_BITS) - 1));
- return 0;
- }
-diff --git a/nptl/pthread_condattr_setclock.c b/nptl/pthread_condattr_setclock.c
-index 0748d78..cb8d8dd 100644
---- a/nptl/pthread_condattr_setclock.c
-+++ b/nptl/pthread_condattr_setclock.c
-@@ -36,11 +36,11 @@ pthread_condattr_setclock (attr, clock_id)
- return EINVAL;
-
- /* Make sure the value fits in the bits we reserved. */
-- assert (clock_id < (1 << COND_NWAITERS_SHIFT));
-+ assert (clock_id < (1 << COND_CLOCK_BITS));
-
- int *valuep = &((struct pthread_condattr *) attr)->value;
-
-- *valuep = ((*valuep & ~(((1 << COND_NWAITERS_SHIFT) - 1) << 1))
-+ *valuep = ((*valuep & ~(((1 << COND_CLOCK_BITS) - 1) << 1))
- | (clock_id << 1));
-
- return 0;
-diff --git a/nptl/tst-cond1.c b/nptl/tst-cond1.c
-index 64f90e0..fab2b19 100644
---- a/nptl/tst-cond1.c
-+++ b/nptl/tst-cond1.c
-@@ -73,6 +73,9 @@ do_test (void)
-
- puts ("parent: wait for condition");
-
-+ /* This test will fail on spurious wake-ups, which are allowed; however,
-+ the current implementation shouldn't produce spurious wake-ups in the
-+ scenario we are testing here. */
- err = pthread_cond_wait (&cond, &mut);
- if (err != 0)
- error (EXIT_FAILURE, err, "parent: cannot wait fir signal");
-diff --git a/nptl/tst-cond18.c b/nptl/tst-cond18.c
-index ceeb1aa..b14ed79 100644
---- a/nptl/tst-cond18.c
-+++ b/nptl/tst-cond18.c
-@@ -23,6 +23,7 @@
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-+#include <atomic.h>
-
- pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
- pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-@@ -43,6 +44,26 @@ tf (void *id)
- pthread_mutex_unlock (&lock);
-
- pthread_mutex_lock (&lock);
-+#ifdef TEST_QUIESCENCE
-+ /* Make sure we're triggering quiescence regularly by simply
-+ increasing all of WSEQ, SIGNALS_SENT, and CONFIRMED.
-+ We have acquire the lock, so there's no concurrent registration
-+ of waiters nor quiescence reset; thus, WSEQ is not concurrently
-+ modified, and when we increase CONFIRMED, we can never reach
-+ the threshold (but CONFIRMED can be concurrently modified).
-+ Also, there's no other thread doing signals, so we're the only
-+ one modifying SIGNALS_SENT. */
-+ unsigned int seq = atomic_load_relaxed (&cv.__data.__wseq);
-+ if (seq < __PTHREAD_COND_WSEQ_THRESHOLD - 3 * count)
-+ {
-+ unsigned int d = __PTHREAD_COND_WSEQ_THRESHOLD - 3 * count
-+ - seq;
-+ atomic_store_relaxed (&cv.__data.__wseq, seq + d);
-+ atomic_store_relaxed (&cv.__data.__signals_sent,
-+ atomic_load_relaxed (&cv.__data.__signals_sent) + d);
-+ atomic_fetch_add_relaxed (&cv.__data.__confirmed, d);
-+ }
-+#endif
- int njobs = rand () % (count + 1);
- nn = njobs;
- if ((rand () % 30) == 0)
-diff --git a/nptl/tst-cond20.c b/nptl/tst-cond20.c
-index 9de062a..5122370 100644
---- a/nptl/tst-cond20.c
-+++ b/nptl/tst-cond20.c
-@@ -82,6 +82,7 @@ do_test (void)
- puts ("barrier_init failed");
- return 1;
- }
-+ /* We simply don't test quiescence in the first round. See below. */
-
- pthread_mutex_lock (&mut);
-
-@@ -96,7 +97,10 @@ do_test (void)
-
- for (i = 0; i < ROUNDS; ++i)
- {
-- pthread_cond_wait (&cond2, &mut);
-+ /* Make sure we discard spurious wake-ups. */
-+ do
-+ pthread_cond_wait (&cond2, &mut);
-+ while (count != N);
-
- if (i & 1)
- pthread_mutex_unlock (&mut);
-@@ -150,6 +154,14 @@ do_test (void)
- printf ("pthread_cond_init failed: %s\n", strerror (err));
- return 1;
- }
-+#ifdef TEST_QUIESCENCE
-+ /* This results in the condvar being in a quiescence state as soon as
-+ some or all of the waiters have started to block. Note that we
-+ must not put it immediately in the quiescence state because we
-+ need some of the waiters to change the generation etc. */
-+ cond.__data.__wseq = cond.__data.__signals_sent = cond.__data.__confirmed
-+ =__PTHREAD_COND_WSEQ_THRESHOLD - i % N - 1;
-+#endif
- }
-
- for (i = 0; i < N; ++i)
-diff --git a/nptl/tst-cond22.c b/nptl/tst-cond22.c
-index bd978e5..1ee5188 100644
---- a/nptl/tst-cond22.c
-+++ b/nptl/tst-cond22.c
-@@ -106,10 +106,10 @@ do_test (void)
- status = 1;
- }
-
-- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
-- c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
-- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
-- c.__data.__nwaiters, c.__data.__broadcast_seq);
-+ printf ("cond = { %u, %u, %u, %u, %p, %u }\n",
-+ c.__data.__wseq, c.__data.__signals_sent, c.__data.__confirmed,
-+ c.__data.__generation, c.__data.__mutex,
-+ c.__data.__quiescence_waiters);
-
- if (pthread_create (&th, NULL, tf, (void *) 1l) != 0)
- {
-@@ -148,10 +148,10 @@ do_test (void)
- status = 1;
- }
-
-- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
-- c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
-- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
-- c.__data.__nwaiters, c.__data.__broadcast_seq);
-+ printf ("cond = { %u, %u, %u, %u, %p, %u }\n",
-+ c.__data.__wseq, c.__data.__signals_sent, c.__data.__confirmed,
-+ c.__data.__generation, c.__data.__mutex,
-+ c.__data.__quiescence_waiters);
-
- return status;
- }
-diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c
-index be0bec4..ddc37a0 100644
---- a/nptl/tst-cond25.c
-+++ b/nptl/tst-cond25.c
-@@ -216,6 +216,14 @@ do_test_wait (thr_func f)
- printf ("cond_init failed: %s\n", strerror (ret));
- goto out;
- }
-+#ifdef TEST_QUIESCENCE
-+ /* This results in the condvar being in a quiescence state as soon as
-+ some or all of the waiters have started to block. Note that we
-+ must not put it immediately in the quiescence state because we
-+ need some of the waiters to change the generation etc. */
-+ cond.__data.__wseq = cond.__data.__signals_sent = cond.__data.__confirmed
-+ =__PTHREAD_COND_WSEQ_THRESHOLD - i % NUM - 1;
-+#endif
-
- if ((ret = pthread_mutex_init (&mutex, &attr)) != 0)
- {
-diff --git a/nptl/tst-cond26.c b/nptl/tst-cond26.c
-new file mode 100644
-index 0000000..b611d62
---- /dev/null
-+++ b/nptl/tst-cond26.c
-@@ -0,0 +1,2 @@
-+#define TEST_QUIESCENCE 1
-+#include "tst-cond20.c"
-diff --git a/nptl/tst-cond27.c b/nptl/tst-cond27.c
-new file mode 100644
-index 0000000..8668a24
---- /dev/null
-+++ b/nptl/tst-cond27.c
-@@ -0,0 +1,2 @@
-+#define TEST_QUIESCENCE 1
-+#include "tst-cond25.c"
-diff --git a/nptl/tst-cond28.c b/nptl/tst-cond28.c
-new file mode 100644
-index 0000000..7fc3b6b
---- /dev/null
-+++ b/nptl/tst-cond28.c
-@@ -0,0 +1,2 @@
-+#define TEST_QUIESCENCE 1
-+#include "tst-cond18.c"
-diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-index 0e4795e..c9ae0d6 100644
---- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
-@@ -90,14 +90,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- long int __align;
-diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
-index 9f2efc2..f84c272 100644
---- a/sysdeps/arm/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/arm/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
-index 845629d..fcd45c9 100644
---- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
-@@ -119,23 +119,19 @@ typedef union
- start of the 4-word lock structure, the next four words
- are set all to 1 by the Linuxthreads
- PTHREAD_COND_INITIALIZER. */
-- int __lock __attribute__ ((aligned(16)));
-+ unsigned int __wseq __attribute__ ((aligned(16)));
- /* Tracks the initialization of this structure:
- 0 initialized with NPTL PTHREAD_COND_INITIALIZER.
- 1 initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
- 2 initialization in progress. */
- int __initializer;
-- unsigned int __futex;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- /* In the old Linuxthreads this would have been the start
-- of the pthread_fastlock status word. */
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-- /* The NPTL pthread_cond_t is exactly the same size as
-- the Linuxthreads version, there are no words to spare. */
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h
-index e9762f5..9477f9a 100644
---- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h
-@@ -90,14 +90,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- long int __align;
-diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
-index 0e2bcdd..40fdec1 100644
---- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,14 @@ typedef union
- {
- struct
- {
-- int __lock __attribute__ ((__aligned__ (4)));
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq __attribute__ ((__aligned__ (4)));
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-index b8bd828..58a0daa 100644
---- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
-@@ -91,14 +91,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
-index 8cf4547..4267568 100644
---- a/sysdeps/mips/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/mips/nptl/bits/pthreadtypes.h
-@@ -122,14 +122,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
-index 4a20803..d35bd01 100644
---- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/nptl/internaltypes.h b/sysdeps/nptl/internaltypes.h
-index 8f5cfa4..726a760 100644
---- a/sysdeps/nptl/internaltypes.h
-+++ b/sysdeps/nptl/internaltypes.h
-@@ -68,20 +68,13 @@ struct pthread_condattr
- {
- /* Combination of values:
-
-- Bit 0 : flag whether conditional variable will be sharable between
-- processes.
--
-- Bit 1-7: clock ID. */
-+ Bit 0 : flag whether conditional variable will be
-+ sharable between processes.
-+ Bit 1-COND_CLOCK_BITS: Clock ID. COND_CLOCK_BITS is the number of bits
-+ needed to represent the ID of the clock. */
- int value;
- };
--
--
--/* The __NWAITERS field is used as a counter and to house the number
-- of bits for other purposes. COND_CLOCK_BITS is the number
-- of bits needed to represent the ID of the clock. COND_NWAITERS_SHIFT
-- is the number of bits reserved for other purposes like the clock. */
--#define COND_CLOCK_BITS 1
--#define COND_NWAITERS_SHIFT 1
-+#define COND_CLOCK_BITS 1
-
-
- /* Read-write lock variable attribute data structure. */
-diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
-index 70ff250..3749f08 100644
---- a/sysdeps/nptl/pthread.h
-+++ b/sysdeps/nptl/pthread.h
-@@ -185,7 +185,7 @@ enum
-
-
- /* Conditional variable handling. */
--#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
-+#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, (void *) 0, 0, 0 } }
-
-
- /* Cleanup buffers */
-diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
-index 1f3bb14..d96dbbe 100644
---- a/sysdeps/s390/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/s390/nptl/bits/pthreadtypes.h
-@@ -142,14 +142,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
-index 5940232..412e831 100644
---- a/sysdeps/sh/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/sh/nptl/bits/pthreadtypes.h
-@@ -93,14 +93,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h
-index 6faf8b2..5e72d77 100644
---- a/sysdeps/sparc/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/sparc/nptl/bits/pthreadtypes.h
-@@ -122,14 +122,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
-index 1f6553d..bb521b7 100644
---- a/sysdeps/tile/nptl/bits/pthreadtypes.h
-+++ b/sysdeps/tile/nptl/bits/pthreadtypes.h
-@@ -122,14 +122,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-index 7121d0b..5d42d70 100644
---- a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-+++ b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
-@@ -89,14 +89,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-index 651ce2e..d649657 100644
---- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-+++ b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
-@@ -46,32 +46,38 @@ fails because __initializer is zero, and the structure will be used as
- is correctly. */
-
- #define cond_compat_clear(var) \
--({ \
-- int tmp = 0; \
-- var->__data.__lock = 0; \
-- var->__data.__futex = 0; \
-- var->__data.__mutex = NULL; \
-- /* Clear __initializer last, to indicate initialization is done. */ \
-- __asm__ __volatile__ ("stw,ma %1,0(%0)" \
-- : : "r" (&var->__data.__initializer), "r" (tmp) : "memory"); \
-+({ \
-+ int tmp = 0; \
-+ var->__data.__wseq = 0; \
-+ var->__data.__signals_sent = 0; \
-+ var->__data.__confirmed = 0; \
-+ var->__data.__generation = 0; \
-+ var->__data.__mutex = NULL; \
-+ var->__data.__quiescence_waiters = 0; \
-+ var->__data.__clockid = 0; \
-+ /* Clear __initializer last, to indicate initialization is done. */ \
-+ /* This synchronizes-with the acquire load below. */ \
-+ atomic_store_release (&var->__data.__initializer, 0); \
- })
-
- #define cond_compat_check_and_clear(var) \
- ({ \
-- int ret; \
-- volatile int *value = &var->__data.__initializer; \
-- if ((ret = atomic_compare_and_exchange_val_acq(value, 2, 1))) \
-+ int v; \
-+ int *value = &var->__data.__initializer; \
-+ /* This synchronizes-with the release store above. */ \
-+ while ((v = atomic_load_acquire (value)) != 0) \
- { \
-- if (ret == 1) \
-+ if (v == 1 \
-+ /* Relaxed MO is fine; it only matters who's first. */ \
-+ && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
-- /* Initialize structure. */ \
-+ /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
-+ break; \
- } \
- else \
-- { \
-- /* Yield until structure is initialized. */ \
-- while (*value == 2) sched_yield (); \
-- } \
-+ /* Yield before we re-check initialization status. */ \
-+ sched_yield (); \
- } \
- })
-
-diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
-deleted file mode 100644
-index 6199013..0000000
---- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
-+++ /dev/null
-@@ -1,43 +0,0 @@
--/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library. If not, see
-- <http://www.gnu.org/licenses/>. */
--
--#ifndef INCLUDED_SELF
--# define INCLUDED_SELF
--# include <pthread_cond_timedwait.c>
--#else
--# include <pthread.h>
--# include <pthreadP.h>
--# include <internaltypes.h>
--# include <shlib-compat.h>
--int
--__pthread_cond_timedwait (cond, mutex, abstime)
-- pthread_cond_t *cond;
-- pthread_mutex_t *mutex;
-- const struct timespec *abstime;
--{
-- cond_compat_check_and_clear (cond);
-- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
--}
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2);
--# undef versioned_symbol
--# define versioned_symbol(lib, local, symbol, version)
--# undef __pthread_cond_timedwait
--# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
--# include_next <pthread_cond_timedwait.c>
--#endif
-diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-index 5e1506f..1496730 100644
---- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-+++ b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
-@@ -34,9 +34,22 @@ __pthread_cond_wait (cond, mutex)
- }
- versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-+int
-+__pthread_cond_timedwait (cond, mutex, abstime)
-+ pthread_cond_t *cond;
-+ pthread_mutex_t *mutex;
-+ const struct timespec *abstime;
-+{
-+ cond_compat_check_and_clear (cond);
-+ return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-+}
-+versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-+ GLIBC_2_3_2);
- # undef versioned_symbol
- # define versioned_symbol(lib, local, symbol, version)
- # undef __pthread_cond_wait
- # define __pthread_cond_wait __pthread_cond_wait_internal
-+# undef __pthread_cond_timedwait
-+# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
- # include_next <pthread_cond_wait.c>
- #endif
-diff --git a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
-deleted file mode 100644
-index 5ddd5ac..0000000
---- a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,241 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_broadcast (pthread_cond_t *cond) */
-- .globl __pthread_cond_broadcast
-- .type __pthread_cond_broadcast, @function
-- .align 16
--__pthread_cond_broadcast:
-- cfi_startproc
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- cfi_remember_state
--
-- movl 20(%esp), %ebx
--
-- LIBC_PROBE (cond_broadcast, 1, %edx)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
--2: addl $cond_futex, %ebx
-- movl total_seq+4-cond_futex(%ebx), %eax
-- movl total_seq-cond_futex(%ebx), %ebp
-- cmpl wakeup_seq+4-cond_futex(%ebx), %eax
-- ja 3f
-- jb 4f
-- cmpl wakeup_seq-cond_futex(%ebx), %ebp
-- jna 4f
--
-- /* Cause all currently waiting threads to recognize they are
-- woken up. */
--3: movl %ebp, wakeup_seq-cond_futex(%ebx)
-- movl %eax, wakeup_seq-cond_futex+4(%ebx)
-- movl %ebp, woken_seq-cond_futex(%ebx)
-- movl %eax, woken_seq-cond_futex+4(%ebx)
-- addl %ebp, %ebp
-- addl $1, broadcast_seq-cond_futex(%ebx)
-- movl %ebp, (%ebx)
--
-- /* Get the address of the mutex used. */
-- movl dep_mutex-cond_futex(%ebx), %edi
--
-- /* Unlock. */
-- LOCK
-- subl $1, cond_lock-cond_futex(%ebx)
-- jne 7f
--
-- /* Don't use requeue for pshared condvars. */
--8: cmpl $-1, %edi
-- je 9f
--
-- /* Do not use requeue for pshared condvars. */
-- testl $PS_BIT, MUTEX_KIND(%edi)
-- jne 9f
--
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 81f
--
-- /* Wake up all threads. */
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %ecx
--#else
-- movl %gs:PRIVATE_FUTEX, %ecx
-- orl $FUTEX_CMP_REQUEUE, %ecx
--#endif
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %esi
-- movl $1, %edx
-- /* Get the address of the futex involved. */
--# if MUTEX_FUTEX != 0
-- addl $MUTEX_FUTEX, %edi
--# endif
--/* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for sysenter.
-- ENTER_KERNEL */
-- int $0x80
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpl $0xfffff001, %eax
-- jae 9f
--
--6: xorl %eax, %eax
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- ret
--
-- cfi_restore_state
--
--81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %esi
-- movl $1, %edx
-- /* Get the address of the futex involved. */
--# if MUTEX_FUTEX != 0
-- addl $MUTEX_FUTEX, %edi
--# endif
-- int $0x80
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpl $0xfffff001, %eax
-- jb 6b
-- jmp 9f
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- .align 16
-- /* Unlock. */
--4: LOCK
-- subl $1, cond_lock-cond_futex(%ebx)
-- je 6b
--
-- /* Unlock in loop requires wakeup. */
--5: leal cond_lock-cond_futex(%ebx), %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 6b
--
-- /* Unlock in loop requires wakeup. */
--7: leal cond_lock-cond_futex(%ebx), %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 8b
--
--9: /* The futex requeue functionality is not available. */
-- movl $0x7fffffff, %edx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- jmp 6b
-- cfi_endproc
-- .size __pthread_cond_broadcast, .-__pthread_cond_broadcast
--versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
-deleted file mode 100644
-index 8f4d937..0000000
---- a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,216 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_signal (pthread_cond_t *cond) */
-- .globl __pthread_cond_signal
-- .type __pthread_cond_signal, @function
-- .align 16
--__pthread_cond_signal:
--
-- cfi_startproc
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- cfi_remember_state
--
-- movl 12(%esp), %edi
--
-- LIBC_PROBE (cond_signal, 1, %edi)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%edi)
--#else
-- cmpxchgl %edx, cond_lock(%edi)
--#endif
-- jnz 1f
--
--2: leal cond_futex(%edi), %ebx
-- movl total_seq+4(%edi), %eax
-- movl total_seq(%edi), %ecx
-- cmpl wakeup_seq+4(%edi), %eax
--#if cond_lock != 0
-- /* Must use leal to preserve the flags. */
-- leal cond_lock(%edi), %edi
--#endif
-- ja 3f
-- jb 4f
-- cmpl wakeup_seq-cond_futex(%ebx), %ecx
-- jbe 4f
--
-- /* Bump the wakeup number. */
--3: addl $1, wakeup_seq-cond_futex(%ebx)
-- adcl $0, wakeup_seq-cond_futex+4(%ebx)
-- addl $1, (%ebx)
--
-- /* Wake up one thread. */
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
--
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- je 8f
--
-- movl dep_mutex-cond_futex(%ebx), %edx
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edx), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 9f
--
--8: subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE_OP, %ecx
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $1, %esi
-- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %ebp
-- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for
-- sysenter.
-- ENTER_KERNEL */
-- int $0x80
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpl $-4095, %eax
-- jae 7f
--
--6: xorl %eax, %eax
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- ret
--
-- cfi_restore_state
--
--9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- xorl %esi, %esi
-- movl dep_mutex-cond_futex(%ebx), %edi
-- movl (%ebx), %ebp
-- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for
-- sysenter.
-- ENTER_KERNEL */
-- int $0x80
-- popl %ebp
-- popl %esi
--
-- leal -cond_futex(%ebx), %edi
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpl $-4095, %eax
-- jb 4f
--
--7:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- orl $FUTEX_WAKE, %ecx
--
-- movl $SYS_futex, %eax
-- /* %edx should be 1 already from $FUTEX_WAKE_OP syscall.
-- movl $1, %edx */
-- ENTER_KERNEL
--
-- /* Unlock. Note that at this point %edi always points to
-- cond_lock. */
--4: LOCK
-- subl $1, (%edi)
-- je 6b
--
-- /* Unlock in loop requires wakeup. */
--5: movl %edi, %eax
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 6b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %edi, %edx
--#else
-- leal cond_lock(%edi), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%edi)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- cfi_endproc
-- .size __pthread_cond_signal, .-__pthread_cond_signal
--versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
-deleted file mode 100644
-index 130c090..0000000
---- a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,973 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-errnos.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <stap-probe.h>
--
-- .text
--
--/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime) */
-- .globl __pthread_cond_timedwait
-- .type __pthread_cond_timedwait, @function
-- .align 16
--__pthread_cond_timedwait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
--
-- movl 20(%esp), %ebx
-- movl 28(%esp), %ebp
--
-- LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp)
--
-- cmpl $1000000000, 4(%ebp)
-- movl $EINVAL, %eax
-- jae 18f
--
-- /* Stack frame:
--
-- esp + 32
-- +--------------------------+
-- esp + 24 | timeout value |
-- +--------------------------+
-- esp + 20 | futex pointer |
-- +--------------------------+
-- esp + 16 | pi-requeued flag |
-- +--------------------------+
-- esp + 12 | old broadcast_seq value |
-- +--------------------------+
-- esp + 4 | old wake_seq value |
-- +--------------------------+
-- esp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
--# ifdef PIC
-- LOAD_PIC_REG (cx)
-- cmpl $0, __have_futex_clock_realtime@GOTOFF(%ecx)
--# else
-- cmpl $0, __have_futex_clock_realtime
--# endif
-- je .Lreltmo
--#endif
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--2: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 17f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--17: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 16f
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
--#ifdef __ASSUME_FUTEX_CLOCK_REALTIME
--# define FRAME_SIZE 24
--#else
--# define FRAME_SIZE 32
--#endif
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
-- movl $0, 16(%esp)
--
-- cmpl $0, (%ebp)
-- movl $-ETIMEDOUT, %esi
-- js 6f
--
--8: movl cond_futex(%ebx), %edi
-- movl %edi, 20(%esp)
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- leal (%ebp), %esi
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- je 40f
--
-- movl dep_mutex(%ebx), %edi
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 40f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%ebx)
-- /* XXX Need to implement using sete instead of a jump. */
-- jne 42f
-- orl $FUTEX_CLOCK_REALTIME, %ecx
--
--42: movl 20(%esp), %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex_pi:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex_pi:
-- movl %eax, %esi
-- /* Set the pi-requeued flag only if the kernel has returned 0. The
-- kernel does not hold the mutex on ETIMEDOUT or any other error. */
-- cmpl $0, %eax
-- sete 16(%esp)
-- je 41f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (16(%esp)) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN (barring
-- the ETIMEOUT of course, for the timeout case in futex) since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 41f
-- xorl %ecx, %ecx
--
--40: subl $1, %ecx
-- movl $0, 16(%esp)
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAIT_BITSET, %ecx
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%ebx)
-- jne 30f
-- orl $FUTEX_CLOCK_REALTIME, %ecx
--30:
-- movl 20(%esp), %edx
-- movl $0xffffffff, %ebp
-- addl $cond_futex, %ebx
--.Ladd_cond_futex:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex:
-- movl 28+FRAME_SIZE(%esp), %ebp
-- movl %eax, %esi
--
--41: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 23f
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 7f
-- cmpl 4(%esp), %edi
-- je 15f
--
--7: cmpl %ecx, %edx
-- jne 9f
-- cmp %eax, %edi
-- jne 9f
--
--15: cmpl $-ETIMEDOUT, %esi
-- je 28f
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
-- movl 16(%esp), %edx
-- test %edx, %edx
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movl dep_mutex(%ebx), %eax
-- call __pthread_mutex_cond_lock_adjust
-- xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
-- jmp 8b
--
--28: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- movl $ETIMEDOUT, %esi
-- jmp 14f
--
--23: xorl %esi, %esi
-- jmp 24f
--
--9: xorl %esi, %esi
--14: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--24: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 25f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 25f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
--
--25: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 10f
--
--11: movl 24+FRAME_SIZE(%esp), %eax
-- /* With requeue_pi, the mutex lock is held in the kernel. */
-- movl 16(%esp), %ecx
-- testl %ecx, %ecx
-- jnz 27f
--
-- call __pthread_mutex_cond_lock
--26: addl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--
-- /* We return the result of the mutex_lock operation if it failed. */
-- testl %eax, %eax
--#ifdef HAVE_CMOV
-- cmovel %esi, %eax
--#else
-- jne 22f
-- movl %esi, %eax
--22:
--#endif
--
--18: popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
--
-- ret
--
-- cfi_restore_state
--
--27: call __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 26b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- /* The initial unlocking of the mutex failed. */
--16:
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 18b
--
-- movl %eax, %esi
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- movl %esi, %eax
-- jmp 18b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 11b
--
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--.Lreltmo:
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--# if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--# else
-- cmpxchgl %edx, cond_lock(%ebx)
--# endif
-- jnz 101f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--102: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 117f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--117: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 16b
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
-- movl $0, 16(%esp)
--
-- /* Get the current time. */
--108: movl %ebx, %edx
--# ifdef __NR_clock_gettime
-- /* Get the clock number. */
-- movl cond_nwaiters(%ebx), %ebx
-- andl $((1 << nwaiters_shift) - 1), %ebx
-- /* Only clocks 0 and 1 are allowed so far. Both are handled in the
-- kernel. */
-- leal 24(%esp), %ecx
-- movl $__NR_clock_gettime, %eax
-- ENTER_KERNEL
-- movl %edx, %ebx
--
-- /* Compute relative timeout. */
-- movl (%ebp), %ecx
-- movl 4(%ebp), %edx
-- subl 24(%esp), %ecx
-- subl 28(%esp), %edx
--# else
-- /* Get the current time. */
-- leal 24(%esp), %ebx
-- xorl %ecx, %ecx
-- movl $__NR_gettimeofday, %eax
-- ENTER_KERNEL
-- movl %edx, %ebx
--
-- /* Compute relative timeout. */
-- movl 28(%esp), %eax
-- movl $1000, %edx
-- mul %edx /* Milli seconds to nano seconds. */
-- movl (%ebp), %ecx
-- movl 4(%ebp), %edx
-- subl 24(%esp), %ecx
-- subl %eax, %edx
--# endif
-- jns 112f
-- addl $1000000000, %edx
-- subl $1, %ecx
--112: testl %ecx, %ecx
-- movl $-ETIMEDOUT, %esi
-- js 106f
--
-- /* Store relative timeout. */
--121: movl %ecx, 24(%esp)
-- movl %edx, 28(%esp)
--
-- movl cond_futex(%ebx), %edi
-- movl %edi, 20(%esp)
--
-- /* Unlock. */
-- LOCK
--# if cond_lock == 0
-- subl $1, (%ebx)
--# else
-- subl $1, cond_lock(%ebx)
--# endif
-- jne 103f
--
--.LcleanupSTART2:
--104: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- leal 24(%esp), %esi
--# if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- subl $1, %ecx
--# ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--# else
-- andl %gs:PRIVATE_FUTEX, %ecx
--# endif
--# if FUTEX_WAIT != 0
-- addl $FUTEX_WAIT, %ecx
--# endif
-- movl 20(%esp), %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex2:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex2:
-- movl %eax, %esi
--
--141: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND2:
--
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--# if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--# else
-- cmpxchgl %edx, cond_lock(%ebx)
--# endif
-- jnz 105f
--
--106: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 23b
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 107f
-- cmpl 4(%esp), %edi
-- je 115f
--
--107: cmpl %ecx, %edx
-- jne 9b
-- cmp %eax, %edi
-- jne 9b
--
--115: cmpl $-ETIMEDOUT, %esi
-- je 28b
--
-- jmp 8b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
-- /* Initial locking failed. */
--101:
--# if cond_lock == 0
-- movl %ebx, %edx
--# else
-- leal cond_lock(%ebx), %edx
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_lock_wait
-- jmp 102b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--103:
--# if cond_lock == 0
-- movl %ebx, %eax
--# else
-- leal cond_lock(%ebx), %eax
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_unlock_wake
-- jmp 104b
--
-- /* Locking in loop failed. */
--105:
--# if cond_lock == 0
-- movl %ebx, %edx
--# else
-- leal cond_lock(%ebx), %edx
--# endif
--# if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--# endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--# if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--# endif
-- call __lll_lock_wait
-- jmp 106b
--#endif
--
-- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2)
--
--
-- .type __condvar_tw_cleanup2, @function
--__condvar_tw_cleanup2:
-- subl $cond_futex, %ebx
-- .size __condvar_tw_cleanup2, .-__condvar_tw_cleanup2
-- .type __condvar_tw_cleanup, @function
--__condvar_tw_cleanup:
-- movl %eax, %esi
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jz 1f
--
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
--
--1: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movl total_seq(%ebx), %eax
-- movl total_seq+4(%ebx), %edi
-- cmpl wakeup_seq+4(%ebx), %edi
-- jb 6f
-- ja 7f
-- cmpl wakeup_seq(%ebx), %eax
-- jbe 7f
--
--6: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
--
--7: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %edi, %edi
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 4f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
-- movl $1, %edi
--
--4: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- je 2f
--
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %edi, %edi
-- jnz 5f
-- addl $cond_futex, %ebx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %edx
-- ENTER_KERNEL
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movl 24+FRAME_SIZE(%esp), %eax
-- movl MUTEX_KIND(%eax), %ebx
-- andl $(ROBUST_BIT|PI_BIT), %ebx
-- cmpl $PI_BIT, %ebx
-- jne 8f
--
-- movl (%eax), %ebx
-- andl $TID_MASK, %ebx
-- cmpl %ebx, %gs:TID
-- jne 8f
-- /* We managed to get the lock. Fix it up before returning. */
-- call __pthread_mutex_cond_lock_adjust
-- jmp 9f
--
--8: call __pthread_mutex_cond_lock
--
--9: movl %esi, (%esp)
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_tw_cleanup, .-__condvar_tw_cleanup
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format (omit)
-- .byte DW_EH_PE_omit # @TType format (omit)
-- .byte DW_EH_PE_sdata4 # call-site format
-- # DW_EH_PE_sdata4
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .long .LcleanupSTART-.LSTARTCODE
-- .long .Ladd_cond_futex_pi-.LcleanupSTART
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex_pi-.LSTARTCODE
-- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex_pi-.LSTARTCODE
-- .long .Ladd_cond_futex-.Lsub_cond_futex_pi
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex-.LSTARTCODE
-- .long .Lsub_cond_futex-.Ladd_cond_futex
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex-.LSTARTCODE
-- .long .LcleanupEND-.Lsub_cond_futex
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
--#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-- .long .LcleanupSTART2-.LSTARTCODE
-- .long .Ladd_cond_futex2-.LcleanupSTART2
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex2-.LSTARTCODE
-- .long .Lsub_cond_futex2-.Ladd_cond_futex2
-- .long __condvar_tw_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex2-.LSTARTCODE
-- .long .LcleanupEND2-.Lsub_cond_futex2
-- .long __condvar_tw_cleanup-.LSTARTCODE
-- .uleb128 0
--#endif
-- .long .LcallUR-.LSTARTCODE
-- .long .LENDCODE-.LcallUR
-- .long 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align 4
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, 4
--DW.ref.__gcc_personality_v0:
-- .long __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
-deleted file mode 100644
-index ec3538f..0000000
---- a/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,641 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <tcb-offsets.h>
--#include <pthread-errnos.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <stap-probe.h>
--
--
-- .text
--
--/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
-- .globl __pthread_cond_wait
-- .type __pthread_cond_wait, @function
-- .align 16
--__pthread_cond_wait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushl %ebp
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebp, 0)
-- pushl %edi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%edi, 0)
-- pushl %esi
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%esi, 0)
-- pushl %ebx
-- cfi_adjust_cfa_offset(4)
-- cfi_rel_offset(%ebx, 0)
--
-- xorl %esi, %esi
-- movl 20(%esp), %ebx
--
-- LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx)
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 1f
--
-- /* Store the reference to the mutex. If there is already a
-- different value in there this is a bad user bug. */
--2: cmpl $-1, dep_mutex(%ebx)
-- movl 24(%esp), %eax
-- je 15f
-- movl %eax, dep_mutex(%ebx)
--
-- /* Unlock the mutex. */
--15: xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 12f
--
-- addl $1, total_seq(%ebx)
-- adcl $0, total_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
--#define FRAME_SIZE 20
-- subl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- /* Get and store current wakeup_seq value. */
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
-- movl broadcast_seq(%ebx), %eax
-- movl %edi, 4(%esp)
-- movl %edx, 8(%esp)
-- movl %eax, 12(%esp)
--
-- /* Reset the pi-requeued flag. */
--8: movl $0, 16(%esp)
-- movl cond_futex(%ebx), %ebp
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: call __pthread_enable_asynccancel
-- movl %eax, (%esp)
--
-- xorl %ecx, %ecx
-- cmpl $-1, dep_mutex(%ebx)
-- sete %cl
-- je 18f
--
-- movl dep_mutex(%ebx), %edi
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%edi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 18f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
-- movl %ebp, %edx
-- xorl %esi, %esi
-- addl $cond_futex, %ebx
--.Ladd_cond_futex_pi:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex_pi:
-- /* Set the pi-requeued flag only if the kernel has returned 0. The
-- kernel does not hold the mutex on error. */
-- cmpl $0, %eax
-- sete 16(%esp)
-- je 19f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (16(%esp)) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 19f
-- xorl %ecx, %ecx
--
--18: subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
--#if FUTEX_WAIT != 0
-- addl $FUTEX_WAIT, %ecx
--#endif
-- movl %ebp, %edx
-- addl $cond_futex, %ebx
--.Ladd_cond_futex:
-- movl $SYS_futex, %eax
-- ENTER_KERNEL
-- subl $cond_futex, %ebx
--.Lsub_cond_futex:
--
--19: movl (%esp), %eax
-- call __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 16f
--
-- movl woken_seq(%ebx), %eax
-- movl woken_seq+4(%ebx), %ecx
--
-- movl wakeup_seq(%ebx), %edi
-- movl wakeup_seq+4(%ebx), %edx
--
-- cmpl 8(%esp), %edx
-- jne 7f
-- cmpl 4(%esp), %edi
-- je 22f
--
--7: cmpl %ecx, %edx
-- jne 9f
-- cmp %eax, %edi
-- je 22f
--
--9: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
-- /* Unlock */
--16: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 17f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 17f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
--
--17: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 10f
--
-- /* With requeue_pi, the mutex lock is held in the kernel. */
--11: movl 24+FRAME_SIZE(%esp), %eax
-- movl 16(%esp), %ecx
-- testl %ecx, %ecx
-- jnz 21f
--
-- call __pthread_mutex_cond_lock
--20: addl $FRAME_SIZE, %esp
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
--
--14: popl %ebx
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebx)
-- popl %esi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%esi)
-- popl %edi
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%edi)
-- popl %ebp
-- cfi_adjust_cfa_offset(-4)
-- cfi_restore(%ebp)
--
-- /* We return the result of the mutex_lock operation. */
-- ret
--
-- cfi_restore_state
--
--21: call __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 20b
--
-- cfi_adjust_cfa_offset(-FRAME_SIZE);
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
--22: movl 16(%esp), %edx
-- test %edx, %edx
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movl dep_mutex(%ebx), %eax
-- call __pthread_mutex_cond_lock_adjust
-- xorl %edx, %edx
-- call __pthread_mutex_unlock_usercnt
-- jmp 8b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 2b
--
-- /* The initial unlocking of the mutex failed. */
--12:
-- LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- jne 14b
--
-- movl %eax, %esi
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- movl %esi, %eax
-- jmp 14b
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
-- jmp 11b
--
-- .size __pthread_cond_wait, .-__pthread_cond_wait
--versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
-- GLIBC_2_3_2)
--
--
-- .type __condvar_w_cleanup2, @function
--__condvar_w_cleanup2:
-- subl $cond_futex, %ebx
-- .size __condvar_w_cleanup2, .-__condvar_w_cleanup2
--.LSbl4:
-- .type __condvar_w_cleanup, @function
--__condvar_w_cleanup:
-- movl %eax, %esi
--
-- /* Get internal lock. */
-- movl $1, %edx
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %edx, (%ebx)
--#else
-- cmpxchgl %edx, cond_lock(%ebx)
--#endif
-- jz 1f
--
--#if cond_lock == 0
-- movl %ebx, %edx
--#else
-- leal cond_lock(%ebx), %edx
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_lock_wait
--
--1: movl broadcast_seq(%ebx), %eax
-- cmpl 12(%esp), %eax
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movl total_seq(%ebx), %eax
-- movl total_seq+4(%ebx), %edi
-- cmpl wakeup_seq+4(%ebx), %edi
-- jb 6f
-- ja 7f
-- cmpl wakeup_seq(%ebx), %eax
-- jbe 7f
--
--6: addl $1, wakeup_seq(%ebx)
-- adcl $0, wakeup_seq+4(%ebx)
-- addl $1, cond_futex(%ebx)
--
--7: addl $1, woken_seq(%ebx)
-- adcl $0, woken_seq+4(%ebx)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %edi, %edi
-- movl total_seq(%ebx), %eax
-- andl total_seq+4(%ebx), %eax
-- cmpl $0xffffffff, %eax
-- jne 4f
-- movl cond_nwaiters(%ebx), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- addl $cond_nwaiters, %ebx
-- movl $SYS_futex, %eax
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $1, %edx
-- ENTER_KERNEL
-- subl $cond_nwaiters, %ebx
-- movl $1, %edi
--
--4: LOCK
--#if cond_lock == 0
-- subl $1, (%ebx)
--#else
-- subl $1, cond_lock(%ebx)
--#endif
-- je 2f
--
--#if cond_lock == 0
-- movl %ebx, %eax
--#else
-- leal cond_lock(%ebx), %eax
--#endif
--#if (LLL_SHARED-LLL_PRIVATE) > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex(%ebx)
-- setne %cl
-- subl $1, %ecx
-- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
--#if LLL_PRIVATE != 0
-- addl $LLL_PRIVATE, %ecx
--#endif
-- call __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %edi, %edi
-- jnz 5f
-- addl $cond_futex, %ebx
--#if FUTEX_PRIVATE_FLAG > 255
-- xorl %ecx, %ecx
--#endif
-- cmpl $-1, dep_mutex-cond_futex(%ebx)
-- sete %cl
-- subl $1, %ecx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %ecx
--#else
-- andl %gs:PRIVATE_FUTEX, %ecx
--#endif
-- addl $FUTEX_WAKE, %ecx
-- movl $SYS_futex, %eax
-- movl $0x7fffffff, %edx
-- ENTER_KERNEL
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movl 24+FRAME_SIZE(%esp), %eax
-- movl MUTEX_KIND(%eax), %ebx
-- andl $(ROBUST_BIT|PI_BIT), %ebx
-- cmpl $PI_BIT, %ebx
-- jne 8f
--
-- movl (%eax), %ebx
-- andl $TID_MASK, %ebx
-- cmpl %ebx, %gs:TID
-- jne 8f
-- /* We managed to get the lock. Fix it up before returning. */
-- call __pthread_mutex_cond_lock_adjust
-- jmp 9f
--
--8: call __pthread_mutex_cond_lock
--
--9: movl %esi, (%esp)
--.LcallUR:
-- call _Unwind_Resume
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_w_cleanup, .-__condvar_w_cleanup
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format (omit)
-- .byte DW_EH_PE_omit # @TType format (omit)
-- .byte DW_EH_PE_sdata4 # call-site format
-- # DW_EH_PE_sdata4
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .long .LcleanupSTART-.LSTARTCODE
-- .long .Ladd_cond_futex_pi-.LcleanupSTART
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex_pi-.LSTARTCODE
-- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi
-- .long __condvar_w_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex_pi-.LSTARTCODE
-- .long .Ladd_cond_futex-.Lsub_cond_futex_pi
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .Ladd_cond_futex-.LSTARTCODE
-- .long .Lsub_cond_futex-.Ladd_cond_futex
-- .long __condvar_w_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .long .Lsub_cond_futex-.LSTARTCODE
-- .long .LcleanupEND-.Lsub_cond_futex
-- .long __condvar_w_cleanup-.LSTARTCODE
-- .uleb128 0
-- .long .LcallUR-.LSTARTCODE
-- .long .LENDCODE-.LcallUR
-- .long 0
-- .uleb128 0
--.Lcstend:
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align 4
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, 4
--DW.ref.__gcc_personality_v0:
-- .long __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S
-deleted file mode 100644
-index 9a4006a..0000000
---- a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_broadcast.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S
-deleted file mode 100644
-index 59f93b6..0000000
---- a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_signal.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S
-deleted file mode 100644
-index d96af08..0000000
---- a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_timedwait.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S
-deleted file mode 100644
-index 9696972..0000000
---- a/sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_wait.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S
-deleted file mode 100644
-index 9a4006a..0000000
---- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_broadcast.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S
-deleted file mode 100644
-index 59f93b6..0000000
---- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_signal.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S
-deleted file mode 100644
-index 0e8d7ff..0000000
---- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,20 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#define HAVE_CMOV 1
--#include "../i486/pthread_cond_timedwait.S"
-diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S
-deleted file mode 100644
-index 9696972..0000000
---- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,19 +0,0 @@
--/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include "../i486/pthread_cond_wait.S"
-diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-index 7cbdb2c..70b65d3 100644
---- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-+++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
-@@ -128,14 +128,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-deleted file mode 100644
-index df635af..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-+++ /dev/null
-@@ -1,179 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <kernel-features.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
-- .text
--
-- /* int pthread_cond_broadcast (pthread_cond_t *cond) */
-- .globl __pthread_cond_broadcast
-- .type __pthread_cond_broadcast, @function
-- .align 16
--__pthread_cond_broadcast:
--
-- LIBC_PROBE (cond_broadcast, 1, %rdi)
--
-- /* Get internal lock. */
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 1f
--
--2: addq $cond_futex, %rdi
-- movq total_seq-cond_futex(%rdi), %r9
-- cmpq wakeup_seq-cond_futex(%rdi), %r9
-- jna 4f
--
-- /* Cause all currently waiting threads to recognize they are
-- woken up. */
-- movq %r9, wakeup_seq-cond_futex(%rdi)
-- movq %r9, woken_seq-cond_futex(%rdi)
-- addq %r9, %r9
-- movl %r9d, (%rdi)
-- incl broadcast_seq-cond_futex(%rdi)
--
-- /* Get the address of the mutex used. */
-- mov dep_mutex-cond_futex(%rdi), %R8_LP
--
-- /* Unlock. */
-- LOCK
-- decl cond_lock-cond_futex(%rdi)
-- jne 7f
--
--8: cmp $-1, %R8_LP
-- je 9f
--
-- /* Do not use requeue for pshared condvars. */
-- testl $PS_BIT, MUTEX_KIND(%r8)
-- jne 9f
--
-- /* Requeue to a PI mutex if the PI bit is set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- je 81f
--
-- /* Wake up all threads. */
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %esi
--#else
-- movl %fs:PRIVATE_FUTEX, %esi
-- orl $FUTEX_CMP_REQUEUE, %esi
--#endif
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $0x7fffffff, %r10d
-- syscall
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpq $-4095, %rax
-- jae 9f
--
--10: xorl %eax, %eax
-- retq
--
-- /* Wake up all threads. */
--81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movl $SYS_futex, %eax
-- movl $1, %edx
-- movl $0x7fffffff, %r10d
-- syscall
--
-- /* For any kind of error, which mainly is EAGAIN, we try again
-- with WAKE. The general test also covers running on old
-- kernels. */
-- cmpq $-4095, %rax
-- jb 10b
-- jmp 9f
--
-- .align 16
-- /* Unlock. */
--4: LOCK
-- decl cond_lock-cond_futex(%rdi)
-- jne 5f
--
--6: xorl %eax, %eax
-- retq
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--5: addq $cond_lock-cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 6b
--
-- /* Unlock in loop requires wakeup. */
--7: addq $cond_lock-cond_futex, %rdi
-- cmp $-1, %R8_LP
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- subq $cond_lock-cond_futex, %rdi
-- jmp 8b
--
--9: /* The futex requeue functionality is not available. */
-- cmp $-1, %R8_LP
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- jmp 10b
-- .size __pthread_cond_broadcast, .-__pthread_cond_broadcast
--versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-deleted file mode 100644
-index 0e8fe0c..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-+++ /dev/null
-@@ -1,164 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-pi-defines.h>
--#include <kernel-features.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--
-- .text
--
-- /* int pthread_cond_signal (pthread_cond_t *cond) */
-- .globl __pthread_cond_signal
-- .type __pthread_cond_signal, @function
-- .align 16
--__pthread_cond_signal:
--
-- LIBC_PROBE (cond_signal, 1, %rdi)
--
-- /* Get internal lock. */
-- movq %rdi, %r8
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 1f
--
--2: addq $cond_futex, %rdi
-- movq total_seq(%r8), %rcx
-- cmpq wakeup_seq(%r8), %rcx
-- jbe 4f
--
-- /* Bump the wakeup number. */
-- addq $1, wakeup_seq(%r8)
-- addl $1, (%rdi)
--
-- /* Wake up one thread. */
-- LP_OP(cmp) $-1, dep_mutex(%r8)
-- movl $FUTEX_WAKE_OP, %esi
-- movl $1, %edx
-- movl $SYS_futex, %eax
-- je 8f
--
-- /* Get the address of the mutex used. */
-- mov dep_mutex(%r8), %RCX_LP
-- movl MUTEX_KIND(%rcx), %r11d
-- andl $(ROBUST_BIT|PI_BIT), %r11d
-- cmpl $PI_BIT, %r11d
-- je 9f
--
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG), %esi
--#else
-- orl %fs:PRIVATE_FUTEX, %esi
--#endif
--
--8: movl $1, %r10d
--#if cond_lock != 0
-- addq $cond_lock, %r8
--#endif
-- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d
-- syscall
--#if cond_lock != 0
-- subq $cond_lock, %r8
--#endif
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpq $-4095, %rax
-- jae 7f
--
-- xorl %eax, %eax
-- retq
--
-- /* Wake up one thread and requeue none in the PI Mutex case. */
--9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movq %rcx, %r8
-- xorq %r10, %r10
-- movl (%rdi), %r9d // XXX Can this be right?
-- syscall
--
-- leaq -cond_futex(%rdi), %r8
--
-- /* For any kind of error, we try again with WAKE.
-- The general test also covers running on old kernels. */
-- cmpq $-4095, %rax
-- jb 4f
--
--7:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- andl $FUTEX_PRIVATE_FLAG, %esi
--#else
-- andl %fs:PRIVATE_FUTEX, %esi
--#endif
-- orl $FUTEX_WAKE, %esi
-- movl $SYS_futex, %eax
-- /* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
-- movl $1, %edx */
-- syscall
--
-- /* Unlock. */
--4: LOCK
--#if cond_lock == 0
-- decl (%r8)
--#else
-- decl cond_lock(%r8)
--#endif
-- jne 5f
--
--6: xorl %eax, %eax
-- retq
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--5:
-- movq %r8, %rdi
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 6b
-- .size __pthread_cond_signal, .-__pthread_cond_signal
--versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
-- GLIBC_2_3_2)
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-deleted file mode 100644
-index 15b872d..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-+++ /dev/null
-@@ -1,623 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--#include <kernel-features.h>
--
--
-- .text
--
--
--/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
-- const struct timespec *abstime) */
-- .globl __pthread_cond_timedwait
-- .type __pthread_cond_timedwait, @function
-- .align 16
--__pthread_cond_timedwait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
-- pushq %r12
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r12, 0)
-- pushq %r13
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r13, 0)
-- pushq %r14
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r14, 0)
-- pushq %r15
-- cfi_adjust_cfa_offset(8)
-- cfi_rel_offset(%r15, 0)
--#define FRAME_SIZE (32+8)
-- subq $FRAME_SIZE, %rsp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
-- cfi_remember_state
--
-- LIBC_PROBE (cond_timedwait, 3, %rdi, %rsi, %rdx)
--
-- cmpq $1000000000, 8(%rdx)
-- movl $EINVAL, %eax
-- jae 48f
--
-- /* Stack frame:
--
-- rsp + 48
-- +--------------------------+
-- rsp + 32 | timeout value |
-- +--------------------------+
-- rsp + 24 | old wake_seq value |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
--
-- /* Prepare structure passed to cancellation handler. */
-- movq %rdi, 8(%rsp)
-- movq %rsi, 16(%rsp)
-- movq %rdx, %r13
--
-- je 22f
-- mov %RSI_LP, dep_mutex(%rdi)
--
--22:
-- xorb %r15b, %r15b
--
-- /* Get internal lock. */
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 31f
--
-- /* Unlock the mutex. */
--32: movq 16(%rsp), %rdi
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 46f
--
-- movq 8(%rsp), %rdi
-- incq total_seq(%rdi)
-- incl cond_futex(%rdi)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Get and store current wakeup_seq value. */
-- movq 8(%rsp), %rdi
-- movq wakeup_seq(%rdi), %r9
-- movl broadcast_seq(%rdi), %edx
-- movq %r9, 24(%rsp)
-- movl %edx, 4(%rsp)
--
-- cmpq $0, (%r13)
-- movq $-ETIMEDOUT, %r14
-- js 36f
--
--38: movl cond_futex(%rdi), %r12d
--
-- /* Unlock. */
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 33f
--
--.LcleanupSTART1:
--34: callq __pthread_enable_asynccancel
-- movl %eax, (%rsp)
--
-- movq %r13, %r10
-- movl $FUTEX_WAIT_BITSET, %esi
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- je 60f
--
-- mov dep_mutex(%rdi), %R8_LP
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 61f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- xorl %eax, %eax
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%rdi)
-- movl $FUTEX_CLOCK_REALTIME, %edx
-- cmove %edx, %eax
-- orl %eax, %esi
-- movq %r12, %rdx
-- addq $cond_futex, %rdi
-- movl $SYS_futex, %eax
-- syscall
--
-- cmpl $0, %eax
-- sete %r15b
--
--#ifdef __ASSUME_REQUEUE_PI
-- jmp 62f
--#else
-- je 62f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (%r15b) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN (barring
-- the ETIMEOUT of course, for the timeout case in futex) since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 62f
--
-- subq $cond_futex, %rdi
--#endif
--
--61: movl $(FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG), %esi
--60: xorb %r15b, %r15b
-- xorl %eax, %eax
-- /* The following only works like this because we only support
-- two clocks, represented using a single bit. */
-- testl $1, cond_nwaiters(%rdi)
-- movl $FUTEX_CLOCK_REALTIME, %edx
-- movl $0xffffffff, %r9d
-- cmove %edx, %eax
-- orl %eax, %esi
-- movq %r12, %rdx
-- addq $cond_futex, %rdi
-- movl $SYS_futex, %eax
-- syscall
--62: movq %rax, %r14
--
-- movl (%rsp), %edi
-- callq __pthread_disable_asynccancel
--.LcleanupEND1:
--
-- /* Lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jne 35f
--
--36: movl broadcast_seq(%rdi), %edx
--
-- movq woken_seq(%rdi), %rax
--
-- movq wakeup_seq(%rdi), %r9
--
-- cmpl 4(%rsp), %edx
-- jne 53f
--
-- cmpq 24(%rsp), %r9
-- jbe 45f
--
-- cmpq %rax, %r9
-- ja 39f
--
--45: cmpq $-ETIMEDOUT, %r14
-- je 99f
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
-- test %r15b, %r15b
-- jz 38b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the
-- mutex correctly. */
-- movq %r8, %rdi
-- callq __pthread_mutex_cond_lock_adjust
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
-- /* Reload cond_var. */
-- movq 8(%rsp), %rdi
-- jmp 38b
--
--99: incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
-- movl $ETIMEDOUT, %r14d
-- jmp 44f
--
--53: xorq %r14, %r14
-- jmp 54f
--
--39: xorq %r14, %r14
--44: incq woken_seq(%rdi)
--
--54: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 55f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 55f
--
-- addq $cond_nwaiters, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
--
--55: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 40f
--
-- /* If requeue_pi is used the kernel performs the locking of the
-- mutex. */
--41: movq 16(%rsp), %rdi
-- testb %r15b, %r15b
-- jnz 64f
--
-- callq __pthread_mutex_cond_lock
--
--63: testq %rax, %rax
-- cmoveq %r14, %rax
--
--48: addq $FRAME_SIZE, %rsp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
-- popq %r15
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r15)
-- popq %r14
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r14)
-- popq %r13
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r13)
-- popq %r12
-- cfi_adjust_cfa_offset(-8)
-- cfi_restore(%r12)
--
-- retq
--
-- cfi_restore_state
--
--64: callq __pthread_mutex_cond_lock_adjust
-- movq %r14, %rax
-- jmp 48b
--
-- /* Initial locking failed. */
--31:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
-- jmp 32b
--
-- /* Unlock in loop requires wakeup. */
--33:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 34b
--
-- /* Locking in loop failed. */
--35:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 36b
--
-- /* Unlock after loop requires wakeup. */
--40:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 41b
--
-- /* The initial unlocking of the mutex failed. */
--46: movq 8(%rsp), %rdi
-- movq %rax, (%rsp)
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 47f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
--47: movq (%rsp), %rax
-- jmp 48b
--
-- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait
--versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
-- GLIBC_2_3_2)
--
--
-- .align 16
-- .type __condvar_cleanup2, @function
--__condvar_cleanup2:
-- /* Stack frame:
--
-- rsp + 72
-- +--------------------------+
-- rsp + 64 | %r12 |
-- +--------------------------+
-- rsp + 56 | %r13 |
-- +--------------------------+
-- rsp + 48 | %r14 |
-- +--------------------------+
-- rsp + 24 | unused |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- movq %rax, 24(%rsp)
--
-- /* Get internal lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jz 1f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
--
--1: movl broadcast_seq(%rdi), %edx
-- cmpl 4(%rsp), %edx
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movq total_seq(%rdi), %rax
-- cmpq wakeup_seq(%rdi), %rax
-- jbe 6f
-- incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
--6: incq woken_seq(%rdi)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorq %r12, %r12
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 4f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_nwaiters(%rdi), %rdi
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
-- movl $1, %r12d
--
--4: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 2f
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testq %r12, %r12
-- jnz 5f
-- addq $cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movq 16(%rsp), %rdi
-- movl MUTEX_KIND(%rdi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 7f
--
-- movl (%rdi), %eax
-- andl $TID_MASK, %eax
-- cmpl %eax, %fs:TID
-- jne 7f
-- /* We managed to get the lock. Fix it up before returning. */
-- callq __pthread_mutex_cond_lock_adjust
-- jmp 8f
--
--7: callq __pthread_mutex_cond_lock
--
--8: movq 24(%rsp), %rdi
-- movq FRAME_SIZE(%rsp), %r15
-- movq FRAME_SIZE+8(%rsp), %r14
-- movq FRAME_SIZE+16(%rsp), %r13
-- movq FRAME_SIZE+24(%rsp), %r12
--.LcallUR:
-- call _Unwind_Resume@PLT
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_cleanup2, .-__condvar_cleanup2
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format
-- .byte DW_EH_PE_omit # @TType format
-- .byte DW_EH_PE_uleb128 # call-site format
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .uleb128 .LcleanupSTART1-.LSTARTCODE
-- .uleb128 .LcleanupEND1-.LcleanupSTART1
-- .uleb128 __condvar_cleanup2-.LSTARTCODE
-- .uleb128 0
-- .uleb128 .LcallUR-.LSTARTCODE
-- .uleb128 .LENDCODE-.LcallUR
-- .uleb128 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align LP_SIZE
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, LP_SIZE
--DW.ref.__gcc_personality_v0:
-- ASM_ADDR __gcc_personality_v0
--#endif
-diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-deleted file mode 100644
-index 2e564a7..0000000
---- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-+++ /dev/null
-@@ -1,555 +0,0 @@
--/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <sysdep.h>
--#include <shlib-compat.h>
--#include <lowlevellock.h>
--#include <lowlevelcond.h>
--#include <tcb-offsets.h>
--#include <pthread-pi-defines.h>
--#include <pthread-errnos.h>
--#include <stap-probe.h>
--
--#include <kernel-features.h>
--
--
-- .text
--
--/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
-- .globl __pthread_cond_wait
-- .type __pthread_cond_wait, @function
-- .align 16
--__pthread_cond_wait:
--.LSTARTCODE:
-- cfi_startproc
--#ifdef SHARED
-- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
-- DW.ref.__gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
--#else
-- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
-- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
--#endif
--
--#define FRAME_SIZE (32+8)
-- leaq -FRAME_SIZE(%rsp), %rsp
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
-- /* Stack frame:
--
-- rsp + 32
-- +--------------------------+
-- rsp + 24 | old wake_seq value |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- LIBC_PROBE (cond_wait, 2, %rdi, %rsi)
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
--
-- /* Prepare structure passed to cancellation handler. */
-- movq %rdi, 8(%rsp)
-- movq %rsi, 16(%rsp)
--
-- je 15f
-- mov %RSI_LP, dep_mutex(%rdi)
--
-- /* Get internal lock. */
--15: movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jne 1f
--
-- /* Unlock the mutex. */
--2: movq 16(%rsp), %rdi
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
--
-- testl %eax, %eax
-- jne 12f
--
-- movq 8(%rsp), %rdi
-- incq total_seq(%rdi)
-- incl cond_futex(%rdi)
-- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Get and store current wakeup_seq value. */
-- movq 8(%rsp), %rdi
-- movq wakeup_seq(%rdi), %r9
-- movl broadcast_seq(%rdi), %edx
-- movq %r9, 24(%rsp)
-- movl %edx, 4(%rsp)
--
-- /* Unlock. */
--8: movl cond_futex(%rdi), %edx
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 3f
--
--.LcleanupSTART:
--4: callq __pthread_enable_asynccancel
-- movl %eax, (%rsp)
--
-- xorq %r10, %r10
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_futex(%rdi), %rdi
-- movl $FUTEX_WAIT, %esi
-- je 60f
--
-- mov dep_mutex-cond_futex(%rdi), %R8_LP
-- /* Requeue to a non-robust PI mutex if the PI bit is set and
-- the robust bit is not set. */
-- movl MUTEX_KIND(%r8), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 61f
--
-- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
-- movl $SYS_futex, %eax
-- syscall
--
-- cmpl $0, %eax
-- sete %r8b
--
--#ifdef __ASSUME_REQUEUE_PI
-- jmp 62f
--#else
-- je 62f
--
-- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns
-- successfully, it has already locked the mutex for us and the
-- pi_flag (%r8b) is set to denote that fact. However, if another
-- thread changed the futex value before we entered the wait, the
-- syscall may return an EAGAIN and the mutex is not locked. We go
-- ahead with a success anyway since later we look at the pi_flag to
-- decide if we got the mutex or not. The sequence numbers then make
-- sure that only one of the threads actually wake up. We retry using
-- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal
-- and PI futexes don't mix.
--
-- Note that we don't check for EAGAIN specifically; we assume that the
-- only other error the futex function could return is EAGAIN since
-- anything else would mean an error in our function. It is too
-- expensive to do that check for every call (which is quite common in
-- case of a large number of threads), so it has been skipped. */
-- cmpl $-ENOSYS, %eax
-- jne 62f
--
--# ifndef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAIT, %esi
--# endif
--#endif
--
--61:
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), %esi
--#else
-- orl %fs:PRIVATE_FUTEX, %esi
--#endif
--60: xorb %r8b, %r8b
-- movl $SYS_futex, %eax
-- syscall
--
--62: movl (%rsp), %edi
-- callq __pthread_disable_asynccancel
--.LcleanupEND:
--
-- /* Lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jnz 5f
--
--6: movl broadcast_seq(%rdi), %edx
--
-- movq woken_seq(%rdi), %rax
--
-- movq wakeup_seq(%rdi), %r9
--
-- cmpl 4(%rsp), %edx
-- jne 16f
--
-- cmpq 24(%rsp), %r9
-- jbe 19f
--
-- cmpq %rax, %r9
-- jna 19f
--
-- incq woken_seq(%rdi)
--
-- /* Unlock */
--16: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 17f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 17f
--
-- addq $cond_nwaiters, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
--
--17: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- jne 10f
--
-- /* If requeue_pi is used the kernel performs the locking of the
-- mutex. */
--11: movq 16(%rsp), %rdi
-- testb %r8b, %r8b
-- jnz 18f
--
-- callq __pthread_mutex_cond_lock
--
--14: leaq FRAME_SIZE(%rsp), %rsp
-- cfi_adjust_cfa_offset(-FRAME_SIZE)
--
-- /* We return the result of the mutex_lock operation. */
-- retq
--
-- cfi_adjust_cfa_offset(FRAME_SIZE)
--
--18: callq __pthread_mutex_cond_lock_adjust
-- xorl %eax, %eax
-- jmp 14b
--
-- /* We need to go back to futex_wait. If we're using requeue_pi, then
-- release the mutex we had acquired and go back. */
--19: testb %r8b, %r8b
-- jz 8b
--
-- /* Adjust the mutex values first and then unlock it. The unlock
-- should always succeed or else the kernel did not lock the mutex
-- correctly. */
-- movq 16(%rsp), %rdi
-- callq __pthread_mutex_cond_lock_adjust
-- movq %rdi, %r8
-- xorl %esi, %esi
-- callq __pthread_mutex_unlock_usercnt
-- /* Reload cond_var. */
-- movq 8(%rsp), %rdi
-- jmp 8b
--
-- /* Initial locking failed. */
--1:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
-- jmp 2b
--
-- /* Unlock in loop requires wakeup. */
--3:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- /* The call preserves %rdx. */
-- callq __lll_unlock_wake
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 4b
--
-- /* Locking in loop failed. */
--5:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
-- jmp 6b
--
-- /* Unlock after loop requires wakeup. */
--10:
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
-- jmp 11b
--
-- /* The initial unlocking of the mutex failed. */
--12: movq %rax, %r10
-- movq 8(%rsp), %rdi
-- LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 13f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_unlock_wake
--
--13: movq %r10, %rax
-- jmp 14b
--
-- .size __pthread_cond_wait, .-__pthread_cond_wait
--versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
-- GLIBC_2_3_2)
--
--
-- .align 16
-- .type __condvar_cleanup1, @function
-- .globl __condvar_cleanup1
-- .hidden __condvar_cleanup1
--__condvar_cleanup1:
-- /* Stack frame:
--
-- rsp + 32
-- +--------------------------+
-- rsp + 24 | unused |
-- +--------------------------+
-- rsp + 16 | mutex pointer |
-- +--------------------------+
-- rsp + 8 | condvar pointer |
-- +--------------------------+
-- rsp + 4 | old broadcast_seq value |
-- +--------------------------+
-- rsp + 0 | old cancellation mode |
-- +--------------------------+
-- */
--
-- movq %rax, 24(%rsp)
--
-- /* Get internal lock. */
-- movq 8(%rsp), %rdi
-- movl $1, %esi
-- xorl %eax, %eax
-- LOCK
--#if cond_lock == 0
-- cmpxchgl %esi, (%rdi)
--#else
-- cmpxchgl %esi, cond_lock(%rdi)
--#endif
-- jz 1f
--
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- callq __lll_lock_wait
--#if cond_lock != 0
-- subq $cond_lock, %rdi
--#endif
--
--1: movl broadcast_seq(%rdi), %edx
-- cmpl 4(%rsp), %edx
-- jne 3f
--
-- /* We increment the wakeup_seq counter only if it is lower than
-- total_seq. If this is not the case the thread was woken and
-- then canceled. In this case we ignore the signal. */
-- movq total_seq(%rdi), %rax
-- cmpq wakeup_seq(%rdi), %rax
-- jbe 6f
-- incq wakeup_seq(%rdi)
-- incl cond_futex(%rdi)
--6: incq woken_seq(%rdi)
--
--3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi)
--
-- /* Wake up a thread which wants to destroy the condvar object. */
-- xorl %ecx, %ecx
-- cmpq $0xffffffffffffffff, total_seq(%rdi)
-- jne 4f
-- movl cond_nwaiters(%rdi), %eax
-- andl $~((1 << nwaiters_shift) - 1), %eax
-- jne 4f
--
-- LP_OP(cmp) $-1, dep_mutex(%rdi)
-- leaq cond_nwaiters(%rdi), %rdi
-- movl $1, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
-- subq $cond_nwaiters, %rdi
-- movl $1, %ecx
--
--4: LOCK
--#if cond_lock == 0
-- decl (%rdi)
--#else
-- decl cond_lock(%rdi)
--#endif
-- je 2f
--#if cond_lock != 0
-- addq $cond_lock, %rdi
--#endif
-- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
-- movl $LLL_PRIVATE, %eax
-- movl $LLL_SHARED, %esi
-- cmovne %eax, %esi
-- /* The call preserves %rcx. */
-- callq __lll_unlock_wake
--
-- /* Wake up all waiters to make sure no signal gets lost. */
--2: testl %ecx, %ecx
-- jnz 5f
-- addq $cond_futex, %rdi
-- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
-- movl $0x7fffffff, %edx
--#ifdef __ASSUME_PRIVATE_FUTEX
-- movl $FUTEX_WAKE, %eax
-- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi
-- cmove %eax, %esi
--#else
-- movl $0, %eax
-- movl %fs:PRIVATE_FUTEX, %esi
-- cmove %eax, %esi
-- orl $FUTEX_WAKE, %esi
--#endif
-- movl $SYS_futex, %eax
-- syscall
--
-- /* Lock the mutex only if we don't own it already. This only happens
-- in case of PI mutexes, if we got cancelled after a successful
-- return of the futex syscall and before disabling async
-- cancellation. */
--5: movq 16(%rsp), %rdi
-- movl MUTEX_KIND(%rdi), %eax
-- andl $(ROBUST_BIT|PI_BIT), %eax
-- cmpl $PI_BIT, %eax
-- jne 7f
--
-- movl (%rdi), %eax
-- andl $TID_MASK, %eax
-- cmpl %eax, %fs:TID
-- jne 7f
-- /* We managed to get the lock. Fix it up before returning. */
-- callq __pthread_mutex_cond_lock_adjust
-- jmp 8f
--
--
--7: callq __pthread_mutex_cond_lock
--
--8: movq 24(%rsp), %rdi
--.LcallUR:
-- call _Unwind_Resume@PLT
-- hlt
--.LENDCODE:
-- cfi_endproc
-- .size __condvar_cleanup1, .-__condvar_cleanup1
--
--
-- .section .gcc_except_table,"a",@progbits
--.LexceptSTART:
-- .byte DW_EH_PE_omit # @LPStart format
-- .byte DW_EH_PE_omit # @TType format
-- .byte DW_EH_PE_uleb128 # call-site format
-- .uleb128 .Lcstend-.Lcstbegin
--.Lcstbegin:
-- .uleb128 .LcleanupSTART-.LSTARTCODE
-- .uleb128 .LcleanupEND-.LcleanupSTART
-- .uleb128 __condvar_cleanup1-.LSTARTCODE
-- .uleb128 0
-- .uleb128 .LcallUR-.LSTARTCODE
-- .uleb128 .LENDCODE-.LcallUR
-- .uleb128 0
-- .uleb128 0
--.Lcstend:
--
--
--#ifdef SHARED
-- .hidden DW.ref.__gcc_personality_v0
-- .weak DW.ref.__gcc_personality_v0
-- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-- .align LP_SIZE
-- .type DW.ref.__gcc_personality_v0, @object
-- .size DW.ref.__gcc_personality_v0, LP_SIZE
--DW.ref.__gcc_personality_v0:
-- ASM_ADDR __gcc_personality_v0
--#endif
-diff --git a/sysdeps/x86/bits/pthreadtypes.h b/sysdeps/x86/bits/pthreadtypes.h
-index 4460615..0898455 100644
---- a/sysdeps/x86/bits/pthreadtypes.h
-+++ b/sysdeps/x86/bits/pthreadtypes.h
-@@ -140,14 +140,14 @@ typedef union
- {
- struct
- {
-- int __lock;
-- unsigned int __futex;
-- __extension__ unsigned long long int __total_seq;
-- __extension__ unsigned long long int __wakeup_seq;
-- __extension__ unsigned long long int __woken_seq;
-+ unsigned int __wseq;
-+#define __PTHREAD_COND_WSEQ_THRESHOLD (~ (unsigned int) 0)
-+ unsigned int __signals_sent;
-+ unsigned int __confirmed;
-+ unsigned int __generation;
- void *__mutex;
-- unsigned int __nwaiters;
-- unsigned int __broadcast_seq;
-+ unsigned int __quiescence_waiters;
-+ int __clockid;
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
diff --git a/glibc-rh1009145.patch b/glibc-rh1009145.patch
deleted file mode 100644
index c1af7fa..0000000
--- a/glibc-rh1009145.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- glibc-2.18-151-g303e567.orig/elf/ldconfig.c 2013-09-25 14:01:01.522446341 -0400
-+++ glibc-2.18-151-g303e567/elf/ldconfig.c 2013-09-25 14:06:31.094218857 -0400
-@@ -959,6 +959,16 @@
- || dlib_ptr->flag == FLAG_ELF_LIBC6)
- && flag == FLAG_ELF)
- dlib_ptr->flag = flag;
-+#ifdef __arm__
-+ /* In Fedora 20 binutils regressed temporarily and failed to
-+ mark hard ABI objects with the correct flag. Therefore we
-+ must accept unmarked objects that were previously marked
-+ hard ABI. We can remove this check once the entire distribution
-+ has been rebuilt. */
-+ else if (dlib_ptr->flag & FLAG_ARM_LIBHF &&
-+ (flag == FLAG_ELF_LIBC6))
-+ ;
-+#endif
- else
- error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
- dlib_ptr->name, direntry->d_name,
diff --git a/glibc-rh1070416.patch b/glibc-rh1070416.patch
deleted file mode 100644
index 08c8e10..0000000
--- a/glibc-rh1070416.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- a/nscd/nscd.service
-+++ b/nscd/nscd.service
-@@ -2,6 +2,7 @@
-
- [Unit]
- Description=Name Service Cache Daemon
-+After=syslog.target
-
- [Service]
- Type=forking
-@@ -17,3 +18,4 @@
-
- [Install]
- WantedBy=multi-user.target
-+Also=nscd.socket
-diff --git a/nscd/nscd.socket b/nscd/nscd.socket
-new file mode 100644
-index 0000000..7e512d5
---- /dev/null
-+++ b/nscd/nscd.socket
-@@ -0,0 +1,8 @@
-+[Unit]
-+Description=Name Service Cache Daemon Socket
-+
-+[Socket]
-+ListenDatagram=/run/nscd/socket
-+
-+[Install]
-+WantedBy=sockets.target
diff --git a/glibc-rh1315108.patch b/glibc-rh1315108.patch
deleted file mode 100644
index 8b4e5fc..0000000
--- a/glibc-rh1315108.patch
+++ /dev/null
@@ -1,1946 +0,0 @@
-From the upstream branch fw/extend_alloca.
-
-commit dc79f9aa56933dc8b475209f9a4059965b50ea26
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 18:29:47 2015 +0100
-
- nscd restart: Use malloc instead of extend_alloca
-
- This introduces a separate function, read_cmdline, which reads the
- contents of /proc/self/cmdline into a heap-allocated buffer.
-
- [BZ #18023]
- * nscd/connections.c (read_cmdline): New function.
- (restart): Use it. Update comment.
-
-commit 9bed8b7fca7867d3027b66ce3985a75136aed013
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 15:14:19 2015 +0100
-
- getgrent_next_nss (compat-initgroups): Remove alloca fallback
-
- If the caller-supplied buffer is not large enough, fall back directly
- malloc.
-
- The previous __libc_use_alloca check was incorrect because it did not
- take into account that extend_alloca may fail to merge allocations, so
- it would underestimate the stack space being used by roughly a factor
- of two.
-
- [BZ #18023]
- * nis/nss_compat/compat-initgroups.c (getgrent_next_nss): Fall
- back to malloc directly, without stack allocations.
-
-commit c95cc759ecb21f812872934ac55518aef28cf46b
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 16:03:01 2015 +0100
-
- _dl_map_object_deps: Use struct scratch_buffer instead of extend_alloca
-
- The function comment suggests that _dl_map_object_deps cannot use
- malloc, but it already allocates the l_initfini array on the heap, so
- the additional allocation should be acceptable.
-
- [BZ #18023]
- * elf/dl-deps.c (_dl_map_object_deps): Use struct
- scratch_buffer instead of extend_alloca.
-
-commit e38bff4db6f03d1fab732737f43a25160c3e4703
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 16:18:21 2015 +0100
-
- _nss_nis_initgroups_dyn: Use struct scratch_buffer instead of extend_alloca
-
- Also adjusts the internal function get_uid.
-
- [BZ #18023]
- * nis/nss_nis/nis-initgroups.c (get_uid, _nss_nis_initgroups_dyn):
- Use struct scratch_buffer instead of extend_alloca.
-
-commit 8825d4709a686a870d313cc602d489ddd5354a08
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 18:55:33 2015 +0100
-
- nscd: Use struct scratch_buffer instead of extend_alloca in most caches
-
- This replaces the ERANGE retry loops with loops which have heap
- fallback. Heap allocation might actually be required for extremely
- large NSS results.
-
- [BZ #18023]
- * nscd/grpcache.c (addgrbyX): Use struct scratch_buffer instead
- of extend_alloca.
- * nscd/hstcache.c (addhstbyX): Likewise.
- * nscd/pwdcache.c (addpwbyX): Likewise.
- * nscd/servicescache.c (addservbyX): Likewise.
-
-commit 140d8711d446f5193b04b56e714ddf8d0eddbf62
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 18:59:48 2015 +0100
-
- nscd: Switch to struct scratch_buffer in adhstaiX
-
- The pre-allocation of the three scratch buffers increased the initial
- stack size somewhat, but if retries are needed, the previous version
- used more stack space if extend_alloca could not merge allocations.
- Lack of alloca accounting also means could be problematic with
- extremely large NSS responses, too.
-
- [BZ #18023]
- * nscd/aicache.c (addhstaiX): Use struct scratch_buffer instead
- of extend_alloca.
-
-commit 1af14faef808f03276766e5ee6d9ee7dc9053fba
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:03:01 2015 +0100
-
- getent: Switch to struct scratch_buffer in initgroups_keys
-
- The retry loop is slightly different here because getgrouplist
- provides size information, so scratch_buffer_set_array_size can be
- used to grow the buffer in a more precise fashion.
-
- [BZ #18023]
- * nss/getent.c (initgroups_keys): Use struct scratch_buffer
- instead of extend_alloca.
-
-commit 9b71d3b4df6dd4e49f7638d1d936c921c50fa3d9
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:09:00 2015 +0100
-
- nss_files: Use struct scratch_buffer instead of extend_alloca
-
- In both _nss_files_gethostbyname3_r and _nss_files_initgroups_dyn,
- __libc_use_alloca was misused because it was not taken into account
- that extend_alloca can fail to merge allocations.
-
- [BZ #18023]
- * nss/nss_files/files-hosts.c (_nss_files_gethostbyname3_r):
- Use struct scratch_buffer instead of extend_alloca.
- * nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn):
- Likewise.
-
-commit 11c2a8bad9ca5fe510b73c0204b3dcf703f14d5c
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:11:55 2015 +0100
-
- gethostid (Linux variant): Switch to struct scratch_buffer
-
- Previously, extend_alloca was used without alloca accounting,
- which could have been problematic with large NSS results.
-
- [BZ #18023]
- * sysdeps/unix/sysv/linux/gethostid.c (gethostid): Use struct
- scratch_buffer instead of extend_alloca.
-
-commit 6de00dd8a3a76d0b7586393451e65ad6c2721a71
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:14:29 2015 +0100
-
- getlogin_r (Linux variant): Switch to struct scratch_buffer
-
- This corrects the alloca accounting as a side effect. It was not off
- if extend_alloca failed to merge allocations.
-
- [BZ #18023]
- * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
- Use struct scratch_buffer instead of extend_alloca.
-
-commit 488063238ee5c87b66c6982b1b6d508e30e44386
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:48:31 2015 +0100
-
- wordexp: Rewrite parse_tilde to use struct scratch_buffer
-
- [BZ #18023]
- * posix/wordexp.c (parse_tilde): Use struct scratch_buffer
- instead of extend_alloca.
-
-commit 7b4c16db30304b83a5d1e913d1a8f7e90a8c398c
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 19:49:50 2015 +0100
-
- glob: Rewrite to use struct scratch_buffer instead of extend_alloca
-
- [BZ #18023]
- * posix/glob.c (glob): Use struct scratch_buffer instead of
- extend_alloca.
-
-commit 683543bbb3e2c1b17554c4096d00c2980f39a802
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Sun Mar 1 23:22:45 2015 +0100
-
- Remove macros extend_alloca, extend_alloca_account [BZ #18023]
-
- And also the helper macro stackinfo_alloca_round.
-
- extend_alloca simply does not work on x86_64 and current i386 because
- its peculiar stack alignment rules.
-
- Here's an analysis of the _dl_fini situation (before the removal of
- extend_alloca).
-
- Dump of assembler code for function _dl_fini:
- <+0>: push %rbp
- <+1>: mov %rsp,%rbp
- <+4>: push %r15
- <+6>: push %r14
- <+8>: push %r13
- <+10>: push %r12
- <+12>: push %rbx
- <+13>: sub $0x38,%rsp
-
- The function pushes 6 registers on the stack and allocates 0x38 bytes,
- which means that %rsp is a multiple of 16 after function prologue.
-
- The initial alloca allocation does not change %rsp alignment:
-
- <+210>: shr $0x4,%rcx
- <+214>: shl $0x4,%rcx
- <+218>: sub %rcx,%rsp
-
- %r15 is the address of the previous stack allocation, it is used below.
-
- This is the extend_alloca reallocation branch:
-
- <+734>: add $0xf,%rdx
- <+738>: and $0xfffffffffffffff0,%rdx
- <+742>: lea 0x1e(%rdx),%rcx
- <+746>: shr $0x4,%rcx
- <+750>: shl $0x4,%rcx
- <+754>: sub %rcx,%rsp
- <+757>: lea 0xf(%rsp),%rcx
- <+762>: and $0xfffffffffffffff0,%rcx
- <+766>: lea (%rcx,%rdx,1),%rsi
- <+770>: cmp %rsi,%r15
- <+773>: je 0x7f963940b673 <_dl_fini+787>
- <+775>: mov %rdx,-0x58(%rbp)
- <+787>: add %rdx,-0x58(%rbp)
-
- (a) %rdx, the new requested size, is rounded up to a multiple of 16
- (+734, %+738), and the result is stored in %rdx@738.
-
- (b) %rdx@738 + 31 is rounded down to a multiple of 16, the result is
- stored in rcx@750 (+742, +746, +750). So %rcx@750 == %rdx@738 + 16.
-
- (c) %rcx@750 bytes are allocated on the stack (+754). %rsp is rounded
- upwards to a multiple of 16, result is stored in %rcx@762 (+757, +762).
- This does not change the value of %rsp because it already was a multiple
- of 16.
-
- (d) %rsi@766 == %rcx@762 + %rdx@738 is compared against %r15. But this
- comparison is always false because we allocated 16 extra bytes on the
- stack in (b), which were reserved for the alignment in (c), but in fact
- unused. We are left with a gap in stack usage, and the comparison is
- always false.
-
- (@XXX refers to register values after executing the instruction at
- offset +XXX.)
-
- If the alignment gap was actually used because of different alignment
- for %rsp, then the comparison failure would still occur because the gap
- would not have been added after this reallocation, but before the
- previous allocation.
-
- As a result, extend_alloca is never able to merge allocations. It also
- turns out that the interface is difficult to use, especially in
- cojunction with alloca account (which is rarely optional).
-
- [BZ #18023]
- * include/alloca.h (stackinfo_alloca_round, extend_alloca,
- extend_alloca_account): Remove.
-Index: b/elf/dl-deps.c
-===================================================================
---- a/elf/dl-deps.c
-+++ b/elf/dl-deps.c
-@@ -27,6 +27,7 @@
- #include <unistd.h>
- #include <sys/param.h>
- #include <ldsodefs.h>
-+#include <scratch_buffer.h>
-
- #include <dl-dst.h>
-
-@@ -184,9 +185,8 @@ _dl_map_object_deps (struct link_map *ma
- /* Pointer to last unique object. */
- tail = &known[nlist - 1];
-
-- /* No alloca'd space yet. */
-- struct link_map **needed_space = NULL;
-- size_t needed_space_bytes = 0;
-+ struct scratch_buffer needed_space;
-+ scratch_buffer_init (&needed_space);
-
- /* Process each element of the search list, loading each of its
- auxiliary objects and immediate dependencies. Auxiliary objects
-@@ -217,13 +217,12 @@ _dl_map_object_deps (struct link_map *ma
- if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL
- && l != map && l->l_ldnum > 0)
- {
-- size_t new_size = l->l_ldnum * sizeof (struct link_map *);
--
-- if (new_size > needed_space_bytes)
-- needed_space
-- = extend_alloca (needed_space, needed_space_bytes, new_size);
--
-- needed = needed_space;
-+ /* l->l_ldnum includes space for the terminating NULL. */
-+ if (!scratch_buffer_set_array_size
-+ (&needed_space, l->l_ldnum, sizeof (struct link_map *)))
-+ _dl_signal_error (ENOMEM, map->l_name, NULL,
-+ N_("cannot allocate dependency buffer"));
-+ needed = needed_space.data;
- }
-
- if (l->l_info[DT_NEEDED] || l->l_info[AUXTAG] || l->l_info[FILTERTAG])
-@@ -463,8 +462,11 @@ _dl_map_object_deps (struct link_map *ma
- struct link_map **l_initfini = (struct link_map **)
- malloc ((2 * nneeded + 1) * sizeof needed[0]);
- if (l_initfini == NULL)
-- _dl_signal_error (ENOMEM, map->l_name, NULL,
-- N_("cannot allocate dependency list"));
-+ {
-+ scratch_buffer_free (&needed_space);
-+ _dl_signal_error (ENOMEM, map->l_name, NULL,
-+ N_("cannot allocate dependency list"));
-+ }
- l_initfini[0] = l;
- memcpy (&l_initfini[1], needed, nneeded * sizeof needed[0]);
- memcpy (&l_initfini[nneeded + 1], l_initfini,
-@@ -482,6 +484,8 @@ _dl_map_object_deps (struct link_map *ma
- }
-
- out:
-+ scratch_buffer_free (&needed_space);
-+
- if (errno == 0 && errno_saved != 0)
- __set_errno (errno_saved);
-
-Index: b/include/alloca.h
-===================================================================
---- a/include/alloca.h
-+++ b/include/alloca.h
-@@ -20,57 +20,17 @@ libc_hidden_proto (__libc_alloca_cutoff)
-
- #include <allocalim.h>
-
--#ifndef stackinfo_alloca_round
--# define stackinfo_alloca_round(l) (((l) + 15) & -16)
--#endif
--
--#if _STACK_GROWS_DOWN
--# define extend_alloca(buf, len, newlen) \
-- (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
-- char *__newbuf = __alloca (__newlen); \
-- if (__newbuf + __newlen == (char *) (buf)) \
-- len += __newlen; \
-- else \
-- len = __newlen; \
-- __newbuf; })
--#elif _STACK_GROWS_UP
--# define extend_alloca(buf, len, newlen) \
-- (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
-- char *__newbuf = __alloca (__newlen); \
-- char *__buf = (char *) (buf); \
-- if (__buf + len == __newbuf) \
-- { \
-- len += __newlen; \
-- __newbuf = __buf; \
-- } \
-- else \
-- len = __newlen; \
-- __newbuf; })
--#else
--# define extend_alloca(buf, len, newlen) \
-- __alloca (((len) = (newlen)))
--#endif
--
- #if defined stackinfo_get_sp && defined stackinfo_sub_sp
- # define alloca_account(size, avar) \
- ({ void *old__ = stackinfo_get_sp (); \
- void *m__ = __alloca (size); \
- avar += stackinfo_sub_sp (old__); \
- m__; })
--# define extend_alloca_account(buf, len, newlen, avar) \
-- ({ void *old__ = stackinfo_get_sp (); \
-- void *m__ = extend_alloca (buf, len, newlen); \
-- avar += stackinfo_sub_sp (old__); \
-- m__; })
- #else
- # define alloca_account(size, avar) \
- ({ size_t s__ = (size); \
- avar += s__; \
- __alloca (s__); })
--# define extend_alloca_account(buf, len, newlen, avar) \
-- ({ size_t s__ = (newlen); \
-- avar += s__; \
-- extend_alloca (buf, len, s__); })
- #endif
-
- #endif
-Index: b/nis/nss_compat/compat-initgroups.c
-===================================================================
---- a/nis/nss_compat/compat-initgroups.c
-+++ b/nis/nss_compat/compat-initgroups.c
-@@ -310,7 +310,6 @@ getgrent_next_nss (ent_t *ent, char *buf
- overwrite the pointer with one to a bigger buffer. */
- char *tmpbuf = buffer;
- size_t tmplen = buflen;
-- bool use_malloc = false;
-
- for (int i = 0; i < mystart; i++)
- {
-@@ -319,29 +318,26 @@ getgrent_next_nss (ent_t *ent, char *buf
- == NSS_STATUS_TRYAGAIN
- && *errnop == ERANGE)
- {
-- if (__libc_use_alloca (tmplen * 2))
-- {
-- if (tmpbuf == buffer)
-- {
-- tmplen *= 2;
-- tmpbuf = __alloca (tmplen);
-- }
-- else
-- tmpbuf = extend_alloca (tmpbuf, tmplen, tmplen * 2);
-- }
-- else
-- {
-- tmplen *= 2;
-- char *newbuf = realloc (use_malloc ? tmpbuf : NULL, tmplen);
--
-- if (newbuf == NULL)
-- {
-- status = NSS_STATUS_TRYAGAIN;
-- goto done;
-- }
-- use_malloc = true;
-- tmpbuf = newbuf;
-- }
-+ /* Check for overflow. */
-+ if (__glibc_unlikely (tmplen * 2 < tmplen))
-+ {
-+ __set_errno (ENOMEM);
-+ status = NSS_STATUS_TRYAGAIN;
-+ goto done;
-+ }
-+ /* Increase the size. Make sure that we retry
-+ with a reasonable size. */
-+ tmplen *= 2;
-+ if (tmplen < 1024)
-+ tmplen = 1024;
-+ if (tmpbuf != buffer)
-+ free (tmpbuf);
-+ tmpbuf = malloc (tmplen);
-+ if (__glibc_unlikely (tmpbuf == NULL))
-+ {
-+ status = NSS_STATUS_TRYAGAIN;
-+ goto done;
-+ }
- }
-
- if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
-@@ -369,7 +365,7 @@ getgrent_next_nss (ent_t *ent, char *buf
- status = NSS_STATUS_NOTFOUND;
-
- done:
-- if (use_malloc)
-+ if (tmpbuf != buffer)
- free (tmpbuf);
- }
-
-Index: b/nis/nss_nis/nis-initgroups.c
-===================================================================
---- a/nis/nss_nis/nis-initgroups.c
-+++ b/nis/nss_nis/nis-initgroups.c
-@@ -16,7 +16,6 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <ctype.h>
- #include <errno.h>
- #include <grp.h>
-@@ -27,6 +26,7 @@
- #include <rpcsvc/yp.h>
- #include <rpcsvc/ypclnt.h>
- #include <sys/param.h>
-+#include <scratch_buffer.h>
-
- #include "nss-nis.h"
- #include <libnsl.h>
-@@ -120,27 +120,30 @@ internal_getgrent_r (struct group *grp,
- static int
- get_uid (const char *user, uid_t *uidp)
- {
-- size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
-- char *buf = (char *) alloca (buflen);
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- while (1)
- {
- struct passwd result;
- struct passwd *resp;
-
-- int r = getpwnam_r (user, &result, buf, buflen, &resp);
-+ int r = getpwnam_r (user, &result, tmpbuf.data, tmpbuf.length, &resp);
- if (r == 0 && resp != NULL)
- {
- *uidp = resp->pw_uid;
-+ scratch_buffer_free (&tmpbuf);
- return 0;
- }
-
- if (r != ERANGE)
- break;
-
-- buf = extend_alloca (buf, buflen, 2 * buflen);
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ return 1;
- }
-
-+ scratch_buffer_free (&tmpbuf);
- return 1;
- }
-
-@@ -254,8 +257,6 @@ _nss_nis_initgroups_dyn (const char *use
- }
-
- struct group grpbuf, *g;
-- size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
-- char *tmpbuf;
- enum nss_status status;
- intern_t intern = { NULL, NULL, 0 };
- gid_t *groups = *groupsp;
-@@ -264,15 +265,21 @@ _nss_nis_initgroups_dyn (const char *use
- if (status != NSS_STATUS_SUCCESS)
- return status;
-
-- tmpbuf = __alloca (buflen);
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- while (1)
- {
- while ((status =
-- internal_getgrent_r (&grpbuf, tmpbuf, buflen, errnop,
-+ internal_getgrent_r (&grpbuf, tmpbuf.data, tmpbuf.length, errnop,
- &intern)) == NSS_STATUS_TRYAGAIN
- && *errnop == ERANGE)
-- tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ {
-+ status = NSS_STATUS_TRYAGAIN;
-+ *errnop = errno;
-+ goto done;
-+ }
-
- if (status != NSS_STATUS_SUCCESS)
- {
-@@ -331,6 +338,7 @@ done:
- intern.start = intern.start->next;
- free (intern.next);
- }
-+ scratch_buffer_free (&tmpbuf);
-
- return status;
- }
-Index: b/nscd/aicache.c
-===================================================================
---- a/nscd/aicache.c
-+++ b/nscd/aicache.c
-@@ -26,6 +26,7 @@
- #include <unistd.h>
- #include <sys/mman.h>
- #include <resolv/res_hconf.h>
-+#include <scratch_buffer.h>
-
- #include "dbg_log.h"
- #include "nscd.h"
-@@ -113,10 +114,13 @@ addhstaiX (struct database_dyn *db, int
- int old_res_options = _res.options;
- _res.options &= ~RES_USE_INET6;
-
-- size_t tmpbuf6len = 1024;
-- char *tmpbuf6 = alloca (tmpbuf6len);
-- size_t tmpbuf4len = 0;
-- char *tmpbuf4 = NULL;
-+ struct scratch_buffer tmpbuf6;
-+ scratch_buffer_init (&tmpbuf6);
-+ struct scratch_buffer tmpbuf4;
-+ scratch_buffer_init (&tmpbuf4);
-+ struct scratch_buffer canonbuf;
-+ scratch_buffer_init (&canonbuf);
-+
- int32_t ttl = INT32_MAX;
- ssize_t total = 0;
- char *key_copy = NULL;
-@@ -129,6 +133,7 @@ addhstaiX (struct database_dyn *db, int
- int status[2] = { NSS_STATUS_UNAVAIL, NSS_STATUS_UNAVAIL };
- int naddrs = 0;
- size_t addrslen = 0;
-+
- char *canon = NULL;
- size_t canonlen;
-
-@@ -143,12 +148,17 @@ addhstaiX (struct database_dyn *db, int
- at = &atmem;
- rc6 = 0;
- herrno = 0;
-- status[1] = DL_CALL_FCT (fct4, (key, &at, tmpbuf6, tmpbuf6len,
-+ status[1] = DL_CALL_FCT (fct4, (key, &at,
-+ tmpbuf6.data, tmpbuf6.length,
- &rc6, &herrno, &ttl));
- if (rc6 != ERANGE || (herrno != NETDB_INTERNAL
- && herrno != TRY_AGAIN))
- break;
-- tmpbuf6 = extend_alloca (tmpbuf6, tmpbuf6len, 2 * tmpbuf6len);
-+ if (!scratch_buffer_grow (&tmpbuf6))
-+ {
-+ rc6 = ENOMEM;
-+ break;
-+ }
- }
-
- if (rc6 != 0 && herrno == NETDB_INTERNAL)
-@@ -226,41 +236,38 @@ addhstaiX (struct database_dyn *db, int
- while (1)
- {
- rc6 = 0;
-- status[0] = DL_CALL_FCT (fct, (key, AF_INET6, &th[0], tmpbuf6,
-- tmpbuf6len, &rc6, &herrno, &ttl,
-+ status[0] = DL_CALL_FCT (fct, (key, AF_INET6, &th[0],
-+ tmpbuf6.data, tmpbuf6.length,
-+ &rc6, &herrno, &ttl,
- &canon));
- if (rc6 != ERANGE || herrno != NETDB_INTERNAL)
- break;
-- tmpbuf6 = extend_alloca (tmpbuf6, tmpbuf6len, 2 * tmpbuf6len);
-+ if (!scratch_buffer_grow (&tmpbuf6))
-+ {
-+ rc6 = ENOMEM;
-+ break;
-+ }
- }
-
- if (rc6 != 0 && herrno == NETDB_INTERNAL)
- goto out;
-
-- /* If the IPv6 lookup has been successful do not use the
-- buffer used in that lookup, use a new one. */
-- if (status[0] == NSS_STATUS_SUCCESS && rc6 == 0)
-- {
-- tmpbuf4len = 512;
-- tmpbuf4 = alloca (tmpbuf4len);
-- }
-- else
-- {
-- tmpbuf4len = tmpbuf6len;
-- tmpbuf4 = tmpbuf6;
-- }
--
- /* Next collect IPv4 information. */
- while (1)
- {
- rc4 = 0;
-- status[1] = DL_CALL_FCT (fct, (key, AF_INET, &th[1], tmpbuf4,
-- tmpbuf4len, &rc4, &herrno,
-+ status[1] = DL_CALL_FCT (fct, (key, AF_INET, &th[1],
-+ tmpbuf4.data, tmpbuf4.length,
-+ &rc4, &herrno,
- ttl == INT32_MAX ? &ttl : NULL,
- canon == NULL ? &canon : NULL));
- if (rc4 != ERANGE || herrno != NETDB_INTERNAL)
- break;
-- tmpbuf4 = extend_alloca (tmpbuf4, tmpbuf4len, 2 * tmpbuf4len);
-+ if (!scratch_buffer_grow (&tmpbuf4))
-+ {
-+ rc4 = ENOMEM;
-+ break;
-+ }
- }
-
- if (rc4 != 0 && herrno == NETDB_INTERNAL)
-@@ -286,13 +293,11 @@ addhstaiX (struct database_dyn *db, int
- cfct = __nss_lookup_function (nip, "getcanonname_r");
- if (cfct != NULL)
- {
-- const size_t max_fqdn_len = 256;
-- char *buf = alloca (max_fqdn_len);
- char *s;
- int rc;
-
-- if (DL_CALL_FCT (cfct, (key, buf, max_fqdn_len, &s,
-- &rc, &herrno))
-+ if (DL_CALL_FCT (cfct, (key, canonbuf.data, canonbuf.length,
-+ &s, &rc, &herrno))
- == NSS_STATUS_SUCCESS)
- canon = s;
- else
-@@ -321,18 +326,20 @@ addhstaiX (struct database_dyn *db, int
- addrfamily = AF_INET6;
- }
-
-- size_t tmpbuflen = 512;
-- char *tmpbuf = alloca (tmpbuflen);
- int rc;
- while (1)
- {
- rc = __gethostbyaddr2_r (addr, addrlen, addrfamily,
-- &hstent_mem, tmpbuf, tmpbuflen,
-+ &hstent_mem,
-+ canonbuf.data, canonbuf.length,
- &hstent, &herrno, NULL);
- if (rc != ERANGE || herrno != NETDB_INTERNAL)
- break;
-- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-- tmpbuflen * 2);
-+ if (!scratch_buffer_grow (&canonbuf))
-+ {
-+ rc = ENOMEM;
-+ break;
-+ }
- }
-
- if (rc == 0)
-@@ -560,6 +567,10 @@ next_nip:
- dh->usable = false;
- }
-
-+ scratch_buffer_free (&tmpbuf6);
-+ scratch_buffer_free (&tmpbuf4);
-+ scratch_buffer_free (&canonbuf);
-+
- return timeout;
- }
-
-Index: b/nscd/connections.c
-===================================================================
---- a/nscd/connections.c
-+++ b/nscd/connections.c
-@@ -1353,64 +1353,83 @@ request from '%s' [%ld] not handled due
- }
- }
-
--
--/* Restart the process. */
--static void
--restart (void)
-+static char *
-+read_cmdline (size_t *size)
- {
-- /* First determine the parameters. We do not use the parameters
-- passed to main() since in case nscd is started by running the
-- dynamic linker this will not work. Yes, this is not the usual
-- case but nscd is part of glibc and we occasionally do this. */
-- size_t buflen = 1024;
-- char *buf = alloca (buflen);
-- size_t readlen = 0;
- int fd = open ("/proc/self/cmdline", O_RDONLY);
-- if (fd == -1)
-- {
-- dbg_log (_("\
--cannot open /proc/self/cmdline: %s; disabling paranoia mode"),
-- strerror (errno));
--
-- paranoia = 0;
-- return;
-+ if (fd < 0)
-+ return NULL;
-+ size_t current = 0;
-+ size_t limit = 1024;
-+ char *buffer = malloc (limit);
-+ if (buffer == NULL)
-+ {
-+ close (fd);
-+ errno = ENOMEM;
-+ return NULL;
- }
--
- while (1)
- {
-- ssize_t n = TEMP_FAILURE_RETRY (read (fd, buf + readlen,
-- buflen - readlen));
-- if (n == -1)
-+ if (current == limit)
- {
-- dbg_log (_("\
--cannot read /proc/self/cmdline: %s; disabling paranoia mode"),
-- strerror (errno));
-+ char *newptr;
-+ if (2 * limit < limit
-+ || (newptr = realloc (buffer, 2 * limit)) == NULL)
-+ {
-+ free (buffer);
-+ close (fd);
-+ errno = ENOMEM;
-+ return NULL;
-+ }
-+ buffer = newptr;
-+ limit *= 2;
-+ }
-
-+ ssize_t n = TEMP_FAILURE_RETRY (read (fd, buffer + current,
-+ limit - current));
-+ if (n == -1)
-+ {
-+ int e = errno;
-+ free (buffer);
- close (fd);
-- paranoia = 0;
-- return;
-+ errno = e;
-+ return NULL;
- }
--
-- readlen += n;
--
-- if (readlen < buflen)
-+ if (n == 0)
- break;
--
-- /* We might have to extend the buffer. */
-- size_t old_buflen = buflen;
-- char *newp = extend_alloca (buf, buflen, 2 * buflen);
-- buf = memmove (newp, buf, old_buflen);
-+ current += n;
- }
-
- close (fd);
-+ *size = current;
-+ return buffer;
-+}
-+
-+
-+/* Restart the process. */
-+static void
-+restart (void)
-+{
-+ /* First determine the parameters. We do not use the parameters
-+ passed to main() because then nscd would would use the system
-+ libc after restarting even if it was started by a non-system
-+ dynamic linker during glibc testing. */
-+ size_t readlen;
-+ char *cmdline = read_cmdline (&readlen);
-+ if (cmdline == NULL)
-+ {
-+ dbg_log (_("\
-+cannot open /proc/self/cmdline: %m; disabling paranoia mode"));
-+ paranoia = 0;
-+ return;
-+ }
-
- /* Parse the command line. Worst case scenario: every two
- characters form one parameter (one character plus NUL). */
- char **argv = alloca ((readlen / 2 + 1) * sizeof (argv[0]));
- int argc = 0;
-
-- char *cp = buf;
-- while (cp < buf + readlen)
-+ for (char *cp = cmdline; cp < cmdline + readlen;)
- {
- argv[argc++] = cp;
- cp = (char *) rawmemchr (cp, '\0') + 1;
-@@ -1427,6 +1446,7 @@ cannot change to old UID: %s; disabling
- strerror (errno));
-
- paranoia = 0;
-+ free (cmdline);
- return;
- }
-
-@@ -1438,6 +1458,7 @@ cannot change to old GID: %s; disabling
-
- ignore_value (setuid (server_uid));
- paranoia = 0;
-+ free (cmdline);
- return;
- }
- }
-@@ -1455,6 +1476,7 @@ cannot change to old working directory:
- ignore_value (setgid (server_gid));
- }
- paranoia = 0;
-+ free (cmdline);
- return;
- }
-
-@@ -1503,6 +1525,7 @@ cannot change to old working directory:
- dbg_log (_("cannot change current working directory to \"/\": %s"),
- strerror (errno));
- paranoia = 0;
-+ free (cmdline);
-
- /* Reenable the databases. */
- time_t now = time (NULL);
-Index: b/nscd/grpcache.c
-===================================================================
---- a/nscd/grpcache.c
-+++ b/nscd/grpcache.c
-@@ -16,7 +16,6 @@
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <assert.h>
- #include <errno.h>
- #include <error.h>
-@@ -32,6 +31,7 @@
- #include <sys/mman.h>
- #include <sys/socket.h>
- #include <stackinfo.h>
-+#include <scratch_buffer.h>
-
- #include "nscd.h"
- #include "dbg_log.h"
-@@ -448,12 +448,12 @@ addgrbyX (struct database_dyn *db, int f
- look again in the table whether the dataset is now available. We
- simply insert it. It does not matter if it is in there twice. The
- pruning function only will look at the timestamp. */
-- size_t buflen = 1024;
-- char *buffer = (char *) alloca (buflen);
-+
- struct group resultbuf;
- struct group *grp;
-- bool use_malloc = false;
- int errval = 0;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- if (__glibc_unlikely (debug_level > 0))
- {
-@@ -463,43 +463,24 @@ addgrbyX (struct database_dyn *db, int f
- dbg_log (_("Reloading \"%s\" in group cache!"), keystr);
- }
-
-- while (lookup (req->type, key, &resultbuf, buffer, buflen, &grp) != 0
-+ while (lookup (req->type, key, &resultbuf,
-+ tmpbuf.data, tmpbuf.length, &grp) != 0
- && (errval = errno) == ERANGE)
-- {
-- errno = 0;
--
-- if (__glibc_unlikely (buflen > 32768))
-- {
-- char *old_buffer = buffer;
-- buflen *= 2;
-- buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
-- if (buffer == NULL)
-- {
-- /* We ran out of memory. We cannot do anything but
-- sending a negative response. In reality this should
-- never happen. */
-- grp = NULL;
-- buffer = old_buffer;
--
-- /* We set the error to indicate this is (possibly) a
-- temporary error and that it does not mean the entry
-- is not available at all. */
-- errval = EAGAIN;
-- break;
-- }
-- use_malloc = true;
-- }
-- else
-- /* Allocate a new buffer on the stack. If possible combine it
-- with the previously allocated buffer. */
-- buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
-- }
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ {
-+ /* We ran out of memory. We cannot do anything but sending a
-+ negative response. In reality this should never
-+ happen. */
-+ grp = NULL;
-+ /* We set the error to indicate this is (possibly) a temporary
-+ error and that it does not mean the entry is not available
-+ at all. */
-+ errval = EAGAIN;
-+ break;
-+ }
-
- time_t timeout = cache_addgr (db, fd, req, keystr, grp, uid, he, dh, errval);
--
-- if (use_malloc)
-- free (buffer);
--
-+ scratch_buffer_free (&tmpbuf);
- return timeout;
- }
-
-Index: b/nscd/hstcache.c
-===================================================================
---- a/nscd/hstcache.c
-+++ b/nscd/hstcache.c
-@@ -34,6 +34,7 @@
- #include <arpa/nameser.h>
- #include <sys/mman.h>
- #include <stackinfo.h>
-+#include <scratch_buffer.h>
-
- #include "nscd.h"
- #include "dbg_log.h"
-@@ -463,11 +464,8 @@ addhstbyX (struct database_dyn *db, int
- look again in the table whether the dataset is now available. We
- simply insert it. It does not matter if it is in there twice. The
- pruning function only will look at the timestamp. */
-- int buflen = 1024;
-- char *buffer = (char *) alloca (buflen);
- struct hostent resultbuf;
- struct hostent *hst;
-- bool use_malloc = false;
- int errval = 0;
- int32_t ttl = INT32_MAX;
-
-@@ -487,46 +485,30 @@ addhstbyX (struct database_dyn *db, int
- dbg_log (_("Reloading \"%s\" in hosts cache!"), (char *) str);
- }
-
-- while (lookup (req->type, key, &resultbuf, buffer, buflen, &hst, &ttl) != 0
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-+
-+ while (lookup (req->type, key, &resultbuf,
-+ tmpbuf.data, tmpbuf.length, &hst, &ttl) != 0
- && h_errno == NETDB_INTERNAL
- && (errval = errno) == ERANGE)
-- {
-- errno = 0;
--
-- if (__glibc_unlikely (buflen > 32768))
-- {
-- char *old_buffer = buffer;
-- buflen *= 2;
-- buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
-- if (buffer == NULL)
-- {
-- /* We ran out of memory. We cannot do anything but
-- sending a negative response. In reality this should
-- never happen. */
-- hst = NULL;
-- buffer = old_buffer;
--
-- /* We set the error to indicate this is (possibly) a
-- temporary error and that it does not mean the entry
-- is not available at all. */
-- h_errno = TRY_AGAIN;
-- errval = EAGAIN;
-- break;
-- }
-- use_malloc = true;
-- }
-- else
-- /* Allocate a new buffer on the stack. If possible combine it
-- with the previously allocated buffer. */
-- buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
-- }
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ {
-+ /* We ran out of memory. We cannot do anything but sending a
-+ negative response. In reality this should never
-+ happen. */
-+ hst = NULL;
-+ /* We set the error to indicate this is (possibly) a temporary
-+ error and that it does not mean the entry is not
-+ available at all. */
-+ h_errno = TRY_AGAIN;
-+ errval = EAGAIN;
-+ break;
-+ }
-
- time_t timeout = cache_addhst (db, fd, req, key, hst, uid, he, dh,
- h_errno == TRY_AGAIN ? errval : 0, ttl);
--
-- if (use_malloc)
-- free (buffer);
--
-+ scratch_buffer_free (&tmpbuf);
- return timeout;
- }
-
-Index: b/nscd/pwdcache.c
-===================================================================
---- a/nscd/pwdcache.c
-+++ b/nscd/pwdcache.c
-@@ -16,7 +16,6 @@
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <assert.h>
- #include <errno.h>
- #include <error.h>
-@@ -32,6 +31,7 @@
- #include <sys/mman.h>
- #include <sys/socket.h>
- #include <stackinfo.h>
-+#include <scratch_buffer.h>
-
- #include "nscd.h"
- #include "dbg_log.h"
-@@ -426,12 +426,11 @@ addpwbyX (struct database_dyn *db, int f
- look again in the table whether the dataset is now available. We
- simply insert it. It does not matter if it is in there twice. The
- pruning function only will look at the timestamp. */
-- size_t buflen = 1024;
-- char *buffer = (char *) alloca (buflen);
- struct passwd resultbuf;
- struct passwd *pwd;
-- bool use_malloc = false;
- int errval = 0;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- if (__glibc_unlikely (debug_level > 0))
- {
-@@ -441,45 +440,26 @@ addpwbyX (struct database_dyn *db, int f
- dbg_log (_("Reloading \"%s\" in password cache!"), keystr);
- }
-
-- while (lookup (req->type, key, &resultbuf, buffer, buflen, &pwd) != 0
-+ while (lookup (req->type, key, &resultbuf,
-+ tmpbuf.data, tmpbuf.length, &pwd) != 0
- && (errval = errno) == ERANGE)
-- {
-- errno = 0;
--
-- if (__glibc_unlikely (buflen > 32768))
-- {
-- char *old_buffer = buffer;
-- buflen *= 2;
-- buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
-- if (buffer == NULL)
-- {
-- /* We ran out of memory. We cannot do anything but
-- sending a negative response. In reality this should
-- never happen. */
-- pwd = NULL;
-- buffer = old_buffer;
--
-- /* We set the error to indicate this is (possibly) a
-- temporary error and that it does not mean the entry
-- is not available at all. */
-- errval = EAGAIN;
-- break;
-- }
-- use_malloc = true;
-- }
-- else
-- /* Allocate a new buffer on the stack. If possible combine it
-- with the previously allocated buffer. */
-- buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
-- }
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ {
-+ /* We ran out of memory. We cannot do anything but sending a
-+ negative response. In reality this should never
-+ happen. */
-+ pwd = NULL;
-+ /* We set the error to indicate this is (possibly) a temporary
-+ error and that it does not mean the entry is not available
-+ at all. */
-+ errval = EAGAIN;
-+ break;
-+ }
-
- /* Add the entry to the cache. */
- time_t timeout = cache_addpw (db, fd, req, keystr, pwd, c_uid, he, dh,
- errval);
--
-- if (use_malloc)
-- free (buffer);
--
-+ scratch_buffer_free (&tmpbuf);
- return timeout;
- }
-
-Index: b/nscd/servicescache.c
-===================================================================
---- a/nscd/servicescache.c
-+++ b/nscd/servicescache.c
-@@ -16,7 +16,6 @@
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <assert.h>
- #include <errno.h>
- #include <libintl.h>
-@@ -25,6 +24,7 @@
- #include <stdint.h>
- #include <sys/mman.h>
- #include <kernel-features.h>
-+#include <scratch_buffer.h>
-
- #include "nscd.h"
- #include "dbg_log.h"
-@@ -374,12 +374,11 @@ addservbyX (struct database_dyn *db, int
- look again in the table whether the dataset is now available. We
- simply insert it. It does not matter if it is in there twice. The
- pruning function only will look at the timestamp. */
-- size_t buflen = 1024;
-- char *buffer = (char *) alloca (buflen);
- struct servent resultbuf;
- struct servent *serv;
-- bool use_malloc = false;
- int errval = 0;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- if (__glibc_unlikely (debug_level > 0))
- {
-@@ -389,43 +388,24 @@ addservbyX (struct database_dyn *db, int
- dbg_log (_("Reloading \"%s\" in services cache!"), key);
- }
-
-- while (lookup (req->type, key, &resultbuf, buffer, buflen, &serv) != 0
-+ while (lookup (req->type, key, &resultbuf,
-+ tmpbuf.data, tmpbuf.length, &serv) != 0
- && (errval = errno) == ERANGE)
-- {
-- errno = 0;
--
-- if (__glibc_unlikely (buflen > 32768))
-- {
-- char *old_buffer = buffer;
-- buflen *= 2;
-- buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen);
-- if (buffer == NULL)
-- {
-- /* We ran out of memory. We cannot do anything but
-- sending a negative response. In reality this should
-- never happen. */
-- serv = NULL;
-- buffer = old_buffer;
--
-- /* We set the error to indicate this is (possibly) a
-- temporary error and that it does not mean the entry
-- is not available at all. */
-- errval = EAGAIN;
-- break;
-- }
-- use_malloc = true;
-- }
-- else
-- /* Allocate a new buffer on the stack. If possible combine it
-- with the previously allocated buffer. */
-- buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
-- }
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ {
-+ /* We ran out of memory. We cannot do anything but sending a
-+ negative response. In reality this should never
-+ happen. */
-+ serv = NULL;
-+ /* We set the error to indicate this is (possibly) a temporary
-+ error and that it does not mean the entry is not available
-+ at all. */
-+ errval = EAGAIN;
-+ break;
-+ }
-
- time_t timeout = cache_addserv (db, fd, req, key, serv, uid, he, dh, errval);
--
-- if (use_malloc)
-- free (buffer);
--
-+ scratch_buffer_free (&tmpbuf);
- return timeout;
- }
-
-Index: b/nss/getent.c
-===================================================================
---- a/nss/getent.c
-+++ b/nss/getent.c
-@@ -39,6 +39,7 @@
- #include <netinet/ether.h>
- #include <netinet/in.h>
- #include <sys/socket.h>
-+#include <scratch_buffer.h>
-
- /* Get libc version number. */
- #include <version.h>
-@@ -477,30 +478,34 @@ netgroup_keys (int number, char *key[])
- static int
- initgroups_keys (int number, char *key[])
- {
-- int ngrps = 100;
-- size_t grpslen = ngrps * sizeof (gid_t);
-- gid_t *grps = alloca (grpslen);
--
- if (number == 0)
- {
- fprintf (stderr, _("Enumeration not supported on %s\n"), "initgroups");
- return 3;
- }
-
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-+
- for (int i = 0; i < number; ++i)
- {
-+ ssize_t ngrps = tmpbuf.length / sizeof (gid_t);
- int no = ngrps;
- int n;
-- while ((n = getgrouplist (key[i], -1, grps, &no)) == -1
-+ while ((n = getgrouplist (key[i], -1, tmpbuf.data, &no)) == -1
- && no > ngrps)
- {
-- grps = extend_alloca (grps, grpslen, no * sizeof (gid_t));
-- ngrps = no;
-+ if (!scratch_buffer_set_array_size (&tmpbuf, no, sizeof (gid_t)))
-+ {
-+ fprintf (stderr, _("Could not allocate group list: %m\n"));
-+ return 3;
-+ }
- }
-
- if (n == -1)
- return 1;
-
-+ const gid_t *grps = tmpbuf.data;
- printf ("%-21s", key[i]);
- for (int j = 0; j < n; ++j)
- if (grps[j] != -1)
-@@ -508,6 +513,8 @@ initgroups_keys (int number, char *key[]
- putchar_unlocked ('\n');
- }
-
-+ scratch_buffer_free (&tmpbuf);
-+
- return 0;
- }
-
-Index: b/nss/nss_files/files-hosts.c
-===================================================================
---- a/nss/nss_files/files-hosts.c
-+++ b/nss/nss_files/files-hosts.c
-@@ -22,7 +22,7 @@
- #include <arpa/nameser.h>
- #include <netdb.h>
- #include <resolv.h>
--
-+#include <scratch_buffer.h>
-
- /* Get implementation for some internal functions. */
- #include "../resolv/mapv4v6addr.h"
-@@ -145,15 +145,12 @@ _nss_files_gethostbyname3_r (const char
- && _res_hconf.flags & HCONF_FLAG_MULTI)
- {
- /* We have to get all host entries from the file. */
-- size_t tmp_buflen = MIN (buflen, 4096);
-- char tmp_buffer_stack[tmp_buflen]
-- __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));
-- char *tmp_buffer = tmp_buffer_stack;
- struct hostent tmp_result_buf;
- int naddrs = 1;
- int naliases = 0;
- char *bufferend;
-- bool tmp_buffer_malloced = false;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- while (result->h_aliases[naliases] != NULL)
- ++naliases;
-@@ -161,9 +158,9 @@ _nss_files_gethostbyname3_r (const char
- bufferend = (char *) &result->h_aliases[naliases + 1];
-
- again:
-- while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer,
-- tmp_buflen, errnop, herrnop, af,
-- flags))
-+ while ((status = internal_getent (stream, &tmp_result_buf,
-+ tmpbuf.data, tmpbuf.length,
-+ errnop, herrnop, af, flags))
- == NSS_STATUS_SUCCESS)
- {
- int matches = 1;
-@@ -287,54 +284,13 @@ _nss_files_gethostbyname3_r (const char
- }
- }
-
-- if (status == NSS_STATUS_TRYAGAIN)
-- {
-- size_t newsize = 2 * tmp_buflen;
-- if (tmp_buffer_malloced)
-- {
-- char *newp = realloc (tmp_buffer, newsize);
-- if (newp != NULL)
-- {
-- assert ((((uintptr_t) newp)
-- & (__alignof__ (struct hostent_data) - 1))
-- == 0);
-- tmp_buffer = newp;
-- tmp_buflen = newsize;
-- goto again;
-- }
-- }
-- else if (!__libc_use_alloca (buflen + newsize))
-- {
-- tmp_buffer = malloc (newsize);
-- if (tmp_buffer != NULL)
-- {
-- assert ((((uintptr_t) tmp_buffer)
-- & (__alignof__ (struct hostent_data) - 1))
-- == 0);
-- tmp_buffer_malloced = true;
-- tmp_buflen = newsize;
-- goto again;
-- }
-- }
-- else
-- {
-- tmp_buffer
-- = extend_alloca (tmp_buffer, tmp_buflen,
-- newsize
-- + __alignof__ (struct hostent_data));
-- tmp_buffer = (char *) (((uintptr_t) tmp_buffer
-- + __alignof__ (struct hostent_data)
-- - 1)
-- & ~(__alignof__ (struct hostent_data)
-- - 1));
-- goto again;
-- }
-- }
-+ if (status == NSS_STATUS_TRYAGAIN
-+ && scratch_buffer_grow (&tmpbuf))
-+ goto again;
- else
- status = NSS_STATUS_SUCCESS;
- out:
-- if (tmp_buffer_malloced)
-- free (tmp_buffer);
-+ scratch_buffer_free (&tmpbuf);
- }
-
- internal_endent (&stream);
-Index: b/nss/nss_files/files-initgroups.c
-===================================================================
---- a/nss/nss_files/files-initgroups.c
-+++ b/nss/nss_files/files-initgroups.c
-@@ -16,7 +16,6 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <errno.h>
- #include <grp.h>
- #include <nss.h>
-@@ -25,6 +24,7 @@
- #include <sys/param.h>
- #include <stdbool.h>
- #include <stdlib.h>
-+#include <scratch_buffer.h>
-
- enum nss_status
- _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
-@@ -46,9 +46,8 @@ _nss_files_initgroups_dyn (const char *u
- enum nss_status status = NSS_STATUS_SUCCESS;
- bool any = false;
-
-- size_t buflen = 1024;
-- void *buffer = alloca (buflen);
-- bool buffer_use_malloc = false;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- gid_t *groups = *groupsp;
-
-@@ -67,26 +66,16 @@ _nss_files_initgroups_dyn (const char *u
- }
-
- struct group grp;
-- int res = _nss_files_parse_grent (line, &grp, buffer, buflen, errnop);
-+ int res = _nss_files_parse_grent (line, &grp,
-+ tmpbuf.data, tmpbuf.length, errnop);
- if (res == -1)
- {
-- size_t newbuflen = 2 * buflen;
-- if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen))
-+ if (!scratch_buffer_grow (&tmpbuf))
- {
-- void *newbuf = realloc (buffer_use_malloc ? buffer : NULL,
-- newbuflen);
-- if (newbuf == NULL)
-- {
-- *errnop = ENOMEM;
-- status = NSS_STATUS_TRYAGAIN;
-- goto out;
-- }
-- buffer = newbuf;
-- buflen = newbuflen;
-- buffer_use_malloc = true;
-+ *errnop = ENOMEM;
-+ status = NSS_STATUS_TRYAGAIN;
-+ goto out;
- }
-- else
-- buffer = extend_alloca (buffer, buflen, newbuflen);
- /* Reread current line, the parser has clobbered it. */
- fsetpos (stream, &pos);
- continue;
-@@ -132,8 +121,7 @@ _nss_files_initgroups_dyn (const char *u
-
- out:
- /* Free memory. */
-- if (buffer_use_malloc)
-- free (buffer);
-+ scratch_buffer_free (&tmpbuf);
- free (line);
-
- fclose (stream);
-Index: b/posix/glob.c
-===================================================================
---- a/posix/glob.c
-+++ b/posix/glob.c
-@@ -27,6 +27,7 @@
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdint.h>
-+#include <scratch_buffer.h>
-
- /* Outcomment the following line for production quality code. */
- /* #define NDEBUG 1 */
-@@ -293,7 +294,7 @@ glob (const char *pattern, int flags, in
- glob_t dirs;
- int retval = 0;
- #ifdef _LIBC
-- size_t alloca_used = 0;
-+ size_t alloca_used = sizeof (struct scratch_buffer);
- #endif
-
- if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
-@@ -650,33 +651,13 @@ glob (const char *pattern, int flags, in
- {
- struct passwd *p;
- # if defined HAVE_GETPWNAM_R || defined _LIBC
-- long int pwbuflen = GETPW_R_SIZE_MAX ();
-- char *pwtmpbuf;
- struct passwd pwbuf;
-- int malloc_pwtmpbuf = 0;
- int save = errno;
-+ struct scratch_buffer pwtmpbuf;
-+ scratch_buffer_init (&pwtmpbuf);
-
--# ifndef _LIBC
-- if (pwbuflen == -1)
-- /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
-- Try a moderate value. */
-- pwbuflen = 1024;
--# endif
-- if (__libc_use_alloca (alloca_used + pwbuflen))
-- pwtmpbuf = alloca_account (pwbuflen, alloca_used);
-- else
-- {
-- pwtmpbuf = malloc (pwbuflen);
-- if (pwtmpbuf == NULL)
-- {
-- retval = GLOB_NOSPACE;
-- goto out;
-- }
-- malloc_pwtmpbuf = 1;
-- }
--
-- while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
-- != 0)
-+ while (getpwnam_r (name, &pwbuf,
-+ pwtmpbuf.data, pwtmpbuf.length, &p) != 0)
- {
- if (errno != ERANGE)
- {
-@@ -684,67 +665,37 @@ glob (const char *pattern, int flags, in
- break;
- }
-
-- if (!malloc_pwtmpbuf
-- && __libc_use_alloca (alloca_used
-- + 2 * pwbuflen))
-- pwtmpbuf = extend_alloca_account (pwtmpbuf, pwbuflen,
-- 2 * pwbuflen,
-- alloca_used);
-- else
-+ if (!scratch_buffer_grow (&pwtmpbuf))
- {
-- char *newp = realloc (malloc_pwtmpbuf
-- ? pwtmpbuf : NULL,
-- 2 * pwbuflen);
-- if (newp == NULL)
-- {
-- if (__glibc_unlikely (malloc_pwtmpbuf))
-- free (pwtmpbuf);
-- retval = GLOB_NOSPACE;
-- goto out;
-- }
-- pwtmpbuf = newp;
-- pwbuflen = 2 * pwbuflen;
-- malloc_pwtmpbuf = 1;
-+ retval = GLOB_NOSPACE;
-+ goto out;
- }
- __set_errno (save);
- }
- # else
-- p = getpwnam (name);
-+ p = getpwnam (namebuf.data);
- # endif
- if (p != NULL)
- {
-- if (!malloc_pwtmpbuf)
-- home_dir = p->pw_dir;
-- else
-+ home_dir = strdup (p->pw_dir);
-+ malloc_home_dir = 1;
-+ if (home_dir == NULL)
- {
-- size_t home_dir_len = strlen (p->pw_dir) + 1;
-- if (__libc_use_alloca (alloca_used + home_dir_len))
-- home_dir = alloca_account (home_dir_len,
-- alloca_used);
-- else
-- {
-- home_dir = malloc (home_dir_len);
-- if (home_dir == NULL)
-- {
-- free (pwtmpbuf);
-- retval = GLOB_NOSPACE;
-- goto out;
-- }
-- malloc_home_dir = 1;
-- }
-- memcpy (home_dir, p->pw_dir, home_dir_len);
--
-- free (pwtmpbuf);
-+ scratch_buffer_free (&pwtmpbuf);
-+ retval = GLOB_NOSPACE;
-+ goto out;
- }
- }
-+ scratch_buffer_free (&pwtmpbuf);
- }
- }
- if (home_dir == NULL || home_dir[0] == '\0')
- {
-+ if (malloc_home_dir)
-+ free (home_dir);
-+ malloc_home_dir = 0;
- if (flags & GLOB_TILDE_CHECK)
- {
-- if (__glibc_unlikely (malloc_home_dir))
-- free (home_dir);
- retval = GLOB_NOMATCH;
- goto out;
- }
-@@ -865,57 +816,24 @@ glob (const char *pattern, int flags, in
- {
- struct passwd *p;
- # if defined HAVE_GETPWNAM_R || defined _LIBC
-- long int buflen = GETPW_R_SIZE_MAX ();
-- char *pwtmpbuf;
-- int malloc_pwtmpbuf = 0;
- struct passwd pwbuf;
- int save = errno;
-+ struct scratch_buffer pwtmpbuf;
-+ scratch_buffer_init (&pwtmpbuf);
-
--# ifndef _LIBC
-- if (buflen == -1)
-- /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a
-- moderate value. */
-- buflen = 1024;
--# endif
-- if (__libc_use_alloca (alloca_used + buflen))
-- pwtmpbuf = alloca_account (buflen, alloca_used);
-- else
-- {
-- pwtmpbuf = malloc (buflen);
-- if (pwtmpbuf == NULL)
-- {
-- nomem_getpw:
-- if (__glibc_unlikely (malloc_user_name))
-- free (user_name);
-- retval = GLOB_NOSPACE;
-- goto out;
-- }
-- malloc_pwtmpbuf = 1;
-- }
--
-- while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0)
-+ while (getpwnam_r (user_name, &pwbuf,
-+ pwtmpbuf.data, pwtmpbuf.length, &p) != 0)
- {
- if (errno != ERANGE)
- {
- p = NULL;
- break;
- }
-- if (!malloc_pwtmpbuf
-- && __libc_use_alloca (alloca_used + 2 * buflen))
-- pwtmpbuf = extend_alloca_account (pwtmpbuf, buflen,
-- 2 * buflen, alloca_used);
-- else
-+
-+ if (!scratch_buffer_grow (&pwtmpbuf))
- {
-- char *newp = realloc (malloc_pwtmpbuf ? pwtmpbuf : NULL,
-- 2 * buflen);
-- if (newp == NULL)
-- {
-- if (__glibc_unlikely (malloc_pwtmpbuf))
-- free (pwtmpbuf);
-- goto nomem_getpw;
-- }
-- pwtmpbuf = newp;
-- malloc_pwtmpbuf = 1;
-+ retval = GLOB_NOSPACE;
-+ goto out;
- }
- __set_errno (save);
- }
-@@ -944,8 +862,7 @@ glob (const char *pattern, int flags, in
- dirname = malloc (home_len + rest_len + 1);
- if (dirname == NULL)
- {
-- if (__glibc_unlikely (malloc_pwtmpbuf))
-- free (pwtmpbuf);
-+ scratch_buffer_free (&pwtmpbuf);
- retval = GLOB_NOSPACE;
- goto out;
- }
-@@ -957,13 +874,11 @@ glob (const char *pattern, int flags, in
- dirlen = home_len + rest_len;
- dirname_modified = 1;
-
-- if (__glibc_unlikely (malloc_pwtmpbuf))
-- free (pwtmpbuf);
-+ scratch_buffer_free (&pwtmpbuf);
- }
- else
- {
-- if (__glibc_unlikely (malloc_pwtmpbuf))
-- free (pwtmpbuf);
-+ scratch_buffer_free (&pwtmpbuf);
-
- if (flags & GLOB_TILDE_CHECK)
- /* We have to regard it as an error if we cannot find the
-Index: b/posix/wordexp.c
-===================================================================
---- a/posix/wordexp.c
-+++ b/posix/wordexp.c
-@@ -17,7 +17,6 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
--#include <alloca.h>
- #include <ctype.h>
- #include <errno.h>
- #include <fcntl.h>
-@@ -41,6 +40,7 @@
- #include <wchar.h>
- #include <wordexp.h>
- #include <kernel-features.h>
-+#include <scratch_buffer.h>
-
- #include <libc-lock.h>
- #include <_itoa.h>
-@@ -308,12 +308,7 @@ parse_tilde (char **word, size_t *word_l
- if (i == 1 + *offset)
- {
- /* Tilde appears on its own */
-- uid_t uid;
-- struct passwd pwd, *tpwd;
-- int buflen = 1000;
- char* home;
-- char* buffer;
-- int result;
-
- /* POSIX.2 says ~ expands to $HOME and if HOME is unset the
- results are unspecified. We do a lookup on the uid if
-@@ -328,25 +323,38 @@ parse_tilde (char **word, size_t *word_l
- }
- else
- {
-- uid = __getuid ();
-- buffer = __alloca (buflen);
--
-- while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
-+ struct passwd pwd, *tpwd;
-+ uid_t uid = __getuid ();
-+ int result;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-+
-+ while ((result = __getpwuid_r (uid, &pwd,
-+ tmpbuf.data, tmpbuf.length,
-+ &tpwd)) != 0
- && errno == ERANGE)
-- buffer = extend_alloca (buffer, buflen, buflen + 1000);
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ return WRDE_NOSPACE;
-
- if (result == 0 && tpwd != NULL && pwd.pw_dir != NULL)
- {
- *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
- if (*word == NULL)
-- return WRDE_NOSPACE;
-+ {
-+ scratch_buffer_free (&tmpbuf);
-+ return WRDE_NOSPACE;
-+ }
- }
- else
- {
- *word = w_addchar (*word, word_length, max_length, '~');
- if (*word == NULL)
-- return WRDE_NOSPACE;
-+ {
-+ scratch_buffer_free (&tmpbuf);
-+ return WRDE_NOSPACE;
-+ }
- }
-+ scratch_buffer_free (&tmpbuf);
- }
- }
- else
-@@ -354,13 +362,15 @@ parse_tilde (char **word, size_t *word_l
- /* Look up user name in database to get home directory */
- char *user = strndupa (&words[1 + *offset], i - (1 + *offset));
- struct passwd pwd, *tpwd;
-- int buflen = 1000;
-- char* buffer = __alloca (buflen);
- int result;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
-- while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0
-+ while ((result = __getpwnam_r (user, &pwd, tmpbuf.data, tmpbuf.length,
-+ &tpwd)) != 0
- && errno == ERANGE)
-- buffer = extend_alloca (buffer, buflen, buflen + 1000);
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ return WRDE_NOSPACE;
-
- if (result == 0 && tpwd != NULL && pwd.pw_dir)
- *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
-@@ -372,6 +382,8 @@ parse_tilde (char **word, size_t *word_l
- *word = w_addstr (*word, word_length, max_length, user);
- }
-
-+ scratch_buffer_free (&tmpbuf);
-+
- *offset = i - 1;
- }
- return *word ? 0 : WRDE_NOSPACE;
-Index: b/sysdeps/unix/sysv/linux/gethostid.c
-===================================================================
---- a/sysdeps/unix/sysv/linux/gethostid.c
-+++ b/sysdeps/unix/sysv/linux/gethostid.c
-@@ -63,13 +63,12 @@ sethostid (long int id)
- # include <sys/param.h>
- # include <resolv/netdb.h>
- # include <netinet/in.h>
-+# include <scratch_buffer.h>
-
- long int
- gethostid (void)
- {
- char hostname[MAXHOSTNAMELEN + 1];
-- size_t buflen;
-- char *buffer;
- struct hostent hostbuf, *hp;
- int32_t id;
- struct in_addr in;
-@@ -94,23 +93,26 @@ gethostid (void)
- /* This also fails. Return and arbitrary value. */
- return 0;
-
-- buflen = 1024;
-- buffer = __alloca (buflen);
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
- /* To get the IP address we need to know the host name. */
-- while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr)
-- != 0
-+ while (__gethostbyname_r (hostname, &hostbuf,
-+ tmpbuf.data, tmpbuf.length, &hp, &herr) != 0
- || hp == NULL)
- if (herr != NETDB_INTERNAL || errno != ERANGE)
-- return 0;
-+ {
-+ scratch_buffer_free (&tmpbuf);
-+ return 0;
-+ }
- else
-- /* Enlarge buffer. */
-- buffer = extend_alloca (buffer, buflen, 2 * buflen);
-+ if (!scratch_buffer_grow (&tmpbuf))
-+ return 0;
-
- in.s_addr = 0;
- memcpy (&in, hp->h_addr,
- (int) sizeof (in) < hp->h_length ? (int) sizeof (in) : hp->h_length);
--
-+ scratch_buffer_free (&tmpbuf);
- /* For the return value to be not exactly the IP address we do some
- bit fiddling. */
- return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
-Index: b/sysdeps/unix/sysv/linux/getlogin_r.c
-===================================================================
---- a/sysdeps/unix/sysv/linux/getlogin_r.c
-+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
-@@ -18,6 +18,7 @@
- #include <pwd.h>
- #include <unistd.h>
- #include <not-cancel.h>
-+#include <scratch_buffer.h>
-
- #define STATIC static
- static int getlogin_r_fd0 (char *name, size_t namesize);
-@@ -54,28 +55,19 @@ __getlogin_r_loginuid (char *name, size_
- endp == uidbuf || *endp != '\0'))
- return -1;
-
-- size_t buflen = 1024;
-- char *buf = alloca (buflen);
-- bool use_malloc = false;
- struct passwd pwd;
- struct passwd *tpwd;
- int result = 0;
- int res;
-+ struct scratch_buffer tmpbuf;
-+ scratch_buffer_init (&tmpbuf);
-
-- while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) == ERANGE)
-- if (__libc_use_alloca (2 * buflen))
-- buf = extend_alloca (buf, buflen, 2 * buflen);
-- else
-+ while ((res = __getpwuid_r (uid, &pwd,
-+ tmpbuf.data, tmpbuf.length, &tpwd)) == ERANGE)
-+ if (!scratch_buffer_grow (&tmpbuf))
- {
-- buflen *= 2;
-- char *newp = realloc (use_malloc ? buf : NULL, buflen);
-- if (newp == NULL)
-- {
-- result = ENOMEM;
-- goto out;
-- }
-- buf = newp;
-- use_malloc = true;
-+ result = ENOMEM;
-+ goto out;
- }
-
- if (res != 0 || tpwd == NULL)
-@@ -95,9 +87,7 @@ __getlogin_r_loginuid (char *name, size_
- memcpy (name, pwd.pw_name, needed);
-
- out:
-- if (use_malloc)
-- free (buf);
--
-+ scratch_buffer_free (&tmpbuf);
- return result;
- }
-
diff --git a/glibc-rh1324623.patch b/glibc-rh1324623.patch
deleted file mode 100644
index ffa449e..0000000
--- a/glibc-rh1324623.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-This patch creates a crypt-glibc subdirectory which builds the
-libgcrypt files, but this time against the glibc sources.
-
-The default subdirs list does not include this subdirectory because
-the file names conflict with the crypt directory. The spec file does
-not use the install target to install the built libcrypt.so file,
-either.
-
-Index: b/crypt-glibc/Makefile
-===================================================================
---- /dev/null
-+++ b/crypt-glibc/Makefile
-@@ -0,0 +1,60 @@
-+# Build libcrypt against internal cryptographic algorithms.
-+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
-+# This file is part of the GNU C Library.
-+
-+# The GNU C Library is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU Lesser General Public
-+# License as published by the Free Software Foundation; either
-+# version 2.1 of the License, or (at your option) any later version.
-+
-+# The GNU C Library is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# Lesser General Public License for more details.
-+
-+# You should have received a copy of the GNU Lesser General Public
-+# License along with the GNU C Library; if not, see
-+# <http://www.gnu.org/licenses/>.
-+
-+#
-+# Sub-makefile for crypt() portion of the library.
-+#
-+subdir := crypt-glibc
-+
-+include ../Makeconfig
-+
-+extra-libs := libcrypt
-+extra-libs-others := $(extra-libs)
-+
-+# Use the sources in the crypt subdirectory.
-+vpath %.c ../crypt
-+
-+libcrypt-routines := \
-+ crypt-entry md5-crypt sha256-crypt sha512-crypt crypt crypt_util
-+
-+tests := cert md5c-test sha256c-test sha512c-test badsalttest
-+
-+libcrypt-routines += md5 sha256 sha512
-+
-+tests += md5test sha256test sha512test
-+
-+# The test md5test-giant uses up to 400 MB of RSS and runs on a fast
-+# machine over a minute.
-+xtests = md5test-giant
-+
-+include ../Rules
-+
-+md5-routines := md5 $(filter md5%,$(libcrypt-sysdep_routines))
-+sha256-routines := sha256 $(filter sha256%,$(libcrypt-sysdep_routines))
-+sha512-routines := sha512 $(filter sha512%,$(libcrypt-sysdep_routines))
-+
-+$(objpfx)md5test: $(patsubst %, $(objpfx)%.o,$(md5-routines))
-+$(objpfx)md5test-giant: $(patsubst %, $(objpfx)%.o,$(md5-routines))
-+$(objpfx)sha256test: $(patsubst %, $(objpfx)%.o,$(sha256-routines))
-+$(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
-+
-+ifeq (yes,$(build-shared))
-+$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
-+else
-+$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
-+endif
-Index: b/crypt/md5.c
-===================================================================
---- a/crypt/md5.c
-+++ b/crypt/md5.c
-@@ -270,4 +270,4 @@ md5_process_bytes (const void *buffer, s
- }
- }
-
--#include <md5-block.c>
-+#include "md5-block.c"
-Index: b/crypt/sha256.c
-===================================================================
---- a/crypt/sha256.c
-+++ b/crypt/sha256.c
-@@ -212,4 +212,4 @@ __sha256_process_bytes (const void *buff
- }
- }
-
--#include <sha256-block.c>
-+#include "sha256-block.c"
-Index: b/crypt/sha512.c
-===================================================================
---- a/crypt/sha512.c
-+++ b/crypt/sha512.c
-@@ -235,4 +235,4 @@ __sha512_process_bytes (const void *buff
- }
- }
-
--#include <sha512-block.c>
-+#include "sha512-block.c"
-Index: b/crypt-glibc/Versions
-===================================================================
---- /dev/null
-+++ b/crypt-glibc/Versions
-@@ -0,0 +1,5 @@
-+libcrypt {
-+ GLIBC_2.0 {
-+ crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
-+ }
-+}
diff --git a/glibc-rh1335011.patch b/glibc-rh1335011.patch
deleted file mode 100644
index 8738f9a..0000000
--- a/glibc-rh1335011.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-Revert these two upstream commits, to unbreak ASAN:
-
-commit e91bd7465816f474617dcb4bbfe72f3594c5783c
-Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
-Date: Thu Mar 31 10:51:51 2016 -0300
-
- Fix tst-dlsym-error build
-
- This patch fixes the new test tst-dlsym-error build on aarch64
- (and possible other architectures as well) due missing strchrnul
- definition.
-
- * elf/tst-dlsym-error.c: Include <string.h> for strchrnul.
-
-commit 7d45c163d00c88d5875a112343c4ea3e61349e6b
-Author: Florian Weimer <fweimer@redhat.com>
-Date: Thu Mar 31 11:26:55 2016 +0200
-
- Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]
-
- * elf/dl-lookup.c (_dl_lookup_symbol_x): Report error even if
- skip_map != NULL.
- * elf/tst-dlsym-error.c: New file.
- * elf/Makefile (tests): Add tst-dlsym-error.
- (tst-dlsym-error): Link against libdl.
-
-Index: b/elf/Makefile
-===================================================================
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -149,7 +149,7 @@ tests += loadtest restest1 preloadtest l
- tst-nodelete) \
- tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
- tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
-- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error
-+ tst-nodelete2 tst-audit11 tst-audit12
- # reldep9
- ifeq ($(build-hardcoded-path-in-tests),yes)
- tests += tst-dlopen-aout
-@@ -1258,5 +1258,3 @@ $(objpfx)tst-prelink-cmp.out: tst-prelin
- $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
- $(SHELL) $< '$(common-objpfx)' '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
- $(evaluate-test)
--
--$(objpfx)tst-dlsym-error: $(libdl)
-Index: b/elf/dl-lookup.c
-===================================================================
---- a/elf/dl-lookup.c
-+++ b/elf/dl-lookup.c
-@@ -858,6 +858,7 @@ _dl_lookup_symbol_x (const char *undef_n
- if (__glibc_unlikely (current_value.s == NULL))
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
-+ && skip_map == NULL
- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
- {
- /* We could find no value for a strong reference. */
-Index: b/elf/tst-dlsym-error.c
-===================================================================
---- a/elf/tst-dlsym-error.c
-+++ /dev/null
-@@ -1,114 +0,0 @@
--/* Test error reporting for dlsym, dlvsym failures.
-- Copyright (C) 2016 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
--
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <http://www.gnu.org/licenses/>. */
--
--#include <dlfcn.h>
--#include <gnu/lib-names.h>
--#include <stdio.h>
--#include <stdlib.h>
--#include <string.h>
--
--/* Used to disambiguate symbol names. */
--static int counter;
--
--static void
--test_one (void *handle, const char *name, void *(func) (void *, const char *),
-- const char *suffix)
--{
-- ++counter;
-- char symbol[32];
-- snprintf (symbol, sizeof (symbol), "no_such_symbol_%d", counter);
-- char *expected_message;
-- if (asprintf (&expected_message, ": undefined symbol: %s%s",
-- symbol, suffix) < 0)
-- {
-- printf ("error: asprintf: %m\n");
-- abort ();
-- }
--
-- void *addr = func (handle, symbol);
-- if (addr != NULL)
-- {
-- printf ("error: %s: found symbol \"no_such_symbol\"\n", name);
-- abort ();
-- }
-- const char *message = dlerror ();
-- if (message == NULL)
-- {
-- printf ("error: %s: missing error message\n", name);
-- abort ();
-- }
-- const char *message_without_path = strchrnul (message, ':');
-- if (strcmp (message_without_path, expected_message) != 0)
-- {
-- printf ("error: %s: unexpected error message: %s\n", name, message);
-- abort ();
-- }
-- free (expected_message);
--
-- message = dlerror ();
-- if (message != NULL)
-- {
-- printf ("error: %s: unexpected error message: %s\n", name, message);
-- abort ();
-- }
--}
--
--static void
--test_handles (const char *name, void *(func) (void *, const char *),
-- const char *suffix)
--{
-- test_one (RTLD_DEFAULT, name, func, suffix);
-- test_one (RTLD_NEXT, name, func, suffix);
--
-- void *handle = dlopen (LIBC_SO, RTLD_LAZY);
-- if (handle == NULL)
-- {
-- printf ("error: cannot dlopen %s: %s\n", LIBC_SO, dlerror ());
-- abort ();
-- }
-- test_one (handle, name, func, suffix);
-- dlclose (handle);
--}
--
--static void *
--dlvsym_no_such_version (void *handle, const char *name)
--{
-- return dlvsym (handle, name, "NO_SUCH_VERSION");
--}
--
--static void *
--dlvsym_glibc_private (void *handle, const char *name)
--{
-- return dlvsym (handle, name, "GLIBC_PRIVATE");
--}
--
--static int
--do_test (void)
--{
-- test_handles ("dlsym", dlsym, "");
-- test_handles ("dlvsym", dlvsym_no_such_version,
-- ", version NO_SUCH_VERSION");
-- test_handles ("dlvsym", dlvsym_glibc_private,
-- ", version GLIBC_PRIVATE");
--
-- return 0;
--}
--
--
--#define TEST_FUNCTION do_test ()
--#include "../test-skeleton.c"
diff --git a/glibc-rh697421.patch b/glibc-rh697421.patch
deleted file mode 100644
index 809c070..0000000
--- a/glibc-rh697421.patch
+++ /dev/null
@@ -1,10 +0,0 @@
-diff -up glibc-2.34/iconvdata/gconv-modules.19~ glibc-2.34/iconvdata/gconv-modules
---- glibc-2.34/iconvdata/gconv-modules.19~ 2021-08-02 10:31:26.283941191 +0200
-+++ glibc-2.34/iconvdata/gconv-modules 2021-08-02 10:32:27.975334292 +0200
-@@ -113,3 +113,6 @@ module INTERNAL UTF-32BE// UTF-32 1
- alias UTF7// UTF-7//
- module UTF-7// INTERNAL UTF-7 1
- module INTERNAL UTF-7// UTF-7 1
-+
-+alias ISO-10646-UCS-2// UNICODE//
-+alias ISO-10646-UCS-2// ISO-10646/UTF8/
diff --git a/glibc-rh825061.patch b/glibc-rh825061.patch
deleted file mode 100644
index 54fae8b..0000000
--- a/glibc-rh825061.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -rup a/manual/Makefile b/manual/Makefile
---- a/manual/Makefile 2012-05-20 19:47:38.000000000 -0600
-+++ b/manual/Makefile 2012-05-29 22:23:33.920428631 -0600
-@@ -129,7 +129,8 @@ $(objpfx)%.c.texi: examples/%.c
- mv -f $@.new $@
-
- $(objpfx)%.info: %.texinfo
-- LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
-+ LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=`basename $@` $<
-+ mv `basename $@`* $(objpfx)
-
- $(objpfx)%.dvi: %.texinfo
- cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(<D) && pwd) --output=$@ \
diff --git a/glibc-rh827510.patch b/glibc-rh827510.patch
index 7fd3e99..6115891 100644
--- a/glibc-rh827510.patch
+++ b/glibc-rh827510.patch
@@ -1,5 +1,15 @@
-2012-06-14 Jeff Law <law@redhat.com>
+Short description: Fix newlocale error return.
+Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
+Origin: PATCH
+Bug-RHEL: #832516
+Bug-Fedora: #827510
+Bug-Upstream: #14247
+Upstream status: not-submitted
+
+This needs to go upstream right away to fix the error case for
+newlocale not correctly returning an error.
+2012-06-14 Jeff Law <law@redhat.com>
* locale/loadlocale.c (_nl_load_locale): Delay setting
file->decided until we have successfully loaded the file's
diff --git a/glibc-rtkaio-clock.patch b/glibc-rtkaio-clock.patch
deleted file mode 100644
index 4aff826..0000000
--- a/glibc-rtkaio-clock.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# Based on the following upstream commit:
-#
-# commit 6e6249d0b461b952d0f544792372663feb6d792a
-# Author: Roland McGrath <roland@hack.frob.com>
-# Date: Wed Oct 24 14:50:46 2012 -0700
-#
-# BZ#14743: Move clock_* symbols from librt to libc.
-#
-# We remove the clock* functions from librtkaio.so.1 and
-# use those provided in libc.so.6, matching librt.so.
-#
---- glibc-2.21-63-gebf27d1.mod/rtkaio/clock-compat.c 1969-12-31 19:00:00.000000000 -0500
-+++ glibc-2.21-63-gebf27d1/rtkaio/clock-compat.c 2015-02-12 01:28:59.615026597 -0500
-@@ -0,0 +1,2 @@
-+#define librt librtkaio
-+#include <rt/clock-compat.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getcpuclockid.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getcpuclockid.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getcpuclockid.c 2015-02-11 13:00:55.105400863 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getcpuclockid.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <clock_getcpuclockid.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getres.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getres.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getres.c 2015-02-11 13:00:55.105400863 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getres.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <clock_getres.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_gettime.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_gettime.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_gettime.c 2015-02-11 13:00:55.109400738 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_gettime.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <clock_gettime.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_nanosleep.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_nanosleep.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_nanosleep.c 2015-02-11 13:00:55.115400552 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_nanosleep.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <clock_nanosleep.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_settime.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_settime.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_settime.c 2015-02-11 13:00:55.110400708 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_settime.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <clock_settime.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_get_clockfreq.c glibc-2.21-59-gd35273f/rtkaio/kaio_get_clockfreq.c
---- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_get_clockfreq.c 2015-02-11 13:00:55.118400459 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/kaio_get_clockfreq.c 1969-12-31 19:00:00.000000000 -0500
-@@ -1 +0,0 @@
--#include <get_clockfreq.c>
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/Makefile glibc-2.21-59-gd35273f/rtkaio/Makefile
---- glibc-2.21-59-gd35273f.mod/rtkaio/Makefile 2015-02-11 13:00:55.107400801 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/Makefile 2015-02-11 22:46:46.930374298 -0500
-@@ -25,9 +25,6 @@
- aio_read64 aio_return aio_suspend aio_write \
- aio_write64 lio_listio lio_listio64 aio_sigqueue \
- aio_notify
--clock-routines := get_clockfreq clock_getcpuclockid \
-- clock_getres clock_gettime clock_settime \
-- clock_nanosleep
- timer-routines := timer_create timer_delete timer_getoverr \
- timer_gettime timer_settime
- shm-routines := shm_open shm_unlink
-@@ -36,8 +33,9 @@
- mq_timedreceive
-
- librtkaio-routines = $(patsubst %,k%,$(aio-routines)) \
-- $(patsubst %,kaio_%,$(clock-routines) $(timer-routines) \
-- $(shm-routines) $(mq-routines))
-+ $(patsubst %,kaio_%,$(timer-routines) \
-+ $(shm-routines) $(mq-routines)) \
-+ clock-compat
-
- tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
- tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
-@@ -64,7 +62,6 @@
- include $(..)Rules
-
- CFLAGS-kaio_suspend.c = -fexceptions
--CFLAGS-kaio_clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-kaio_librt-cancellation.c = -fasynchronous-unwind-tables
-
- LDFLAGS-rtkaio.so = -Wl,-soname=lib$(libprefix)rt.so$(librt.so-version) \
-@@ -88,9 +85,6 @@
- else
- $(addprefix $(objpfx),$(tests)): $(objpfx)librtkaio.a $(static-thread-library)
- endif
--ifeq (yes,$(build-bounded))
--$(tests:%=$(objpfx)%-bp): $(objpfx)librtkaio_b.a $(bounded-thread-library)
--endif
-
- tst-mqueue7-ARGS = -- $(built-program-file)
-
-diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/Versions glibc-2.21-59-gd35273f/rtkaio/Versions
---- glibc-2.21-59-gd35273f.mod/rtkaio/Versions 2015-02-11 13:00:55.118400459 -0500
-+++ glibc-2.21-59-gd35273f/rtkaio/Versions 2015-02-11 22:36:11.974051389 -0500
-@@ -6,7 +6,7 @@
- aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
- }
- GLIBC_2.2 {
-- # c*
-+ # These have moved to libc and are still here only for compatibility.
- clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
- clock_nanosleep;
-
diff --git a/glibc-rtkaio-libof.patch b/glibc-rtkaio-libof.patch
deleted file mode 100644
index 3db525e..0000000
--- a/glibc-rtkaio-libof.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff -pruN glibc-2.21-649-gae5eae7/rtkaio/Makefile glibc-2.21-649-gae5eae7.new/rtkaio/Makefile
---- glibc-2.21-649-gae5eae7/rtkaio/Makefile 2015-07-27 22:57:05.742601066 +0530
-+++ glibc-2.21-649-gae5eae7.new/rtkaio/Makefile 2015-07-27 23:33:09.892874337 +0530
-@@ -66,7 +66,9 @@ CFLAGS-kaio_librt-cancellation.c = -fasy
-
- LDFLAGS-rtkaio.so = -Wl,-soname=lib$(libprefix)rt.so$(librt.so-version) \
- -Wl,--enable-new-dtags,-z,nodelete
--CPPFLAGS-librtkaio += -DIS_IN_librt=1 -I$(..)rt
-+# Resort to this ugliness of undefining and defining MODULE_NAME because
-+# setting libof-<> to librt has many more side-effects that we want to avoid.
-+CPPFLAGS-librtkaio += -I$(..)rt -UMODULE_NAME -DMODULE_NAME=librt
-
- rpath-dirs := $(patsubst rt,rtkaio,$(rpath-dirs))
-
-diff -pruN glibc-2.21-649-gae5eae7/rtkaio/sysdeps/unix/sysv/linux/syscalls.list glibc-2.21-649-gae5eae7.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list
---- glibc-2.21-649-gae5eae7/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 2015-07-27 22:47:23.073776396 +0530
-+++ glibc-2.21-649-gae5eae7.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 2015-07-27 23:33:09.892874337 +0530
-@@ -1,5 +1,5 @@
- # File name Caller Syscall name Args Strong name Weak names
-
--kaio_mq_timedsend - mq_timedsend Ci:ipiip __GI_mq_timedsend mq_timedsend
--kaio_mq_timedreceive - mq_timedreceive Ci:ipipp __GI_mq_timedreceive mq_timedreceive
--kaio_mq_setattr - mq_getsetattr i:ipp __GI_mq_setattr mq_setattr
-+kaio_mq_timedsend - mq_timedsend Ci:ipiip __mq_timedsend mq_timedsend
-+kaio_mq_timedreceive - mq_timedreceive Ci:ipipp __mq_timedreceive mq_timedreceive
-+kaio_mq_setattr - mq_getsetattr i:ipp mq_setattr
diff --git a/glibc-rtkaio.patch b/glibc-rtkaio.patch
deleted file mode 100644
index f5940d6..0000000
--- a/glibc-rtkaio.patch
+++ /dev/null
@@ -1,5015 +0,0 @@
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/Banner glibc-2.17-931-g30bbc0c.new/rtkaio/Banner
---- glibc-2.17-931-g30bbc0c/rtkaio/Banner 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/Banner 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+RT using linux kernel aio
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/ChangeLog glibc-2.17-931-g30bbc0c.new/rtkaio/ChangeLog
---- glibc-2.17-931-g30bbc0c/rtkaio/ChangeLog 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/ChangeLog 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1,255 @@
-+2009-10-30 Andreas Schwab <schwab@redhat.com>
-+
-+ * tst-aiod.h: Include <string.h>.
-+
-+2009-09-30 Andreas Schwab <schwab@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/x86_64/librtkaio-cancellation.S: New
-+ file.
-+
-+2007-12-12 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_read.c (aio_read64): Define to
-+ something else while including kaio_misc.h.
-+ * sysdeps/unix/sysv/linux/kaio_write.c (aio_write64): Likewise.
-+
-+2007-08-01 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_misc.h (AIO_MISC_NOTIFY,
-+ AIO_MISC_WAIT): Add LLL_PRIVATE as last argument to lll_futex_*wait.
-+
-+2006-09-15 Jakub Jelinek <jakub@redhat.com>
-+
-+ [BZ #3138]
-+ * rt/tst-aiod.c (do_prepare): Give name_len type size_t.
-+ * rt/tst-aiod64.c (do_prepare): Likewise.
-+
-+2006-09-07 Jakub Jelinek <jakub@redhat.com>
-+
-+ * tst-aiod2.c: Adjust test for new semantics of lio_listio.
-+ * tst-aiod3.c: The thread is now supposed to be created.
-+
-+ * Makefile: Use $(..) in place of ../.
-+ (tests): Add tst-aio{8,9,10}, tst-cpuclock{1,2}, tst-cputimer{1,2,3}
-+ and tst-clock2.
-+ (CPPFLAGS-librtkaio): Append -I$(..)rt.
-+ * Versions.def (librtkaio): Add GLIBC_2.4 version.
-+ * sysdeps/unix/sysv/linux/kaio_misc.c (wait_for_kernel_requests)
-+ [!DONT_NEED_AIO_MISC_COND]: Don't use condvar, use AIO_MISC_WAIT.
-+ * sysdeps/unix/sysv/linux/kaio_misc.h [HAVE_FORCED_UNWIND]
-+ (DONT_NEED_AIO_MISC_COND, AIO_MISC_NOTIFY, AIO_MISC_WAIT): Define.
-+ (struct waitlist) [DONT_NEED_AIO_MISC_COND]: Remove cond.
-+ * sysdeps/unix/sysv/linux/kaio_suspend.c (struct clparam)
-+ [DONT_NEED_AIO_MISC_COND]: Remove cond.
-+ (cleanup) [DONT_NEED_AIO_MISC_COND]: Lock __aio_requests_mutex on
-+ entry. Don't destroy param->cond.
-+ (aio_suspend): Fail if nent is negative.
-+ (aio_suspend) [DONT_NEED_AIO_MISC_COND]: Don't use cond, use
-+ AIO_MISC_WAIT.
-+ * sysdeps/unix/sysv/linux/klio_listio.c (lio_listio): Renamed to...
-+ (lio_listio_internal): ... this. Don't use cond, but AIO_MISC_WAIT,
-+ if DONT_NEED_AIO_MISC_COND. Remove mode parameter check. Only set
-+ sigevent type to SIGEV_NONE if LIO_NO_INDIVIDUAL_EVENT is set.
-+ (__lio_listio_21): New function. Compatiblity version which sets
-+ LIO_NO_INDIVIDUAL_EVENT before calling lio_listio_internal.
-+ (__lio_listio_item_notify): New function.
-+ * sysdeps/unix/sysv/linux/klio_listio64.c: Define __lio_listio_21 and
-+ __lio_listio_item_notify macros.
-+ * aio.h: Removed.
-+ * configure.in: New file
-+ * configure: Regenerated.
-+ * sysdeps/rtkaio/kaio_cancel.c: Moved to...
-+ * kaio_cancel.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_error.c: Moved to...
-+ * kaio_error.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_fsync.c: Moved to...
-+ * kaio_fsync.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_misc.c: Moved to...
-+ * kaio_misc.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_notify.c: Moved to...
-+ * kaio_notify.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_read.c: Moved to...
-+ * kaio_read.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_read64.c: Moved to...
-+ * kaio_read64.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_return.c: Moved to...
-+ * kaio_return.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_sigqueue.c: Moved to...
-+ * kaio_sigqueue.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_suspend.c: Moved to...
-+ * kaio_suspend.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_write.c: Moved to...
-+ * kaio_write.c: ... here. New file.
-+ * sysdeps/rtkaio/kaio_write64.c: Moved to...
-+ * kaio_write64.c: ... here. New file.
-+ * sysdeps/rtkaio/klio_listio.c: Moved to...
-+ * klio_listio.c: ... here. New file.
-+ * sysdeps/rtkaio/klio_listio64.c: Moved to...
-+ * klio_listio64.c: ... here. New file.
-+ * sysdeps/pthread/Versions: New file.
-+ * tst-aio8.c: New file.
-+ * tst-aio9.c: New file.
-+ * tst-aio10.c: New file.
-+ * tst-clock2.c: New file.
-+ * tst-cpuclock1.c: New file.
-+ * tst-cpuclock2.c: New file.
-+ * tst-cputimer1.c: New file.
-+ * tst-cputimer2.c: New file.
-+ * tst-cputimer3.c: New file.
-+ * sysdeps/unix/sysv/linux/sparc/Makefile: New file.
-+ * sysdeps/unix/sysv/linux/sparc/rtkaio-sysdep.c: New file.
-+ * sysdeps/unix/sysv/linux/sparc/sparc64/Versions: New file.
-+ * sysdeps/mips/Makefile: Removed.
-+ * sysdeps/unix/mips/rtkaio-sysdep.S: Removed.
-+ * sysdeps/unix/sysv/linux/hppa/Versions: Removed.
-+ * sysdeps/unix/sysv/linux/hppa/kaio_cancel.c: Removed.
-+
-+2006-07-19 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_misc.c: Include atomic.h.
-+ (kernel_callback): Ensure __return_value is updated before
-+ __error_code is set.
-+
-+2006-05-11 Jakub Jelinek <jakub@redhat.com>
-+
-+ * Makefile (tests): Add tst-mqueue{8,9}, tst-timer5 and
-+ tst-aiod{,64,2,3,4,5}.
-+ (LDFLAGS-rtkaio.so): Add -Wl,--enable-new-dtags,-z,nodelete.
-+ * sysdeps/unix/sysv/linux/kaio_misc.h: Include signal.h and
-+ sysdep.h.
-+ (aio_start_notify_thread, aio_create_helper_thread): Define
-+ for !BROKEN_THREAD_SIGNALS.
-+ (__aio_start_notify_thread, __aio_create_helper_thread): New
-+ functions for !BROKEN_THREAD_SIGNALS.
-+ * sysdeps/unix/sysv/linux/kaio_misc.c: Include sys/sysmacros.h.
-+ (aio_create_helper_thread): Define if not yet defined.
-+ (__aio_create_helper_thread): New function.
-+ (__aio_wait_for_events): Pass 1 rather than 0 as min_nr to
-+ io_getevents.
-+ (handle_kernel_aio): Likewise.
-+ (__aio_create_kernel_thread): Use aio_create_helper_thread.
-+ (__aio_enqueue_user_request): Likewise.
-+ (handle_fildes_io): Likewise. Remove noreturn attribute,
-+ return NULL instead of calling pthread_exit (NULL).
-+ (__aio_enqueue_request_ctx): Call fcntl and fxstat64 to avoid using
-+ kaio on non-O_DIRECT non-/dev/raw* filedescriptors. For LIO_SYNC
-+ and LIO_DSYNC also set kctx to KCTX_NONE.
-+ * sysdeps/unix/sysv/linux/kaio_suspend.c (aio_suspend): Don't start
-+ handle_kernel_aio thread if ktotal is zero.
-+ * sysdeps/pthread/Makefile (tests): Add tst-mqueue8x.
-+ (CFLAGS-tst-mqueue8x.c): Add -fexceptions.
-+ * Versions.def (librtkaio): Add GLIBC_2.3.4 version.
-+ * kaio_mq_close.c: New file.
-+ * kaio_mq_getattr.c: New file.
-+ * kaio_mq_notify.c: New file.
-+ * kaio_mq_open.c: New file.
-+ * kaio_mq_receive.c: New file.
-+ * kaio_mq_send.c: New file.
-+ * kaio_mq_setattr.c: New file.
-+ * kaio_mq_timedreceive.c: New file.
-+ * kaio_mq_timedsend.c: New file.
-+ * kaio_mq_unlink.c: New file.
-+ * sysdeps/pthread/tst-mqueue8x.c: New file.
-+ * sysdeps/unix/sysv/linux/syscalls.list: New file.
-+ * tst-mqueue8.c: New file.
-+ * tst-mqueue9.c: New file.
-+ * tst-timer5.c: New file.
-+ * tst-aiod.h: New file.
-+ * tst-aiod.c: New test.
-+ * tst-aiod64.c: New test.
-+ * tst-aiod2.c: New test.
-+ * tst-aiod3.c: New test.
-+ * tst-aiod4.c: New test.
-+ * tst-aiod5.c: New test.
-+ * sysdeps/mips/Makefile: New file.
-+ * sysdeps/unix/alpha/Makefile: New file.
-+ * sysdeps/unix/alpha/rtkaio-sysdep.S: New file.
-+ * sysdeps/unix/mips/rtkaio-sysdep.S: New file.
-+ * sysdeps/unix/sysv/linux/Makefile: New file.
-+ * sysdeps/unix/sysv/linux/s390/Makefile: New file.
-+ * sysdeps/unix/sysv/linux/s390/rtkaio-sysdep.S: New file.
-+ * sysdeps/unix/sysv/linux/powerpc/Makefile: New file.
-+ * sysdeps/unix/sysv/linux/powerpc/rtkaio-sysdep.c: New file.
-+ * sysdeps/unix/sysv/linux/ia64/Makefile: New file.
-+ * sysdeps/unix/sysv/linux/ia64/rtkaio-sysdep.S: New file.
-+
-+2004-04-17 Jakub Jelinek <jakub@redhat.com>
-+
-+ * rt/Makefile (mq-routines): Set.
-+ (librt-routines): Use it.
-+ (tests): Add tst-mqueue{1,2,3,4,5,6,7} and tst-timer{3,4}.
-+ (tst-mqueue7-ARGS): Set.
-+ * rt/Versions (librt): Add mq_*@@GLIBC_2.3.4.
-+ * rt/tst-mqueue1.c: New file.
-+ * rt/tst-mqueue2.c: New file.
-+ * rt/tst-mqueue3.c: New file.
-+ * rt/tst-mqueue4.c: New file.
-+ * rt/tst-mqueue5.c: New file.
-+ * rt/tst-mqueue6.c: New file.
-+ * rt/tst-mqueue7.c: New file.
-+ * rt/tst-timer3.c: New file.
-+ * rt/tst-timer4.c: New file.
-+
-+2003-08-14 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_misc.c (wait_for_kernel_requests):
-+ New function.
-+ (handle_fildes_io): Use it for LIO_SYNC and LIO_DSYNC.
-+
-+ * sysdeps/pthread/Makefile (CPPFLAGS): Add -DBROKEN_THREAD_SIGNALS
-+ for rtkaio/linuxthreads combo.
-+ * sysdeps/unix/sysv/linux/kaio_misc.c (__aio_enqueue_request_ctx):
-+ Only set caller_pid if BROKEN_THREAD_SIGNALS.
-+ * sysdeps/unix/sysv/linux/kaio_misc.h (struct waitlist,
-+ struct requestlist): Remove caller_pid unless BROKEN_THREAD_SIGNALS.
-+ (__aio_notify_only): Remove last argument if not
-+ BROKEN_THREAD_SIGNALS.
-+ * sysdeps/unix/sysv/linux/kaio_suspend.c (aio_suspend): Only set
-+ caller_pid if not BROKEN_THREAD_SIGNALS.
-+ * sysdeps/unix/sysv/linux/klio_listio.c (lio_listio): Likewise.
-+ Remove last argument in call to __aio_notify_only unless
-+ BROKEN_THREAD_SIGNALS.
-+
-+ * tst-aio.c: Avoid test duplication. Include rt/aio.c instead.
-+ * tst-aio2.c: Similarly.
-+ * tst-aio3.c: Similarly.
-+ * tst-aio4.c: Similarly.
-+ * tst-aio5.c: Similarly.
-+ * tst-aio6.c: Similarly.
-+ * tst-aio64.c: Similarly.
-+ * tst-aio7.c: Similarly.
-+ * tst-clock.c: Similarly.
-+ * tst-clock_nanosleep.c: Similarly.
-+ * tst-shm.c: Similarly.
-+ * tst-timer2.c: Similarly.
-+
-+2003-07-29 Roland McGrath <roland@redhat.com>
-+
-+ * rt/tst-timer2.c: New file.
-+ * rt/Makefile (tests): Add it.
-+
-+2003-07-25 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_cancel.c (aio_cancel): Attempt
-+ to cancel kioctx != KCTX_NONE requests even if second argument
-+ to aio_cancel is NULL.
-+
-+2003-07-24 Jakub Jelinek <jakub@redhat.com>
-+
-+ * sysdeps/unix/sysv/linux/kaio_cancel.c (aio_cancel): Return
-+ AIO_ALLDONE if aiocbp != NULL and has already completed. Return
-+ -1/EINVAL if aiocbp->aio_fildes does not match fildes.
-+
-+ * sysdeps/unix/sysv/linux/alpha/kaio_cancel.c: New file.
-+ * sysdeps/unix/sysv/linux/hppa/kaio_cancel.c: New file.
-+ * sysdeps/unix/sysv/linux/sparc/kaio_cancel.c: New file.
-+ * sysdeps/unix/sysv/linux/kaio_cancel.c (aio_cancel): Attempt
-+ to cancel request handled by kernel (so far just if aiocbp != NULL).
-+ * sysdeps/unix/sysv/linux/kaio_misc.c (__aio_remove_krequest): Fix
-+ assertion, req->kioctx must NOT be KCTX_NONE.
-+ * sysdeps/unix/sysv/linux/kaio_misc.h (__aio_remove_krequest): New
-+ prototype.
-+
-+2003-07-23 Jakub Jelinek <jakub@redhat.com>
-+
-+ * New add-on.
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/configure glibc-2.17-931-g30bbc0c.new/rtkaio/configure
---- glibc-2.17-931-g30bbc0c/rtkaio/configure 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/configure 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1,4 @@
-+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
-+
-+libc_add_on_canonical=
-+libc_add_on_subdirs=.
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/configure.in glibc-2.17-931-g30bbc0c.new/rtkaio/configure.in
---- glibc-2.17-931-g30bbc0c/rtkaio/configure.in 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/configure.in 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1,5 @@
-+dnl glibc configure fragment for rtkaio add-on
-+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-+
-+libc_add_on_canonical=
-+libc_add_on_subdirs=.
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/Depend glibc-2.17-931-g30bbc0c.new/rtkaio/Depend
---- glibc-2.17-931-g30bbc0c/rtkaio/Depend 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/Depend 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+rt
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_cancel.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_cancel.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_cancel.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_cancel.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_cancel.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_getcpuclockid.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_getcpuclockid.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_getcpuclockid.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_getcpuclockid.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <clock_getcpuclockid.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_getres.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_getres.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_getres.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_getres.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <clock_getres.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_gettime.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_gettime.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_gettime.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_gettime.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <clock_gettime.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_nanosleep.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_nanosleep.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_nanosleep.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_nanosleep.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <clock_nanosleep.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_settime.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_settime.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_clock_settime.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_clock_settime.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <clock_settime.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_error.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_error.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_error.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_error.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_error.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_fsync.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_fsync.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_fsync.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_fsync.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_fsync.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_get_clockfreq.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_get_clockfreq.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_get_clockfreq.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_get_clockfreq.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <get_clockfreq.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_misc.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_misc.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_misc.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_misc.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_misc.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_close.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_close.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_close.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_close.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_close.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_getattr.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_getattr.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_getattr.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_getattr.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_getattr.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_notify.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_notify.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_notify.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_notify.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_notify.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_open.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_open.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_open.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_open.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_open.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_receive.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_receive.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_receive.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_receive.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_receive.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_send.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_send.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_send.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_send.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_send.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_setattr.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_setattr.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_setattr.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_setattr.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_setattr.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_timedreceive.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_timedreceive.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_timedreceive.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_timedreceive.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_timedreceive.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_timedsend.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_timedsend.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_timedsend.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_timedsend.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_timedsend.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_unlink.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_unlink.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_mq_unlink.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_mq_unlink.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <mq_unlink.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_notify.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_notify.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_notify.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_notify.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_notify.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_read64.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_read64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_read64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_read64.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_read64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_read.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_read.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_read.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_read.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_read.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_return.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_return.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_return.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_return.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_return.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_shm_open.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_shm_open.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_shm_open.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_shm_open.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <shm_open.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_shm_unlink.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_shm_unlink.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_shm_unlink.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_shm_unlink.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <shm_unlink.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_sigqueue.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_sigqueue.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_sigqueue.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_sigqueue.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_sigqueue.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_suspend.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_suspend.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_suspend.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_suspend.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_suspend.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_create.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_create.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_create.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_create.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_create.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_delete.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_delete.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_delete.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_delete.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_delete.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_getoverr.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_getoverr.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_getoverr.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_getoverr.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_getoverr.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_gettime.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_gettime.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_gettime.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_gettime.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_gettime.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_settime.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_settime.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_timer_settime.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_timer_settime.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_settime.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_write64.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_write64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_write64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_write64.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_write64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/kaio_write.c glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_write.c
---- glibc-2.17-931-g30bbc0c/rtkaio/kaio_write.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/kaio_write.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <aio_write.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/klio_listio64.c glibc-2.17-931-g30bbc0c.new/rtkaio/klio_listio64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/klio_listio64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/klio_listio64.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <lio_listio64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/klio_listio.c glibc-2.17-931-g30bbc0c.new/rtkaio/klio_listio.c
---- glibc-2.17-931-g30bbc0c/rtkaio/klio_listio.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/klio_listio.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <lio_listio.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/Makefile 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1,106 @@
-+# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
-+# This file is part of the GNU C Library.
-+
-+# The GNU C Library is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU Lesser General Public
-+# License as published by the Free Software Foundation; either
-+# version 2.1 of the License, or (at your option) any later version.
-+
-+# The GNU C Library is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# Lesser General Public License for more details.
-+
-+# You should have received a copy of the GNU Lesser General Public
-+# License along with the GNU C Library; if not, write to the Free
-+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+# 02111-1307 USA.
-+
-+#
-+# Sub-makefile for real-time kaio portion of the library.
-+#
-+subdir := rtkaio
-+
-+aio-routines := aio_cancel aio_error aio_fsync aio_misc aio_read \
-+ aio_read64 aio_return aio_suspend aio_write \
-+ aio_write64 lio_listio lio_listio64 aio_sigqueue \
-+ aio_notify
-+clock-routines := get_clockfreq clock_getcpuclockid \
-+ clock_getres clock_gettime clock_settime \
-+ clock_nanosleep
-+timer-routines := timer_create timer_delete timer_getoverr \
-+ timer_gettime timer_settime
-+shm-routines := shm_open shm_unlink
-+mq-routines := mq_open mq_close mq_unlink mq_getattr mq_setattr \
-+ mq_notify mq_send mq_receive mq_timedsend \
-+ mq_timedreceive
-+
-+librtkaio-routines = $(patsubst %,k%,$(aio-routines)) \
-+ $(patsubst %,kaio_%,$(clock-routines) $(timer-routines) \
-+ $(shm-routines) $(mq-routines))
-+
-+tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
-+ tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
-+ tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
-+ tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
-+ tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
-+ tst-timer3 tst-timer4 tst-timer5 \
-+ tst-cpuclock1 tst-cpuclock2 \
-+ tst-cputimer1 tst-cputimer2 tst-cputimer3 \
-+ tst-clock2 \
-+ tst-aiod tst-aiod64 tst-aiod2 tst-aiod3 tst-aiod4 tst-aiod5
-+
-+extra-libs := librtkaio
-+extra-libs-others := $(extra-libs)
-+
-+include $(..)Makeconfig
-+
-+ifeq (yesyes,$(build-shared)$(elf))
-+generated += librt.so$(librt.so-version)
-+
-+$(objpfx)librt.so$(librt.so-version): $(objpfx)librtkaio.so; $(make-link)
-+endif
-+
-+include $(..)Rules
-+
-+CFLAGS-kaio_suspend.c = -fexceptions
-+CFLAGS-kaio_clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables
-+CFLAGS-kaio_librt-cancellation.c = -fasynchronous-unwind-tables
-+
-+LDFLAGS-rtkaio.so = -Wl,-soname=lib$(libprefix)rt.so$(librt.so-version) \
-+ -Wl,--enable-new-dtags,-z,nodelete
-+CPPFLAGS-librtkaio += -DIS_IN_librt=1 -I$(..)rt
-+
-+rpath-dirs := $(patsubst rt,rtkaio,$(rpath-dirs))
-+
-+ifeq (yesyes,$(build-shared)$(elf))
-+others: $(objpfx)librt.so$(librt.so-version)
-+endif
-+
-+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-+# This ensures they will load libc.so for needed symbols if loaded by
-+# a statically-linked program that hasn't already loaded it.
-+$(objpfx)librtkaio.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
-+ $(shared-thread-library) \
-+ $(if $(filter yes,$(elf)), $(elf-objpfx)ld.so)
-+
-+ifeq (yes,$(build-shared))
-+$(addprefix $(objpfx),$(tests)): $(objpfx)librtkaio.so $(shared-thread-library)
-+else
-+$(addprefix $(objpfx),$(tests)): $(objpfx)librtkaio.a $(static-thread-library)
-+endif
-+ifeq (yes,$(build-bounded))
-+$(tests:%=$(objpfx)%-bp): $(objpfx)librtkaio_b.a $(bounded-thread-library)
-+endif
-+
-+tst-mqueue7-ARGS = -- $(built-program-file)
-+
-+ifeq (yes,$(build-static-nss))
-+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
-+ $(resolvobjdir)/libresolv.a
-+endif
-+
-+# FIXME: This is a placeholder to let the tests run to conclusion. This needs
-+# a real abilist file.
-+$(objpfx)check-abi-librtkaio.out:
-+ touch $@
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/shlib-versions glibc-2.17-931-g30bbc0c.new/rtkaio/shlib-versions
---- glibc-2.17-931-g30bbc0c/rtkaio/shlib-versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/shlib-versions 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1,1 @@
-+librtkaio=1
-diff --git a/sysdeps/unix/sysv/linux/mips/shlib-versions b/sysdeps/unix/sysv/linux/mips/shlib-versions
-index c5bd7db..06f28ea 100644
---- a/sysdeps/unix/sysv/linux/mips/shlib-versions
-+++ b/sysdeps/unix/sysv/linux/mips/shlib-versions
-@@ -23,5 +23,6 @@ libnss_hesiod=2 GLIBC_2.0 GLIBC_2.2
- libnsl=1 GLIBC_2.0 GLIBC_2.2
-
- librt=1 GLIBC_2.0 GLIBC_2.2
-+librtkaio=1 GLIBC_2.0 GLIBC_2.2
-
- libpthread=0 GLIBC_2.0 GLIBC_2.2
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/kaio_timer_routines.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/kaio_timer_routines.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/kaio_timer_routines.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/kaio_timer_routines.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <timer_routines.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/librtkaio-cancellation.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/librtkaio-cancellation.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/librtkaio-cancellation.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/librtkaio-cancellation.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <librt-cancellation.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/Makefile 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1,39 @@
-+ifeq ($(filter nptl,$(sorted-subdirs)),nptl)
-+
-+ifeq ($(subdir),rtkaio)
-+librtkaio-sysdep_routines += kaio_timer_routines librtkaio-cancellation rtkaio-unwind-resume
-+librtkaio-shared-only-routines += rtkaio-unwind-resume
-+tests += tst-cancel17 tst-cancelx17
-+CPPFLAGS-kaio_timer_routines.c = -I../nptl
-+CFLAGS-librtkaio-cancellation.c += -fexceptions -fasynchronous-unwind-tables
-+CFLAGS-rtkaio-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
-+CFLAGS-tst-cancelx17.c += -fexceptions
-+
-+ifeq (yes,$(build-shared))
-+$(objpfx)tst-timer: $(objpfx)librtkaio.so $(shared-thread-library)
-+else
-+$(objpfx)tst-timer: $(objpfx)librtkaio.a $(static-thread-library)
-+endif
-+
-+ifeq ($(have-forced-unwind),yes)
-+tests += tst-mqueue8x
-+CFLAGS-tst-mqueue8x.c += -fexceptions
-+endif
-+endif
-+
-+endif
-+
-+ifeq ($(filter linuxthreads,$(sorted-subdirs)),linuxthreads)
-+
-+ifeq ($(subdir),rtkaio)
-+librtkaio-sysdep_routines += kaio_timer_routines
-+CPPFLAGS += -DBROKEN_THREAD_SIGNALS
-+
-+ifeq (yes,$(build-shared))
-+$(objpfx)tst-timer: $(objpfx)librtkaio.so $(shared-thread-library)
-+else
-+$(objpfx)tst-timer: $(objpfx)librtkaio.a $(static-thread-library)
-+endif
-+endif
-+
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/rtkaio-unwind-resume.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/rtkaio-unwind-resume.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/rtkaio-unwind-resume.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/rtkaio-unwind-resume.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-unwind-resume.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-cancel17.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-cancel17.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-cancel17.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-cancel17.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <nptl/tst-cancel17.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-cancelx17.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-cancelx17.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-cancelx17.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-cancelx17.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include "tst-cancel17.c"
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-mqueue8x.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-mqueue8x.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-mqueue8x.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-mqueue8x.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include_next <tst-mqueue8x.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-timer.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-timer.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/tst-timer.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/tst-timer.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include_next <tst-timer.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/pthread/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/pthread/Versions 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1,7 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.4 {
-+ lio_listio; lio_listio64;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/alpha/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/alpha/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/alpha/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/alpha/Makefile 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,3 @@
-+ifeq ($(subdir),rtkaio)
-+librtkaio-sysdep_routines += rtkaio-sysdep
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/alpha/rtkaio-sysdep.S glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/alpha/rtkaio-sysdep.S
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/alpha/rtkaio-sysdep.S 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/alpha/rtkaio-sysdep.S 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-sysdep.S>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/alpha/kaio_cancel.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/alpha/kaio_cancel.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/alpha/kaio_cancel.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/alpha/kaio_cancel.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,33 @@
-+#include <shlib-compat.h>
-+
-+#define aio_cancel64 XXX
-+#include <aio.h>
-+#undef aio_cancel64
-+#include <errno.h>
-+
-+extern __typeof (aio_cancel) __new_aio_cancel;
-+extern __typeof (aio_cancel) __old_aio_cancel;
-+
-+#define aio_cancel __new_aio_cancel
-+
-+#include <sysdeps/unix/sysv/linux/kaio_cancel.c>
-+
-+#undef aio_cancel
-+strong_alias (__new_aio_cancel, __new_aio_cancel64);
-+versioned_symbol (librt, __new_aio_cancel, aio_cancel, GLIBC_2_3);
-+versioned_symbol (librt, __new_aio_cancel64, aio_cancel64, GLIBC_2_3);
-+
-+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3)
-+
-+#undef ECANCELED
-+#define aio_cancel __old_aio_cancel
-+#define ECANCELED 125
-+
-+#include <sysdeps/unix/sysv/linux/kaio_cancel.c>
-+
-+#undef aio_cancel
-+strong_alias (__old_aio_cancel, __old_aio_cancel64);
-+compat_symbol (librt, __old_aio_cancel, aio_cancel, GLIBC_2_1);
-+compat_symbol (librt, __old_aio_cancel64, aio_cancel64, GLIBC_2_1);
-+
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/alpha/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/alpha/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/alpha/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/alpha/Versions 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,6 @@
-+librtkaio {
-+ GLIBC_2.3 {
-+ # AIO functions.
-+ aio_cancel; aio_cancel64;
-+ }
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/Makefile 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,3 @@
-+ifeq ($(subdir),rtkaio)
-+librtkaio-routines += rtkaio-sysdep
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/rtkaio-sysdep.S glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/rtkaio-sysdep.S
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/rtkaio-sysdep.S 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/rtkaio-sysdep.S 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-sysdep.S>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/ia64/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/ia64/Versions 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,9 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.3.3 {
-+ # Changed timer_t.
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_cancel.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_cancel.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_cancel.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_cancel.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,240 @@
-+/* Cancel requests associated with given file descriptor.
-+ Copyright (C) 1997, 1998, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* We use an UGLY hack to prevent gcc from finding us cheating. The
-+ implementation of aio_cancel and aio_cancel64 are identical and so
-+ we want to avoid code duplication by using aliases. But gcc sees
-+ the different parameter lists and prints a warning. We define here
-+ a function so that aio_cancel64 has no prototype. */
-+#ifndef aio_cancel
-+#define aio_cancel64 XXX
-+#include <aio.h>
-+/* And undo the hack. */
-+#undef aio_cancel64
-+#endif
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <aio_cancel.c>
-+#else
-+
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <assert.h>
-+#include <errno.h>
-+
-+int
-+aio_cancel (fildes, aiocbp)
-+ int fildes;
-+ struct aiocb *aiocbp;
-+{
-+ struct requestlist *req = NULL;
-+ int result = AIO_ALLDONE;
-+
-+ /* If fildes is invalid, error. */
-+ if (fcntl (fildes, F_GETFL) < 0)
-+ {
-+ __set_errno (EBADF);
-+ return -1;
-+ }
-+
-+ /* Request the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ /* We are asked to cancel a specific AIO request. */
-+ if (aiocbp != NULL)
-+ {
-+ /* If the AIO request is not for this descriptor it has no value
-+ to look for the request block. */
-+ if (aiocbp->aio_fildes != fildes)
-+ {
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ __set_errno (EINVAL);
-+ return -1;
-+ }
-+ else if (aiocbp->__error_code == EINPROGRESS)
-+ {
-+ struct requestlist *last = NULL;
-+
-+ req = __aio_find_req_fd (fildes);
-+
-+ if (req != NULL)
-+ while (req->aiocbp != (aiocb_union *) aiocbp)
-+ {
-+ last = req;
-+ req = req->next_prio;
-+ if (req == NULL)
-+ break;
-+ }
-+
-+ if (req != NULL)
-+ {
-+ /* Don't remove the entry if a thread is already working on
-+ it. */
-+ if (req->running == allocated)
-+ {
-+ result = AIO_NOTCANCELED;
-+ req = NULL;
-+ }
-+ else
-+ {
-+ /* We can remove the entry. */
-+ __aio_remove_request (last, req, 0);
-+
-+ result = AIO_CANCELED;
-+
-+ req->next_prio = NULL;
-+ }
-+ }
-+ else
-+ {
-+ /* Try kernel requests. */
-+ req = __aio_find_req ((aiocb_union *) aiocbp);
-+
-+ if (req == NULL)
-+ {
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ __set_errno (EINVAL);
-+ return -1;
-+ }
-+
-+ assert (req->kioctx != KCTX_NONE);
-+
-+ /* If kernel is working on it, try cancelling it. */
-+ if (req->running == allocated)
-+ {
-+ struct kio_event ev;
-+ INTERNAL_SYSCALL_DECL (err);
-+ int res;
-+
-+ res = INTERNAL_SYSCALL (io_cancel, err, 3, __aio_kioctx,
-+ &req->kiocb, &ev);
-+ if (INTERNAL_SYSCALL_ERROR_P (res, err))
-+ {
-+ result = AIO_NOTCANCELED;
-+ req = NULL;
-+ }
-+ else
-+ req->running = queued;
-+ }
-+ if (req != NULL)
-+ {
-+ /* We can remove the entry. */
-+ __aio_remove_krequest (req);
-+ result = AIO_CANCELED;
-+ req->next_prio = NULL;
-+ }
-+ }
-+ }
-+ }
-+ else
-+ {
-+ /* Find the beginning of the list of all requests for this
-+ desriptor. */
-+ req = __aio_find_req_fd (fildes);
-+
-+ /* If any request is worked on by a thread it must be the first.
-+ So either we can delete all requests or all but the first. */
-+ if (req != NULL)
-+ {
-+ if (req->running == allocated)
-+ {
-+ struct requestlist *old = req;
-+ req = req->next_prio;
-+ old->next_prio = NULL;
-+
-+ result = AIO_NOTCANCELED;
-+
-+ if (req != NULL)
-+ __aio_remove_request (old, req, 1);
-+ }
-+ else
-+ {
-+ result = AIO_CANCELED;
-+
-+ /* We can remove the entry. */
-+ __aio_remove_request (NULL, req, 1);
-+ }
-+ }
-+
-+ if (result != AIO_NOTCANCELED)
-+ {
-+ /* Try to cancel kernel requests. */
-+ struct requestlist *kreq = __aio_find_kreq_fd (fildes);
-+
-+ while (kreq)
-+ {
-+ struct requestlist *next;
-+
-+ /* If kernel is working on it, try cancelling it. */
-+ if (kreq->running == allocated)
-+ {
-+ struct kio_event ev;
-+ INTERNAL_SYSCALL_DECL (err);
-+ int res;
-+
-+ res = INTERNAL_SYSCALL (io_cancel, err, 3, __aio_kioctx,
-+ &kreq->kiocb, &ev);
-+ if (INTERNAL_SYSCALL_ERROR_P (res, err))
-+ {
-+ result = AIO_NOTCANCELED;
-+ break;
-+ }
-+ else
-+ kreq->running = queued;
-+ }
-+ next = kreq->next_prio;
-+ __aio_remove_krequest (kreq);
-+ result = AIO_CANCELED;
-+ kreq->next_prio = NULL;
-+ assert (kreq->running == yes || kreq->running == queued);
-+ kreq->aiocbp->aiocb.__error_code = ECANCELED;
-+ kreq->aiocbp->aiocb.__return_value = -1;
-+ __aio_notify (kreq);
-+ __aio_free_request (kreq);
-+ kreq = next;
-+ }
-+ }
-+ }
-+
-+ /* Mark requests as canceled and send signal. */
-+ while (req != NULL)
-+ {
-+ struct requestlist *old = req;
-+ assert (req->running == yes || req->running == queued);
-+ req->aiocbp->aiocb.__error_code = ECANCELED;
-+ req->aiocbp->aiocb.__return_value = -1;
-+ __aio_notify (req);
-+ req = req->next_prio;
-+ __aio_free_request (old);
-+ }
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+
-+ return result;
-+}
-+
-+#ifndef aio_cancel
-+weak_alias (aio_cancel, aio_cancel64)
-+#endif
-+
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_error.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_error.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_error.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_error.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,54 @@
-+/* Return error status of asynchronous I/O request.
-+ Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* We use an UGLY hack to prevent gcc from finding us cheating. The
-+ implementation of aio_error and aio_error64 are identical and so
-+ we want to avoid code duplication by using aliases. But gcc sees
-+ the different parameter lists and prints a warning. We define here
-+ a function so that aio_error64 has no prototype. */
-+#define aio_error64 XXX
-+#include <aio.h>
-+/* And undo the hack. */
-+#undef aio_error64
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <aio_error.c>
-+#else
-+
-+#include <errno.h>
-+
-+int
-+aio_error (aiocbp)
-+ const struct aiocb *aiocbp;
-+{
-+ int ret = aiocbp->__error_code;
-+
-+ if (ret == EINPROGRESS)
-+ {
-+ __aio_read_one_event ();
-+ ret = aiocbp->__error_code;
-+ }
-+ return ret;
-+}
-+
-+weak_alias (aio_error, aio_error64)
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_fsync.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_fsync.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_fsync.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_fsync.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,6 @@
-+#define aio_fsync64 XXX
-+#include <aio.h>
-+/* And undo the hack. */
-+#undef aio_fsync64
-+#include <kaio_misc.h>
-+#include <aio_fsync.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,1139 @@
-+/* Handle general operations.
-+ Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2006,2010
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <aio_misc.c>
-+#else
-+
-+#include <aio.h>
-+#include <assert.h>
-+#include <atomic.h>
-+#include <errno.h>
-+#include <limits.h>
-+#include <pthread.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <sys/stat.h>
-+#include <sys/time.h>
-+#include <sys/sysmacros.h>
-+
-+#ifndef aio_create_helper_thread
-+# define aio_create_helper_thread __aio_create_helper_thread
-+
-+extern inline int
-+__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
-+{
-+ pthread_attr_t attr;
-+
-+ /* Make sure the thread is created detached. */
-+ pthread_attr_init (&attr);
-+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
-+
-+ int ret = pthread_create (threadp, &attr, tf, arg);
-+
-+ (void) pthread_attr_destroy (&attr);
-+ return ret;
-+}
-+
-+#endif
-+
-+
-+static void add_request_to_runlist (struct requestlist *newrequest)
-+ internal_function;
-+static int add_request_to_list (struct requestlist *newrequest, int fildes,
-+ int prio)
-+ internal_function;
-+static void * handle_kernel_aio (void *arg);
-+static void kernel_callback (kctx_t ctx, struct kiocb *kiocb, long res,
-+ long res2);
-+
-+/* Pool of request list entries. */
-+static struct requestlist **pool;
-+
-+/* Number of total and allocated pool entries. */
-+static size_t pool_max_size;
-+static size_t pool_size;
-+
-+/* Kernel AIO context. */
-+kctx_t __aio_kioctx = KCTX_NONE;
-+int __have_no_kernel_aio;
-+int __kernel_thread_started;
-+
-+/* We implement a two dimensional array but allocate each row separately.
-+ The macro below determines how many entries should be used per row.
-+ It should better be a power of two. */
-+#define ENTRIES_PER_ROW 32
-+
-+/* How many rows we allocate at once. */
-+#define ROWS_STEP 8
-+
-+/* List of available entries. */
-+static struct requestlist *freelist;
-+
-+/* List of request waiting to be processed. */
-+static struct requestlist *runlist;
-+
-+/* Structure list of all currently processed requests. */
-+static struct requestlist *requests, *krequests;
-+
-+/* Number of threads currently running. */
-+static int nthreads;
-+
-+/* Number of threads waiting for work to arrive. */
-+static int idle_thread_count;
-+
-+
-+/* These are the values used to optimize the use of AIO. The user can
-+ overwrite them by using the `aio_init' function. */
-+static struct aioinit optim =
-+{
-+ 20, /* int aio_threads; Maximal number of threads. */
-+ 64, /* int aio_num; Number of expected simultanious requests. */
-+ 0,
-+ 0,
-+ 0,
-+ 0,
-+ 1,
-+ 0
-+};
-+
-+
-+/* Since the list is global we need a mutex protecting it. */
-+pthread_mutex_t __aio_requests_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-+
-+/* When you add a request to the list and there are idle threads present,
-+ you signal this condition variable. When a thread finishes work, it waits
-+ on this condition variable for a time before it actually exits. */
-+pthread_cond_t __aio_new_request_notification = PTHREAD_COND_INITIALIZER;
-+
-+
-+/* Functions to handle request list pool. */
-+static struct requestlist *
-+get_elem (void)
-+{
-+ struct requestlist *result;
-+
-+ if (freelist == NULL)
-+ {
-+ struct requestlist *new_row;
-+ int cnt;
-+
-+ assert (sizeof (struct aiocb) == sizeof (struct aiocb64));
-+
-+ if (pool_size + 1 >= pool_max_size)
-+ {
-+ size_t new_max_size = pool_max_size + ROWS_STEP;
-+ struct requestlist **new_tab;
-+
-+ new_tab = (struct requestlist **)
-+ realloc (pool, new_max_size * sizeof (struct requestlist *));
-+
-+ if (new_tab == NULL)
-+ return NULL;
-+
-+ pool_max_size = new_max_size;
-+ pool = new_tab;
-+ }
-+
-+ /* Allocate the new row. */
-+ cnt = pool_size == 0 ? optim.aio_num : ENTRIES_PER_ROW;
-+ new_row = (struct requestlist *) calloc (cnt,
-+ sizeof (struct requestlist));
-+ if (new_row == NULL)
-+ return NULL;
-+
-+ pool[pool_size++] = new_row;
-+
-+ /* Put all the new entries in the freelist. */
-+ do
-+ {
-+ new_row->next_prio = freelist;
-+ freelist = new_row++;
-+ }
-+ while (--cnt > 0);
-+ }
-+
-+ result = freelist;
-+ freelist = freelist->next_prio;
-+
-+ return result;
-+}
-+
-+
-+void
-+internal_function
-+__aio_free_request (struct requestlist *elem)
-+{
-+ elem->running = no;
-+ elem->next_prio = freelist;
-+ freelist = elem;
-+}
-+
-+
-+struct requestlist *
-+internal_function
-+__aio_find_req (aiocb_union *elem)
-+{
-+ struct requestlist *runp;
-+ int fildes = elem->aiocb.aio_fildes;
-+ int i;
-+
-+ for (i = 0; i < 2; i++)
-+ {
-+ runp = i ? requests : krequests;
-+
-+ while (runp != NULL && runp->aiocbp->aiocb.aio_fildes < fildes)
-+ runp = runp->next_fd;
-+
-+ if (runp != NULL)
-+ {
-+ if (runp->aiocbp->aiocb.aio_fildes != fildes)
-+ runp = NULL;
-+ else
-+ while (runp != NULL && runp->aiocbp != elem)
-+ runp = runp->next_prio;
-+ if (runp != NULL)
-+ return runp;
-+ }
-+ }
-+
-+ return NULL;
-+}
-+
-+
-+struct requestlist *
-+internal_function
-+__aio_find_req_fd (int fildes)
-+{
-+ struct requestlist *runp = requests;
-+
-+ while (runp != NULL && runp->aiocbp->aiocb.aio_fildes < fildes)
-+ runp = runp->next_fd;
-+
-+ return (runp != NULL && runp->aiocbp->aiocb.aio_fildes == fildes
-+ ? runp : NULL);
-+}
-+
-+
-+struct requestlist *
-+internal_function
-+__aio_find_kreq_fd (int fildes)
-+{
-+ struct requestlist *runp = krequests;
-+
-+ while (runp != NULL && runp->aiocbp->aiocb.aio_fildes < fildes)
-+ runp = runp->next_fd;
-+
-+ return (runp != NULL && runp->aiocbp->aiocb.aio_fildes == fildes
-+ ? runp : NULL);
-+}
-+
-+
-+void
-+internal_function
-+__aio_remove_request (struct requestlist *last, struct requestlist *req,
-+ int all)
-+{
-+ assert (req->running == yes || req->running == queued
-+ || req->running == done);
-+ assert (req->kioctx == KCTX_NONE);
-+
-+ if (last != NULL)
-+ last->next_prio = all ? NULL : req->next_prio;
-+ else
-+ {
-+ if (all || req->next_prio == NULL)
-+ {
-+ if (req->last_fd != NULL)
-+ req->last_fd->next_fd = req->next_fd;
-+ else
-+ requests = req->next_fd;
-+ if (req->next_fd != NULL)
-+ req->next_fd->last_fd = req->last_fd;
-+ }
-+ else
-+ {
-+ if (req->last_fd != NULL)
-+ req->last_fd->next_fd = req->next_prio;
-+ else
-+ requests = req->next_prio;
-+
-+ if (req->next_fd != NULL)
-+ req->next_fd->last_fd = req->next_prio;
-+
-+ req->next_prio->last_fd = req->last_fd;
-+ req->next_prio->next_fd = req->next_fd;
-+
-+ /* Mark this entry as runnable. */
-+ req->next_prio->running = yes;
-+ }
-+
-+ if (req->running == yes)
-+ {
-+ struct requestlist *runp = runlist;
-+
-+ last = NULL;
-+ while (runp != NULL)
-+ {
-+ if (runp == req)
-+ {
-+ if (last == NULL)
-+ runlist = runp->next_run;
-+ else
-+ last->next_run = runp->next_run;
-+ break;
-+ }
-+ last = runp;
-+ runp = runp->next_run;
-+ }
-+ }
-+ }
-+}
-+
-+void
-+internal_function
-+__aio_remove_krequest (struct requestlist *req)
-+{
-+ assert (req->running == yes || req->running == queued
-+ || req->running == done);
-+ assert (req->kioctx != KCTX_NONE);
-+
-+ if (req->prev_prio != NULL)
-+ {
-+ req->prev_prio->next_prio = req->next_prio;
-+ if (req->next_prio != NULL)
-+ req->next_prio->prev_prio = req->prev_prio;
-+ }
-+ else if (req->next_prio == NULL)
-+ {
-+ if (req->last_fd != NULL)
-+ req->last_fd->next_fd = req->next_fd;
-+ else
-+ krequests = req->next_fd;
-+ if (req->next_fd != NULL)
-+ req->next_fd->last_fd = req->last_fd;
-+ }
-+ else
-+ {
-+ if (req->last_fd != NULL)
-+ req->last_fd->next_fd = req->next_prio;
-+ else
-+ krequests = req->next_prio;
-+ if (req->next_fd != NULL)
-+ req->next_fd->last_fd = req->next_prio;
-+
-+ req->next_prio->prev_prio = NULL;
-+ req->next_prio->last_fd = req->last_fd;
-+ req->next_prio->next_fd = req->next_fd;
-+ }
-+}
-+
-+
-+/* The thread handler. */
-+static void *handle_fildes_io (void *arg);
-+static int wait_for_kernel_requests (int fildes);
-+
-+
-+/* User optimization. */
-+void
-+__aio_init (const struct aioinit *init)
-+{
-+ /* Get the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ /* Only allow writing new values if the table is not yet allocated. */
-+ if (pool == NULL)
-+ {
-+ optim.aio_threads = init->aio_threads < 1 ? 1 : init->aio_threads;
-+ optim.aio_num = (init->aio_num < ENTRIES_PER_ROW
-+ ? ENTRIES_PER_ROW
-+ : init->aio_num & ~ENTRIES_PER_ROW);
-+ }
-+
-+ if (init->aio_idle_time != 0)
-+ optim.aio_idle_time = init->aio_idle_time;
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+}
-+weak_alias (__aio_init, aio_init)
-+
-+static void
-+kernel_callback (kctx_t ctx, struct kiocb *kiocb, long res, long res2)
-+{
-+ struct requestlist *req = (struct requestlist *)kiocb;
-+ long errcode = 0;
-+
-+ if (res < 0 && res > -1000)
-+ {
-+ errcode = -res;
-+ res = -1;
-+ }
-+ req->aiocbp->aiocb.__return_value = res;
-+ atomic_write_barrier ();
-+ req->aiocbp->aiocb.__error_code = errcode;
-+ __aio_notify (req);
-+ assert (req->running == allocated);
-+ req->running = done;
-+ __aio_remove_krequest (req);
-+ __aio_free_request (req);
-+}
-+
-+void
-+internal_function
-+__aio_read_one_event (void)
-+{
-+ struct kio_event ev[10];
-+ struct timespec ts;
-+ int count, i;
-+
-+ if (__aio_kioctx == KCTX_NONE)
-+ return;
-+ ts.tv_sec = 0;
-+ ts.tv_nsec = 0;
-+ do
-+ {
-+ INTERNAL_SYSCALL_DECL (err);
-+ count = INTERNAL_SYSCALL (io_getevents, err, 5, __aio_kioctx, 0, 10,
-+ ev, &ts);
-+ if (INTERNAL_SYSCALL_ERROR_P (count, err) || count == 0)
-+ break;
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+ for (i = 0; i < count; i++)
-+ {
-+ void (*cb)(kctx_t, struct kiocb *, long, long);
-+
-+ cb = (void *) (uintptr_t) ev[i].kioe_data;
-+ cb (__aio_kioctx, (struct kiocb *) (uintptr_t) ev[i].kioe_obj,
-+ ev[i].kioe_res, ev[i].kioe_res2);
-+ }
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ }
-+ while (count == 10);
-+}
-+
-+int
-+internal_function
-+__aio_wait_for_events (kctx_t kctx, const struct timespec *timespec)
-+{
-+ int ret, i;
-+ struct kio_event ev[10];
-+ struct timespec ts;
-+ INTERNAL_SYSCALL_DECL (err);
-+
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ ts.tv_sec = 0;
-+ ts.tv_nsec = 0;
-+ do
-+ {
-+ ret = INTERNAL_SYSCALL (io_getevents, err, 5, kctx, 1, 10, ev,
-+ timespec);
-+ if (INTERNAL_SYSCALL_ERROR_P (ret, err) || ret == 0)
-+ break;
-+
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+ for (i = 0; i < ret; i++)
-+ {
-+ void (*cb)(kctx_t, struct kiocb *, long, long);
-+
-+ cb = (void *) (uintptr_t) ev[i].kioe_data;
-+ cb (kctx, (struct kiocb *) (uintptr_t) ev[i].kioe_obj,
-+ ev[i].kioe_res, ev[i].kioe_res2);
-+ }
-+ if (ret < 10)
-+ return 0;
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ timespec = &ts;
-+ }
-+ while (1);
-+
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+ return (timespec != &ts
-+ && INTERNAL_SYSCALL_ERROR_P (ret, err)
-+ && INTERNAL_SYSCALL_ERRNO (ret, err) == ETIMEDOUT) ? ETIMEDOUT : 0;
-+}
-+
-+int
-+internal_function
-+__aio_create_kernel_thread (void)
-+{
-+ pthread_t thid;
-+
-+ if (__kernel_thread_started)
-+ return 0;
-+
-+ if (aio_create_helper_thread (&thid, handle_kernel_aio, NULL) != 0)
-+ return -1;
-+ __kernel_thread_started = 1;
-+ return 0;
-+}
-+
-+static void *
-+handle_kernel_aio (void *arg __attribute__((unused)))
-+{
-+ int ret, i;
-+ INTERNAL_SYSCALL_DECL (err);
-+ struct kio_event ev[10];
-+
-+ for (;;)
-+ {
-+ ret = INTERNAL_SYSCALL (io_getevents, err, 5, __aio_kioctx, 1, 10, ev,
-+ NULL);
-+ if (INTERNAL_SYSCALL_ERROR_P (ret, err) || ret == 0)
-+ continue;
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+ for (i = 0; i < ret; i++)
-+ {
-+ void (*cb)(kctx_t, struct kiocb *, long, long);
-+
-+ cb = (void *) (uintptr_t) ev[i].kioe_data;
-+ cb (__aio_kioctx, (struct kiocb *) (uintptr_t) ev[i].kioe_obj,
-+ ev[i].kioe_res, ev[i].kioe_res2);
-+ }
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ }
-+ return NULL;
-+}
-+
-+static int
-+internal_function
-+add_request_to_list (struct requestlist *newp, int fildes, int prio)
-+{
-+ struct requestlist *last, *runp, *reqs;
-+
-+ last = NULL;
-+ reqs = newp->kioctx != KCTX_NONE ? krequests : requests;
-+ runp = reqs;
-+
-+ /* First look whether the current file descriptor is currently
-+ worked with. */
-+ while (runp != NULL
-+ && runp->aiocbp->aiocb.aio_fildes < fildes)
-+ {
-+ last = runp;
-+ runp = runp->next_fd;
-+ }
-+
-+ if (runp != NULL
-+ && runp->aiocbp->aiocb.aio_fildes == fildes)
-+ {
-+ /* The current file descriptor is worked on. It makes no sense
-+ to start another thread since this new thread would fight
-+ with the running thread for the resources. But we also cannot
-+ say that the thread processing this desriptor shall immediately
-+ after finishing the current job process this request if there
-+ are other threads in the running queue which have a higher
-+ priority. */
-+
-+ /* Simply enqueue it after the running one according to the
-+ priority. */
-+ while (runp->next_prio != NULL
-+ && runp->next_prio->aiocbp->aiocb.__abs_prio >= prio)
-+ runp = runp->next_prio;
-+
-+ newp->next_prio = runp->next_prio;
-+ runp->next_prio = newp;
-+ if (newp->kioctx != KCTX_NONE)
-+ {
-+ newp->prev_prio = runp;
-+ if (newp->next_prio != NULL)
-+ newp->next_prio->prev_prio = newp;
-+ }
-+ return queued;
-+ }
-+ else
-+ {
-+ /* Enqueue this request for a new descriptor. */
-+ if (last == NULL)
-+ {
-+ newp->last_fd = NULL;
-+ newp->next_fd = reqs;
-+ if (reqs != NULL)
-+ reqs->last_fd = newp;
-+ if (newp->kioctx != KCTX_NONE)
-+ krequests = newp;
-+ else
-+ requests = newp;
-+ }
-+ else
-+ {
-+ newp->next_fd = last->next_fd;
-+ newp->last_fd = last;
-+ last->next_fd = newp;
-+ if (newp->next_fd != NULL)
-+ newp->next_fd->last_fd = newp;
-+ }
-+
-+ newp->next_prio = NULL;
-+ if (newp->kioctx != KCTX_NONE)
-+ newp->prev_prio = NULL;
-+ return yes;
-+ }
-+}
-+
-+static int
-+internal_function
-+__aio_enqueue_user_request (struct requestlist *newp)
-+{
-+ int result = 0;
-+ int running = add_request_to_list (newp, newp->aiocbp->aiocb.aio_fildes,
-+ newp->aiocbp->aiocb.__abs_prio);
-+
-+ if (running == yes)
-+ {
-+ /* We try to create a new thread for this file descriptor. The
-+ function which gets called will handle all available requests
-+ for this descriptor and when all are processed it will
-+ terminate.
-+
-+ If no new thread can be created or if the specified limit of
-+ threads for AIO is reached we queue the request. */
-+
-+ /* See if we need to and are able to create a thread. */
-+ if (nthreads < optim.aio_threads && idle_thread_count == 0)
-+ {
-+ pthread_t thid;
-+
-+ running = newp->running = allocated;
-+
-+ /* Now try to start a thread. */
-+ result = aio_create_helper_thread (&thid, handle_fildes_io, newp);
-+ if (result == 0)
-+ /* We managed to enqueue the request. All errors which can
-+ happen now can be recognized by calls to `aio_return' and
-+ `aio_error'. */
-+ ++nthreads;
-+ else
-+ {
-+ /* Reset the running flag. The new request is not running. */
-+ running = newp->running = yes;
-+
-+ if (nthreads == 0)
-+ {
-+ /* We cannot create a thread in the moment and there is
-+ also no thread running. This is a problem. `errno' is
-+ set to EAGAIN if this is only a temporary problem. */
-+ __aio_remove_request (NULL, newp, 0);
-+ }
-+ else
-+ result = 0;
-+ }
-+ }
-+ }
-+
-+ /* Enqueue the request in the run queue if it is not yet running. */
-+ if (running == yes && result == 0)
-+ {
-+ add_request_to_runlist (newp);
-+
-+ /* If there is a thread waiting for work, then let it know that we
-+ have just given it something to do. */
-+ if (idle_thread_count > 0)
-+ pthread_cond_signal (&__aio_new_request_notification);
-+ }
-+
-+ if (result == 0)
-+ newp->running = running;
-+ return result;
-+}
-+
-+/* The main function of the async I/O handling. It enqueues requests
-+ and if necessary starts and handles threads. */
-+struct requestlist *
-+internal_function
-+__aio_enqueue_request_ctx (aiocb_union *aiocbp, int operation, kctx_t kctx)
-+{
-+ int policy, prio, result;
-+ struct sched_param param;
-+ struct requestlist *newp;
-+ int op = (operation & 0xffff);
-+
-+ if (op == LIO_SYNC || op == LIO_DSYNC)
-+ {
-+ aiocbp->aiocb.aio_reqprio = 0;
-+ /* FIXME: Kernel doesn't support sync yet. */
-+ operation &= ~LIO_KTHREAD;
-+ kctx = KCTX_NONE;
-+ }
-+ else if (aiocbp->aiocb.aio_reqprio < 0
-+ || aiocbp->aiocb.aio_reqprio > AIO_PRIO_DELTA_MAX)
-+ {
-+ /* Invalid priority value. */
-+ __set_errno (EINVAL);
-+ aiocbp->aiocb.__error_code = EINVAL;
-+ aiocbp->aiocb.__return_value = -1;
-+ return NULL;
-+ }
-+
-+ if ((operation & LIO_KTHREAD) || kctx != KCTX_NONE)
-+ {
-+ /* io_* is only really asynchronous for O_DIRECT or /dev/raw*. */
-+ int fl = __fcntl (aiocbp->aiocb.aio_fildes, F_GETFL);
-+ if (fl < 0 || (fl & O_DIRECT) == 0)
-+ {
-+ struct stat64 st;
-+ if (__fxstat64 (_STAT_VER, aiocbp->aiocb.aio_fildes, &st) < 0
-+ || ! S_ISCHR (st.st_mode)
-+ || major (st.st_rdev) != 162)
-+ {
-+ operation &= ~LIO_KTHREAD;
-+ kctx = KCTX_NONE;
-+ }
-+ }
-+ }
-+
-+ /* Compute priority for this request. */
-+ pthread_getschedparam (pthread_self (), &policy, ¶m);
-+ prio = param.sched_priority - aiocbp->aiocb.aio_reqprio;
-+
-+ /* Get the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ if (operation & LIO_KTHREAD)
-+ {
-+ if (__aio_kioctx == KCTX_NONE && !__have_no_kernel_aio)
-+ {
-+ int res;
-+ INTERNAL_SYSCALL_DECL (err);
-+
-+ __aio_kioctx = 0;
-+ do
-+ res = INTERNAL_SYSCALL (io_setup, err, 2, 1024, &__aio_kioctx);
-+ while (INTERNAL_SYSCALL_ERROR_P (res, err)
-+ && INTERNAL_SYSCALL_ERRNO (res, err) == EINTR);
-+ if (INTERNAL_SYSCALL_ERROR_P (res, err))
-+ {
-+ __have_no_kernel_aio = 1;
-+ __aio_kioctx = KCTX_NONE;
-+ }
-+ }
-+
-+ kctx = __aio_kioctx;
-+
-+ if (kctx != KCTX_NONE && !__kernel_thread_started
-+ && ((operation & LIO_KTHREAD_REQUIRED)
-+ || aiocbp->aiocb.aio_sigevent.sigev_notify != SIGEV_NONE))
-+ {
-+ if (__aio_create_kernel_thread () < 0)
-+ kctx = KCTX_NONE;
-+ }
-+ }
-+
-+ /* Get a new element for the waiting list. */
-+ newp = get_elem ();
-+ if (newp == NULL)
-+ {
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ __set_errno (EAGAIN);
-+ return NULL;
-+ }
-+ newp->aiocbp = aiocbp;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ newp->caller_pid = (aiocbp->aiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL
-+ ? getpid () : 0);
-+#endif
-+ newp->waiting = NULL;
-+ newp->kioctx = kctx;
-+
-+ aiocbp->aiocb.__abs_prio = prio;
-+ aiocbp->aiocb.__policy = policy;
-+ aiocbp->aiocb.aio_lio_opcode = op;
-+ aiocbp->aiocb.__error_code = EINPROGRESS;
-+ aiocbp->aiocb.__return_value = 0;
-+
-+ if (newp->kioctx != KCTX_NONE)
-+ {
-+ int res;
-+ INTERNAL_SYSCALL_DECL (err);
-+
-+ aiocb_union *aiocbp = newp->aiocbp;
-+ struct kiocb *kiocbs[] __attribute__((unused)) = { &newp->kiocb };
-+
-+ newp->kiocb.kiocb_data = (uintptr_t) kernel_callback;
-+ switch (op & 127)
-+ {
-+ case LIO_READ: newp->kiocb.kiocb_lio_opcode = IO_CMD_PREAD; break;
-+ case LIO_WRITE: newp->kiocb.kiocb_lio_opcode = IO_CMD_PWRITE; break;
-+ case LIO_SYNC:
-+ case LIO_DSYNC: newp->kiocb.kiocb_lio_opcode = IO_CMD_FSYNC; break;
-+ }
-+ if (op & 128)
-+ newp->kiocb.kiocb_offset = aiocbp->aiocb64.aio_offset;
-+ else
-+ newp->kiocb.kiocb_offset = aiocbp->aiocb.aio_offset;
-+ newp->kiocb.kiocb_fildes = aiocbp->aiocb.aio_fildes;
-+ newp->kiocb.kiocb_buf = (uintptr_t) aiocbp->aiocb.aio_buf;
-+ newp->kiocb.kiocb_nbytes = aiocbp->aiocb.aio_nbytes;
-+ /* FIXME. */
-+ newp->kiocb.kiocb_req_prio = 0;
-+ res = INTERNAL_SYSCALL (io_submit, err, 3, newp->kioctx, 1, kiocbs);
-+ if (! INTERNAL_SYSCALL_ERROR_P (res, err))
-+ {
-+ newp->running = allocated;
-+ add_request_to_list (newp, aiocbp->aiocb.aio_fildes, prio);
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ return newp;
-+ }
-+ newp->kioctx = KCTX_NONE;
-+ }
-+
-+ result = __aio_enqueue_user_request (newp);
-+ if (result)
-+ {
-+ /* Something went wrong. */
-+ __aio_free_request (newp);
-+ aiocbp->aiocb.__error_code = result;
-+ __set_errno (result);
-+ newp = NULL;
-+ }
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+
-+ return newp;
-+}
-+
-+
-+static int
-+wait_for_kernel_requests (int fildes)
-+{
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ struct requestlist *kreq = __aio_find_kreq_fd (fildes), *req;
-+ int nent = 0;
-+ int ret = 0;
-+
-+ req = kreq;
-+ while (req)
-+ {
-+ if (req->running == allocated)
-+ ++nent;
-+ req = req->next_prio;
-+ }
-+
-+ if (nent)
-+ {
-+ if (__aio_create_kernel_thread () < 0)
-+ {
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ return -1;
-+ }
-+
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-+#endif
-+ struct waitlist waitlist[nent];
-+ int cnt = 0;
-+
-+ while (kreq)
-+ {
-+ if (kreq->running == allocated)
-+ {
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ waitlist[cnt].cond = &cond;
-+#endif
-+ waitlist[cnt].result = NULL;
-+ waitlist[cnt].next = kreq->waiting;
-+ waitlist[cnt].counterp = &nent;
-+ waitlist[cnt].sigevp = NULL;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ waitlist[cnt].caller_pid = 0; /* Not needed. */
-+#endif
-+ kreq->waiting = &waitlist[cnt++];
-+ }
-+ kreq = kreq->next_prio;
-+ }
-+
-+#ifdef DONT_NEED_AIO_MISC_COND
-+ AIO_MISC_WAIT (ret, nent, NULL, 0);
-+#else
-+ do
-+ pthread_cond_wait (&cond, &__aio_requests_mutex);
-+ while (nent);
-+
-+ pthread_cond_destroy (&cond);
-+#endif
-+ }
-+
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ return ret;
-+}
-+
-+
-+static void *
-+handle_fildes_io (void *arg)
-+{
-+ pthread_t self = pthread_self ();
-+ struct sched_param param;
-+ struct requestlist *runp = (struct requestlist *) arg;
-+ aiocb_union *aiocbp;
-+ int policy;
-+ int fildes;
-+
-+ pthread_getschedparam (self, &policy, ¶m);
-+
-+ do
-+ {
-+ /* If runp is NULL, then we were created to service the work queue
-+ in general, not to handle any particular request. In that case we
-+ skip the "do work" stuff on the first pass, and go directly to the
-+ "get work off the work queue" part of this loop, which is near the
-+ end. */
-+ if (runp == NULL)
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+ else
-+ {
-+ /* Hopefully this request is marked as running. */
-+ assert (runp->running == allocated);
-+
-+ /* Update our variables. */
-+ aiocbp = runp->aiocbp;
-+ fildes = aiocbp->aiocb.aio_fildes;
-+
-+ /* Change the priority to the requested value (if necessary). */
-+ if (aiocbp->aiocb.__abs_prio != param.sched_priority
-+ || aiocbp->aiocb.__policy != policy)
-+ {
-+ param.sched_priority = aiocbp->aiocb.__abs_prio;
-+ policy = aiocbp->aiocb.__policy;
-+ pthread_setschedparam (self, policy, ¶m);
-+ }
-+
-+ /* Process request pointed to by RUNP. We must not be disturbed
-+ by signals. */
-+ if ((aiocbp->aiocb.aio_lio_opcode & 127) == LIO_READ)
-+ {
-+ if (aiocbp->aiocb.aio_lio_opcode & 128)
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (__pread64 (fildes, (void *)
-+ aiocbp->aiocb64.aio_buf,
-+ aiocbp->aiocb64.aio_nbytes,
-+ aiocbp->aiocb64.aio_offset));
-+ else
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (pread (fildes,
-+ (void *) aiocbp->aiocb.aio_buf,
-+ aiocbp->aiocb.aio_nbytes,
-+ aiocbp->aiocb.aio_offset));
-+
-+ if (aiocbp->aiocb.__return_value == -1 && errno == ESPIPE)
-+ /* The Linux kernel is different from others. It returns
-+ ESPIPE if using pread on a socket. Other platforms
-+ simply ignore the offset parameter and behave like
-+ read. */
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (read (fildes,
-+ (void *) aiocbp->aiocb64.aio_buf,
-+ aiocbp->aiocb64.aio_nbytes));
-+ }
-+ else if ((aiocbp->aiocb.aio_lio_opcode & 127) == LIO_WRITE)
-+ {
-+ if (aiocbp->aiocb.aio_lio_opcode & 128)
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (__pwrite64 (fildes, (const void *)
-+ aiocbp->aiocb64.aio_buf,
-+ aiocbp->aiocb64.aio_nbytes,
-+ aiocbp->aiocb64.aio_offset));
-+ else
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (__libc_pwrite (fildes, (const void *)
-+ aiocbp->aiocb.aio_buf,
-+ aiocbp->aiocb.aio_nbytes,
-+ aiocbp->aiocb.aio_offset));
-+
-+ if (aiocbp->aiocb.__return_value == -1 && errno == ESPIPE)
-+ /* The Linux kernel is different from others. It returns
-+ ESPIPE if using pwrite on a socket. Other platforms
-+ simply ignore the offset parameter and behave like
-+ write. */
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (write (fildes,
-+ (void *) aiocbp->aiocb64.aio_buf,
-+ aiocbp->aiocb64.aio_nbytes));
-+ }
-+ else if (aiocbp->aiocb.aio_lio_opcode == LIO_DSYNC
-+ || aiocbp->aiocb.aio_lio_opcode == LIO_SYNC)
-+ {
-+ if (wait_for_kernel_requests (fildes) < 0)
-+ {
-+ aiocbp->aiocb.__return_value = -1;
-+ __set_errno (ENOMEM);
-+ }
-+ else if (aiocbp->aiocb.aio_lio_opcode == LIO_DSYNC)
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (fdatasync (fildes));
-+ else
-+ aiocbp->aiocb.__return_value =
-+ TEMP_FAILURE_RETRY (fsync (fildes));
-+ }
-+ else
-+ {
-+ /* This is an invalid opcode. */
-+ aiocbp->aiocb.__return_value = -1;
-+ __set_errno (EINVAL);
-+ }
-+
-+ /* Get the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ /* In theory we would need here a write memory barrier since the
-+ callers test using aio_error() whether the request finished
-+ and once this value != EINPROGRESS the field __return_value
-+ must be committed to memory.
-+
-+ But since the pthread_mutex_lock call involves write memory
-+ barriers as well it is not necessary. */
-+
-+ if (aiocbp->aiocb.__return_value == -1)
-+ aiocbp->aiocb.__error_code = errno;
-+ else
-+ aiocbp->aiocb.__error_code = 0;
-+
-+ /* Send the signal to notify about finished processing of the
-+ request. */
-+ __aio_notify (runp);
-+
-+ /* For debugging purposes we reset the running flag of the
-+ finished request. */
-+ assert (runp->running == allocated);
-+ runp->running = done;
-+
-+ /* Now dequeue the current request. */
-+ __aio_remove_request (NULL, runp, 0);
-+ if (runp->next_prio != NULL)
-+ add_request_to_runlist (runp->next_prio);
-+
-+ /* Free the old element. */
-+ __aio_free_request (runp);
-+ }
-+
-+ runp = runlist;
-+
-+ /* If the runlist is empty, then we sleep for a while, waiting for
-+ something to arrive in it. */
-+ if (runp == NULL && optim.aio_idle_time >= 0)
-+ {
-+ struct timeval now;
-+ struct timespec wakeup_time;
-+
-+ ++idle_thread_count;
-+ gettimeofday (&now, NULL);
-+ wakeup_time.tv_sec = now.tv_sec + optim.aio_idle_time;
-+ wakeup_time.tv_nsec = now.tv_usec * 1000;
-+ if (wakeup_time.tv_nsec > 1000000000)
-+ {
-+ wakeup_time.tv_nsec -= 1000000000;
-+ ++wakeup_time.tv_sec;
-+ }
-+ pthread_cond_timedwait (&__aio_new_request_notification,
-+ &__aio_requests_mutex,
-+ &wakeup_time);
-+ --idle_thread_count;
-+ runp = runlist;
-+ }
-+
-+ if (runp == NULL)
-+ --nthreads;
-+ else
-+ {
-+ assert (runp->running == yes);
-+ runp->running = allocated;
-+ runlist = runp->next_run;
-+
-+ /* If we have a request to process, and there's still another in
-+ the run list, then we need to either wake up or create a new
-+ thread to service the request that is still in the run list. */
-+ if (runlist != NULL)
-+ {
-+ /* There are at least two items in the work queue to work on.
-+ If there are other idle threads, then we should wake them
-+ up for these other work elements; otherwise, we should try
-+ to create a new thread. */
-+ if (idle_thread_count > 0)
-+ pthread_cond_signal (&__aio_new_request_notification);
-+ else if (nthreads < optim.aio_threads)
-+ {
-+ pthread_t thid;
-+
-+ /* Now try to start a thread. If we fail, no big deal,
-+ because we know that there is at least one thread (us)
-+ that is working on AIO operations. */
-+ if (aio_create_helper_thread (&thid, handle_fildes_io, NULL)
-+ == 0)
-+ ++nthreads;
-+ }
-+ }
-+ }
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+ }
-+ while (runp != NULL);
-+
-+ return NULL;
-+}
-+
-+
-+/* Free allocated resources. */
-+libc_freeres_fn (free_res)
-+{
-+ size_t row;
-+
-+ for (row = 0; row < pool_max_size; ++row)
-+ free (pool[row]);
-+
-+ free (pool);
-+}
-+
-+
-+/* Add newrequest to the runlist. The __abs_prio flag of newrequest must
-+ be correctly set to do this. Also, you had better set newrequest's
-+ "running" flag to "yes" before you release your lock or you'll throw an
-+ assertion. */
-+static void
-+internal_function
-+add_request_to_runlist (struct requestlist *newrequest)
-+{
-+ int prio = newrequest->aiocbp->aiocb.__abs_prio;
-+ struct requestlist *runp;
-+
-+ if (runlist == NULL || runlist->aiocbp->aiocb.__abs_prio < prio)
-+ {
-+ newrequest->next_run = runlist;
-+ runlist = newrequest;
-+ }
-+ else
-+ {
-+ runp = runlist;
-+
-+ while (runp->next_run != NULL
-+ && runp->next_run->aiocbp->aiocb.__abs_prio >= prio)
-+ runp = runp->next_run;
-+
-+ newrequest->next_run = runp->next_run;
-+ runp->next_run = newrequest;
-+ }
-+}
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.h glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.h
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.h 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_misc.h 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,329 @@
-+/* Copyright (C) 1997,1999,2000,2001,2002,2003,2006
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _AIO_MISC_H
-+
-+#include <sysdep.h>
-+
-+#if !defined __NR_io_setup || !defined __NR_io_destroy \
-+ || !defined __NR_io_getevents || !defined __NR_io_submit \
-+ || !defined __NR_io_cancel
-+
-+#include <aio_misc.h>
-+
-+#else
-+
-+#define _AIO_MISC_H 1
-+#define USE_KAIO 1
-+
-+#include <aio.h>
-+#include <pthread.h>
-+#include <stdint.h>
-+#include <signal.h>
-+#include <sysdep.h>
-+#include <limits.h>
-+
-+#ifdef HAVE_FORCED_UNWIND
-+
-+/* We define a special synchronization primitive for AIO. POSIX
-+ conditional variables would be ideal but the pthread_cond_*wait
-+ operations do not return on EINTR. This is a requirement for
-+ correct aio_suspend and lio_listio implementations. */
-+
-+#include <assert.h>
-+#include <nptl/pthreadP.h>
-+#include <lowlevellock.h>
-+
-+# define DONT_NEED_AIO_MISC_COND 1
-+
-+# define AIO_MISC_NOTIFY(waitlist) \
-+ do { \
-+ if (*waitlist->counterp > 0 && --*waitlist->counterp == 0) \
-+ lll_futex_wake (waitlist->counterp, 1, LLL_PRIVATE); \
-+ } while (0)
-+
-+# define AIO_MISC_WAIT(result, futex, timeout, cancel) \
-+ do { \
-+ volatile int *futexaddr = &futex; \
-+ int oldval = futex; \
-+ \
-+ if (oldval != 0) \
-+ { \
-+ pthread_mutex_unlock (&__aio_requests_mutex); \
-+ \
-+ int oldtype; \
-+ if (cancel) \
-+ oldtype = LIBC_CANCEL_ASYNC (); \
-+ \
-+ int status; \
-+ do \
-+ { \
-+ status = lll_futex_timed_wait (futexaddr, oldval, timeout, \
-+ LLL_PRIVATE); \
-+ if (status != -EWOULDBLOCK) \
-+ break; \
-+ \
-+ oldval = *futexaddr; \
-+ } \
-+ while (oldval != 0); \
-+ \
-+ if (cancel) \
-+ LIBC_CANCEL_RESET (oldtype); \
-+ \
-+ if (status == -EINTR) \
-+ result = EINTR; \
-+ else if (status == -ETIMEDOUT) \
-+ result = EAGAIN; \
-+ else \
-+ assert (status == 0 || status == -EWOULDBLOCK); \
-+ \
-+ pthread_mutex_lock (&__aio_requests_mutex); \
-+ } \
-+ } while (0)
-+
-+#endif
-+
-+typedef unsigned long kctx_t;
-+#define KCTX_NONE ~0UL
-+extern kctx_t __aio_kioctx;
-+
-+enum
-+{
-+ IO_CMD_PREAD,
-+ IO_CMD_PWRITE,
-+ IO_CMD_FSYNC,
-+ IO_CMD_FDSYNC,
-+ IO_CMD_PREADX,
-+ IO_CMD_POLL
-+};
-+
-+struct kiocb
-+{
-+ uint64_t kiocb_data;
-+ uint64_t kiocb_key;
-+ uint16_t kiocb_lio_opcode;
-+ int16_t kiocb_req_prio;
-+ uint32_t kiocb_fildes;
-+ uint64_t kiocb_buf;
-+ uint64_t kiocb_nbytes;
-+ int64_t kiocb_offset;
-+ int64_t __pad3, __pad4;
-+};
-+
-+struct kio_event
-+{
-+ uint64_t kioe_data;
-+ uint64_t kioe_obj;
-+ int64_t kioe_res;
-+ int64_t kioe_res2;
-+};
-+
-+/* Extend the operation enum. */
-+enum
-+{
-+ LIO_DSYNC = LIO_NOP + 1,
-+ LIO_SYNC,
-+ LIO_READ64 = LIO_READ | 128,
-+ LIO_WRITE64 = LIO_WRITE | 128,
-+ LIO_KTHREAD = 0x10000,
-+ LIO_KTHREAD_REQUIRED = 0x20000
-+};
-+
-+
-+/* Union of the two request types. */
-+typedef union
-+ {
-+ struct aiocb aiocb;
-+ struct aiocb64 aiocb64;
-+ } aiocb_union;
-+
-+
-+/* Used to synchronize. */
-+struct waitlist
-+ {
-+ struct waitlist *next;
-+
-+ /* The next two fields is used in synchronous io_listio' operations. */
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ pthread_cond_t *cond;
-+#endif
-+ int *result;
-+
-+ volatile int *counterp;
-+ /* The next field is used in asynchronous `lio_listio' operations. */
-+ struct sigevent *sigevp;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ /* XXX See requestlist, it's used to work around the broken signal
-+ handling in Linux. */
-+ pid_t caller_pid;
-+#endif
-+ };
-+
-+
-+/* Status of a request. */
-+enum
-+{
-+ no,
-+ queued,
-+ yes,
-+ allocated,
-+ done
-+};
-+
-+
-+/* Used to queue requests.. */
-+struct requestlist
-+ {
-+ struct kiocb kiocb;
-+ kctx_t kioctx;
-+
-+ int running;
-+
-+ struct requestlist *last_fd;
-+ struct requestlist *next_fd;
-+ struct requestlist *next_prio;
-+ struct requestlist *next_run;
-+ /* For kioctx != KCTX_NONE requests we are doubly linked. */
-+#define prev_prio next_run
-+
-+ /* Pointer to the actual data. */
-+ aiocb_union *aiocbp;
-+
-+#ifdef BROKEN_THREAD_SIGNALS
-+ /* PID of the initiator thread.
-+ XXX This is only necessary for the broken signal handling on Linux. */
-+ pid_t caller_pid;
-+#endif
-+
-+ /* List of waiting processes. */
-+ struct waitlist *waiting;
-+ };
-+
-+
-+/* Lock for global I/O list of requests. */
-+extern pthread_mutex_t __aio_requests_mutex attribute_hidden;
-+
-+
-+/* Enqueue request. */
-+extern struct requestlist *__aio_enqueue_request_ctx (aiocb_union *aiocbp,
-+ int operation,
-+ kctx_t kctx)
-+ attribute_hidden internal_function;
-+
-+#define __aio_enqueue_request(aiocbp, operation) \
-+ __aio_enqueue_request_ctx (aiocbp, operation | LIO_KTHREAD, KCTX_NONE)
-+
-+/* Find request entry for given AIO control block. */
-+extern struct requestlist *__aio_find_req (aiocb_union *elem)
-+ attribute_hidden internal_function;
-+
-+/* Find request entry for given file descriptor. */
-+extern struct requestlist *__aio_find_req_fd (int fildes)
-+ attribute_hidden internal_function;
-+
-+/* Find request entry for given file descriptor. */
-+extern struct requestlist *__aio_find_kreq_fd (int fildes)
-+ attribute_hidden internal_function;
-+
-+/* Remove request from the list. */
-+extern void __aio_remove_request (struct requestlist *last,
-+ struct requestlist *req, int all)
-+ attribute_hidden internal_function;
-+
-+extern void __aio_remove_krequest (struct requestlist *req)
-+ attribute_hidden internal_function;
-+
-+/* Release the entry for the request. */
-+extern void __aio_free_request (struct requestlist *req)
-+ attribute_hidden internal_function;
-+
-+/* Notify initiator of request and tell this everybody listening. */
-+extern void __aio_notify (struct requestlist *req)
-+ attribute_hidden internal_function;
-+
-+/* Notify initiator of request. */
-+#ifdef BROKEN_THREAD_SIGNALS
-+extern int __aio_notify_only (struct sigevent *sigev, pid_t caller_pid)
-+ attribute_hidden internal_function;
-+#else
-+extern int __aio_notify_only (struct sigevent *sigev)
-+ attribute_hidden internal_function;
-+#endif
-+
-+/* Send the signal. */
-+extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
-+ attribute_hidden internal_function;
-+
-+extern int __aio_wait_for_events (kctx_t kctx, const struct timespec *timeout)
-+ attribute_hidden internal_function;
-+
-+extern void __aio_read_one_event (void) attribute_hidden internal_function;
-+
-+extern int __aio_create_kernel_thread (void)
-+ attribute_hidden internal_function;
-+
-+extern int __have_no_kernel_aio attribute_hidden;
-+extern int __kernel_thread_started attribute_hidden;
-+
-+#ifndef BROKEN_THREAD_SIGNALS
-+# define aio_start_notify_thread __aio_start_notify_thread
-+# define aio_create_helper_thread __aio_create_helper_thread
-+
-+extern inline void
-+__aio_start_notify_thread (void)
-+{
-+ sigset_t ss;
-+ sigemptyset (&ss);
-+ INTERNAL_SYSCALL_DECL (err);
-+ INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
-+}
-+
-+extern inline int
-+__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
-+{
-+ pthread_attr_t attr;
-+
-+ /* Make sure the thread is created detached. */
-+ pthread_attr_init (&attr);
-+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
-+
-+ /* The helper thread needs only very little resources. */
-+ (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
-+
-+ /* Block all signals in the helper thread. To do this thoroughly we
-+ temporarily have to block all signals here. */
-+ sigset_t ss;
-+ sigset_t oss;
-+ sigfillset (&ss);
-+ INTERNAL_SYSCALL_DECL (err);
-+ INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8);
-+
-+ int ret = pthread_create (threadp, &attr, tf, arg);
-+
-+ /* Restore the signal mask. */
-+ INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL,
-+ _NSIG / 8);
-+
-+ (void) pthread_attr_destroy (&attr);
-+ return ret;
-+}
-+#endif
-+
-+#endif
-+#endif /* aio_misc.h */
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_notify.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_notify.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_notify.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_notify.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,2 @@
-+#include <kaio_misc.h>
-+#include <aio_notify.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_read64.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_read64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_read64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_read64.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,2 @@
-+#include <kaio_misc.h>
-+#include <aio_read64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_read.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_read.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_read.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_read.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,4 @@
-+#define aio_read64 __renamed_aio_read64
-+#include <kaio_misc.h>
-+#undef aio_read64
-+#include <aio_read.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_return.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_return.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_return.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_return.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,50 @@
-+/* Return exit value of asynchronous I/O request.
-+ Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+
-+/* We use an UGLY hack to prevent gcc from finding us cheating. The
-+ implementation of aio_return and aio_return64 are identical and so
-+ we want to avoid code duplication by using aliases. But gcc sees
-+ the different parameter lists and prints a warning. We define here
-+ a function so that aio_return64 has no prototype. */
-+#define aio_return64 XXX
-+#include <aio.h>
-+/* And undo the hack. */
-+#undef aio_return64
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <aio_return.c>
-+#else
-+
-+#include <errno.h>
-+
-+ssize_t
-+aio_return (aiocbp)
-+ struct aiocb *aiocbp;
-+{
-+ if (aiocbp->__error_code == EINPROGRESS)
-+ __aio_read_one_event ();
-+ return aiocbp->__return_value;
-+}
-+
-+weak_alias (aio_return, aio_return64)
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_sigqueue.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_sigqueue.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_sigqueue.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_sigqueue.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,2 @@
-+#include <kaio_misc.h>
-+#include <aio_sigqueue.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_suspend.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_suspend.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_suspend.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_suspend.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,327 @@
-+/* Suspend until termination of a requests.
-+ Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2006
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+
-+/* We use an UGLY hack to prevent gcc from finding us cheating. The
-+ implementations of aio_suspend and aio_suspend64 are identical and so
-+ we want to avoid code duplication by using aliases. But gcc sees
-+ the different parameter lists and prints a warning. We define here
-+ a function so that aio_suspend64 has no prototype. */
-+#define aio_suspend64 XXX
-+#include <aio.h>
-+/* And undo the hack. */
-+#undef aio_suspend64
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <aio_suspend.c>
-+#else
-+
-+#include <assert.h>
-+#include <errno.h>
-+#include <stdbool.h>
-+#include <stdlib.h>
-+#include <sys/time.h>
-+
-+#include <bits/libc-lock.h>
-+#include <sysdep-cancel.h>
-+
-+
-+struct clparam
-+{
-+ const struct aiocb *const *list;
-+ struct waitlist *waitlist;
-+ struct requestlist **requestlist;
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ pthread_cond_t *cond;
-+#endif
-+ int nent;
-+};
-+
-+
-+static void
-+cleanup (void *arg)
-+{
-+#ifdef DONT_NEED_AIO_MISC_COND
-+ /* Acquire the mutex. If pthread_cond_*wait is used this would
-+ happen implicitly. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+#endif
-+
-+ const struct clparam *param = (const struct clparam *) arg;
-+
-+ /* Now remove the entry in the waiting list for all requests
-+ which didn't terminate. */
-+ int cnt = param->nent;
-+ while (cnt-- > 0)
-+ if (param->list[cnt] != NULL
-+ && param->list[cnt]->__error_code == EINPROGRESS)
-+ {
-+ struct waitlist **listp;
-+
-+ assert (param->requestlist[cnt] != NULL);
-+
-+ /* There is the chance that we cannot find our entry anymore. This
-+ could happen if the request terminated and restarted again. */
-+ listp = ¶m->requestlist[cnt]->waiting;
-+ while (*listp != NULL && *listp != ¶m->waitlist[cnt])
-+ listp = &(*listp)->next;
-+
-+ if (*listp != NULL)
-+ *listp = (*listp)->next;
-+ }
-+
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ /* Release the conditional variable. */
-+ (void) pthread_cond_destroy (param->cond);
-+#endif
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+}
-+
-+
-+int
-+aio_suspend (list, nent, timeout)
-+ const struct aiocb *const list[];
-+ int nent;
-+ const struct timespec *timeout;
-+{
-+ if (__builtin_expect (nent < 0, 0))
-+ {
-+ __set_errno (EINVAL);
-+ return -1;
-+ }
-+
-+ struct waitlist waitlist[nent];
-+ struct requestlist *requestlist[nent];
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-+#endif
-+ int cnt;
-+ int result = 0;
-+ int cntr = 1;
-+ int total = 0, ktotal = 0;
-+
-+ /* Request the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ /* There is not yet a finished request. Signal the request that
-+ we are working for it. */
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ if (list[cnt] != NULL)
-+ {
-+ if (list[cnt]->__error_code == EINPROGRESS)
-+ {
-+ requestlist[cnt] = __aio_find_req ((aiocb_union *) list[cnt]);
-+
-+ if (requestlist[cnt] != NULL)
-+ {
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ waitlist[cnt].cond = &cond;
-+#endif
-+ waitlist[cnt].result = NULL;
-+ waitlist[cnt].next = requestlist[cnt]->waiting;
-+ waitlist[cnt].counterp = &cntr;
-+ waitlist[cnt].sigevp = NULL;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ waitlist[cnt].caller_pid = 0; /* Not needed. */
-+#endif
-+ requestlist[cnt]->waiting = &waitlist[cnt];
-+ total++;
-+ if (requestlist[cnt]->kioctx != KCTX_NONE)
-+ ktotal++;
-+ }
-+ else
-+ /* We will never suspend. */
-+ break;
-+ }
-+ else
-+ /* We will never suspend. */
-+ break;
-+ }
-+
-+
-+ /* Only if none of the entries is NULL or finished to be wait. */
-+ if (cnt == nent && total)
-+ {
-+ struct clparam clparam =
-+ {
-+ .list = list,
-+ .waitlist = waitlist,
-+ .requestlist = requestlist,
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ .cond = &cond,
-+#endif
-+ .nent = nent
-+ };
-+
-+ pthread_cleanup_push (cleanup, &clparam);
-+
-+ if (!__kernel_thread_started && ktotal)
-+ {
-+ /* If the kernel aio thread was not started yet all requests
-+ are served by the kernel and there are no other threads running,
-+ read events with mutex hold, so that nobody else can get them
-+ instead of us here. */
-+ if (SINGLE_THREAD_P && total == ktotal)
-+ {
-+ if (timeout == NULL)
-+ {
-+ while (cntr == 1)
-+ __aio_wait_for_events (__aio_kioctx, NULL);
-+ }
-+ else
-+ {
-+ struct timeval now;
-+ struct timespec abstime, ts;
-+
-+ __gettimeofday (&now, NULL);
-+ abstime.tv_nsec = timeout->tv_nsec + now.tv_usec * 1000;
-+ abstime.tv_sec = timeout->tv_sec + now.tv_sec;
-+ if (abstime.tv_nsec >= 1000000000)
-+ {
-+ abstime.tv_nsec -= 1000000000;
-+ abstime.tv_sec += 1;
-+ }
-+
-+ for (;;)
-+ {
-+ result = __aio_wait_for_events (__aio_kioctx, timeout);
-+ if (cntr < 1)
-+ break;
-+ if (result == ETIMEDOUT)
-+ break;
-+
-+ __gettimeofday (&now, NULL);
-+ if (now.tv_sec > abstime.tv_sec
-+ || (now.tv_sec == abstime.tv_sec
-+ && now.tv_usec * 1000 >= abstime.tv_nsec))
-+ break;
-+
-+ ts.tv_nsec = abstime.tv_nsec - now.tv_usec * 1000;
-+ ts.tv_sec = abstime.tv_sec - now.tv_sec;
-+ if (abstime.tv_nsec < now.tv_usec * 1000)
-+ {
-+ ts.tv_nsec += 1000000000;
-+ ts.tv_sec -= 1;
-+ }
-+ timeout = &ts;
-+ }
-+
-+ if (cntr < 1)
-+ result = 0;
-+ else
-+ result = ETIMEDOUT;
-+ }
-+ total = 0;
-+ }
-+ else if (__aio_create_kernel_thread () < 0)
-+ {
-+ total = 0;
-+ __set_errno (ENOMEM);
-+ result = -1;
-+ }
-+ }
-+
-+ if (total == 0)
-+ /* Suspending was handled above. */
-+ ;
-+#ifdef DONT_NEED_AIO_MISC_COND
-+ else
-+ AIO_MISC_WAIT (result, cntr, timeout, 1);
-+#else
-+ else if (timeout == NULL)
-+ result = pthread_cond_wait (&cond, &__aio_requests_mutex);
-+ else
-+ {
-+ /* We have to convert the relative timeout value into an
-+ absolute time value with pthread_cond_timedwait expects. */
-+ struct timeval now;
-+ struct timespec abstime;
-+
-+ __gettimeofday (&now, NULL);
-+ abstime.tv_nsec = timeout->tv_nsec + now.tv_usec * 1000;
-+ abstime.tv_sec = timeout->tv_sec + now.tv_sec;
-+ if (abstime.tv_nsec >= 1000000000)
-+ {
-+ abstime.tv_nsec -= 1000000000;
-+ abstime.tv_sec += 1;
-+ }
-+
-+ result = pthread_cond_timedwait (&cond, &__aio_requests_mutex,
-+ &abstime);
-+ }
-+#endif
-+
-+ pthread_cleanup_pop (0);
-+ }
-+
-+ /* Now remove the entry in the waiting list for all requests
-+ which didn't terminate. */
-+ while (cnt-- > 0)
-+ if (list[cnt] != NULL && list[cnt]->__error_code == EINPROGRESS)
-+ {
-+ struct waitlist **listp;
-+
-+ assert (requestlist[cnt] != NULL);
-+
-+ /* There is the chance that we cannot find our entry anymore. This
-+ could happen if the request terminated and restarted again. */
-+ listp = &requestlist[cnt]->waiting;
-+ while (*listp != NULL && *listp != &waitlist[cnt])
-+ listp = &(*listp)->next;
-+
-+ if (*listp != NULL)
-+ *listp = (*listp)->next;
-+ }
-+
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ /* Release the conditional variable. */
-+ if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0))
-+ /* This must never happen. */
-+ abort ();
-+#endif
-+
-+ if (result != 0)
-+ {
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ /* An error occurred. Possibly it's ETIMEDOUT. We have to translate
-+ the timeout error report of `pthread_cond_timedwait' to the
-+ form expected from `aio_suspend'. */
-+ if (result == ETIMEDOUT)
-+ __set_errno (EAGAIN);
-+ else
-+#endif
-+ __set_errno (result);
-+
-+ result = -1;
-+ }
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+
-+ return result;
-+}
-+
-+weak_alias (aio_suspend, aio_suspend64)
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_write64.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_write64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_write64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_write64.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,2 @@
-+#include <kaio_misc.h>
-+#include <aio_write64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_write.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_write.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/kaio_write.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/kaio_write.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,4 @@
-+#define aio_write64 __renamed_aio_write64
-+#include <kaio_misc.h>
-+#undef aio_write64
-+#include <aio_write.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/klio_listio64.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/klio_listio64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/klio_listio64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/klio_listio64.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,40 @@
-+/* Enqueue and list of read or write requests, 64bit offset version.
-+ Copyright (C) 1997, 1998, 1999, 2003, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <lio_listio64.c>
-+#else
-+
-+#include <aio.h>
-+#include <assert.h>
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+
-+#define lio_listio lio_listio64
-+#define __lio_listio_21 __lio_listio64_21
-+#define __lio_listio_item_notify __lio_listio64_item_notify
-+#define aiocb aiocb64
-+#define LIO_OPCODE_BASE 128
-+#include <klio_listio.c>
-+
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/klio_listio.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/klio_listio.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/klio_listio.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/klio_listio.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,322 @@
-+/* Enqueue and list of read or write requests.
-+ Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <kaio_misc.h>
-+
-+#ifndef USE_KAIO
-+#include <lio_listio.c>
-+#else
-+
-+#ifndef lio_listio
-+#include <aio.h>
-+#include <assert.h>
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+
-+#define LIO_OPCODE_BASE 0
-+#endif
-+
-+#include <shlib-compat.h>
-+
-+
-+/* We need this special structure to handle asynchronous I/O. */
-+struct async_waitlist
-+ {
-+ int counter;
-+ struct sigevent sigev;
-+ struct waitlist list[0];
-+ };
-+
-+
-+/* The code in glibc 2.1 to glibc 2.4 issued only one event when all
-+ requests submitted with lio_listio finished. The existing practice
-+ is to issue events for the individual requests as well. This is
-+ what the new code does. */
-+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
-+# define LIO_MODE(mode) ((mode) & 127)
-+# define NO_INDIVIDUAL_EVENT_P(mode) ((mode) & 128)
-+#else
-+# define LIO_MODE(mode) mode
-+# define NO_INDIVIDUAL_EVENT_P(mode) 0
-+#endif
-+
-+
-+static int
-+lio_listio_internal (int mode, struct aiocb *const list[], int nent,
-+ struct sigevent *sig)
-+{
-+ struct sigevent defsigev;
-+ struct requestlist *requests[nent];
-+ int cnt;
-+ volatile int total = 0;
-+ int result = 0, op = 0;
-+ kctx_t kctx = KCTX_NONE;
-+
-+ if (sig == NULL)
-+ {
-+ defsigev.sigev_notify = SIGEV_NONE;
-+ sig = &defsigev;
-+ }
-+
-+ /* Request the mutex. */
-+ pthread_mutex_lock (&__aio_requests_mutex);
-+
-+ if (LIO_MODE (mode) == LIO_WAIT && ! __have_no_kernel_aio && nent > 0)
-+ {
-+ int res;
-+ INTERNAL_SYSCALL_DECL (err);
-+
-+ kctx = 0;
-+ do
-+ res = INTERNAL_SYSCALL (io_setup, err, 2, nent, &kctx);
-+ while (INTERNAL_SYSCALL_ERROR_P (res, err)
-+ && INTERNAL_SYSCALL_ERRNO (res, err) == EINTR);
-+ if (INTERNAL_SYSCALL_ERROR_P (res, err))
-+ {
-+ kctx = KCTX_NONE;
-+ if (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS)
-+ __have_no_kernel_aio = 1;
-+ }
-+ }
-+ else if (LIO_MODE (mode) == LIO_NOWAIT)
-+ {
-+ op = LIO_KTHREAD;
-+ if (sig->sigev_notify != SIGEV_NONE)
-+ op = LIO_KTHREAD | LIO_KTHREAD_REQUIRED;
-+ }
-+ op |= LIO_OPCODE_BASE;
-+
-+ /* Now we can enqueue all requests. Since we already acquired the
-+ mutex the enqueue function need not do this. */
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
-+ {
-+ if (NO_INDIVIDUAL_EVENT_P (mode))
-+ list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
-+ requests[cnt]
-+ = __aio_enqueue_request_ctx ((aiocb_union *) list[cnt],
-+ list[cnt]->aio_lio_opcode | op,
-+ kctx);
-+
-+ if (requests[cnt] != NULL)
-+ /* Successfully enqueued. */
-+ ++total;
-+ else
-+ /* Signal that we've seen an error. `errno' and the error code
-+ of the aiocb will tell more. */
-+ result = -1;
-+ }
-+ else
-+ requests[cnt] = NULL;
-+
-+ if (total == 0)
-+ {
-+ /* We don't have anything to do except signalling if we work
-+ asynchronously. */
-+
-+ if (kctx != KCTX_NONE)
-+ {
-+ INTERNAL_SYSCALL_DECL (err);
-+ INTERNAL_SYSCALL (io_destroy, err, 1, kctx);
-+ }
-+
-+ /* Release the mutex. We do this before raising a signal since the
-+ signal handler might do a `siglongjmp' and then the mutex is
-+ locked forever. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+
-+ if (LIO_MODE (mode) == LIO_NOWAIT)
-+ {
-+#ifdef BROKEN_THREAD_SIGNALS
-+ __aio_notify_only (sig,
-+ sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0);
-+#else
-+ __aio_notify_only (sig);
-+#endif
-+ }
-+
-+ return result;
-+ }
-+ else if (LIO_MODE (mode) == LIO_WAIT)
-+ {
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-+ int oldstate;
-+#endif
-+ struct waitlist waitlist[nent];
-+ volatile int ktotal = 0;
-+
-+ total = 0;
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ {
-+ assert (requests[cnt] == NULL || list[cnt] != NULL);
-+
-+ if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
-+ {
-+ if (requests[cnt]->kioctx != KCTX_NONE)
-+ {
-+ assert (requests[cnt]->kioctx == kctx);
-+ waitlist[cnt].counterp = &ktotal;
-+ ++ktotal;
-+ }
-+ else
-+ {
-+ waitlist[cnt].counterp = &total;
-+ ++total;
-+ }
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ waitlist[cnt].cond = &cond;
-+#endif
-+ waitlist[cnt].result = &result;
-+ waitlist[cnt].next = requests[cnt]->waiting;
-+ waitlist[cnt].sigevp = NULL;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ waitlist[cnt].caller_pid = 0; /* Not needed. */
-+#endif
-+ requests[cnt]->waiting = &waitlist[cnt];
-+ }
-+ }
-+
-+ while (ktotal > 0)
-+ __aio_wait_for_events (kctx, NULL);
-+#ifdef DONT_NEED_AIO_MISC_COND
-+ AIO_MISC_WAIT (result, total, NULL, 0);
-+#else
-+ /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancellation
-+ points we must be careful. We added entries to the waiting lists
-+ which we must remove. So defer cancellation for now. */
-+ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
-+
-+ while (total > 0)
-+ pthread_cond_wait (&cond, &__aio_requests_mutex);
-+
-+ /* Now it's time to restore the cancellation state. */
-+ pthread_setcancelstate (oldstate, NULL);
-+
-+ /* Release the conditional variable. */
-+ if (pthread_cond_destroy (&cond) != 0)
-+ /* This must never happen. */
-+ abort ();
-+#endif
-+
-+ if (kctx != KCTX_NONE)
-+ {
-+ INTERNAL_SYSCALL_DECL (err);
-+ INTERNAL_SYSCALL (io_destroy, err, 1, kctx);
-+ }
-+
-+ /* If any of the I/O requests failed, return -1 and set errno. */
-+ if (result != 0)
-+ {
-+ __set_errno (result == EINTR ? EINTR : EIO);
-+ result = -1;
-+ }
-+ }
-+ else if (sig->sigev_notify != SIGEV_NONE)
-+ {
-+ struct async_waitlist *waitlist;
-+
-+ waitlist = (struct async_waitlist *)
-+ malloc (sizeof (struct async_waitlist)
-+ + (nent * sizeof (struct waitlist)));
-+
-+ if (waitlist == NULL)
-+ {
-+ __set_errno (EAGAIN);
-+ result = -1;
-+ }
-+ else
-+ {
-+#ifdef BROKEN_THREAD_SIGNALS
-+ pid_t caller_pid = sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0;
-+#endif
-+ total = 0;
-+
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ {
-+ assert (requests[cnt] == NULL || list[cnt] != NULL);
-+
-+ if (requests[cnt] != NULL
-+ && list[cnt]->aio_lio_opcode != LIO_NOP)
-+ {
-+#ifndef DONT_NEED_AIO_MISC_COND
-+ waitlist->list[cnt].cond = NULL;
-+#endif
-+ waitlist->list[cnt].result = NULL;
-+ waitlist->list[cnt].next = requests[cnt]->waiting;
-+ waitlist->list[cnt].counterp = &waitlist->counter;
-+ waitlist->list[cnt].sigevp = &waitlist->sigev;
-+#ifdef BROKEN_THREAD_SIGNALS
-+ waitlist->list[cnt].caller_pid = caller_pid;
-+#endif
-+ requests[cnt]->waiting = &waitlist->list[cnt];
-+ ++total;
-+ }
-+ }
-+
-+ waitlist->counter = total;
-+ waitlist->sigev = *sig;
-+ }
-+ }
-+
-+ /* Release the mutex. */
-+ pthread_mutex_unlock (&__aio_requests_mutex);
-+
-+ return result;
-+}
-+
-+
-+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
-+int
-+attribute_compat_text_section
-+__lio_listio_21 (int mode, struct aiocb *const list[], int nent,
-+ struct sigevent *sig)
-+{
-+ /* Check arguments. */
-+ if (mode != LIO_WAIT && mode != LIO_NOWAIT)
-+ {
-+ __set_errno (EINVAL);
-+ return -1;
-+ }
-+
-+ return lio_listio_internal (mode | LIO_NO_INDIVIDUAL_EVENT, list, nent, sig);
-+}
-+compat_symbol (librt, __lio_listio_21, lio_listio, GLIBC_2_1);
-+#endif
-+
-+
-+int
-+__lio_listio_item_notify (int mode, struct aiocb *const list[], int nent,
-+ struct sigevent *sig)
-+{
-+ /* Check arguments. */
-+ if (mode != LIO_WAIT && mode != LIO_NOWAIT)
-+ {
-+ __set_errno (EINVAL);
-+ return -1;
-+ }
-+
-+ return lio_listio_internal (mode, list, nent, sig);
-+}
-+versioned_symbol (librt, __lio_listio_item_notify, lio_listio, GLIBC_2_4);
-+
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/Makefile 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,4 @@
-+ifeq ($(subdir),rtkaio)
-+CFLAGS-kaio_mq_send.c += -fexceptions
-+CFLAGS-kaio_mq_receive.c += -fexceptions
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/Makefile 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,3 @@
-+ifeq ($(subdir),rtkaio)
-+librtkaio-routines += rtkaio-sysdep
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,9 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.3.3 {
-+ # Changed timer_t.
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/rtkaio-sysdep.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/rtkaio-sysdep.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/powerpc/rtkaio-sysdep.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/powerpc/rtkaio-sysdep.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-sysdep.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/Makefile 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,3 @@
-+ifeq ($(subdir),rtkaio)
-+librtkaio-routines += rtkaio-sysdep
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/rtkaio-sysdep.S glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/rtkaio-sysdep.S
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/rtkaio-sysdep.S 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/rtkaio-sysdep.S 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-sysdep.S>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/s390-64/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/s390-64/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/s390/s390-64/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/s390/s390-64/Versions 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,9 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.3.3 {
-+ # Changed timer_t.
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/kaio_cancel.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/kaio_cancel.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/kaio_cancel.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/kaio_cancel.c 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,33 @@
-+#include <shlib-compat.h>
-+
-+#define aio_cancel64 XXX
-+#include <aio.h>
-+#undef aio_cancel64
-+#include <errno.h>
-+
-+extern __typeof (aio_cancel) __new_aio_cancel;
-+extern __typeof (aio_cancel) __old_aio_cancel;
-+
-+#define aio_cancel __new_aio_cancel
-+
-+#include <sysdeps/unix/sysv/linux/kaio_cancel.c>
-+
-+#undef aio_cancel
-+strong_alias (__new_aio_cancel, __new_aio_cancel64);
-+versioned_symbol (librt, __new_aio_cancel, aio_cancel, GLIBC_2_3);
-+versioned_symbol (librt, __new_aio_cancel64, aio_cancel64, GLIBC_2_3);
-+
-+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3)
-+
-+#undef ECANCELED
-+#define aio_cancel __old_aio_cancel
-+#define ECANCELED 125
-+
-+#include <sysdeps/unix/sysv/linux/kaio_cancel.c>
-+
-+#undef aio_cancel
-+strong_alias (__old_aio_cancel, __old_aio_cancel64);
-+compat_symbol (librt, __old_aio_cancel, aio_cancel, GLIBC_2_1);
-+compat_symbol (librt, __old_aio_cancel64, aio_cancel64, GLIBC_2_1);
-+
-+#endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/Makefile glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/Makefile
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/Makefile 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/Makefile 2013-08-16 16:23:23.243028404 +0530
-@@ -0,0 +1,3 @@
-+ifeq ($(subdir),rtkaio)
-+librtkaio-routines += rtkaio-sysdep
-+endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/rtkaio-sysdep.c glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/rtkaio-sysdep.c
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/rtkaio-sysdep.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/rtkaio-sysdep.c 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1 @@
-+#include <rt-sysdep.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/sparc64/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/sparc64/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/sparc64/Versions 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,9 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.3.3 {
-+ # Changed timer_t.
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/sparc/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/sparc/Versions 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,6 @@
-+librtkaio {
-+ GLIBC_2.3 {
-+ # AIO functions.
-+ aio_cancel; aio_cancel64;
-+ }
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/syscalls.list glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,5 @@
-+# File name Caller Syscall name Args Strong name Weak names
-+
-+kaio_mq_timedsend - mq_timedsend Ci:ipiip __GI_mq_timedsend mq_timedsend
-+kaio_mq_timedreceive - mq_timedreceive Ci:ipipp __GI_mq_timedreceive mq_timedreceive
-+kaio_mq_setattr - mq_getsetattr i:ipp __GI_mq_setattr mq_setattr
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/x86_64/librtkaio-cancellation.S glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/x86_64/librtkaio-cancellation.S
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/x86_64/librtkaio-cancellation.S 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/x86_64/librtkaio-cancellation.S 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1 @@
-+#include <librt-cancellation.S>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/x86_64/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/x86_64/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/sysdeps/unix/sysv/linux/x86_64/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/sysdeps/unix/sysv/linux/x86_64/Versions 2013-08-16 16:23:23.244028404 +0530
-@@ -0,0 +1,9 @@
-+%ifdef HAVE_FORCED_UNWIND
-+librtkaio {
-+ GLIBC_2.3.3 {
-+ # Changed timer_t.
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+}
-+%endif
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio10.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio10.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio10.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio10.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio10.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio2.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio3.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio3.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio3.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio3.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio3.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio4.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio4.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio4.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio4.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio4.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio5.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio5.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio5.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio5.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio5.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio64.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio64.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio64.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio6.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio6.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio6.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio6.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio6.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio7.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio7.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio7.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio7.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio7.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio8.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio8.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio8.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio8.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio8.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio9.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio9.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio9.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio9.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio9.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aio.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aio.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aio.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-aio.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod2.c 2013-08-16 16:23:23.241028404 +0530
-@@ -0,0 +1,128 @@
-+/* Test for notification mechanism in lio_listio.
-+ Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <aio.h>
-+#include <signal.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <errno.h>
-+#include "tst-aiod.h"
-+
-+
-+static pthread_barrier_t b;
-+
-+
-+static void
-+thrfct (sigval_t arg)
-+{
-+ int e = pthread_barrier_wait (&b);
-+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
-+ {
-+ puts ("thread: barrier_wait failed");
-+ exit (1);
-+ }
-+}
-+
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+ char name[] = "/tmp/aio2.XXXXXX";
-+ int fd;
-+ struct aiocb *arr[1];
-+ struct aiocb cb;
-+ static const char buf[] = "Hello World\n";
-+
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ {
-+ printf ("cannot open temp name: %m\n");
-+ return 1;
-+ }
-+
-+ unlink (name);
-+
-+ if (pthread_barrier_init (&b, NULL, 2) != 0)
-+ {
-+ puts ("barrier_init failed");
-+ return 1;
-+ }
-+
-+ arr[0] = &cb;
-+
-+ void *p;
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ int err = posix_memalign (&p, sz, sz);
-+ if (err)
-+ {
-+ errno = err;
-+ printf ("cannot allocate memory: %m\n");
-+ return 1;
-+ }
-+ memcpy (p, buf, sizeof (buf) - 1);
-+ memset (p + sizeof (buf) - 1, ' ', sz - sizeof (buf) + 1);
-+ printf ("Using O_DIRECT with block size %d\n", sz);
-+ }
-+ else
-+ {
-+ p = (void *) buf;
-+ sz = sizeof (buf) - 1;
-+ }
-+
-+ cb.aio_fildes = fd;
-+ cb.aio_lio_opcode = LIO_WRITE;
-+ cb.aio_reqprio = 0;
-+ cb.aio_buf = p;
-+ cb.aio_nbytes = sz;
-+ cb.aio_offset = 0;
-+ cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
-+ cb.aio_sigevent.sigev_notify_function = thrfct;
-+ cb.aio_sigevent.sigev_notify_attributes = NULL;
-+ cb.aio_sigevent.sigev_value.sival_ptr = NULL;
-+
-+ if (lio_listio (LIO_WAIT, arr, 1, NULL) < 0)
-+ {
-+ if (errno == ENOSYS)
-+ {
-+ puts ("no aio support in this configuration");
-+ return 0;
-+ }
-+ printf ("lio_listio failed: %m\n");
-+ return 1;
-+ }
-+
-+ puts ("lio_listio returned");
-+
-+ int e = pthread_barrier_wait (&b);
-+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
-+ {
-+ puts ("barrier_wait failed");
-+ return 1;
-+ }
-+
-+ puts ("all OK");
-+
-+ return 0;
-+}
-+
-+#include "../test-skeleton.c"
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod3.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod3.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod3.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod3.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1,131 @@
-+/* Test for notification mechanism in lio_listio.
-+ Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <aio.h>
-+#include <signal.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <errno.h>
-+#include "tst-aiod.h"
-+
-+
-+static pthread_barrier_t b;
-+
-+
-+static void
-+thrfct (sigval_t arg)
-+{
-+ int e = pthread_barrier_wait (&b);
-+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
-+ {
-+ puts ("child: barrier_wait failed");
-+ exit (1);
-+ }
-+}
-+
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+ char name[] = "/tmp/aio3.XXXXXX";
-+ int fd;
-+ struct aiocb *arr[1];
-+ struct aiocb cb;
-+ static const char buf[] = "Hello World\n";
-+
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ {
-+ printf ("cannot open temp name: %m\n");
-+ return 1;
-+ }
-+
-+ unlink (name);
-+
-+ if (pthread_barrier_init (&b, NULL, 2) != 0)
-+ {
-+ puts ("barrier_init failed");
-+ return 1;
-+ }
-+
-+ arr[0] = &cb;
-+
-+ void *p;
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ int err = posix_memalign (&p, sz, sz);
-+ if (err)
-+ {
-+ errno = err;
-+ printf ("cannot allocate memory: %m\n");
-+ return 1;
-+ }
-+ memcpy (p, buf, sizeof (buf) - 1);
-+ memset (p + sizeof (buf) - 1, ' ', sz - sizeof (buf) + 1);
-+ printf ("Using O_DIRECT with block size %d\n", sz);
-+ }
-+ else
-+ {
-+ p = (void *) buf;
-+ sz = sizeof (buf) - 1;
-+ }
-+
-+ cb.aio_fildes = fd;
-+ cb.aio_lio_opcode = LIO_WRITE;
-+ cb.aio_reqprio = 0;
-+ cb.aio_buf = p;
-+ cb.aio_nbytes = sz;
-+ cb.aio_offset = 0;
-+ cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
-+ cb.aio_sigevent.sigev_notify_function = thrfct;
-+ cb.aio_sigevent.sigev_notify_attributes = NULL;
-+ cb.aio_sigevent.sigev_value.sival_ptr = NULL;
-+
-+ if (lio_listio (LIO_NOWAIT, arr, 1, NULL) < 0)
-+ {
-+ if (errno == ENOSYS)
-+ {
-+ puts ("no aio support in this configuration");
-+ return 0;
-+ }
-+ printf ("lio_listio failed: %m\n");
-+ return 1;
-+ }
-+
-+ if (aio_suspend ((const struct aiocb *const *) arr, 1, NULL) < 0)
-+ {
-+ printf ("aio_suspend failed: %m\n");
-+ return 1;
-+ }
-+
-+ int e = pthread_barrier_wait (&b);
-+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
-+ {
-+ puts ("parent: barrier_wait failed");
-+ return 1;
-+ }
-+
-+ puts ("all OK");
-+
-+ return 0;
-+}
-+
-+#include "../test-skeleton.c"
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod4.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod4.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod4.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod4.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1,182 @@
-+/* Test for completion signal handling.
-+ Copyright (C) 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <aio.h>
-+#include <signal.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <errno.h>
-+#include "tst-aiod.h"
-+
-+/* We might need a bit longer timeout. */
-+#define TIMEOUT 10 /* sec */
-+
-+int my_signo;
-+
-+volatile sig_atomic_t flag;
-+
-+
-+static void
-+sighandler (const int signo)
-+{
-+ flag = signo;
-+}
-+
-+static int
-+wait_flag (void)
-+{
-+ while (flag == 0)
-+ {
-+ puts ("Sleeping...");
-+ sleep (1);
-+ }
-+
-+ if (flag != my_signo)
-+ {
-+ printf ("signal handler received wrong signal, flag is %d\n", flag);
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+#ifndef SIGRTMIN
-+# define SIGRTMIN -1
-+# define SIGRTMAX -1
-+#endif
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+ char name[] = "/tmp/aio4.XXXXXX";
-+ int fd;
-+ struct aiocb *arr[1];
-+ struct aiocb cb;
-+ static const char buf[] = "Hello World\n";
-+ struct aioinit init = {10, 20, 0};
-+ struct sigaction sa;
-+ struct sigevent ev;
-+
-+ if (SIGRTMIN == -1)
-+ {
-+ printf ("RT signals not supported.\n");
-+ return 0;
-+ }
-+
-+ /* Select a signal from the middle of the available choices... */
-+ my_signo = (SIGRTMAX + SIGRTMIN) / 2;
-+
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ {
-+ printf ("cannot open temp name: %m\n");
-+ return 1;
-+ }
-+
-+ unlink (name);
-+
-+ /* Test also aio_init. */
-+ aio_init (&init);
-+
-+ arr[0] = &cb;
-+
-+ void *p;
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ int err = posix_memalign (&p, sz, sz);
-+ if (err)
-+ {
-+ errno = err;
-+ printf ("cannot allocate memory: %m\n");
-+ return 1;
-+ }
-+ memcpy (p, buf, sizeof (buf) - 1);
-+ memset (p + sizeof (buf) - 1, ' ', sz - sizeof (buf) + 1);
-+ printf ("Using O_DIRECT with block size %d\n", sz);
-+ }
-+ else
-+ {
-+ p = (void *) buf;
-+ sz = sizeof (buf) - 1;
-+ }
-+
-+ cb.aio_fildes = fd;
-+ cb.aio_lio_opcode = LIO_WRITE;
-+ cb.aio_reqprio = 0;
-+ cb.aio_buf = p;
-+ cb.aio_nbytes = sz;
-+ cb.aio_offset = 0;
-+ cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
-+ cb.aio_sigevent.sigev_notify_function = NULL;
-+ cb.aio_sigevent.sigev_notify_attributes = NULL;
-+ cb.aio_sigevent.sigev_signo = my_signo;
-+ cb.aio_sigevent.sigev_value.sival_ptr = NULL;
-+
-+ ev.sigev_notify = SIGEV_SIGNAL;
-+ ev.sigev_notify_function = NULL;
-+ ev.sigev_notify_attributes = NULL;
-+ ev.sigev_signo = my_signo;
-+
-+ sa.sa_handler = sighandler;
-+ sigemptyset (&sa.sa_mask);
-+ sa.sa_flags = SA_RESTART;
-+
-+ if (sigaction (my_signo, &sa, NULL) < 0)
-+ {
-+ printf ("sigaction failed: %m\n");
-+ return 1;
-+ }
-+
-+ flag = 0;
-+ /* First use aio_write. */
-+ if (aio_write (arr[0]) < 0)
-+ {
-+ if (errno == ENOSYS)
-+ {
-+ puts ("no aio support in this configuration");
-+ return 0;
-+ }
-+ printf ("aio_write failed: %m\n");
-+ return 1;
-+ }
-+
-+ if (wait_flag ())
-+ return 1;
-+
-+ puts ("aio_write OK");
-+
-+ flag = 0;
-+ /* Again with lio_listio. */
-+ if (lio_listio (LIO_NOWAIT, arr, 1, &ev) < 0)
-+ {
-+ printf ("lio_listio failed: %m\n");
-+ return 1;
-+ }
-+
-+ if (wait_flag ())
-+ return 1;
-+
-+ puts ("all OK");
-+
-+ return 0;
-+}
-+
-+#include "../test-skeleton.c"
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod5.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod5.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod5.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod5.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1,152 @@
-+/* Test for completion thread handling.
-+ Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <aio.h>
-+#include <signal.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <errno.h>
-+#include "tst-aiod.h"
-+
-+/* We might need a bit longer timeout. */
-+#define TIMEOUT 10 /* sec */
-+
-+#define MY_SIVAL 27
-+
-+volatile sig_atomic_t flag;
-+
-+
-+static void
-+callback (sigval_t s)
-+{
-+ flag = s.sival_int;
-+}
-+
-+static int
-+wait_flag (void)
-+{
-+ while (flag == 0)
-+ {
-+ puts ("Sleeping...");
-+ sleep (1);
-+ }
-+
-+ if (flag != MY_SIVAL)
-+ {
-+ printf ("signal handler received wrong signal, flag is %d\n", flag);
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+ char name[] = "/tmp/aio5.XXXXXX";
-+ int fd;
-+ struct aiocb *arr[1];
-+ struct aiocb cb;
-+ static const char buf[] = "Hello World\n";
-+ struct sigevent ev;
-+
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ {
-+ printf ("cannot open temp name: %m\n");
-+ return 1;
-+ }
-+
-+ unlink (name);
-+
-+ arr[0] = &cb;
-+
-+ void *p;
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ int err = posix_memalign (&p, sz, sz);
-+ if (err)
-+ {
-+ errno = err;
-+ printf ("cannot allocate memory: %m\n");
-+ return 1;
-+ }
-+ memcpy (p, buf, sizeof (buf) - 1);
-+ memset (p + sizeof (buf) - 1, ' ', sz - sizeof (buf) + 1);
-+ printf ("Using O_DIRECT with block size %d\n", sz);
-+ }
-+ else
-+ {
-+ p = (void *) buf;
-+ sz = sizeof (buf) - 1;
-+ }
-+
-+ cb.aio_fildes = fd;
-+ cb.aio_lio_opcode = LIO_WRITE;
-+ cb.aio_reqprio = 0;
-+ cb.aio_buf = p;
-+ cb.aio_nbytes = sz;
-+ cb.aio_offset = 0;
-+ cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
-+ cb.aio_sigevent.sigev_notify_function = callback;
-+ cb.aio_sigevent.sigev_notify_attributes = NULL;
-+ cb.aio_sigevent.sigev_value.sival_int = MY_SIVAL;
-+
-+ ev.sigev_notify = SIGEV_THREAD;
-+ ev.sigev_notify_function = callback;
-+ ev.sigev_notify_attributes = NULL;
-+ ev.sigev_value.sival_int = MY_SIVAL;
-+
-+ /* First use aio_write. */
-+ if (aio_write (arr[0]) < 0)
-+ {
-+ if (errno == ENOSYS)
-+ {
-+ puts ("no aio support in this configuration");
-+ return 0;
-+ }
-+ printf ("aio_write failed: %m\n");
-+ return 1;
-+ }
-+
-+ if (wait_flag ())
-+ return 1;
-+
-+ puts ("aio_write OK");
-+
-+ flag = 0;
-+ /* Again with lio_listio. */
-+ if (lio_listio (LIO_NOWAIT, arr, 1, &ev) < 0)
-+ {
-+ printf ("lio_listio failed: %m\n");
-+ return 1;
-+ }
-+
-+ if (wait_flag ())
-+ return 1;
-+
-+ puts ("all OK");
-+
-+ return 0;
-+}
-+
-+#include "../test-skeleton.c"
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod64.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod64.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod64.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod64.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1,308 @@
-+/* Tests for 64bit AIO in librt.
-+ Copyright (C) 1998, 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#define _LARGEFILE_SOURCE 1
-+#include <aio.h>
-+#include <errno.h>
-+#include <error.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <sys/stat.h>
-+#include "tst-aiod.h"
-+
-+
-+/* Prototype for our test function. */
-+extern void do_prepare (int argc, char *argv[]);
-+extern int do_test (int argc, char *argv[]);
-+
-+/* We have a preparation function. */
-+#define PREPARE do_prepare
-+
-+/* We might need a bit longer timeout. */
-+#define TIMEOUT 20 /* sec */
-+
-+/* This defines the `main' function and some more. */
-+#include <test-skeleton.c>
-+
-+
-+/* These are for the temporary file we generate. */
-+char *name;
-+int fd;
-+char *tmpbuf;
-+int blksz = 100;
-+
-+void
-+do_prepare (int argc, char *argv[])
-+{
-+ size_t name_len;
-+
-+ name_len = strlen (test_dir);
-+ name = malloc (name_len + sizeof ("/aioXXXXXX"));
-+ mempcpy (mempcpy (name, test_dir, name_len),
-+ "/aioXXXXXX", sizeof ("/aioXXXXXX"));
-+ add_temp_file (name);
-+
-+ /* Open our test file. */
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
-+
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ blksz = sz;
-+ printf ("Using O_DIRECT with block size %d\n", blksz);
-+ }
-+}
-+
-+
-+static int
-+test_file (const void *buf, size_t size, int fd, const char *msg)
-+{
-+ struct stat st;
-+ char *tmp = tmpbuf;
-+
-+ errno = 0;
-+ if (fstat (fd, &st) < 0)
-+ {
-+ error (0, errno, "%s: failed stat", msg);
-+ return 1;
-+ }
-+
-+ if (st.st_size != (off_t) size)
-+ {
-+ error (0, errno, "%s: wrong size: %lu, should be %lu",
-+ msg, (unsigned long int) st.st_size, (unsigned long int) size);
-+ return 1;
-+ }
-+
-+ if (pread (fd, tmp, size, 0) != (ssize_t) size)
-+ {
-+ error (0, errno, "%s: failed pread", msg);
-+ return 1;
-+ }
-+
-+ if (memcmp (buf, tmp, size) != 0)
-+ {
-+ error (0, errno, "%s: failed comparison", msg);
-+ return 1;
-+ }
-+
-+ printf ("%s test ok\n", msg);
-+
-+ return 0;
-+}
-+
-+
-+static int
-+do_wait (struct aiocb64 **cbp, size_t nent, int allowed_err)
-+{
-+ int go_on;
-+ size_t cnt;
-+ int result = 0;
-+
-+ do
-+ {
-+ aio_suspend64 ((const struct aiocb64 *const *) cbp, nent, NULL);
-+ go_on = 0;
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ if (cbp[cnt] != NULL)
-+ {
-+ if (aio_error64 (cbp[cnt]) == EINPROGRESS)
-+ go_on = 1;
-+ else
-+ {
-+ if (aio_return64 (cbp[cnt]) == -1
-+ && (allowed_err == 0
-+ || aio_error64 (cbp[cnt]) != allowed_err))
-+ {
-+ error (0, aio_error64 (cbp[cnt]), "Operation failed\n");
-+ result = 1;
-+ }
-+ cbp[cnt] = NULL;
-+ }
-+ }
-+ }
-+ while (go_on);
-+
-+ return result;
-+}
-+
-+
-+int
-+do_test (int argc, char *argv[])
-+{
-+ struct aiocb64 cbs[10];
-+ struct aiocb64 cbs_fsync;
-+ struct aiocb64 *cbp[10];
-+ struct aiocb64 *cbp_fsync[1];
-+ char *buf;
-+ size_t cnt;
-+ int result = 0;
-+
-+ buf = mmap (NULL, 20 * blksz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-+ tmpbuf = buf + 10 * blksz;
-+ if (buf == MAP_FAILED)
-+ {
-+ error (0, errno, "mmap failed");
-+ return 1;
-+ }
-+
-+ /* Preparation. */
-+ for (cnt = 0; cnt < 10; ++cnt)
-+ {
-+ cbs[cnt].aio_fildes = fd;
-+ cbs[cnt].aio_reqprio = 0;
-+ cbs[cnt].aio_buf = memset (&buf[cnt * blksz], '0' + cnt, blksz);
-+ cbs[cnt].aio_nbytes = blksz;
-+ cbs[cnt].aio_offset = cnt * blksz;
-+ cbs[cnt].aio_sigevent.sigev_notify = SIGEV_NONE;
-+
-+ cbp[cnt] = &cbs[cnt];
-+ }
-+
-+ /* First a simple test. */
-+ for (cnt = 10; cnt > 0; )
-+ if (aio_write64 (cbp[--cnt]) < 0 && errno == ENOSYS)
-+ {
-+ error (0, 0, "no aio support in this configuration");
-+ return 0;
-+ }
-+ /* Wait 'til the results are there. */
-+ result |= do_wait (cbp, 10, 0);
-+ /* Test this. */
-+ result |= test_file (buf, 10 * blksz, fd, "aio_write");
-+
-+ /* Read now as we've written it. */
-+ memset (buf, '\0', 10 * blksz);
-+ /* Issue the commands. */
-+ for (cnt = 10; cnt > 0; )
-+ {
-+ --cnt;
-+ cbp[cnt] = &cbs[cnt];
-+ aio_read64 (cbp[cnt]);
-+ }
-+ /* Wait 'til the results are there. */
-+ result |= do_wait (cbp, 10, 0);
-+ /* Test this. */
-+ for (cnt = 0; cnt < 10 * blksz; ++cnt)
-+ if (buf[cnt] != '0' + (cnt / blksz))
-+ {
-+ result = 1;
-+ error (0, 0, "comparison failed for aio_read test");
-+ break;
-+ }
-+
-+ if (cnt == 10 * blksz)
-+ puts ("aio_read test ok");
-+
-+ /* Remove the test file contents. */
-+ if (ftruncate64 (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Test lio_listio. */
-+ for (cnt = 0; cnt < 10; ++cnt)
-+ {
-+ cbs[cnt].aio_lio_opcode = LIO_WRITE;
-+ cbp[cnt] = &cbs[cnt];
-+ }
-+ /* Issue the command. */
-+ lio_listio64 (LIO_WAIT, cbp, 10, NULL);
-+ /* ...and immediately test it since we started it in wait mode. */
-+ result |= test_file (buf, 10 * blksz, fd, "lio_listio (write)");
-+
-+ /* Test aio_fsync. */
-+ cbs_fsync.aio_fildes = fd;
-+ cbs_fsync.aio_sigevent.sigev_notify = SIGEV_NONE;
-+ cbp_fsync[0] = &cbs_fsync;
-+
-+ /* Remove the test file contents first. */
-+ if (ftruncate64 (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ aio_write64 (cbp[--cnt]);
-+
-+ if (aio_fsync64 (O_SYNC, &cbs_fsync) < 0)
-+ {
-+ error (0, errno, "aio_fsync failed\n");
-+ result = 1;
-+ }
-+ result |= do_wait (cbp_fsync, 1, 0);
-+
-+ /* ...and test since all data should be on disk now. */
-+ result |= test_file (buf, 10 * blksz, fd, "aio_fsync (aio_write)");
-+
-+ /* Test aio_cancel. */
-+ /* Remove the test file contents first. */
-+ if (ftruncate64 (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ aio_write64 (cbp[--cnt]);
-+
-+ /* Cancel all requests. */
-+ if (aio_cancel64 (fd, NULL) == -1)
-+ printf ("aio_cancel64 (fd, NULL) cannot cancel anything\n");
-+
-+ result |= do_wait (cbp, 10, ECANCELED);
-+
-+ /* Another test for aio_cancel. */
-+ /* Remove the test file contents first. */
-+ if (ftruncate64 (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ {
-+ --cnt;
-+ cbp[cnt] = &cbs[cnt];
-+ aio_write64 (cbp[cnt]);
-+ }
-+ puts ("finished3");
-+
-+ /* Cancel all requests. */
-+ for (cnt = 10; cnt > 0; )
-+ if (aio_cancel64 (fd, cbp[--cnt]) == -1)
-+ /* This is not an error. The request can simply be finished. */
-+ printf ("aio_cancel64 (fd, cbp[%Zd]) cannot be canceled\n", cnt);
-+ puts ("finished2");
-+
-+ result |= do_wait (cbp, 10, ECANCELED);
-+
-+ puts ("finished");
-+
-+ return result;
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1,307 @@
-+/* Tests for AIO in librt.
-+ Copyright (C) 1998, 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <aio.h>
-+#include <errno.h>
-+#include <error.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <sys/stat.h>
-+#include "tst-aiod.h"
-+
-+
-+/* Prototype for our test function. */
-+extern void do_prepare (int argc, char *argv[]);
-+extern int do_test (int argc, char *argv[]);
-+
-+/* We have a preparation function. */
-+#define PREPARE do_prepare
-+
-+/* We might need a bit longer timeout. */
-+#define TIMEOUT 20 /* sec */
-+
-+/* This defines the `main' function and some more. */
-+#include <test-skeleton.c>
-+
-+
-+/* These are for the temporary file we generate. */
-+char *name;
-+int fd;
-+char *tmpbuf;
-+int blksz = 100;
-+
-+void
-+do_prepare (int argc, char *argv[])
-+{
-+ size_t name_len;
-+
-+ name_len = strlen (test_dir);
-+ name = malloc (name_len + sizeof ("/aioXXXXXX"));
-+ mempcpy (mempcpy (name, test_dir, name_len),
-+ "/aioXXXXXX", sizeof ("/aioXXXXXX"));
-+ add_temp_file (name);
-+
-+ /* Open our test file. */
-+ fd = mkstemp (name);
-+ if (fd == -1)
-+ error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
-+
-+ int sz = set_o_direct (fd);
-+ if (sz != -1)
-+ {
-+ blksz = sz;
-+ printf ("Using O_DIRECT with block size %d\n", blksz);
-+ }
-+}
-+
-+
-+static int
-+test_file (const void *buf, size_t size, int fd, const char *msg)
-+{
-+ struct stat st;
-+ char *tmp = tmpbuf;
-+
-+ errno = 0;
-+ if (fstat (fd, &st) < 0)
-+ {
-+ error (0, errno, "%s: failed stat", msg);
-+ return 1;
-+ }
-+
-+ if (st.st_size != (off_t) size)
-+ {
-+ error (0, errno, "%s: wrong size: %lu, should be %lu",
-+ msg, (unsigned long int) st.st_size, (unsigned long int) size);
-+ return 1;
-+ }
-+
-+ if (pread (fd, tmp, size, 0) != (ssize_t) size)
-+ {
-+ error (0, errno, "%s: failed pread", msg);
-+ return 1;
-+ }
-+
-+ if (memcmp (buf, tmp, size) != 0)
-+ {
-+ error (0, errno, "%s: failed comparison", msg);
-+ return 1;
-+ }
-+
-+ printf ("%s test ok\n", msg);
-+
-+ return 0;
-+}
-+
-+
-+static int
-+do_wait (struct aiocb **cbp, size_t nent, int allowed_err)
-+{
-+ int go_on;
-+ size_t cnt;
-+ int result = 0;
-+
-+ do
-+ {
-+ aio_suspend ((const struct aiocb *const *) cbp, nent, NULL);
-+ go_on = 0;
-+ for (cnt = 0; cnt < nent; ++cnt)
-+ if (cbp[cnt] != NULL)
-+ {
-+ if (aio_error (cbp[cnt]) == EINPROGRESS)
-+ go_on = 1;
-+ else
-+ {
-+ if (aio_return (cbp[cnt]) == -1
-+ && (allowed_err == 0
-+ || aio_error (cbp[cnt]) != allowed_err))
-+ {
-+ error (0, aio_error (cbp[cnt]), "Operation failed\n");
-+ result = 1;
-+ }
-+ cbp[cnt] = NULL;
-+ }
-+ }
-+ }
-+ while (go_on);
-+
-+ return result;
-+}
-+
-+
-+int
-+do_test (int argc, char *argv[])
-+{
-+ struct aiocb cbs[10];
-+ struct aiocb cbs_fsync;
-+ struct aiocb *cbp[10];
-+ struct aiocb *cbp_fsync[1];
-+ char *buf;
-+ size_t cnt;
-+ int result = 0;
-+
-+ buf = mmap (NULL, 20 * blksz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-+ tmpbuf = buf + 10 * blksz;
-+ if (buf == MAP_FAILED)
-+ {
-+ error (0, errno, "mmap failed");
-+ return 1;
-+ }
-+
-+ /* Preparation. */
-+ for (cnt = 0; cnt < 10; ++cnt)
-+ {
-+ cbs[cnt].aio_fildes = fd;
-+ cbs[cnt].aio_reqprio = 0;
-+ cbs[cnt].aio_buf = memset (&buf[cnt * blksz], '0' + cnt, blksz);
-+ cbs[cnt].aio_nbytes = blksz;
-+ cbs[cnt].aio_offset = cnt * blksz;
-+ cbs[cnt].aio_sigevent.sigev_notify = SIGEV_NONE;
-+
-+ cbp[cnt] = &cbs[cnt];
-+ }
-+
-+ /* First a simple test. */
-+ for (cnt = 10; cnt > 0; )
-+ if (aio_write (cbp[--cnt]) < 0 && errno == ENOSYS)
-+ {
-+ error (0, 0, "no aio support in this configuration");
-+ return 0;
-+ }
-+ /* Wait 'til the results are there. */
-+ result |= do_wait (cbp, 10, 0);
-+ /* Test this. */
-+ result |= test_file (buf, 10 * blksz, fd, "aio_write");
-+
-+ /* Read now as we've written it. */
-+ memset (buf, '\0', 10 * blksz);
-+ /* Issue the commands. */
-+ for (cnt = 10; cnt > 0; )
-+ {
-+ --cnt;
-+ cbp[cnt] = &cbs[cnt];
-+ aio_read (cbp[cnt]);
-+ }
-+ /* Wait 'til the results are there. */
-+ result |= do_wait (cbp, 10, 0);
-+ /* Test this. */
-+ for (cnt = 0; cnt < 10 * blksz; ++cnt)
-+ if (buf[cnt] != '0' + (cnt / blksz))
-+ {
-+ result = 1;
-+ error (0, 0, "comparison failed for aio_read test");
-+ break;
-+ }
-+
-+ if (cnt == 10 * blksz)
-+ puts ("aio_read test ok");
-+
-+ /* Remove the test file contents. */
-+ if (ftruncate (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Test lio_listio. */
-+ for (cnt = 0; cnt < 10; ++cnt)
-+ {
-+ cbs[cnt].aio_lio_opcode = LIO_WRITE;
-+ cbp[cnt] = &cbs[cnt];
-+ }
-+ /* Issue the command. */
-+ lio_listio (LIO_WAIT, cbp, 10, NULL);
-+ /* ...and immediately test it since we started it in wait mode. */
-+ result |= test_file (buf, 10 * blksz, fd, "lio_listio (write)");
-+
-+ /* Test aio_fsync. */
-+ cbs_fsync.aio_fildes = fd;
-+ cbs_fsync.aio_sigevent.sigev_notify = SIGEV_NONE;
-+ cbp_fsync[0] = &cbs_fsync;
-+
-+ /* Remove the test file contents first. */
-+ if (ftruncate (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ aio_write (cbp[--cnt]);
-+
-+ if (aio_fsync (O_SYNC, &cbs_fsync) < 0)
-+ {
-+ error (0, errno, "aio_fsync failed\n");
-+ result = 1;
-+ }
-+ result |= do_wait (cbp_fsync, 1, 0);
-+
-+ /* ...and test since all data should be on disk now. */
-+ result |= test_file (buf, 10 * blksz, fd, "aio_fsync (aio_write)");
-+
-+ /* Test aio_cancel. */
-+ /* Remove the test file contents first. */
-+ if (ftruncate (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ aio_write (cbp[--cnt]);
-+
-+ /* Cancel all requests. */
-+ if (aio_cancel (fd, NULL) == -1)
-+ printf ("aio_cancel (fd, NULL) cannot cancel anything\n");
-+
-+ result |= do_wait (cbp, 10, ECANCELED);
-+
-+ /* Another test for aio_cancel. */
-+ /* Remove the test file contents first. */
-+ if (ftruncate (fd, 0) < 0)
-+ {
-+ error (0, errno, "ftruncate failed\n");
-+ result = 1;
-+ }
-+
-+ /* Write again. */
-+ for (cnt = 10; cnt > 0; )
-+ {
-+ --cnt;
-+ cbp[cnt] = &cbs[cnt];
-+ aio_write (cbp[cnt]);
-+ }
-+ puts ("finished3");
-+
-+ /* Cancel all requests. */
-+ for (cnt = 10; cnt > 0; )
-+ if (aio_cancel (fd, cbp[--cnt]) == -1)
-+ /* This is not an error. The request can simply be finished. */
-+ printf ("aio_cancel (fd, cbp[%Zd]) cannot be canceled\n", cnt);
-+ puts ("finished2");
-+
-+ result |= do_wait (cbp, 10, ECANCELED);
-+
-+ puts ("finished");
-+
-+ return result;
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod.h glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod.h
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-aiod.h 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-aiod.h 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1,53 @@
-+/* Tests for AIO in librt.
-+ Copyright (C) 1998, 2000, 2002, 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fcntl.h>
-+#include <sys/mman.h>
-+#include <string.h>
-+#include <unistd.h>
-+
-+static int
-+set_o_direct (int fd)
-+{
-+ int ret = -1;
-+#ifdef O_DIRECT
-+ if (fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) | O_DIRECT) >= 0)
-+ {
-+ int pgsz = sysconf (_SC_PAGESIZE);
-+ char *buf = mmap (NULL, 16 * pgsz, PROT_READ | PROT_WRITE,
-+ MAP_PRIVATE | MAP_ANON, -1, 0);
-+ if (buf != MAP_FAILED)
-+ {
-+ memset (buf, 0, 16 * pgsz);
-+ for (int sz = 256; sz <= 16 * pgsz; sz *= 2)
-+ if (write (fd, buf, sz) > 0)
-+ {
-+ ret = sz;
-+ break;
-+ }
-+ ftruncate64 (fd, 0);
-+ munmap (buf, 16 * pgsz);
-+ }
-+ if (ret < 0)
-+ fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) & ~O_DIRECT);
-+ }
-+#endif
-+ return ret;
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-clock2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-clock2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock2.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-clock2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-clock.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-clock.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-clock.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-clock_nanosleep.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock_nanosleep.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-clock_nanosleep.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-clock_nanosleep.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-clock_nanosleep.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-cpuclock1.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cpuclock1.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-cpuclock1.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cpuclock1.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-cpuclock1.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-cpuclock2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cpuclock2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-cpuclock2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cpuclock2.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-cpuclock2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer1.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer1.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer1.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer1.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-cputimer1.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer2.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-cputimer2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer3.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer3.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-cputimer3.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-cputimer3.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-cputimer3.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue1.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue1.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue1.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue1.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue1.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue2.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue3.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue3.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue3.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue3.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue3.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue4.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue4.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue4.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue4.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue4.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue5.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue5.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue5.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue5.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue5.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue6.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue6.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue6.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue6.c 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue6.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue7.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue7.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue7.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue7.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue7.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue8.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue8.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue8.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue8.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue8.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue9.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue9.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue9.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue9.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue9.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue.h glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue.h
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-mqueue.h 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-mqueue.h 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-mqueue.h>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-shm.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-shm.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-shm.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-shm.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-shm.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-timer2.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer2.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-timer2.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer2.c 2013-08-16 16:23:23.245028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-timer2.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-timer3.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer3.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-timer3.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer3.c 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-timer3.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-timer4.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer4.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-timer4.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer4.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-timer4.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-timer5.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer5.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-timer5.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer5.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-timer5.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/tst-timer.c glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer.c
---- glibc-2.17-931-g30bbc0c/rtkaio/tst-timer.c 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/tst-timer.c 2013-08-16 16:23:23.246028404 +0530
-@@ -0,0 +1 @@
-+#include <rt/tst-timer.c>
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/Versions glibc-2.17-931-g30bbc0c.new/rtkaio/Versions
---- glibc-2.17-931-g30bbc0c/rtkaio/Versions 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/Versions 2013-08-16 16:23:23.247028404 +0530
-@@ -0,0 +1,25 @@
-+librtkaio {
-+ GLIBC_2.1 {
-+ # AIO functions.
-+ aio_cancel; aio_cancel64; aio_error; aio_error64; aio_fsync; aio_fsync64;
-+ aio_init; aio_read; aio_read64; aio_return; aio_return64; aio_suspend;
-+ aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
-+ }
-+ GLIBC_2.2 {
-+ # c*
-+ clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
-+ clock_nanosleep;
-+
-+ # s*
-+ shm_open; shm_unlink;
-+
-+ # t*
-+ timer_create; timer_delete; timer_getoverrun; timer_gettime;
-+ timer_settime;
-+ }
-+ GLIBC_2.3.4 {
-+ # m*
-+ mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr;
-+ mq_notify; mq_send; mq_receive; mq_timedsend; mq_timedreceive;
-+ }
-+}
-diff -pruN glibc-2.17-931-g30bbc0c/rtkaio/Versions.def glibc-2.17-931-g30bbc0c.new/rtkaio/Versions.def
---- glibc-2.17-931-g30bbc0c/rtkaio/Versions.def 1970-01-01 05:30:00.000000000 +0530
-+++ glibc-2.17-931-g30bbc0c.new/rtkaio/Versions.def 2013-08-16 16:23:23.242028404 +0530
-@@ -0,0 +1,8 @@
-+librtkaio {
-+ GLIBC_2.1
-+ GLIBC_2.2
-+ GLIBC_2.3
-+ GLIBC_2.3.3
-+ GLIBC_2.3.4
-+ GLIBC_2.4
-+}
diff --git a/glibc.spec b/glibc.spec
index d26c443..af24491 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -1,4 +1,13 @@
+%if %{cross_compiling}
+%bcond_with crosscompilers
+%else
%bcond_without crosscompilers
+%endif
+# The test suite should be run after updates, but is very
+# slow especially on arches where we have slow builders.
+# Let's cut build time in half for now (but remember to
+# build "--with tests" tests before throwing updates at abf!)
+%bcond_with tests
%ifarch %{ix86}
# FIXME add riscv32-linux when glibc starts supporting it
# FIXME Determine why (and fix) 32-bit platform to x86_64-linux crosscompilers
@@ -9,15 +18,10 @@
# FIXME determine why gcc segfaults when building any cross libc on armv7hnl
%global targets armv7hnl-linux
%else
-%ifarch aarch64
-# (tpg) reduce targets for aarch64 as aarch64 build nodes are low on disk space
-%global targets aarch64-linux
-%else
# FIXME add riscv32-linux when glibc starts supporting it
%global targets aarch64-linux armv7hnl-linux i686-linux x86_64-linux x32-linux riscv64-linux ppc64-linux ppc64le-linux
%endif
%endif
-%endif
%global long_targets %(
for i in %{targets}; do
CPU=$(echo $i |cut -d- -f1)
@@ -28,13 +32,12 @@
%define _libdir32 %{_prefix}/lib
%define _libdirn32 %{_prefix}/lib32
-
-%define ver 2.34
-%define fullver 2.34
+# Don't make /lib/ld-linux-aarch64.so.1 and friends relative
+%define dont_relink 1
%define oname glibc
%define major 6
-%define source_dir %{oname}-%{ver}
+%define source_dir %{oname}-%{version}
%define checklist %{_builddir}/%{source_dir}/Check.list
%define libc %mklibname c %{major}
%define devname %mklibname -d c
@@ -52,7 +55,9 @@
%define _disable_ld_no_undefined 1
# (tpg) optimize it a bit
-%global optflags %{optflags} -O3 -Wno-error=stringop-overflow -fno-strict-aliasing -Wformat
+# --hash-style=both is for https://sourceware.org/bugzilla/show_bug.cgi?id=29456
+%global optflags %{optflags} -O3 -Wno-error=stringop-overflow -fno-strict-aliasing -Wformat -Wl,--hash-style=both
+%global build_ldflags %{build_ldflags} -Wl,--hash-style=both
%global Werror_cflags %{nil}
%global platform %{_target_vendor}-%{_target_os}%{?_gnu}
@@ -62,8 +67,6 @@
%global target_arch %{_arch}
%define cross_prefix %{nil}
%define cross_program_prefix %{nil}
-%define _slibdir /%{_lib}
-%define _slibdir32 /lib
# Define target (base) architecture
%define arch %(echo %{target_cpu}|sed -e "s/\\(i.86\\|athlon\\)/i386/" -e "s/amd64/x86_64/")
@@ -102,7 +105,7 @@
%define build_biarch 1
%endif
-%bcond_without nscd
+%bcond_with nscd
%bcond_without i18ndata
%bcond_with timezone
%bcond_without locales
@@ -123,52 +126,52 @@
# Utility functions for pre/post scripts. Stick them at the beginning of
# any lua %pre, %post, %postun, etc. sections to have them expand into
# those scripts. It only works in lua sections and not anywhere else.
-%define glibc_post_funcs() \
--- We use lua posix.exec because there may be no shell that we can \
--- run during glibc upgrade. We used to implement much of %%post as a \
--- C program, but from an overall maintenance perspective the lua in \
--- the spec file was simpler and safer given the operations required. \
--- All lua code will be ignored by rpm-ostree; see: \
--- https://github.com/projectatomic/rpm-ostree/pull/1869 \
--- If we add new lua actions to the %%post code we should coordinate \
--- with rpm-ostree and ensure that their glibc install is functional. \
-function post_exec (program, ...) \
- local pid = posix.fork () \
- if pid == 0 then \
- posix.exec (program, ...) \
- assert (nil) \
- elseif pid > 0 then \
- posix.wait (pid) \
- end \
-end \
-\
-function update_gconv_modules_cache () \
- local iconv_dir = "%{_libdir}/gconv" \
- local iconv_cache = iconv_dir .. "/gconv-modules.cache" \
- local iconv_modules = iconv_dir .. "/gconv-modules" \
- if (posix.utime (iconv_modules) == 0) then \
- if (posix.utime (iconv_cache) == 0) then \
- post_exec ("%{_prefix}/sbin/iconvconfig", \
- "-o", iconv_cache, \
- "--nostdlib", \
- iconv_dir) \
- else \
- io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n") \
- end \
- end \
-end \
-%{nil}
+%global glibc_post_funcs %{expand:
+-- We use lua because there may be no shell that we can run during
+-- glibc upgrade. We used to implement much of %%post as a C program,
+-- but from an overall maintenance perspective the lua in the spec
+-- file was simpler and safer given the operations required.
+-- All lua code will be ignored by rpm-ostree; see:
+-- https://github.com/projectatomic/rpm-ostree/pull/1869
+-- If we add new lua actions to the %%post code we should coordinate
+-- with rpm-ostree and ensure that their glibc install is functional.
+--
+
+function call_ldconfig ()
+ if not rpm.execute("%{_sbindir}/ldconfig") then
+ io.stdout:write ("Error: call to %{_sbindir}/ldconfig failed.\n")
+ end
+end
+
+function update_gconv_modules_cache ()
+ local iconv_dir = "%{_libdir}/gconv"
+ local iconv_cache = iconv_dir .. "/gconv-modules.cache"
+ local iconv_modules = iconv_dir .. "/gconv-modules"
+ if posix.utime(iconv_modules) == 0 then
+ if posix.utime (iconv_cache) == 0 then
+ if not rpm.execute("%{_sbindir}/iconvconfig",
+ "-o", iconv_cache,
+ "--nostdlib",
+ iconv_dir)
+ then
+ io.stdout:write ("Error: call to %{_sbindir}/iconvconfig failed.\n")
+ end
+ else
+ io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
+ end
+ end
+end}
#-----------------------------------------------------------------------
Summary: The GNU libc libraries
Name: %{cross_prefix}%{oname}
Epoch: 6
-Version: %{ver}
-Source0: http://ftp.gnu.org/gnu/glibc/%{oname}-%{ver}.tar.xz
+Version: 2.39
+Source0: http://ftp.gnu.org/gnu/glibc/%{oname}-%{version}.tar.xz
#if %(test $(echo %{version}.0 |cut -d. -f3) -lt 90 && echo 1 || echo 0)
-#Source1: http://ftp.gnu.org/gnu/glibc/%{oname}-%{ver}.tar.xz.sig
+#Source1: http://ftp.gnu.org/gnu/glibc/%{oname}-%{version}.tar.xz.sig
#endif
-Release: 6
+Release: 1
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Group: System/Libraries
Url: http://www.gnu.org/software/libc/
@@ -189,165 +192,62 @@ Source1003: locales.sysconfig
# Ugly, temporary arch specific (x86_32) hack
Source1010: glibc-x86_32-workaround-for-gcc-11-bug.patch
+#
+# Patches from upstream
+#
+# Taken from git://sourceware.org/git/glibc.git
+# release branch
+# git format-patch glibc-2.38
+# (PN=000; for i in *patch; do echo -e "Patch$((PN)):\t$i"; PN=$((PN+1)); done)
+# [currently none required]
+
+
#-----------------------------------------------------------------------
# fedora patches
-Patch25: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-linux-tcsetattr.patch
-Patch26: eglibc-fedora-locale-euro.patch
-Patch27: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedata-rh61908.patch
+Patch125: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-linux-tcsetattr.patch
+Patch126: eglibc-fedora-locale-euro.patch
+Patch127: https://src.fedoraproject.org/rpms/glibc/raw/rawhide/f/glibc-fedora-localedata-rh61908.patch
# We disagree with
# http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-streams-rh436349.patch
# Therefore we don't package/apply it.
-Patch30: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedef.patch
-Patch31: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-locarchive.patch
-Patch32: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-manual-dircategory.patch
-Patch35: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-ppc-unwind.patch
-Patch36: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-aarch64-tls-fixes.patch
-Patch38: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-arm-hardfloat-3.patch
-Patch40: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-c-utf8-locale.patch
-Patch41: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-cs-path.patch
+Patch130: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedef.patch
+Patch131: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-locarchive.patch
+Patch132: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-manual-dircategory.patch
+Patch135: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-ppc-unwind.patch
+Patch136: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-aarch64-tls-fixes.patch
+Patch138: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-arm-hardfloat-3.patch
+Patch141: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-cs-path.patch
# We disagree with http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-disable-rwlock-elision.patch
# Patch 131 is a much nicer solution that disables rwlock elision only on CPUs that can't handle it.
-Patch44: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-__libc_multiple_libcs.patch
-Patch46: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nscd.patch
-Patch47: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-gcc-PR69537.patch
-Patch50: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-nscd-sysconfig.patch
-Patch52: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1009145.patch
-Patch54: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1070416.patch
-#Patch55: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1315108.patch
-Patch58: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1324623.patch
-#Patch59: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1335011.patch
-Patch61: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh697421.patch
-Patch64: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh825061.patch
-Patch65: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh827510.patch
+Patch144: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-__libc_multiple_libcs.patch
+Patch146: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nscd.patch
+Patch147: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-gcc-PR69537.patch
+Patch150: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-nscd-sysconfig.patch
+Patch165: https://src.fedoraproject.org/rpms/glibc/raw/rawhide/f/glibc-rh827510.patch
#-----------------------------------------------------------------------
# Clear Linux patches
-Patch83: https://github.com/clearlinux-pkgs/glibc/blob/master/alternate_trim.patch
-Patch84: https://github.com/clearlinux-pkgs/glibc/blob/master/madvise-bss.patch
-Patch86: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/large-page-huge-page.patch
-Patch87: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/use_madv_free.patch
-Patch88: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/malloc_tune.patch
+Patch184: https://github.com/clearlinux-pkgs/glibc/blob/master/madvise-bss.patch
+Patch186: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/large-page-huge-page.patch
+Patch187: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/use_madv_free.patch
+Patch188: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/malloc_tune.patch
# (tpg) CLR disabled this patch
-#Patch90: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-Os.patch
-Patch92: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/pause.patch
-Patch100: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/spin-smarter.patch
-Patch101: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/nostackshrink.patch
+#Patch190: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-Os.patch
+Patch192: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/pause.patch
+# Needs porting
+#Patch201: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/nostackshrink.patch
-#
-# Patches from upstream
-#
-# Taken from git://sourceware.org/git/glibc.git
-# release branch
-# git format-patch glibc-2.34
-# (PN=200; for i in *patch; do echo -e "Patch$((PN)):\t$i"; PN=$((PN+1)); done)
-Patch200: 0001-ldconfig-avoid-leak-on-empty-paths-in-config-file.patch
-Patch201: 0002-gconv_parseconfdir-Fix-memory-leak.patch
-Patch202: 0003-gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
-Patch203: 0004-copy_and_spawn_sgid-Avoid-double-calls-to-close.patch
-Patch204: 0005-iconv_charmap-Close-output-file-when-done.patch
-Patch205: 0006-Linux-Fix-fcntl-ioctl-prctl-redirects-for-_TIME_BITS.patch
-Patch206: 0007-librt-fix-NULL-pointer-dereference-bug-28213.patch
-Patch207: 0008-librt-add-test-bug-28213.patch
-Patch208: 0009-elf-Fix-missing-colon-in-LD_SHOW_AUXV-output-BZ-2825.patch
-Patch209: 0010-x86-64-Use-testl-to-check-__x86_string_control.patch
-Patch210: 0011-MIPS-Setup-errno-for-f-l-xstat.patch
-Patch211: 0012-support-Add-support_wait_for_thread_exit.patch
-Patch212: 0013-nptl-pthread_kill-pthread_cancel-should-not-fail-aft.patch
-Patch213: 0014-nptl-Fix-race-between-pthread_kill-and-thread-exit-b.patch
-Patch214: 0015-iconvconfig-Fix-behaviour-with-prefix-BZ-28199.patch
-Patch215: 0016-Fix-failing-nss-tst-nss-files-hosts-long-with-local-.patch
-Patch216: 0017-Use-Linux-5.14-in-build-many-glibcs.py.patch
-Patch217: 0018-Update-syscall-lists-for-Linux-5.14.patch
-Patch218: 0019-Update-kernel-version-to-5.14-in-tst-mman-consts.py.patch
-Patch219: 0020-Add-MADV_POPULATE_READ-and-MADV_POPULATE_WRITE-from-.patch
-Patch220: 0021-posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch
-Patch221: 0022-nptl-pthread_kill-needs-to-return-ESRCH-for-old-prog.patch
-Patch222: 0023-nptl-Fix-type-of-pthread_mutexattr_getrobust_np-pthr.patch
-Patch223: 0024-support-Add-support_open_dev_null_range.patch
-Patch224: 0025-Use-support_open_dev_null_range-io-tst-closefrom-mis.patch
-Patch225: 0026-nptl-Avoid-setxid-deadlock-with-blocked-signals-in-t.patch
-Patch226: 0027-support-Add-check-for-TID-zero-in-support_wait_for_t.patch
-Patch227: 0028-nptl-pthread_kill-must-send-signals-to-a-specific-th.patch
-Patch228: 0029-misc-Add-__get_nprocs_sched.patch
-Patch229: 0030-linux-Simplify-get_nprocs.patch
-Patch230: 0031-linux-Revert-the-use-of-sched_getaffinity-on-get_npr.patch
-Patch231: 0032-Suppress-Wcast-qual-warnings-in-bsearch.patch
-Patch232: 0033-Add-missing-braces-to-bsearch-inline-implementation-.patch
-Patch233: 0034-support-Also-return-fd-when-it-is-0.patch
-Patch234: 0035-S390-Add-PCI_MIO-and-SIE-HWCAPs.patch
-Patch235: 0036-elf-Replace-nsid-with-args.nsid-BZ-27609.patch
-Patch236: 0037-y2038-Use-a-common-definition-for-stat-for-sparc32.patch
-Patch237: 0038-timex-Use-64-bit-fields-on-32-bit-TIMESIZE-64-system.patch
-Patch238: 0039-elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch
-Patch239: 0040-Handle-NULL-input-to-malloc_usable_size-BZ-28506.patch
-Patch240: 0041-ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch
-Patch241: 0042-ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch
-Patch242: 0043-Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch
-Patch243: 0044-gconv-Do-not-emit-spurious-NUL-character-in-ISO-2022.patch
-Patch244: 0045-elf-Earlier-missing-dynamic-segment-check-in-_dl_map.patch
-Patch245: 0046-s390-Use-long-branches-across-object-boundaries-jgh-.patch
-Patch246: 0047-nptl-Do-not-set-signal-mask-on-second-setjmp-return-.patch
-Patch247: 0048-linux-Use-proc-stat-fallback-for-__get_nprocs_conf-B.patch
-Patch248: 0049-powerpc64-le-Fix-CFI-and-LR-save-address-for-asm-sys.patch
-Patch249: 0050-nptl-Add-one-more-barrier-to-nptl-tst-create1.patch
-Patch250: 0051-Run-conform-tests-using-newly-built-libc.patch
-Patch251: 0052-Use-pie-default-with-conformtest.patch
-Patch252: 0053-pthread-tst-cancel28-Fix-barrier-re-init-race-condit.patch
-Patch253: 0054-mips-align-stack-in-clone-BZ-28223.patch
-Patch254: 0055-mips-increase-stack-alignment-in-clone-to-match-the-.patch
-Patch255: 0056-arm-Guard-ucontext-_rtld_global_ro-access-by-SHARED-.patch
-Patch256: 0057-nss-Use-files-dns-as-the-default-for-the-hosts-datab.patch
-Patch257: 0058-elf-Fix-tst-cpu-features-cpuinfo-for-KVM-guests-on-s.patch
-Patch258: 0059-powerpc64-le-Allocate-extra-stack-frame-on-syscall.S.patch
-Patch259: 0060-riscv-align-stack-in-clone-BZ-28702.patch
-Patch260: 0061-riscv-align-stack-before-calling-_dl_init-BZ-28703.patch
-Patch261: 0062-Update-hppa-libm-test-ulps.patch
-Patch262: 0063-Update-sparc-libm-test-ulps.patch
-Patch263: 0064-linux-Add-sparck-brk-implementation.patch
-Patch264: 0065-Linux-Fix-32-bit-vDSO-for-clock_gettime-on-powerpc32.patch
-Patch265: 0066-intl-plural.y-Avoid-conflicting-declarations-of-yyer.patch
-Patch266: 0067-AArch64-Check-for-SVE-in-ifuncs-BZ-28744.patch
-Patch267: 0068-Fix-subscript-error-with-odd-TZif-file-BZ-28338.patch
-Patch268: 0069-timezone-handle-truncated-timezones-from-tzcode-2021.patch
-Patch269: 0070-timezone-test-case-for-BZ-28707.patch
-Patch270: 0071-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
-Patch271: 0072-Update-syscall-lists-for-Linux-5.15.patch
-Patch272: 0073-i386-Remove-broken-CAN_USE_REGISTER_ASM_EBP-bug-2877.patch
-Patch273: 0074-Update-syscall-lists-for-Linux-5.16.patch
-Patch274: 0075-Disable-debuginfod-in-printer-tests-BZ-28757.patch
-Patch275: 0076-socket-Add-the-__sockaddr_un_set-function.patch
-Patch276: 0077-CVE-2022-23219-Buffer-overflow-in-sunrpc-clnt_create.patch
-Patch277: 0078-sunrpc-Test-case-for-clnt_create-unix-buffer-overflo.patch
-Patch278: 0079-CVE-2022-23218-Buffer-overflow-in-sunrpc-svcunix_cre.patch
-Patch279: 0080-x86-use-default-cache-size-if-it-cannot-be-determine.patch
-Patch280: 0081-powerpc-Fix-unrecognized-instruction-errors-with-rec.patch
-Patch281: 0082-support-Add-helpers-to-create-paths-longer-than-PATH.patch
-Patch282: 0083-stdlib-Sort-tests-in-Makefile.patch
-Patch283: 0084-stdlib-Fix-formatting-of-tests-list-in-Makefile.patch
-Patch284: 0085-realpath-Set-errno-to-ENAMETOOLONG-for-result-larger.patch
-Patch285: 0086-tst-realpath-toolong-Fix-hurd-build.patch
-Patch286: 0087-getcwd-Set-errno-to-ERANGE-for-size-1-CVE-2021-3999.patch
-Patch287: 0088-realpath-Avoid-overwriting-preexisting-error-CVE-202.patch
-Patch288: 0089-Linux-Detect-user-namespace-support-in-io-tst-getcwd.patch
-Patch289: 0090-NEWS-add-bug-entry-for-BZ-28769-and-BZ-28770.patch
-Patch290: 0091-x86-Fix-__wcsncmp_avx2-in-strcmp-avx2.S-BZ-28755.patch
-Patch291: 0092-x86-Fix-__wcsncmp_evex-in-strcmp-evex.S-BZ-28755.patch
-Patch292: 0093-NEWS-Add-a-bug-entry-for-BZ-28755.patch
-
-# from IBM release branch (ibm/%{version}/master branch in git)
-# [currently none]
#-----------------------------------------------------------------------
# OpenMandriva patches
-Patch1000: eglibc-mandriva-localedef-archive-follow-symlinks.patch
-Patch1001: glibc-2.33-compile.patch
Patch1002: glibc-2.34-headers-clang.patch
Patch1003: eglibc-mandriva-share-locale.patch
Patch1004: eglibc-mandriva-nsswitch.conf.patch
Patch1005: eglibc-mandriva-xterm-xvt.patch
+# Fixes a compile error when doing #include <cmath> in clang++ 16.0.6+
+Patch1006: glibc-2.37-aarch64-clang++-16.0.6.patch
Patch1007: eglibc-mandriva-nscd-no-host-cache.patch
Patch1010: eglibc-mandriva-timezone.patch
-Patch1012: eglibc-mandriva-ENOTTY-fr-translation.patch
Patch1018: eglibc-mandriva-testsuite-ldbl-bits.patch
Patch1019: eglibc-mandriva-testsuite-rt-notparallel.patch
Patch1020: glibc-2.19-no-__builtin_va_arg_pack-with-clang.patch
@@ -367,18 +267,20 @@ Patch1040: https://github.com/FireBurn/glibc/commit/2efa9591e5e8a129e7b73ad0dad3
# https://forums.gentoo.org/viewtopic-p-8568765.html?sid=563ab671df23b2a550273edc2dea30a2
# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5dbd6a821ff753e3b41324c4fb7c58cf65eeea33
Patch1041: glibc-2.33-no-x86-isa-level.patch
-Patch1042: glibc-2.33-gcc-11.1.patch
# Fix _Float32/_Float64 assumptions to make it work with
# clang setting __GNUC__ to something > 6
Patch1043: glibc-2.33-clang-_Float32-_Float64.patch
Patch1044: glibc-2.34-allow-zstd-compressed-locales.patch
Patch1050: https://803950.bugs.gentoo.org/attachment.cgi?id=757176#/nss-dont-crash-on-NULL.patch
+# https://www.phoronix.com/news/Glibc-2.36-EAC-Problems
+# https://sourceware.org/bugzilla/show_bug.cgi?id=29456
+Patch1051: https://raw.githubusercontent.com/archlinux/svntogit-packages/e1d69d80d07494e3c086ee2c5458594d5261d2e4/trunk/reenable_DT_HASH.patch
BuildRequires: autoconf2.5
BuildRequires: %{cross_prefix}binutils >= 2.30-7
BuildRequires: %{cross_prefix}gcc
BuildRequires: gettext
-BuildRequires: kernel-release-headers >= %{enablekernel}
+BuildRequires: kernel-headers >= %{enablekernel}
BuildRequires: patch
BuildRequires: hardlink
BuildRequires: cap-devel
@@ -424,13 +326,11 @@ Provides: ld.so.1
%rename ldconfig
%define libnssfiles %mklibname nss_files 2
%rename %{libnssfiles}
+Provides: %{_bindir}/ldconfig
+# FIXME remove at some point
Provides: /sbin/ldconfig
Obsoletes: nss_db
-%if %{build_biarch}
-Requires: %{multilibc} = %{EVRD}
-%endif
-
%if ! %{with locales}
# Fake it to keep build roots working with temporary
# non-locale glibcs during upgrades
@@ -574,12 +474,44 @@ if posix.access (ldsoconf) then
end
end
+%ifarch %{aarch64}
+-- ABI spec says it lib/ld-linux-aarch64.so.1 even though logic says lib64...
+posix.symlink("%{_libdir}/ld-linux-aarch64.so.1", "/lib/ld-linux-aarch64.so.1")
+%endif
+
+-- Place compat symlink if the system is still split-usr
+local st=posix.stat("/%{_lib}")
+if st.type ~= "link" then
+%ifarch %{ix86}
+ posix.symlink("%{_libdir}/ld-linux.so.2", "/lib/ld-linux.so.2")
+%endif
+%ifarch %{x86_64}
+ posix.symlink("%{_libdir}/ld-linux-x86-64.so.2", "/%{_lib}/ld-linux-x86-64.so.2")
+%endif
+%ifarch armv7l armv8l
+ posix.symlink("%{_libdir}/ld-linux.so.3", "/lib/ld-linux.so.3")
+%endif
+%ifarch armv7hl armv7hnl armv8hl armv8hnl armv8hcnl armv6j
+ posix.symlink("%{_libdir}/ld-linux-armhf.so.3", "/lib/ld-linux-armhf.so.3")
+%endif
+%ifarch %{aarch64}
+ posix.symlink("%{_libdir}/ld-linux-aarch64.so.1", "/%{_lib}/ld-linux-aarch64.so.1")
+%endif
+%ifarch %{mips}
+ posix.symlink("%{_libdir}/ld.so.1", "/%{_lib}/ld.so.1")
+%endif
+%ifarch riscv64
+ posix.symlink("%{_libdir}/ld-linux-riscv64-lp64d.so.1", "/%{_lib}/ld-linux-riscv64-lp64d.so.1")
+%endif
+ posix.symlink("%{_bindir}/ldconfig", "/sbin/ldconfig")
+end
+
-- (3) Rebuild ld.so.cache early.
-- If the format of the cache changes then we need to rebuild
-- the cache early to avoid any problems running binaries with
-- the new glibc.
--- Note: We use _prefix because Fedora's UsrMove says so.
-post_exec ("/sbin/ldconfig")
+
+call_ldconfig()
-- (4) Update gconv modules cache.
-- If the /usr/lib/gconv/gconv-modules.cache exists, then update it
@@ -591,32 +523,70 @@ update_gconv_modules_cache()
-- (5) On upgrades, restart systemd if installed. "systemctl -q" does
-- not suppress the error message (which is common in chroots), so
--- open-code post_exec with standard error suppressed.
+-- open-code rpm.execute with standard error suppressed.
if tonumber(arg[2]) >= 2
- and posix.access("/bin/systemctl", "x")
+ and posix.access("%{_prefix}/bin/systemctl", "x")
then
local pid = posix.fork()
if pid == 0 then
posix.redirect2null(2)
- assert(posix.exec("/bin/systemctl", "daemon-reexec"))
+ posix.exec("%{_prefix}/bin/systemctl", "daemon-reexec")
elseif pid > 0 then
posix.wait(pid)
end
end
-%transfiletriggerin -p <lua> -P 2000000 -- /lib /lib64 /usr/lib /usr/lib64 /etc/ld.so.conf.d
-os.execute("/sbin/ldconfig -X")
+%transfiletriggerin -p <lua> -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64 /etc/ld.so.conf.d
+%glibc_post_funcs
+call_ldconfig()
+%end
+
+%transfiletriggerpostun -p <lua> -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64 /etc/ld.so.conf.d
+%glibc_post_funcs
+call_ldconfig()
+%end
+%endif
+
+%posttrans -p <lua>
+-- Need to repeat it here, deinstallation of an older version
+-- wiped out the files that used to be in the older versions
-%transfiletriggerpostun -p <lua> -P 2000000 -- /lib /lib64 /usr/lib /usr/lib64 /etc/ld.so.conf.d
-os.execute("/sbin/ldconfig -X")
+%ifarch %{aarch64}
+-- ABI spec says it lib/ld-linux-aarch64.so.1 even though logic says lib64...
+posix.symlink("%{_libdir}/ld-linux-aarch64.so.1", "/lib/ld-linux-aarch64.so.1")
+%endif
+
+-- Place compat symlink if the system is still split-usr
+st=posix.stat("/%{_lib}")
+if st.type ~= "link" then
+%ifarch %{ix86}
+ posix.symlink("%{_libdir}/ld-linux.so.2", "/lib/ld-linux.so.2")
+%endif
+%ifarch %{x86_64}
+ posix.symlink("%{_libdir}/ld-linux-x86-64.so.2", "/%{_lib}/ld-linux-x86-64.so.2")
+%endif
+%ifarch armv7l armv8l
+ posix.symlink("%{_libdir}/ld-linux.so.3", "/lib/ld-linux.so.3")
+%endif
+%ifarch armv7hl armv7hnl armv8hl armv8hnl armv8hcnl armv6j
+ posix.symlink("%{_libdir}/ld-linux-armhf.so.3", "/lib/ld-linux-armhf.so.3")
%endif
+%ifarch %{aarch64}
+ posix.symlink("%{_libdir}/ld-linux-aarch64.so.1", "/%{_lib}/ld-linux-aarch64.so.1")
+%endif
+%ifarch %{mips}
+ posix.symlink("%{_libdir}/ld.so.1", "/%{_lib}/ld.so.1")
+%endif
+%ifarch riscv64
+ posix.symlink("%{_libdir}/ld-linux-riscv64-lp64d.so.1", "/%{_lib}/ld-linux-riscv64-lp64d.so.1")
+%endif
+ posix.symlink("%{_bindir}/ldconfig", "/sbin/ldconfig")
+end
%if %{with locales}
%package -n locales
Summary: Base files for localization
Group: System/Internationalization
-Obsoletes: locales <= 2.18.90-2
-Obsoletes: locales < 2.19-13
# FIXME localedef should be adapted to load
# just built charmaps instead of hardcoding
# /usr/share/i18n/charmaps
@@ -625,7 +595,7 @@ Requires(post,preun): /bin/sh
Requires(post,preun): grep
Requires(post,preun): sed
Requires(post,preun): coreutils
-Requires(post,preun): util-linux
+Requires(post,preun): util-linux-core
Requires(post,preun): glibc
Requires(post,preun): rpm
@@ -665,7 +635,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Chechen" "ce" "ce_RU")}
%{expand:%(sh %{S:1000} "Cherokee" "chr" "chr_US")}
%{expand:%(sh %{S:1000} "Central Kurdish" "ckb" "ckb_IQ")}
-%{expand:%(sh %{S:1000} "Crimean Tatar" "crh" "crh_UA")}
+%{expand:%(sh %{S:1000} "Crimean Tatar" "crh" "crh_UA" "crh_RU")}
%{expand:%(sh %{S:1000} "Czech" "cs" "cs_CZ")}
%{expand:%(sh %{S:1000} "Chuvash" "cv" "cv_RU")}
%{expand:%(sh %{S:1000} "Welsh" "cy" "cy_GB")}
@@ -689,6 +659,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Friulan" "fur" "fur_IT")}
%{expand:%(sh %{S:1000} "Frisian" "fy" "fy_DE" "fy_NL")}
%{expand:%(sh %{S:1000} "Irish" "ga" "ga_IE")}
+%{expand:%(sh %{S:1000} "Gawhwali" "gbm" "gbm_IN")}
%{expand:%(sh %{S:1000} "Scottish Gaelic" "gd" "gd_GB")}
%{expand:%(sh %{S:1000} "Galician" "gl" "gl_ES")}
%{expand:%(sh %{S:1000} "Gujarati" "gu" "gu_IN")}
@@ -723,6 +694,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Konkani" "kok" "kok_IN")}
%{expand:%(sh %{S:1000} "Kashmiri" "ks" "ks_IN")}
%{expand:%(sh %{S:1000} "Kurdish" "ku" "ku_TR")}
+%{expand:%(sh %{S:1000} "Komi" "kv" "kv_RU")}
%{expand:%(sh %{S:1000} "Cornish" "kw" "kw_GB")}
%{expand:%(sh %{S:1000} "Kyrgyz" "ky" "ky_KG")}
%{expand:%(sh %{S:1000} "Luxembourgish" "lb" "lb_LU")}
@@ -768,6 +740,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Portuguese" "pt" "pt_BR" "pt_PT")}
%{expand:%(sh %{S:1000} "Quechua" "quz" "quz_PE")}
%{expand:%(sh %{S:1000} "Rajasthani" "raj" "raj_IN")}
+%{expand:%(sh %{S:1000} "Tarifit" "rif" "rif_MA")}
%{expand:%(sh %{S:1000} "Romanian" "ro" "ro_RO")}
%{expand:%(sh %{S:1000} "Russian" "ru" "ru_RU" "ru_UA")}
%{expand:%(sh %{S:1000} "Kinyarwanda" "rw" "rw_RW")}
@@ -784,13 +757,16 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Slovenian" "sl" "sl_SI")}
%{expand:%(sh %{S:1000} "Samoan" "sm" "sm_WS")}
%{expand:%(sh %{S:1000} "Serbian" "sr" "sr_ME" "sr_RS")}
+%{expand:%(sh %{S:1000} "Saho" "ssy" "ssy_ER")}
%{expand:%(sh %{S:1000} "Somali" "so" "so_DJ" "so_ET" "so_KE" "so_SO")}
%{expand:%(sh %{S:1000} "Albanian" "sq" "sq_AL" "sq_MK")}
%{expand:%(sh %{S:1000} "Swati" "ss" "ss_ZA")}
%{expand:%(sh %{S:1000} "Sotho" "st" "st_ZA")}
+%{expand:%(sh %{S:1000} "Sundanese" "su" "su_ID")}
%{expand:%(sh %{S:1000} "Swedish" "sv" "sv_FI" "sv_SE")}
# sw_XX?
%{expand:%(sh %{S:1000} "Swahili" "sw" "sw_KE" "sw_TZ")}
+%{expand:%(sh %{S:1000} "Chaldean-Neo-Aramaic" "syr")}
%{expand:%(sh %{S:1000} "Silesian" "szl" "szl_PL")}
%{expand:%(sh %{S:1000} "Tamil" "ta" "ta_IN" "ta_LK")}
%{expand:%(sh %{S:1000} "Telugu" "te" "te_IN")}
@@ -802,6 +778,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Pilipino" "tl" "r:ph" "fil_PH" "tl_PH")}
%{expand:%(sh %{S:1000} "Tswana" "tn" "tn_ZA")}
%{expand:%(sh %{S:1000} "Tonga" "to" "to_TO")}
+%{expand:%(sh %{S:1000} "Toki Pona" "tok")}
%{expand:%(sh %{S:1000} "Turkish" "tr" "tr_CY" "tr_TR")}
%{expand:%(sh %{S:1000} "Tsonga" "ts" "ts_ZA")}
%{expand:%(sh %{S:1000} "Tatar" "tt" "tt_RU")}
@@ -821,9 +798,19 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Yoruba" "yo" "yo_NG")}
%{expand:%(sh %{S:1000} "Yue Chinese (Cantonese)" "yue" "yue_HK")}
%{expand:%(sh %{S:1000} "Yau" "yuw" "yuw_PG")}
+%{expand:%(sh %{S:1000} "Tamazight" "zgh" "zgh_MA")}
%{expand:%(sh %{S:1000} "Chinese" "zh" "zh_CN" "zh_HK" "zh_SG" "zh_TW" "cmn_TW" "hak_TW" "lzh_TW" "nan_TW")}
%{expand:%(sh %{S:1000} "Zulu" "zu" "zu_ZA")}
+%ifarch %{aarch64}
+# FIXME Workaround for the %%post script not being
+# able to run /bin/sh because of missing ld-linux-aarch64.so.1
+# symlink while building docker-builder
+# This should really not be necessary, but somehow it is.
+%pre -n locales-en -p <lua>
+posix.symlink("%{_libdir}/ld-linux-aarch64.so.1", "/lib/ld-linux-aarch64.so.1")
+%endif
+
%endif
%files -f libc.lang
@@ -835,6 +822,7 @@ LANG variable to their preferred language in their
%config %{_sysconfdir}/nsswitch.conf
%verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/ld.so.conf
%dir %{_sysconfdir}/ld.so.conf.d
+%{_sysconfdir}/ld.so.conf.d/legacy.conf
%config(noreplace) %{_sysconfdir}/rpc
%doc %dir %{_docdir}/glibc
%doc %{_docdir}/glibc/gai.conf
@@ -851,7 +839,7 @@ LANG variable to their preferred language in their
%endif
%endif
%{_localedir}/locale.alias
-/sbin/sln
+%{_bindir}/sln
%{_prefix}/libexec/getconf
%endif
%if %isarch %{x86_64}
@@ -863,43 +851,47 @@ LANG variable to their preferred language in their
%exclude %{_prefix}/libexec/getconf/XBS5_ILP32_OFFBIG
%endif
%if %isarch %{ix86}
-%{_slibdir}/ld-linux.so.2
+%{_libdir}/ld-linux.so.2
%endif
%if %isarch %{x86_64}
-%{_slibdir}/ld-linux-x86-64.so.2
+%{_libdir}/ld-linux-x86-64.so.2
%endif
%if %isarch armv7l armv8l
-%{_slibdir}/ld-linux.so.3
+%{_libdir}/ld-linux.so.3
%endif
%if %isarch armv7hl armv7hnl armv8hl armv8hnl armv8hcnl armv6j
-%{_slibdir}/ld-linux-armhf.so.3
+%{_libdir}/ld-linux-armhf.so.3
%endif
%if %isarch aarch64
-%{_slibdir}/ld-linux-aarch64.so.1
+%{_libdir}/ld-linux-aarch64.so.1
/lib/ld-linux-aarch64.so.1
%endif
+%if %isarch %{power64}
+%{_libdir}/ld64.so.2
+%endif
%if %isarch %{mips}
-%{_slibdir}/ld.so.1
+%{_libdir}/ld.so.1
%endif
%if %isarch riscv64
-%{_slibdir}/ld-linux-riscv64-lp64d.so.1
+%{_libdir}/ld-linux-riscv64-lp64d.so.1
/lib/ld-linux-riscv64-lp64d.so.1
-%{_slibdir}/lp64d
%{_libdir}/lp64d
%endif
-%{_slibdir}/lib*.so.[0-9]*
-%{_slibdir}/libSegFault.so
+%{_libdir}/lib*.so.[0-9]*
%if "%{name}" == "glibc"
%dir %{_libdir}/audit
%{_libdir}/audit/sotruss-lib.so
-%{_libdir}/gconv/*.so
+%{_libdir}/gconv/UNICODE.so
+%{_libdir}/gconv/UTF-7.so
+%{_libdir}/gconv/UTF-16.so
+%{_libdir}/gconv/UTF-32.so
%{_libdir}/gconv/gconv-modules
%ghost %{_libdir}/gconv/gconv-modules.cache
-%{_bindir}/catchsegv
%{_bindir}/gencat
%{_bindir}/getconf
%{_bindir}/getent
%{_bindir}/iconv
+%{_bindir}/ld.so
%{_bindir}/ldd
%if %isarch %{ix86}
%{_bindir}/lddlibc4
@@ -913,7 +905,7 @@ LANG variable to their preferred language in their
%{_bindir}/tzselect
%{_bindir}/zdump
%{_sbindir}/iconvconfig
-/sbin/ldconfig
+%{_bindir}/ldconfig
%ghost %{_sysconfdir}/ld.so.cache
%dir %{_var}/cache/ldconfig
%ghost %{_var}/cache/ldconfig/aux-cache
@@ -921,17 +913,33 @@ LANG variable to their preferred language in their
%else
%if %isarch mips mipsel
%if %{build_biarch}
-%{_slibdir32}/ld.so.1
-%{_slibdir32}/lib*.so.[0-9]*
-%{_slibdir32}/libSegFault.so
-%dir %{_slibdirn32}
-%{_slibdirn32}/ld.so.1
-%{_slibdirn32}/lib*.so.[0-9]*
-%{_slibdirn32}/libSegFault.so
+%{_libdir32}/ld.so.1
+%{_libdir32}/lib*.so.[0-9]*
+%dir %{_libdirn32}
+%{_libdirn32}/ld.so.1
+%{_libdirn32}/lib*.so.[0-9]*
%endif
%endif
%endif
+%transfiletriggerin -p <lua> -- %{_libdir}/gconv
+os.execute("%{_sbindir}/iconvconfig -o %{_libdir}/gconv/gconv-modules.cache --nostdlib %{_libdir}/gconv")
+
+%package -n locales-extra-charsets
+Summary: Character set definitions for non-Unicode locales
+Group: System/Libraries
+Requires: %{name} = %{EVRD}
+
+%description -n locales-extra-charsets
+Character set definitions for non-Unicode locales
+
+Pretty much everything has moved on to Unicode
+(primarily UTF-8 and UTF-16) - but text files in older encodings
+likely still exist. These modules help working with/converting
+those files.
+
+%files -n locales-extra-charsets -f extra-charsets.list
+
########################################################################
%if %{build_biarch}
#-----------------------------------------------------------------------
@@ -941,8 +949,18 @@ Group: System/Libraries
Conflicts: glibc < 2.14.90-13
Requires: %{name} = %{EVRD}
-%transfiletriggerin -p <lua> -- %{_libdir}/gconv
-os.execute("/usr/sbin/iconvconfig -o %{_libdir}/gconv/gconv-modules.cache --nostdlib %{_libdir}/gconv")
+%transfiletriggerin -p <lua> -- %{_prefix}/lib/gconv
+os.execute("%{_sbindir}/iconvconfig -o %{_prefix}/lib/gconv/gconv-modules.cache --nostdlib %{_prefix}/lib/gconv")
+
+%posttrans -n %{multilibc} -p <lua>
+-- Need to repeat it here, deinstallation of an older version
+-- wiped out the files that used to be in the older versions
+-- Place compat symlink if the system is still split-usr
+st=posix.stat("/%{_lib}")
+if st.type ~= "link" then
+ posix.symlink("%{_libdir32}/ld-linux.so.2", "/lib/ld-linux.so.2")
+end
+
%description -n %{multilibc}
The glibc package contains standard libraries which are used by
@@ -954,14 +972,16 @@ library and the standard math library. Without these two libraries, a
Linux system will not function.
%files -n %{multilibc}
-%{_slibdir32}/ld-linux*.so.2
-%{_slibdir32}/lib*.so.[0-9]*
-%{_slibdir32}/libSegFault.so
+%{_libdir32}/ld-linux*.so.2
+%{_libdir32}/lib*.so.[0-9]*
%if "%{name}" == "glibc"
%dir %{_libdir32}/audit
%{_libdir32}/audit/sotruss-lib.so
%dir %{_libdir32}/gconv
-%{_libdir32}/gconv/*.so
+%{_libdir32}/gconv/UNICODE.so
+%{_libdir32}/gconv/UTF-7.so
+%{_libdir32}/gconv/UTF-16.so
+%{_libdir32}/gconv/UTF-32.so
%{_libdir32}/gconv/gconv-modules
%ghost %{_libdir32}/gconv/gconv-modules.cache
%endif
@@ -972,6 +992,22 @@ Linux system will not function.
%{_prefix}/libexec/getconf/POSIX_V7_ILP32_OFFBIG
%{_prefix}/libexec/getconf/XBS5_ILP32_OFF32
%{_prefix}/libexec/getconf/XBS5_ILP32_OFFBIG
+
+%package -n locales-extra-charsets32
+Summary: Character set definitions for non-Unicode locales (32-bit)
+Group: System/Libraries
+Requires: %{name} = %{EVRD}
+
+%description -n locales-extra-charsets32
+Character set definitions for non-Unicode locales (32-bit)
+
+Pretty much everything has moved on to Unicode
+(primarily UTF-8 and UTF-16) - but text files in older encodings
+likely still exist. These modules help working with/converting
+those files.
+
+%files -n locales-extra-charsets32 -f extra-charsets32.list
+
#-----------------------------------------------------------------------
# build_biarch
%endif
@@ -982,11 +1018,7 @@ Summary: Header and object files for development using standard C libraries
Group: Development/C
Requires: %{name} = %{EVRD}
Requires: pkgconfig(libxcrypt)
-%if %{build_biarch}
-Requires: %{multilibc} = %{EVRD}
-%endif
-Autoreq: true
-Requires: %{?cross:cross-}kernel-release-headers >= %{enablekernel}
+Requires: %{?cross:cross-}kernel-headers >= %{enablekernel}
%if %{with pdf}
%rename glibc-doc-pdf
%endif
@@ -1020,15 +1052,17 @@ The glibc-docs package contains docs for %{name}.
%{_includedir}/*
%{_libdir}/*.o
%{_libdir}/*.so
-%exclude %{_slibdir}/ld*-[.0-9]*.so
-%exclude %{_slibdir}/lib*-[.0-9]*.so
-%exclude %{_slibdir}/libSegFault.so
+%exclude %{_libdir}/ld*-[.0-9]*.so
+%exclude %{_libdir}/lib*-[.0-9]*.so
%{_libdir}/libc_nonshared.a
# Exists for some, but not all arches
%optional %{_libdir}/libmvec_nonshared.a
%{_libdir}/libg.a
%{_libdir}/libmcheck.a
%optional %{_libdir}/libmvec.a
+%if %isarch %{power64}
+%{_libdir}/libnldbl_nonshared.a
+%endif
%if %{build_biarch}
%{_libdir32}/*.o
%{_libdir32}/*.so
@@ -1036,20 +1070,17 @@ The glibc-docs package contains docs for %{name}.
%{_libdir32}/libg.a
%{_libdir32}/libmcheck.a
%if %isarch mips mipsel
-%exclude %{_slibdir32}/ld*-[.0-9]*.so
-%exclude %{_slibdir32}/lib*-[.0-9]*.so
-%exclude %{_slibdir32}/libSegFault.so
-%exclude %{_slibdirn32}/ld*-[.0-9]*.so
-%exclude %{_slibdirn32}/lib*-[.0-9]*.so
-%exclude %{_slibdirn32}/libSegFault.so
+%exclude %{_libdir32}/ld*-[.0-9]*.so
+%exclude %{_libdir32}/lib*-[.0-9]*.so
+%exclude %{_libdirn32}/ld*-[.0-9]*.so
+%exclude %{_libdirn32}/lib*-[.0-9]*.so
%{_libdirn32}/*.o
%{_libdirn32}/*.so
%{_libdirn32}/libc_nonshared.a
%{_libdirn32}/libg.a
%{_libdirn32}/libmcheck.a
-%exclude %{_slibdir}/ld*-[.0-9]*.so
-%exclude %{_slibdir}/lib*-[.0-9]*.so
-%exclude %{_slibdir}/libSegFault.so
+%exclude %{_libdir}/ld*-[.0-9]*.so
+%exclude %{_libdir}/lib*-[.0-9]*.so
%endif
%endif
@@ -1169,16 +1200,18 @@ can be helpful during program debugging.
If unsure if you need this, don't install this package.
%files utils
+%if ! %{cross_compiling}
%{_bindir}/memusage
%{_bindir}/memusagestat
+%endif
%{_bindir}/mtrace
%{_bindir}/pcprofiledump
%{_bindir}/xtrace
-%{_slibdir}/libmemusage.so
-%{_slibdir}/libpcprofile.so
+%{_libdir}/libmemusage.so
+%{_libdir}/libpcprofile.so
%if %{build_biarch}
-%{_slibdir32}/libmemusage.so
-%{_slibdir32}/libpcprofile.so
+%{_libdir32}/libmemusage.so
+%{_libdir32}/libpcprofile.so
%endif
#-----------------------------------------------------------------------
# with utils
@@ -1228,7 +1261,7 @@ These are configuration files that describe possible time zones.
%endif
%if %{with crosscompilers}
-%global kernelver %(rpm -q --qf '%%{version}-%%{release}%%{disttag}' kernel-release-source)
+%global kernelver %(rpm -q --qf '%%{version}-%%{release}%%{disttag}' kernel-source)
%(
for i in %{long_targets}; do
[ "$i" = "%{_target_platform}" ] && continue
@@ -1237,8 +1270,8 @@ for i in %{long_targets}; do
%package -n ${package}
Summary: Libc for crosscompiling to ${i}
Group: Development/Other
-BuildRequires: cross-${i}-binutils cross-${i}-gcc-bootstrap cross-${i}-kernel-release-headers
-BuildRequires: kernel-release-source
+BuildRequires: cross-${i}-binutils cross-${i}-gcc-bootstrap cross-${i}-kernel-headers
+BuildRequires: kernel-source
Recommends: cross-${i}-binutils cross-${i}-gcc
%description -n ${package}
Libc for crosscompiling to ${i}.
@@ -1275,8 +1308,8 @@ find . -type f -size 0 -o -name "*.orig" -exec rm {} \;
#rm localedata/locales/[a-z_]*.*
# Regenerate autoconf files, some of our patches touch them
-# Remove the autoconf 2.69 hardcode...
-sed -e "s,2.69,$(autoconf --version |head -n1 |cut -d' ' -f4)," -i aclocal.m4
+# Remove the autoconf 2.71 hardcode...
+sed -e "s,2.71,$(autoconf --version |head -n1 |cut -d' ' -f4)," -i aclocal.m4
# fix nss headers location
sed -e 's@<hasht.h>@<nss/hasht.h>@g' -e 's@<nsslowhash.h>@<nss/nsslowhash.h>@g' -i configure*
@@ -1330,7 +1363,8 @@ function BuildGlibc() {
BuildCompFlags=""
# -Wall is just added to get conditionally %%optflags printed...
# cut -flto flag
- BuildFlags="$(rpm --target ${arch}-%{_target_os} -D '%__common_cflags_with_ssp -Wall' -E %%{optflags} | sed -e 's# -fPIC##g' -e 's#-m64##' -e 's#-gdwarf-4##;s#-g[0-3]##;s#-gdwarf-[0-9]##;s#-g##' -e 's#-flto##' -e 's#-m[36][24]##' -e 's#-O[sz0-9]#-O3#')"
+# BuildFlags="$(rpm --target ${arch}-%{_target_os} -D '%__common_cflags_with_ssp -Wall' -E %%{optflags} | sed -e 's# -fPIC##g' -e 's#-m64##' -e 's#-gdwarf-4##;s#-g[0-3]##;s#-gdwarf-[0-9]##;s#-g##' -e 's#-flto##' -e 's#-m[36][24]##' -e 's#-O[sz0-9]#-O3#')"
+ BuildFlags="-O2"
case $arch in
i[3-6]86)
%ifarch %{x86_64}
@@ -1406,7 +1440,8 @@ function BuildGlibc() {
# set some extra flags here
# (tpg) build with -O3
- BuildFlags="$BuildFlags -Wp,-D_GLIBCXX_ASSERTIONS -DNDEBUG=1 -fstack-clash-protection %(echo %{optflags} |sed -e 's#-m[36][24]##g;s#-O[s2]#-O3#g')"
+# BuildFlags="$BuildFlags -Wp,-D_GLIBCXX_ASSERTIONS -DNDEBUG=1 -fstack-clash-protection %(echo %{optflags} |sed -e 's#-m[36][24]##g;s#-O[s2]#-O3#g')"
+ BuildFlags="-O2"
%ifnarch %{arm}
# As of gcc 8.3.0, glibc 2.29, using -funwind-tables or -fasynchronous-unwind-tables
# on armv7hnl results in a build failure because configure can't find a
@@ -1417,7 +1452,7 @@ function BuildGlibc() {
BuildFlags="$BuildFlags -fno-lto"
if [ "$arch" = 'i586' ] || [ "$arch" = 'i686' ]; then
- # Work around https://sourceware.org/ml/libc-alpha/2015-10/msg00745.html
+# Work around https://sourceware.org/ml/libc-alpha/2015-10/msg00745.html
BuildCC="$BuildCC -fomit-frame-pointer"
BuildCXX="$BuildCXX -fomit-frame-pointer"
fi
@@ -1447,6 +1482,11 @@ function BuildGlibc() {
fi
%endif
+# (tpg) enable Memory Tagging Extension (MTE) for aarch64
+ if [ "$arch" = 'aarch64' ]; then
+ ExtraFlags="$ExtraFlags --enable-memory-tagging"
+ fi
+
# Add-ons
AddOns="libidn"
@@ -1459,7 +1499,6 @@ function BuildGlibc() {
LIB=$(rpm --macros %{_usrlibrpm}/macros:%{_usrlibrpm}/platform/${arch}-%{_target_os}/macros --target=${arch} -E %%{_lib})
LIBDIR=$(rpm --macros %{_usrlibrpm}/macros:%{_usrlibrpm}/platform/${arch}-%{_target_os}/macros --target=${arch} -E %%{_libdir})
- SLIBDIR=/${LIB}
# Determine library name
glibc_cv_cc_64bit_output=no
@@ -1479,8 +1518,8 @@ function BuildGlibc() {
# Force a separate object dir
mkdir -p build-$arch-linux
cd build-$arch-linux
+ export libc_cv_slibdir=${LIBDIR}
[ "$BuildAltArch" = 'yes' ] && touch ".alt" || touch ".main"
- export libc_cv_slibdir=${SLIBDIR}
case $arch in
znver1)
configarch=x86_64
@@ -1490,11 +1529,32 @@ function BuildGlibc() {
;;
esac
echo CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-error" ARFLAGS="$ARFLAGS --generate-missing-build-notes=yes" LDFLAGS="%{build_ldflags} -fuse-ld=bfd"
+%if %{cross_compiling}
+ export TRIPLET=%{_target_platform}
+ CC="${TRIPLET}-gcc ${CFLAGS}" \
+ ../configure \
+ --prefix=%{_prefix} \
+ --bindir=%{_bindir} \
+ --sbindir=%{_sbindir} \
+ --libexecdir=%{_prefix}/libexec \
+ --libdir=${LIBDIR} \
+ --host=${TRIPLET} \
+ --target=${TRIPLET} \
+ --with-gnu-ld=${TRIPLET}-ld.bfd \
+%if %{with nscd}
+ --enable-build-nscd \
+%else
+ --disable-build-nscd \
+%endif
+ --enable-add-ons=$AddOns
+%else
CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-error" ARFLAGS="$ARFLAGS --generate-missing-build-notes=yes" LDFLAGS="%{build_ldflags} -fuse-ld=bfd" ../configure \
--target=$configarch-%{platform} \
--host=$configarch-%{platform} \
$BuildCross \
--prefix=%{_prefix} \
+ --bindir=%{_bindir} \
+ --sbindir=%{_sbindir} \
--libexecdir=%{_prefix}/libexec \
--libdir=${LIBDIR} \
--infodir=%{_infodir} \
@@ -1505,7 +1565,9 @@ echo CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-error" ARFLAGS="$ARF
--disable-nss-crypt \
--disable-crypt \
$(WithSelinux) \
-%if !%{with nscd}
+%if %{with nscd}
+ --enable-build-nscd \
+%else
--disable-build-nscd \
%endif
--enable-bind-now \
@@ -1517,6 +1579,7 @@ echo CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-error" ARFLAGS="$ARF
--enable-kernel=%{enablekernel} \
--with-headers=$KernelHeaders ${1+"$@"} \
--with-bugurl=%{bugurl}
+%endif
# FIXME drop -j1 if the Makefiles ever get fixed for parallel build
if [ "$BuildAltArch" = "yes" ]; then
@@ -1565,10 +1628,10 @@ for i in %{targets}; do
echo "===== Building %{_target_platform} -> $i ($TRIPLET) cross libc ====="
mkdir -p obj-${TRIPLET}
cd obj-${TRIPLET}
- CFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
- CXXFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
- ASFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
- LDFLAGS="$(rpm --target ${i} --eval '%%{ldflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g')" \
+# CFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
+# CXXFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
+# ASFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
+# LDFLAGS="$(rpm --target ${i} --eval '%%{ldflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g')" \
CC="${TRIPLET}-gcc ${CFLAGS}" \
../configure \
--prefix=%{_prefix}/${TRIPLET} \
@@ -1601,6 +1664,12 @@ for i in %{targets}; do
%make_install DESTDIR="${DD}"
cd ..
+ # Make legacy build systems that hardcode -ldl and/or -lpthread happy
+ echo '/* GNU ld script */' >${DD}%{_prefix}/${TRIPLET}/lib/libdl.so
+ echo '/* GNU ld script */' >${DD}%{_prefix}/${TRIPLET}/lib/libutil.so
+ echo '/* GNU ld script */' >${DD}%{_prefix}/${TRIPLET}/lib/librt.so
+ echo '/* GNU ld script */' >${DD}%{_prefix}/${TRIPLET}/lib/libpthread.so
+
# Get rid of object files to be a little friendlier to tmpfs buildroots
rm -rf "obj-${TRIPLET}"
# We need to get rid of this hardcode at some point so the sysroot can
@@ -1648,7 +1717,7 @@ export BIARCH_BUILDING=1
#-----------------------------------------------------------------------
-%if "%{target_cpu}" != "i686"
+%if %{with tests}
%check
# ...
export PATH=$PWD/bin:$PATH
@@ -1667,6 +1736,7 @@ done < %{checklist}
%if !%isarch %{mipsx}
export PATH=$PWD/bin:$PATH
%endif
+builddir="$(pwd)"
%if %{with crosscompilers}
for i in %{long_targets}; do
@@ -1705,23 +1775,20 @@ make install_root=%{buildroot} install -C build-%{target_cpu}-linux
# Dispatch */lib only
case "$ALT_ARCH" in
mips32*)
- LIB="%{_slibdirn32}"
+ LIB="%{_libdirn32}"
;;
mips64*)
- LIB="%{_slibdir}"
+ LIB="%{_libdir}"
;;
mips*)
- LIB="%{_slibdir32}"
+ LIB="%{_libdir32}"
;;
*)
- LIB=/lib
+ LIB=%{_prefix}/lib
;;
esac
mv %{buildroot}/$ALT_ARCH/$LIB %{buildroot}/$LIB
mv %{buildroot}/$ALT_ARCH%{_libexecdir}/getconf/* %{buildroot}%{_prefix}/libexec/getconf/
- [ ! -d %{buildroot}%{_prefix}/$LIB/ ] && mkdir -p %{buildroot}%{_prefix}/$LIB/
- mv %{buildroot}/$ALT_ARCH%{_prefix}/$LIB/* %{buildroot}%{_prefix}/$LIB/
-
rm -rf %{buildroot}/$ALT_ARCH
# XXX Dispatch 32-bit stubs
(sed '/^@/d' include/stubs-prologue.h; LC_ALL=C sort $(find build-$ALT_ARCH -name stubs)) \
@@ -1735,7 +1802,7 @@ function InstallGlibc() {
local SubDir="$2"
local LibDir="$3"
- [ -z "$LibDir" ] && LibDir="%{_slibdir}"
+ [ -z "$LibDir" ] && LibDir="%{_libdir}"
cd $BuildDir
mkdir -p %{buildroot}$LibDir/$SubDir/
@@ -1802,16 +1869,39 @@ EOF
install -m755 build-%{_target_cpu}-linux/elf/ldd %{buildroot}%{_bindir}/ldd
%endif
+# usrmerge + binmerge
+mv %{buildroot}/sbin/* %{buildroot}%{_bindir}/
+mv %{buildroot}%{_prefix}/sbin/* %{buildroot}%{_bindir}/
+rmdir %{buildroot}/sbin %{buildroot}%{_prefix}/sbin
+
# ldconfig cache
mkdir -p %{buildroot}%{_var}/cache/ldconfig
truncate -s 0 %{buildroot}%{_var}/cache/ldconfig/aux-cache
# Note: This has to happen before creating /etc/ld.so.conf.
# ldconfig is statically linked, so we can use the new version.
-%{buildroot}/sbin/ldconfig -N -r %{buildroot}
+%if %{cross_compiling}
+ldconfig -N -r %{buildroot}
+%else
+%{buildroot}%{_bindir}/ldconfig -N -r %{buildroot}
+%endif
echo "include /etc/ld.so.conf.d/*.conf" > %{buildroot}%{_sysconfdir}/ld.so.conf
chmod 644 %{buildroot}%{_sysconfdir}/ld.so.conf
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
+echo '/%{_lib}' >%{buildroot}%{_sysconfdir}/ld.so.conf.d/legacy.conf
+
+# gconv modules
+for i in %{buildroot}%{_libdir}/gconv/*.so; do
+ B=$(basename $i)
+ echo $B |grep -qE '^(UNICODE|UTF)' || echo "%{_libdir}/gconv/$B" >>extra-charsets.list
+done
+
+%if %{build_biarch}
+for i in %{buildroot}%{_prefix}/lib/gconv/*.so; do
+ B=$(basename $i)
+ echo $B |grep -qE '^(UNICODE|UTF)' || echo "%{_prefix}/lib/gconv/$B" >>extra-charsets32.list
+done
+%endif
# gconv-modules.cache
truncate -s 0 %{buildroot}%{_libdir}/gconv/gconv-modules.cache
@@ -1831,12 +1921,12 @@ if [ "%{_target_cpu}" != "%{target_cpu}" ]; then
fi
# Strip debugging info from all static libraries
-cd %{buildroot}%{_slibdir}
+cd %{buildroot}%{_libdir}
for i in *.a; do
if [ -f "$i" ]; then
case "$i" in
*_p.a) ;;
- *) $Strip -g -R .comment -R .GCC.command.line $i ;;
+ *) LC_ALL=C file $i |grep -q archive && $Strip -g -R .comment -R .GCC.command.line $i ;;
esac
fi
done
@@ -1872,6 +1962,21 @@ install -m 644 COPYING COPYING.LIB README NEWS INSTALL \
%{buildroot}%{_docdir}/glibc
install -m 644 timezone/README %{buildroot}%{_docdir}/glibc/README.timezone
+# Make legacy Makefiles/build scripts that hardcode
+# -ldl and/or -lpthread happy
+echo '/* GNU ld script */' >%{buildroot}%{_libdir}/libdl.so
+echo '/* GNU ld script */' >%{buildroot}%{_libdir}/libutil.so
+echo '/* GNU ld script */' >%{buildroot}%{_libdir}/librt.so
+echo '/* GNU ld script */' >%{buildroot}%{_libdir}/libpthread.so
+%if "%{_lib}" != "lib"
+if [ -e %{buildroot}%{_prefix}/lib/libc.so ]; then
+ echo '/* GNU ld script */' >%{buildroot}%{_prefix}/lib/libdl.so
+ echo '/* GNU ld script */' >%{buildroot}%{_prefix}/lib/libutil.so
+ echo '/* GNU ld script */' >%{buildroot}%{_prefix}/lib/librt.so
+ echo '/* GNU ld script */' >%{buildroot}%{_prefix}/lib/libpthread.so
+fi
+%endif
+
# Localization
%if "%{name}" == "glibc"
%find_lang libc
@@ -1883,7 +1988,7 @@ touch libc.lang
# (tpg) remove duplicated langs from lang list
for i in %{long_targets}; do
[ "$i" = "%{_target_platform}" ] && continue
- grep %{_prefix}/${i} libc.lang >cross-${i}.lang
+ grep -E "%{_prefix}/${i}($|/)" libc.lang >cross-${i}.lang || echo "%optional /no/locales/for/$i" >cross-${i}.lang
cat libc.lang cross-${i}.lang |sort |uniq -u >libc.lang.new
# We want to own the whole directory, not just libc.mo
sed -i -e 's,/libc.mo$,,' cross-${i}.lang
@@ -1903,20 +2008,19 @@ rm -f %{buildroot}%{_bindir}/rpcgen %{buildroot}%{_mandir}/man1/rpcgen.1*
rm -f %{buildroot}%{_bindir}/mtrace
rm -f %{buildroot}%{_bindir}/pcprofiledump
rm -f %{buildroot}%{_bindir}/xtrace
- rm -f %{buildroot}%{_slibdir}/libmemusage.so
- rm -f %{buildroot}%{_slibdir}/libpcprofile.so
+ rm -f %{buildroot}%{_libdir}/libmemusage.so
+ rm -f %{buildroot}%{_libdir}/libpcprofile.so
%if %{build_biarch}
- rm -f %{buildroot}%{_slibdir32}/libmemusage.so
- rm -f %{buildroot}%{_slibdir32}/libpcprofile.so
+ rm -f %{buildroot}%{_libdir32}/libmemusage.so
+ rm -f %{buildroot}%{_libdir32}/libpcprofile.so
%endif
%if %isarch %{mips} %{mipsel}
- rm -f %{buildroot}%{_slibdirn32}/libmemusage.so
- rm -f %{buildroot}%{_slibdirn32}/libpcprofile.so
+ rm -f %{buildroot}%{_libdirn32}/libmemusage.so
+ rm -f %{buildroot}%{_libdirn32}/libpcprofile.so
%endif
%endif
%if !%{with timezone}
- rm -f %{buildroot}%{_sbindir}/zdump
rm -f %{buildroot}%{_sbindir}/zic
rm -f %{buildroot}%{_mandir}/man1/zdump.1*
%endif
@@ -1926,31 +2030,38 @@ rm -f %{buildroot}%{_bindir}/rpcgen %{buildroot}%{_mandir}/man1/rpcgen.1*
%endif
%if %{with locales}
-# Build locales...
-%global glibcver %(rpm -q --qf "%%{VERSION}" glibc)
-export I18NPATH=%{buildroot}%{_datadir}/i18n
-
-export LDSO=$(ls -1 %{buildroot}/%{_lib}/ld-*.so* |head -n1)
-export LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir}
-# make default charset pseudo-locales
-# those will be symlinked (for LC_CTYPE, LC_COLLATE mainly) from
-# a lot of other locales, thus saving space
+# Generate locales...
+%if %{cross_compiling}
+export LOCALEDEF=%{_bindir}/localedef
+%else
+export LDSO="$(ls -1 %{buildroot}%{_libdir}/ld-*.so* |head -n1) --library-path %{buildroot}%{_libdir}"
+export LOCALEDEF=%{buildroot}%{_bindir}/localedef
+%endif
+# default charset pseudo-locales
for DEF_CHARSET in UTF-8 ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 \
- ISO-8859-5 ISO-8859-7 ISO-8859-9 \
- ISO-8859-13 ISO-8859-14 ISO-8859-15 KOI8-R KOI8-U CP1251
+ ISO-8859-5 ISO-8859-7 ISO-8859-9 \
+ ISO-8859-13 ISO-8859-14 ISO-8859-15 KOI8-R KOI8-U CP1251
do
- # don't use en_DK because of LC_MONETARY
- $LDSO %{buildroot}%{_bindir}/localedef -c -f $DEF_CHARSET -i en_US %{buildroot}%{_datadir}/locale/$DEF_CHARSET
+ # don't use en_DK because of LC_MONETARY
+ $LDSO $LOCALEDEF -c -f $DEF_CHARSET -i en_US --prefix %{buildroot} %{buildroot}%{_datadir}/locale/$DEF_CHARSET
done
# Build regular locales
-LANGS="$(sed '1,/^SUPPORTED-LOCALES=/d;s,\\$,,;s,\n,,' %{buildroot}%{_datadir}/i18n/SUPPORTED)"
+LANGS="$(sed '1,/^SUPPORTED-LOCALES=/d;s,\\$,,;s,\n,,' ${builddir}/localedata/SUPPORTED)"
+export I18NPATH=%{buildroot}%{_datadir}/i18n
for l in $LANGS; do
LNG=$(echo $l |cut -d/ -f1)
CS=$(echo $l |cut -d/ -f2)
- $LDSO %{buildroot}%{_bindir}/localedef -i "$(echo $LNG |sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/')" -c -f $CS %{buildroot}%{_datadir}/locale/$LNG
+ $LDSO $LOCALEDEF --prefix %{buildroot} -i "$(echo $LNG |sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/')" -c -f $CS %{buildroot}%{_datadir}/locale/$LNG
+done
+
+# Replace files identical to default locales
+# with symlinks
+find %{buildroot}%{_datadir}/locale -name LC_CTYPE -samefile %{buildroot}%{_datadir}/locale/C.UTF-8/LC_CTYPE |while read r; do
+ [ "$r" = "%{buildroot}%{_datadir}/locale/C.UTF-8/LC_CTYPE" ] && continue
+ echo "===== Symlinking $r to C.UTF-8 ====="
+ ln -sf ../C.UTF-8/LC_CTYPE "$r"
done
-unset LD_LIBRARY_PATH
# Locale related tools
install -c -m 755 %{SOURCE1001} %{SOURCE1002} %{buildroot}%{_bindir}/
@@ -1976,20 +2087,20 @@ rm -f %{buildroot}%{_prefix}/lib/libcrypt.so
%ifarch %{aarch64}
# Compat symlink -- some versions of ld hardcoded /lib/ld-linux-aarch64.so.1
# as dynamic loader
-ln -s %{_slibdir}/ld-linux-aarch64.so.1 %{buildroot}/lib/ld-linux-aarch64.so.1
+mkdir -p %{buildroot}/lib
+ln -s /lib64/ld-linux-aarch64.so.1 %{buildroot}/lib/ld-linux-aarch64.so.1
%endif
%ifarch riscv64
# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d.
# Make these be symlinks to /lib64 or /usr/lib64 respectively. See:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/
-for d in %{buildroot}%{_libdir} %{buildroot}/%{_lib}; do
- mkdir -p $d
- (cd $d && rm -f lp64d; ln -sf . lp64d)
-done
-# Compat symlink -- some versions of ld hardcoded /lib/ld-linux-aarch64.so.1
+mkdir -p %{buildroot}%{_libdir}
+(cd %{buildroot}%{_libdir} && rm -f lp64d; ln -sf . lp64d)
+# Compat symlink -- some versions of ld hardcoded /lib/ld-linux-riscv64-lp64d.so.1
# as dynamic loader
-ln -s %{_slibdir}/ld-linux-riscv64-lp64d.so.1 %{buildroot}/lib/ld-linux-riscv64-lp64d.so.1
+mkdir -p %{buildroot}/lib
+ln -s /%{_lib}/ld-linux-riscv64-lp64d.so.1 %{buildroot}/lib/ld-linux-riscv64-lp64d.so.1
%endif
%ifarch %{x86_64}
@@ -2000,7 +2111,7 @@ ln -s %{_slibdir}/ld-linux-riscv64-lp64d.so.1 %{buildroot}/lib/ld-linux-riscv64-
# This will make the '-g' argument to be passed to eu-strip for these libraries, so that
# some info is kept that's required to make valgrind work without depending on glibc-debug
# package to be installed.
-export EXCLUDE_FROM_FULL_STRIP="ld-%{fullver}.so libpthread libc-%{fullver}.so libm-%{fullver}.so"
+export EXCLUDE_FROM_FULL_STRIP="ld-%{version}.so libpthread libc-%{version}.so libm-%{version}.so"
# Disallow linking against libc_malloc_debug.
%if %{build_biarch}
@@ -2020,10 +2131,4 @@ rm -f %{buildroot}%{_libdir}/libc_malloc_debug.so
%{_datadir}/locale/CP*
%{_datadir}/locale/UTF*
%{_datadir}/locale/KOI*
-
-%post -n locales
-%{_bindir}/locale_install.sh "ENCODINGS"
-
-%preun -n locales
-%{_bindir}/locale_uninstall.sh "ENCODINGS"
%endif
diff --git a/large-page-huge-page.patch b/large-page-huge-page.patch
index 6ba61fd..0a79d4a 100644
--- a/large-page-huge-page.patch
+++ b/large-page-huge-page.patch
@@ -1,11 +1,13 @@
---- glibc-2.24/malloc/malloc.c~ 2016-08-02 02:01:36.000000000 +0000
-+++ glibc-2.24/malloc/malloc.c 2016-08-27 04:16:33.210410956 +0000
-@@ -2333,6 +2333,8 @@
+diff -up glibc-2.39/malloc/malloc.c.17~ glibc-2.39/malloc/malloc.c
+--- glibc-2.39/malloc/malloc.c.17~ 2024-01-31 23:41:16.674558991 +0100
++++ glibc-2.39/malloc/malloc.c 2024-01-31 23:41:54.042915557 +0100
+@@ -2431,6 +2431,9 @@ sysmalloc_mmap (INTERNAL_SIZE_T nb, size
- if (mm != MAP_FAILED)
- {
-+ if (size > 8 * 1024 * 1024)
-+ __madvise (mm, size , MADV_HUGEPAGE);
- /*
- The offset to the start of the mmapped region is stored
- in the prev_size field of the chunk. This allows us to adjust
+ __set_vma_name (mm, size, " glibc: malloc");
+
++ if (size > 8 * 1024 * 1024)
++ __madvise (mm, size , MADV_HUGEPAGE);
++
+ /*
+ The offset to the start of the mmapped region is stored in the prev_size
+ field of the chunk. This allows us to adjust returned start address to
diff --git a/locale_install.sh b/locale_install.sh
index 38b74be..479a28f 100644
--- a/locale_install.sh
+++ b/locale_install.sh
@@ -4,28 +4,6 @@
# it gets the locale name(s) as parameter, and does the needed steps
# so that the new locale can be used by the system
-# check if installing main locales package (just encodings)
-if [ "$1" = 'ENCODINGS' ]; then
- # update encoding files used by locales
- ENCODINGS="CP1251 ISO-8859-1 ISO-8859-13 ISO-8859-14 ISO-8859-15 \
- ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 \
- ISO-8859-9 KOI8-R KOI8-U UTF-8"
- for enc in $ENCODINGS; do
- if [ -r "/usr/share/locale/$enc/LC_CTYPE" ]; then
- mkdir -p "/etc/locale/$enc/LC_MESSAGES"
- for i in LC_ADDRESS LC_COLLATE LC_CTYPE \
- LC_IDENTIFICATION LC_MEASUREMENT LC_MONETARY \
- LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE \
- LC_TIME LC_MESSAGES/SYS_LC_MESSAGES
- do
- cp -fp "/usr/share/locale/$enc/$i" \
- "/etc/locale/$enc/$i"
- done
- fi
- done
- exit 0
-fi
-
# the list of languages that rpm installs their translations
if [ -r /etc/rpm/macros ]; then
RPM_INSTALL_LANG="$(grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-)"
@@ -55,19 +33,7 @@ for i in "$@"; do
langs="$langs $lng"
done
for k in $langs; do
- # copy the LC_* of the all system locales to /etc/locale, so
- # everything is ok on boot time, even if /usr is not mounted
if [ -r "/usr/share/locale/$k/LC_CTYPE" ]; then
- mkdir -p "/etc/locale/$k/LC_MESSAGES"
- for j in LC_ADDRESS LC_IDENTIFICATION LC_MONETARY \
- LC_PAPER LC_COLLATE LC_MEASUREMENT LC_NAME \
- LC_TELEPHONE LC_CTYPE LC_NUMERIC LC_TIME \
- LC_MESSAGES/SYS_LC_MESSAGES
- do
- cp -fpP "/usr/share/locale/$k/$j" \
- "/etc/locale/$k/$j"
- done
-
# maintain updated locale-archive file
[ "$update_locarchive" -eq 0 ] || \
localedef \
diff --git a/locale_uninstall.sh b/locale_uninstall.sh
index 2309df5..79f3960 100644
--- a/locale_uninstall.sh
+++ b/locale_uninstall.sh
@@ -3,27 +3,6 @@
# this script is to be called when a locale is removed from the sistem;
# so translations in the language(s) of the locale are no longer installed
-if [ "$1" = 'ENCODINGS' ]; then
- # remove encoding files used by locales
- ENCODINGS="CP1251 ISO-8859-1 ISO-8859-13 ISO-8859-14 ISO-8859-15 \
- ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 \
- ISO-8859-9 KOI8-R KOI8-U UTF-8"
- for enc in $ENCODINGS; do
- if [ -d "/etc/locale/$enc" ]; then
- for i in LC_ADDRESS LC_COLLATE LC_CTYPE \
- LC_IDENTIFICATION LC_MEASUREMENT LC_MONETARY \
- LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE \
- LC_TIME LC_MESSAGES/SYS_LC_MESSAGES
- do
- rm -f "/etc/locale/$enc/$i"
- done
- rmdir "/etc/locale/$enc/LC_MESSAGES" > /dev/null 2>&1
- rmdir "/etc/locale/$enc" > /dev/null 2>&1
- fi
- done
- exit 0
-fi
-
# the list of languages that rpm installs their translations
if [ -r /etc/rpm/macros ]; then
RPM_INSTALL_LANG="$(grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-)"
@@ -40,21 +19,6 @@ for i in "$@"; do
echo "$lng" | grep -q "$i" || continue
langs="$langs $lng"
done
- for k in $langs; do
- # remove the LC_* of the all system locales from /etc/locale,
- # copied by locale_install.sh
- if [ -d "/etc/locale/$k" ]; then
- for j in LC_ADDRESS LC_IDENTIFICATION LC_MONETARY \
- LC_PAPER LC_COLLATE LC_MEASUREMENT LC_NAME \
- LC_TELEPHONE LC_CTYPE LC_NUMERIC LC_TIME \
- LC_MESSAGES/SYS_LC_MESSAGES
- do
- rm -f "/etc/locale/$k/$j"
- done
- rmdir "/etc/locale/$k/LC_MESSAGES" > /dev/null 2>&1
- rmdir "/etc/locale/$k" > /dev/null 2>&1
- fi
- done
# remove the locale from the list known to rpm (so translations in that
# language are no more installed), and from the menu system
diff --git a/localepkg.sh b/localepkg.sh
index 8fabc4b..6e3869b 100644
--- a/localepkg.sh
+++ b/localepkg.sh
@@ -2,7 +2,7 @@
langname="$1"
shift
locale="$1"
-shift
+[ "$#" -gt 1 ] && shift
cat <<EOF
%package -n locales-$locale
diff --git a/nostackshrink.patch b/nostackshrink.patch
deleted file mode 100644
index 0963ee9..0000000
--- a/nostackshrink.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-when this gets called the stack is likely not there; avoid the tlb flushes
-
-
---- glibc-2.28/nptl/allocatestack.c~ 2018-08-01 05:10:47.000000000 +0000
-+++ glibc-2.28/nptl/allocatestack.c 2018-09-27 16:18:09.043648892 +0000
-@@ -385,6 +385,8 @@
- {
- uintptr_t sp = (uintptr_t) CURRENT_STACK_FRAME;
- size_t pagesize_m1 = __getpagesize () - 1;
-+
-+ return;
- #if _STACK_GROWS_DOWN && !defined(NEED_SEPARATE_REGISTER_STACK)
- size_t freesize = (sp - (uintptr_t) mem) & ~pagesize_m1;
- assert (freesize < size);
diff --git a/nptl-getrlimit-compile.patch b/nptl-getrlimit-compile.patch
deleted file mode 100644
index 2052b19..0000000
--- a/nptl-getrlimit-compile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- libc/nptl/nptl-init.c.bero~ 2012-12-01 23:55:26.722754391 +0100
-+++ libc/nptl/nptl-init.c 2012-12-01 23:55:42.725950817 +0100
-@@ -414,7 +414,7 @@ __pthread_initialize_minimal_internal (v
- /* Determine the default allowed stack size. This is the size used
- in case the user does not specify one. */
- struct rlimit limit;
-- if (__getrlimit (RLIMIT_STACK, &limit) != 0
-+ if (getrlimit (RLIMIT_STACK, &limit) != 0
- || limit.rlim_cur == RLIM_INFINITY)
- /* The system limit is not usable. Use an architecture-specific
- default. */
diff --git a/nss-dont-crash-on-NULL.patch b/nss-dont-crash-on-NULL.patch
index 844382d..f6de0a3 100644
--- a/nss-dont-crash-on-NULL.patch
+++ b/nss-dont-crash-on-NULL.patch
@@ -1,6 +1,7 @@
---- glibc-2.34.orig/nss/XXX-lookup.c 2021-12-02 10:57:55.785033000 +0100
-+++ glibc-2.34/nss/XXX-lookup.c 2021-12-02 10:59:22.796033000 +0100
-@@ -53,6 +53,9 @@
+diff -up glibc-2.35/nss/XXX-lookup.c.185~ glibc-2.35/nss/XXX-lookup.c
+--- glibc-2.35/nss/XXX-lookup.c.185~ 2022-06-24 23:19:42.023870561 +0200
++++ glibc-2.35/nss/XXX-lookup.c 2022-06-24 23:20:35.490963277 +0200
+@@ -53,6 +53,9 @@ DB_LOOKUP_FCT (nss_action_list *ni, cons
if (! __nss_database_get (DATABASE_NAME_ID, &DATABASE_NAME_SYMBOL))
return -1;
@@ -9,4 +10,4 @@
+
*ni = DATABASE_NAME_SYMBOL;
- return __nss_lookup (ni, fct_name, fct2_name, fctp);
+ /* We want to know about it if we've somehow got a NULL action list;
diff --git a/reenable_DT_HASH.patch b/reenable_DT_HASH.patch
new file mode 100644
index 0000000..7b7fe9e
--- /dev/null
+++ b/reenable_DT_HASH.patch
@@ -0,0 +1,101 @@
+diff -up glibc-2.38/Makeconfig.45~ glibc-2.38/Makeconfig
+--- glibc-2.38/Makeconfig.45~ 2023-08-01 01:02:58.246719027 +0200
++++ glibc-2.38/Makeconfig 2023-08-01 01:02:58.303719582 +0200
+@@ -381,6 +381,15 @@ relro-LDFLAGS = -Wl,-z,relro
+ LDFLAGS.so += $(relro-LDFLAGS)
+ LDFLAGS-rtld += $(relro-LDFLAGS)
+
++ifeq (yes,$(have-hash-style))
++# For the time being we unconditionally use 'both'. At some time we
++# should declare statically linked code as 'out of luck' and compile
++# with --hash-style=gnu only.
++hashstyle-LDFLAGS = -Wl,--hash-style=both
++LDFLAGS.so += $(hashstyle-LDFLAGS)
++LDFLAGS-rtld += $(hashstyle-LDFLAGS)
++endif
++
+ # Linker options to enable and disable DT_RELR.
+ ifeq ($(have-dt-relr),yes)
+ dt-relr-ldflag = -Wl,-z,pack-relative-relocs
+diff -up glibc-2.38/Makerules.45~ glibc-2.38/Makerules
+diff -up glibc-2.38/config.make.in.45~ glibc-2.38/config.make.in
+--- glibc-2.38/config.make.in.45~ 2023-08-01 01:02:58.301719562 +0200
++++ glibc-2.38/config.make.in 2023-08-01 01:03:54.721267748 +0200
+@@ -71,6 +71,7 @@ have-libaudit = @have_libaudit@
+ have-libcap = @have_libcap@
+ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
+ bind-now = @bindnow@
++have-hash-style = @libc_cv_hashstyle@
+ have-cxx-thread_local = @libc_cv_cxx_thread_local@
+ have-loop-to-function = @libc_cv_cc_loop_to_function@
+ have-textrel_ifunc = @libc_cv_textrel_ifunc@
+diff -up glibc-2.38/configure.45~ glibc-2.38/configure
+--- glibc-2.38/configure.45~ 2023-07-31 19:54:16.000000000 +0200
++++ glibc-2.38/configure 2023-08-01 01:04:54.904850299 +0200
+@@ -655,6 +655,7 @@ libc_cv_cc_submachine
+ libc_cv_cc_nofma
+ libc_cv_mtls_dialect_gnu2
+ libc_cv_has_glob_dat
++libc_cv_hashstyle
+ libc_cv_fpie
+ libc_cv_z_execstack
+ ASFLAGS_config
+@@ -7107,6 +7108,32 @@ fi
+ printf "%s\n" "$libc_cv_fpie" >&6; }
+
+
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --hash-style option" >&5
++$as_echo_n "checking for --hash-style option... " >&6; }
++if ${libc_cv_hashstyle+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat > conftest.c <<EOF
++int _start (void) { return 42; }
++EOF
++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
++ -fPIC -shared -o conftest.so conftest.c
++ -Wl,--hash-style=both -nostdlib 1>&5'
++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; }
++then
++ libc_cv_hashstyle=yes
++else
++ libc_cv_hashstyle=no
++fi
++rm -f conftest*
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hashstyle" >&5
++$as_echo "$libc_cv_hashstyle" >&6; }
++
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
+ printf %s "checking for GLOB_DAT reloc... " >&6; }
+diff -up glibc-2.38/configure.ac.45~ glibc-2.38/configure.ac
+--- glibc-2.38/configure.ac.45~ 2023-07-31 19:54:16.000000000 +0200
++++ glibc-2.38/configure.ac 2023-08-01 01:02:58.303719582 +0200
+@@ -1339,6 +1339,22 @@ LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpi
+
+ AC_SUBST(libc_cv_fpie)
+
++AC_CACHE_CHECK(for --hash-style option,
++ libc_cv_hashstyle, [dnl
++cat > conftest.c <<EOF
++int _start (void) { return 42; }
++EOF
++if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
++ -fPIC -shared -o conftest.so conftest.c
++ -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
++then
++ libc_cv_hashstyle=yes
++else
++ libc_cv_hashstyle=no
++fi
++rm -f conftest*])
++AC_SUBST(libc_cv_hashstyle)
++
+ AC_CACHE_CHECK(for GLOB_DAT reloc,
+ libc_cv_has_glob_dat, [dnl
+ cat > conftest.c <<EOF
diff --git a/spin-smarter.patch b/spin-smarter.patch
deleted file mode 100644
index 1304a86..0000000
--- a/spin-smarter.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- glibc-2.27/nptl/pthread_mutex_lock.c~ 2018-02-01 16:17:18.000000000 +0000
-+++ glibc-2.27/nptl/pthread_mutex_lock.c 2018-05-15 14:19:00.864190585 +0000
-@@ -133,7 +133,13 @@
- LLL_MUTEX_LOCK (mutex);
- break;
- }
-- atomic_spin_nop ();
-+ /* MO read while spinning */
-+ do
-+ {
-+ atomic_spin_nop ();
-+ }
-+ while (atomic_load_relaxed (&mutex->__data.__lock) != 0 &&
-+ ++cnt < max_cnt);
- }
- while (LLL_MUTEX_TRYLOCK (mutex) != 0);
-