Subject: [PATCH 5/6] gnu: glibc: Update to 2.31.

From: Marius Bakke <[email-masked]>
Date: Thu, 6 Feb 2020 19:02:44 +0100

* gnu/packages/patches/glibc-supported-locales.patch: Adjust for upstream
changes.
* gnu/packages/patches/glibc-2.29-supported-locales.patch: New file, with
previous contents.
* gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch,
gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch,
gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch,
gnu/packages/patches/gcc-8-libsanitizer-mode-size.patch,
gnu/packages/patches/gcc-9-libsanitizer-mode-size.patch: New files.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/gcc.scm (gcc-4.9, gcc-5, gcc-6, gcc-7, gcc-8,
gcc-9)[source](patches): Add the respective patch files.
* gnu/packages/base.scm (glibc): Update to 2.31.
[source](patches): Remove obsolete.
(glibc-2.30): New public variable.
(glibc-2.29)[source](patches): Adjust for renamed patch file.
---
 gnu/local.mk                                  |  6 ++
 gnu/packages/base.scm                         | 25 ++++++--
 gnu/packages/gcc.scm                          |  6 ++
 .../gcc-4.9-libsanitizer-mode-size.patch      | 52 +++++++++++++++++
 .../gcc-6-libsanitizer-mode-size.patch        | 53 +++++++++++++++++
 .../gcc-7-libsanitizer-mode-size.patch        | 53 +++++++++++++++++
 .../gcc-8-libsanitizer-mode-size.patch        | 56 ++++++++++++++++++
 .../gcc-9-libsanitizer-mode-size.patch        | 58 +++++++++++++++++++
 .../glibc-2.29-supported-locales.patch        | 33 +++++++++++
 .../patches/glibc-supported-locales.patch     | 11 ++--
 10 files changed, 343 insertions(+), 10 deletions(-)
 create mode 100644 gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch
 create mode 100644 gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch
 create mode 100644 gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch
 create mode 100644 gnu/packages/patches/gcc-8-libsanitizer-mode-size.patch
 create mode 100644 gnu/packages/patches/gcc-9-libsanitizer-mode-size.patch
 create mode 100644 gnu/packages/patches/glibc-2.29-supported-locales.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3c080bcd6e..4784e338d9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -886,6 +886,11 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-4.9-libsanitizer-fix.patch		\
   %D%/packages/patches/gcc-4.9-libsanitizer-ustat.patch		\
   %D%/packages/patches/gcc-libsanitizer-ustat.patch		\
+  %D%/packages/patches/gcc-4.9-libsanitizer-mode-size.patch	\
+  %D%/packages/patches/gcc-6-libsanitizer-mode-size.patch	\
+  %D%/packages/patches/gcc-7-libsanitizer-mode-size.patch	\
+  %D%/packages/patches/gcc-8-libsanitizer-mode-size.patch	\
+  %D%/packages/patches/gcc-9-libsanitizer-mode-size.patch	\
   %D%/packages/patches/gcc-libvtv-runpath.patch			\
   %D%/packages/patches/gcc-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-4-compile-with-gcc-5.patch		 \
@@ -957,6 +962,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-2.29-git-updates.patch     	\
   %D%/packages/patches/glibc-2.27-supported-locales.patch     	\
   %D%/packages/patches/glibc-2.28-supported-locales.patch     	\
+  %D%/packages/patches/glibc-2.29-supported-locales.patch     	\
   %D%/packages/patches/glibc-supported-locales.patch     	\
   %D%/packages/patches/glm-restore-install-target.patch		\
   %D%/packages/patches/gmp-arm-asm-nothumb.patch		\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index a37b10153e..2f93bfd638 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -574,13 +574,13 @@ the store.")
   ;; version 2.28, GNU/Hurd used a different glibc branch.
   (package
    (name "glibc")
-   (version "2.30")
+   (version "2.31")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
             (sha256
              (base32
-              "1bxqpg91d02qnaz837a5kamm0f43pr1il4r9pknygywsar713i72"))
+              "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))
             (snippet
              ;; Disable 'ldconfig' and /etc/ld.so.cache.  The latter is
              ;; required on LFS distros to avoid loading the distro's libc.so
@@ -592,7 +592,6 @@ the store.")
                 #t))
             (modules '((guix build utils)))
             (patches (search-patches "glibc-ldd-x86_64.patch"
-                                     "glibc-CVE-2019-19126.patch"
                                      "glibc-hidden-visibility-ldconfig.patch"
                                      "glibc-versioned-locpath.patch"
                                      "glibc-allow-kernel-2.6.32.patch"
@@ -824,6 +823,24 @@ with the Linux kernel.")
 ;; Below are old libc versions, which we use mostly to build locale data in
 ;; the old format (which the new libc cannot cope with.)
 
+(define-public glibc-2.30
+  (package
+    (inherit glibc)
+    (version "2.30")
+    (source (origin
+              (inherit (package-source glibc))
+              (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1bxqpg91d02qnaz837a5kamm0f43pr1il4r9pknygywsar713i72"))
+              (patches (search-patches "glibc-ldd-x86_64.patch"
+                                       "glibc-CVE-2019-19126.patch"
+                                       "glibc-hidden-visibility-ldconfig.patch"
+                                       "glibc-versioned-locpath.patch"
+                                       "glibc-allow-kernel-2.6.32.patch"
+                                       "glibc-reinstate-prlimit64-fallback.patch"
+                                       "glibc-2.29-supported-locales.patch"))))))
+
 (define-public glibc-2.29
   (package
     (inherit glibc)
@@ -842,7 +859,7 @@ with the Linux kernel.")
                                        "glibc-versioned-locpath.patch"
                                        "glibc-allow-kernel-2.6.32.patch"
                                        "glibc-reinstate-prlimit64-fallback.patch"
-                                       "glibc-supported-locales.patch"))))))
+                                       "glibc-2.29-supported-locales.patch"))))))
 
 (define-public glibc-2.28
   (package
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 94f7e15382..2eaca38dfb 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -400,6 +400,7 @@ Go.  It also includes runtime support libraries for these languages.")
                 "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"))
               (patches (search-patches "gcc-4.9-libsanitizer-fix.patch"
                                        "gcc-4.9-libsanitizer-ustat.patch"
+                                       "gcc-4.9-libsanitizer-mode-size.patch"
                                        "gcc-arm-bug-71399.patch"
                                        "gcc-asan-missing-include.patch"
                                        "gcc-libvtv-runpath.patch"
@@ -439,6 +440,7 @@ Go.  It also includes runtime support libraries for these languages.")
                                        "gcc-5.0-libvtv-runpath.patch"
                                        "gcc-5-source-date-epoch-1.patch"
                                        "gcc-5-source-date-epoch-2.patch"
+                                       "gcc-6-libsanitizer-mode-size.patch"
                                        "gcc-fix-texi2pod.patch"))
               (modules '((guix build utils)))
               (snippet
@@ -471,6 +473,7 @@ Go.  It also includes runtime support libraries for these languages.")
                (base32
                 "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby"))
               (patches (search-patches "gcc-strmov-store-file-names.patch"
+                                       "gcc-6-libsanitizer-mode-size.patch"
                                        "gcc-6-source-date-epoch-1.patch"
                                        "gcc-6-source-date-epoch-2.patch"
                                        "gcc-5.0-libvtv-runpath.patch"))))
@@ -500,6 +503,7 @@ Go.  It also includes runtime support libraries for these languages.")
                (base32
                 "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq"))
               (patches (search-patches "gcc-strmov-store-file-names.patch"
+                                       "gcc-7-libsanitizer-mode-size.patch"
                                        "gcc-5.0-libvtv-runpath.patch"))))
     (description
      "GCC is the GNU Compiler Collection.  It provides compiler front-ends
@@ -518,6 +522,7 @@ It also includes runtime support libraries for these languages.")))
                (base32
                 "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4"))
               (patches (search-patches "gcc-8-strmov-store-file-names.patch"
+                                       "gcc-8-libsanitizer-mode-size.patch"
                                        "gcc-5.0-libvtv-runpath.patch"))))))
 
 (define-public gcc-9
@@ -532,6 +537,7 @@ It also includes runtime support libraries for these languages.")))
              (base32
               "01mj3yk7z49i49168hg2cg7qs4bsccrrnv7pjmbdlf8j2a7z0vpa"))
             (patches (search-patches "gcc-9-strmov-store-file-names.patch"
+                                     "gcc-9-libsanitizer-mode-size.patch"
                                      "gcc-9-asan-fix-limits-include.patch"
                                      "gcc-5.0-libvtv-runpath.patch"))))))
 
diff --git a/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..7df22c21aa
--- /dev/null
+++ b/gnu/packages/patches/gcc-4.9-libsanitizer-mode-size.patch
@@ -0,0 +1,52 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 196eb3b3c64..b588e07e5ab 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -928,7 +928,11 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
++#endif
+ CHECK_SIZE_AND_OFFSET(ipc_perm, __seq);
+ 
+ CHECK_TYPE_SIZE(shmid_ds);
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index aec950454b3..6d94fc65c28 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -154,20 +154,13 @@ namespace __sanitizer {
+     u64 __unused1;
+     u64 __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-# else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-# endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..005e3c4079
--- /dev/null
+++ b/gnu/packages/patches/gcc-6-libsanitizer-mode-size.patch
@@ -0,0 +1,53 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 069d8d557de..c49c28c6e07 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(x, y) 0
+ #endif
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 304d04e3935..6dee89c97e1 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -207,20 +207,13 @@ namespace __sanitizer {
+     unsigned long __unused1;
+     unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-# else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-# endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+
diff --git a/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..41b4a4cac6
--- /dev/null
+++ b/gnu/packages/patches/gcc-7-libsanitizer-mode-size.patch
@@ -0,0 +1,53 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 97eae3fc7bc..4089d4695e2 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index c139322839a..7c3c2d866e5 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,20 +211,13 @@ namespace __sanitizer {
+     unsigned long __unused1;
+     unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-# else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-# endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+
diff --git a/gnu/packages/patches/gcc-8-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-8-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..e343034991
--- /dev/null
+++ b/gnu/packages/patches/gcc-8-libsanitizer-mode-size.patch
@@ -0,0 +1,56 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+Adapted from these upstream revision:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index a915d37cdfe..5c720b2e700 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1147,8 +1147,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 4d11d071776..eda75a7cd84 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -210,14 +210,8 @@ namespace __sanitizer {
+     u64 __unused1;
+     u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-#else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-#endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+@@ -228,8 +222,7 @@ namespace __sanitizer {
+     unsigned long __unused1;
+     unsigned long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
+
diff --git a/gnu/packages/patches/gcc-9-libsanitizer-mode-size.patch b/gnu/packages/patches/gcc-9-libsanitizer-mode-size.patch
new file mode 100644
index 0000000000..9e99a3d198
--- /dev/null
+++ b/gnu/packages/patches/gcc-9-libsanitizer-mode-size.patch
@@ -0,0 +1,58 @@
+Fix assertion failure in libsanitizer when using glibc 2.31 and later.
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154
+https://reviews.llvm.org/D69104
+
+This is a combination of these upstream revisions:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=277981
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=279653
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 6cd4a5bac8b..d823a12190c 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1156,8 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 73af92af1e8..6a673a7c995 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,26 +211,13 @@ namespace __sanitizer {
+     u64 __unused1;
+     u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-#else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-#endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+-    unsigned int mode;
+-    unsigned short __seq;
+-    unsigned short __pad1;
+-    unsigned long __unused1;
+-    unsigned long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/gnu/packages/patches/glibc-2.29-supported-locales.patch b/gnu/packages/patches/glibc-2.29-supported-locales.patch
new file mode 100644
index 0000000000..05865dc7be
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.29-supported-locales.patch
@@ -0,0 +1,33 @@
+This patch is taken from debian's glibc package (generate-supported.mk).
+It install the localedata/SUPPORTED file of the glibc. This file lists
+all the supported locales of the glibc.
+
+diff --git a/localedata/Makefile b/localedata/Makefile
+index 65079f9eb8..14818f84e0 100644
+--- a/localedata/Makefile
++++ b/localedata/Makefile
+@@ -169,7 +169,8 @@ endif
+ # Files to install.
+ install-others := $(addprefix $(inst_i18ndir)/, \
+ 			      $(addsuffix .gz, $(charmaps)) \
+-			      $(locales))
++			      $(locales)) \
++                   $(inst_i18ndir)/SUPPORTED
+ 
+ tests: $(objdir)/iconvdata/gconv-modules
+ 
+@@ -380,6 +381,14 @@ endif
+ 
+ include SUPPORTED
+ 
++$(inst_i18ndir)/SUPPORTED: SUPPORTED $(+force)
++	for locale in $(SUPPORTED-LOCALES); do \
++		[ $$locale = true ] && continue; \
++		echo $$locale | sed 's,/, ,' >> LOCALES; \
++	done
++	$(make-target-directory)
++	$(INSTALL_DATA) LOCALES $@
++
+ INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
+ INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
+ 
\ No newline at end of file
diff --git a/gnu/packages/patches/glibc-supported-locales.patch b/gnu/packages/patches/glibc-supported-locales.patch
index 05865dc7be..28577c75c0 100644
--- a/gnu/packages/patches/glibc-supported-locales.patch
+++ b/gnu/packages/patches/glibc-supported-locales.patch
@@ -3,20 +3,19 @@ It install the localedata/SUPPORTED file of the glibc. This file lists
 all the supported locales of the glibc.
 
 diff --git a/localedata/Makefile b/localedata/Makefile
-index 65079f9eb8..14818f84e0 100644
 --- a/localedata/Makefile
 +++ b/localedata/Makefile
-@@ -169,7 +169,8 @@ endif
- # Files to install.
+@@ -176,7 +176,8 @@
+ else
  install-others := $(addprefix $(inst_i18ndir)/, \
  			      $(addsuffix .gz, $(charmaps)) \
 -			      $(locales))
 +			      $(locales)) \
 +                   $(inst_i18ndir)/SUPPORTED
+ endif
  
  tests: $(objdir)/iconvdata/gconv-modules
- 
-@@ -380,6 +381,14 @@ endif
+@@ -401,6 +402,14 @@
  
  include SUPPORTED
  
@@ -30,4 +29,4 @@ index 65079f9eb8..14818f84e0 100644
 +
  INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
  INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
- 
\ No newline at end of file
+ 
-- 
2.25.0