summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/ath9k-htc-firmware-gcc-compat.patch29
-rw-r--r--gnu/packages/patches/bash-completion-directories.patch4
-rw-r--r--gnu/packages/patches/brightnessctl-elogind-support.patch13
-rw-r--r--gnu/packages/patches/bsdiff-CVE-2014-9862.patch15
-rw-r--r--gnu/packages/patches/connman-CVE-2021-33833.patch74
-rw-r--r--gnu/packages/patches/curl-7.77-tls-priority-string.patch98
-rw-r--r--gnu/packages/patches/efivar-gcc-compat.patch177
-rw-r--r--gnu/packages/patches/gcc-8-sort-libtool-find-output.patch399
-rw-r--r--gnu/packages/patches/grub-cross-system-i686.patch96
-rw-r--r--gnu/packages/patches/grub-setup-root.patch99
-rw-r--r--gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch41
-rw-r--r--gnu/packages/patches/hexchat-add-libera-chat.patch76
-rw-r--r--gnu/packages/patches/inkscape-1.1-fix-build-witch-gcc7.5.patch24
-rw-r--r--gnu/packages/patches/isc-dhcp-gcc-compat.patch72
-rw-r--r--gnu/packages/patches/jfsutils-gcc-compat.patch72
-rw-r--r--gnu/packages/patches/libcacard-unknown-variable.patch50
-rw-r--r--gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch276
-rw-r--r--gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch163
-rw-r--r--gnu/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch78
-rw-r--r--gnu/packages/patches/polkit-CVE-2021-3560.patch21
-rw-r--r--gnu/packages/patches/qemu-build-info-manual.patch53
-rw-r--r--gnu/packages/patches/qemu-meson-compat.patch27
-rw-r--r--gnu/packages/patches/qemu-sphinx-compat.patch18
-rw-r--r--gnu/packages/patches/rust-ndarray-0.13-remove-blas-src.patch28
-rw-r--r--gnu/packages/patches/tor-fix-build-with-gcc-7.patch30
-rw-r--r--gnu/packages/patches/xpra-4.0.1-systemd-run.patch34
-rw-r--r--gnu/packages/patches/xpra-4.2-systemd-run.patch45
27 files changed, 1843 insertions, 269 deletions
diff --git a/gnu/packages/patches/ath9k-htc-firmware-gcc-compat.patch b/gnu/packages/patches/ath9k-htc-firmware-gcc-compat.patch
new file mode 100644
index 0000000000..ceada2fa24
--- /dev/null
+++ b/gnu/packages/patches/ath9k-htc-firmware-gcc-compat.patch
@@ -0,0 +1,29 @@
+Fixes for compiling with -fno-common, default in GCC 10.
+
+Taken from upstream:
+https://github.com/qca/open-ath9k-htc-firmware/commit/559e3eba3b4cf103da6b8d022f3e1387278b9db8
+
+diff --git a/target_firmware/magpie_fw_dev/target/init/app_start.c b/target_firmware/magpie_fw_dev/target/init/app_start.c
+--- a/target_firmware/magpie_fw_dev/target/init/app_start.c
++++ b/target_firmware/magpie_fw_dev/target/init/app_start.c
+@@ -52,6 +52,8 @@
+ #define ALLOCRAM_START       ( ((unsigned int)&_fw_image_end) + 4)
+ #define ALLOCRAM_SIZE        ( SYS_RAM_SZIE - ( ALLOCRAM_START - SYS_D_RAM_REGION_0_BASE) - SYS_D_RAM_STACK_SIZE)
+ 
++void (* _assfail_ori)(struct register_dump_s *);
++
+ // support for more than 64 bytes on command pipe
+ extern void usb_reg_out_patch(void);
+ extern int _HIFusb_get_max_msg_len_patch(hif_handle_t handle, int pipe);
+diff --git a/target_firmware/magpie_fw_dev/target/init/init.h b/target_firmware/magpie_fw_dev/target/init/init.h
+--- a/target_firmware/magpie_fw_dev/target/init/init.h
++++ b/target_firmware/magpie_fw_dev/target/init/init.h
+@@ -46,7 +46,7 @@
+ void AR6002_fatal_exception_handler_patch(CPU_exception_frame_t *exc_frame);
+ void exception_reset(struct register_dump_s *dump);
+ 
+-void (* _assfail_ori)(struct register_dump_s *);
++extern void (* _assfail_ori)(struct register_dump_s *);
+ void HTCMsgRecvHandler_patch(adf_nbuf_t hdr_buf, adf_nbuf_t buffer, void *context);
+ void HTCControlSvcProcessMsg_patch(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf,
+ 				   adf_nbuf_t pBuffers, void *arg);
diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
index 164096f16c..021e34653b 100644
--- a/gnu/packages/patches/bash-completion-directories.patch
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -16,11 +16,11 @@ This is what this patch does.
  {
 -    local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
 +    local -a dirs=(
++        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
 +        "$HOME/.guix-profile/share/bash-completion/completions/$base"
 +        "$HOME/.guix-profile/etc/bash_completion.d/$base"
 +        "/run/current-system/profile/share/bash-completion/completions/$base"
-+        "/run/current-system/profile/etc/bash_completion.d/$base"
-+        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
++        "/run/current-system/profile/etc/bash_completion.d/$base" )
 +
      local OIFS=$IFS IFS=: dir cmd="${1##*/}" compfile
      for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
diff --git a/gnu/packages/patches/brightnessctl-elogind-support.patch b/gnu/packages/patches/brightnessctl-elogind-support.patch
new file mode 100644
index 0000000000..8125f1c459
--- /dev/null
+++ b/gnu/packages/patches/brightnessctl-elogind-support.patch
@@ -0,0 +1,13 @@
+From https://github.com/Hummer12007/brightnessctl/issues/67
+
+--- a/Makefile
++++ b/Makefile
+@@ -18,6 +18,8 @@ MODE = ${MODE_${INSTALL_UDEV_RULES}}
+ ifdef ENABLE_SYSTEMD
+ 	CFLAGS += ${shell pkg-config --cflags libsystemd}
+ 	LDLIBS += ${shell pkg-config --libs libsystemd}
++	CFLAGS += ${shell pkg-config --cflags libelogind}
++	LDLIBS += ${shell pkg-config --libs libelogind}
+ 	CPPFLAGS += -DENABLE_SYSTEMD
+ 	INSTALL_UDEV_RULES=0
+ 	MODE = 0755
diff --git a/gnu/packages/patches/bsdiff-CVE-2014-9862.patch b/gnu/packages/patches/bsdiff-CVE-2014-9862.patch
deleted file mode 100644
index 7aab818090..0000000000
--- a/gnu/packages/patches/bsdiff-CVE-2014-9862.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/bspatch.c b/bspatch.c
-index 8d95633..ab77722 100644
---- a/bspatch.c
-+++ b/bspatch.c
-
-@@ -187,6 +187,10 @@
- 		};
- 
- 		/* Sanity-check */
-+		if ((ctrl[0] < 0) || (ctrl[1] < 0))
-+			errx(1,"Corrupt patch\n");
-+
-+		/* Sanity-check */
- 		if(newpos+ctrl[0]>newsize)
- 			errx(1,"Corrupt patch\n");
diff --git a/gnu/packages/patches/connman-CVE-2021-33833.patch b/gnu/packages/patches/connman-CVE-2021-33833.patch
new file mode 100644
index 0000000000..3e1a19d961
--- /dev/null
+++ b/gnu/packages/patches/connman-CVE-2021-33833.patch
@@ -0,0 +1,74 @@
+Fix CVE-2021-33833:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33833
+
+Patch copied from upstream source repository:
+
+https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=eceb2e8d2341c041df55a5e2f047d9a8c491463c
+
+From eceb2e8d2341c041df55a5e2f047d9a8c491463c Mon Sep 17 00:00:00 2001
+From: Valery Kashcheev <v.kascheev@omp.ru>
+Date: Mon, 7 Jun 2021 18:58:24 +0200
+Subject: [PATCH] dnsproxy: Check the length of buffers before memcpy
+
+Fix using a stack-based buffer overflow attack by checking the length of
+the ptr and uptr buffers.
+
+Fix debug message output.
+
+Fixes: CVE-2021-33833
+---
+ src/dnsproxy.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/src/dnsproxy.c b/src/dnsproxy.c
+index de52df5a..38dbdd71 100644
+--- a/src/dnsproxy.c
++++ b/src/dnsproxy.c
+@@ -1788,17 +1788,15 @@ static char *uncompress(int16_t field_count, char *start, char *end,
+ 		 * tmp buffer.
+ 		 */
+ 
+-		debug("pos %d ulen %d left %d name %s", pos, ulen,
+-			(int)(uncomp_len - (uptr - uncompressed)), uptr);
+-
+-		ulen = strlen(name);
+-		if ((uptr + ulen + 1) > uncomp_end) {
++		ulen = strlen(name) + 1;
++		if ((uptr + ulen) > uncomp_end)
+ 			goto out;
+-		}
+-		strncpy(uptr, name, uncomp_len - (uptr - uncompressed));
++		strncpy(uptr, name, ulen);
++
++		debug("pos %d ulen %d left %d name %s", pos, ulen,
++			(int)(uncomp_end - (uptr + ulen)), uptr);
+ 
+ 		uptr += ulen;
+-		*uptr++ = '\0';
+ 
+ 		ptr += pos;
+ 
+@@ -1841,7 +1839,7 @@ static char *uncompress(int16_t field_count, char *start, char *end,
+ 		} else if (dns_type == ns_t_a || dns_type == ns_t_aaaa) {
+ 			dlen = uptr[-2] << 8 | uptr[-1];
+ 
+-			if (ptr + dlen > end) {
++			if ((ptr + dlen) > end || (uptr + dlen) > uncomp_end) {
+ 				debug("data len %d too long", dlen);
+ 				goto out;
+ 			}
+@@ -1880,6 +1878,10 @@ static char *uncompress(int16_t field_count, char *start, char *end,
+ 			 * refresh interval, retry interval, expiration
+ 			 * limit and minimum ttl). They are 20 bytes long.
+ 			 */
++			if ((uptr + 20) > uncomp_end || (ptr + 20) > end) {
++				debug("soa record too long");
++				goto out;
++			}
+ 			memcpy(uptr, ptr, 20);
+ 			uptr += 20;
+ 			ptr += 20;
+-- 
+2.32.0
+
diff --git a/gnu/packages/patches/curl-7.77-tls-priority-string.patch b/gnu/packages/patches/curl-7.77-tls-priority-string.patch
new file mode 100644
index 0000000000..bf1bfa8aaa
--- /dev/null
+++ b/gnu/packages/patches/curl-7.77-tls-priority-string.patch
@@ -0,0 +1,98 @@
+cURL 7.77.0 would use a bogus TLS priority string favoring older TLS
+protocol versions, which in turn would prevent access to bitbucket.org:
+
+  https://issues.guix.gnu.org/49035
+  https://github.com/curl/curl/pull/7278
+
+This patch fixes it.
+From <https://github.com/curl/curl/pull/7278/commits/b98f79f6ecdb708c67f9a0cec56ce48952a54556>.
+
+From b98f79f6ecdb708c67f9a0cec56ce48952a54556 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Fri, 18 Jun 2021 14:54:07 +0200
+Subject: [PATCH] gnutls: set the prefer ciphers in correct order
+
+Reported-by: civodul on github
+Assisted-by: Nikos Mavrogiannopoulos
+Fixes #7277
+---
+ lib/vtls/gtls.c | 30 +++++++++++++-----------------
+ 1 file changed, 13 insertions(+), 17 deletions(-)
+
+diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
+index d9bc5611e8f9..da2af64955c3 100644
+--- a/lib/vtls/gtls.c
++++ b/lib/vtls/gtls.c
+@@ -330,6 +330,9 @@ set_ssl_version_min_max(struct Curl_easy *data,
+       ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+     }
+   }
++  else if(ssl_version_max == CURL_SSLVERSION_MAX_DEFAULT) {
++    ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_3;
++  }
+ 
+   switch(ssl_version | ssl_version_max) {
+   case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_0:
+@@ -338,11 +341,11 @@ set_ssl_version_min_max(struct Curl_easy *data,
+     return CURLE_OK;
+   case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_1:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.0:+VERS-TLS1.1";
++      "+VERS-TLS1.1:+VERS-TLS1.0";
+     return CURLE_OK;
+   case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_2:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2";
++      "+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0";
+     return CURLE_OK;
+   case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_1:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+@@ -350,7 +353,7 @@ set_ssl_version_min_max(struct Curl_easy *data,
+     return CURLE_OK;
+   case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_2:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.1:+VERS-TLS1.2";
++      "+VERS-TLS1.2:+VERS-TLS1.1";
+     return CURLE_OK;
+   case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_2:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+@@ -360,25 +363,17 @@ set_ssl_version_min_max(struct Curl_easy *data,
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+       "+VERS-TLS1.3";
+     return CURLE_OK;
+-  case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT:
+-    *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2"
+-      ":+VERS-TLS1.3";
++  case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_3:
++    *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0";
+     return CURLE_OK;
+-  case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT:
++  case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_3:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.1:+VERS-TLS1.2"
+-      ":+VERS-TLS1.3";
++      "+VERS-TLS1.3:+VERS-TLS1.2:+VERS-TLS1.1";
+     return CURLE_OK;
+-  case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT:
++  case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3:
+     *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.2"
+-      ":+VERS-TLS1.3";
++      "+VERS-TLS1.3:+VERS-TLS1.2";
+     return CURLE_OK;
+-  case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_DEFAULT:
+-    *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+-      "+VERS-TLS1.2"
+-      ":+VERS-TLS1.3";
+     return CURLE_OK;
+   }
+ 
+@@ -608,6 +603,7 @@ gtls_connect_step1(struct Curl_easy *data,
+   }
+   else {
+ #endif
++    infof(data, "GnuTLS ciphers: %s\n", prioritylist);
+     rc = gnutls_priority_set_direct(session, prioritylist, &err);
+ #ifdef HAVE_GNUTLS_SRP
+   }
diff --git a/gnu/packages/patches/efivar-gcc-compat.patch b/gnu/packages/patches/efivar-gcc-compat.patch
new file mode 100644
index 0000000000..fd1a3dc90a
--- /dev/null
+++ b/gnu/packages/patches/efivar-gcc-compat.patch
@@ -0,0 +1,177 @@
+Fix build with -Werror=address-of-packed-member, which is default since
+GCC 9.
+
+This is a combination of three upstream commits:
+
+  https://github.com/rhboot/efivar/commit/b98ba8921010d03f46704a476c69861515deb1ca
+  https://github.com/rhboot/efivar/commit/c3c553db85ff10890209d0fe48fb4856ad68e4e0
+  https://github.com/rhboot/efivar/commit/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865
+
+diff --git a/src/dp-media.c b/src/dp-media.c
+index 96a576f..be691c4 100644
+--- a/src/dp-media.c
++++ b/src/dp-media.c
+@@ -46,8 +46,7 @@ _format_media_dn(char *buf, size_t size, const_efidp dp)
+ 			break;
+ 		case EFIDP_HD_SIGNATURE_GUID:
+ 			format(buf, size, off, "HD", "GPT,");
+-			format_guid(buf, size, off, "HD",
+-				    (efi_guid_t *)dp->hd.signature);
++			format_guid(buf, size, off, "HD", dp->hd.signature);
+ 			format(buf, size, off, "HD",
+ 			       ",0x%"PRIx64",0x%"PRIx64")",
+ 			       dp->hd.start, dp->hd.size);
+diff --git a/src/dp-message.c b/src/dp-message.c
+index 3724e5f..6b8e907 100644
+--- a/src/dp-message.c
++++ b/src/dp-message.c
+@@ -364,7 +364,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
+ 			       dp->infiniband.port_gid[1],
+ 			       dp->infiniband.port_gid[0]);
+ 			format_guid(buf, size, off, "Infiniband",
+-				    (efi_guid_t *)&dp->infiniband.ioc_guid);
++				    &dp->infiniband.ioc_guid);
+ 			format(buf, size, off, "Infiniband",
+ 			       ",%"PRIu64",%"PRIu64")",
+ 			       dp->infiniband.target_port_id,
+@@ -620,11 +620,13 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
+ 			  ) / sizeof(efi_ip_addr_t);
+ 		format(buf, size, off, "Dns", "Dns(");
+ 		for (int i=0; i < end; i++) {
+-			const efi_ip_addr_t *addr = &dp->dns.addrs[i];
++			efi_ip_addr_t addr;
++
++			memcpy(&addr, &dp->dns.addrs[i], sizeof(addr));
+ 			if (i != 0)
+ 				format(buf, size, off, "Dns", ",");
+ 			format_ip_addr(buf, size, off, "Dns",
+-				       dp->dns.is_ipv6, addr);
++				       dp->dns.is_ipv6, &addr);
+ 		}
+ 		format(buf, size, off, "Dns", ")");
+ 		break;
+diff --git a/src/dp.h b/src/dp.h
+index aa4e390..1f921d5 100644
+--- a/src/dp.h
++++ b/src/dp.h
+@@ -70,8 +70,11 @@
+ #define format_guid(buf, size, off, dp_type, guid) ({			\
+ 		int _rc;						\
+ 		char *_guidstr = NULL;					\
++		efi_guid_t _guid;					\
++		const efi_guid_t * const _guid_p = &_guid;		\
+ 									\
+-		_rc = efi_guid_to_str(guid, &_guidstr);			\
++		memmove(&_guid, guid, sizeof(_guid));			\
++		_rc = efi_guid_to_str(_guid_p, &_guidstr);		\
+ 		if (_rc < 0) {						\
+ 			efi_error("could not build %s GUID DP string",	\
+ 				  dp_type);				\
+@@ -79,7 +82,7 @@
+ 			_guidstr = onstack(_guidstr,			\
+ 					   strlen(_guidstr)+1);		\
+ 			_rc = format(buf, size, off, dp_type, "%s",	\
+-				     _guidstr);	\
++				     _guidstr);				\
+ 		}							\
+ 		_rc;							\
+ 	})
+diff --git a/src/guid.c b/src/guid.c
+index 306c9ff..3156b3b 100644
+--- a/src/guid.c
++++ b/src/guid.c
+@@ -31,7 +31,7 @@
+ extern const efi_guid_t efi_guid_zero;
+ 
+ int NONNULL(1, 2) PUBLIC
+-efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
++efi_guid_cmp(const void * const a, const void * const b)
+ {
+ 	return memcmp(a, b, sizeof (efi_guid_t));
+ }
+diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
+index 316891c..ad6449d 100644
+--- a/src/include/efivar/efivar.h
++++ b/src/include/efivar/efivar.h
+@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
+ 
+ extern int efi_guid_is_zero(const efi_guid_t *guid);
+ extern int efi_guid_is_empty(const efi_guid_t *guid);
+-extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
++extern int efi_guid_cmp(const void * const a, const void * const b);
+ 
+ /* import / export functions */
+ typedef struct efi_variable efi_variable_t;
+diff --git a/src/ucs2.h b/src/ucs2.h
+index dbb5900..edd8367 100644
+--- a/src/ucs2.h
++++ b/src/ucs2.h
+@@ -23,16 +23,21 @@
+ 	(((val) & ((mask) << (shift))) >> (shift))
+ 
+ static inline size_t UNUSED
+-ucs2len(const uint16_t * const s, ssize_t limit)
++ucs2len(const void *vs, ssize_t limit)
+ {
+ 	ssize_t i;
+-	for (i = 0; i < (limit >= 0 ? limit : i+1) && s[i] != (uint16_t)0; i++)
++	const uint16_t *s = vs;
++	const uint8_t *s8 = vs;
++
++	for (i = 0;
++	     i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
++	     i++, s8 += 2, s++)
+ 		;
+ 	return i;
+ }
+ 
+ static inline size_t UNUSED
+-ucs2size(const uint16_t * const s, ssize_t limit)
++ucs2size(const void *s, ssize_t limit)
+ {
+ 	size_t rc = ucs2len(s, limit);
+ 	rc *= sizeof (uint16_t);
+@@ -69,10 +74,11 @@ utf8size(uint8_t *s, ssize_t limit)
+ }
+ 
+ static inline unsigned char * UNUSED
+-ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
++ucs2_to_utf8(const void * const voidchars, ssize_t limit)
+ {
+ 	ssize_t i, j;
+ 	unsigned char *ret;
++	const uint16_t * const chars = voidchars;
+ 
+ 	if (limit < 0)
+ 		limit = ucs2len(chars, -1);
+@@ -124,10 +130,12 @@ ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
+ }
+ 
+ static inline ssize_t UNUSED NONNULL(4)
+-utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
++utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
+ {
+ 	ssize_t req;
+ 	ssize_t i, j;
++	uint16_t *ucs2 = ucs2void;
++	uint16_t val16;
+ 
+ 	if (!ucs2 && size > 0) {
+ 		errno = EINVAL;
+@@ -162,10 +170,13 @@ utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
+ 			val = utf8[i] & 0x7f;
+ 			i += 1;
+ 		}
+-		ucs2[j] = val;
++		val16 = val;
++		ucs2[j] = val16;
++	}
++	if (terminate) {
++		val16 = 0;
++		ucs2[j++] = val16;
+ 	}
+-	if (terminate)
+-		ucs2[j++] = (uint16_t)0;
+ 	return j;
+ };
+ 
diff --git a/gnu/packages/patches/gcc-8-sort-libtool-find-output.patch b/gnu/packages/patches/gcc-8-sort-libtool-find-output.patch
new file mode 100644
index 0000000000..5bdb15a1c4
--- /dev/null
+++ b/gnu/packages/patches/gcc-8-sort-libtool-find-output.patch
@@ -0,0 +1,399 @@
+Sort find output in autotool files to ensure reproducibility.
+
+Without sorting find output, static archives (such as libstdc++.a) are
+unreproducible as wildcard find output has no ordering guarantees.
+
+Documented here: https://reproducible-builds.org/docs/archives/#gnu-libtool
+
+diff --git a/gcc/configure b/gcc/configure
+index 97ba7d7d69c..e37a96f0c0c 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -19720,20 +19720,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libcc1/configure b/libcc1/configure
+index f53a121611c..5740ca90cab 100755
+--- a/libcc1/configure
++++ b/libcc1/configure
+@@ -12221,20 +12221,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libffi/configure b/libffi/configure
+index 790a291011f..54b1ac18306 100755
+--- a/libffi/configure
++++ b/libffi/configure
+@@ -12661,20 +12661,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libgo/config/libtool.m4 b/libgo/config/libtool.m4
+index f7005947454..8a84417b828 100644
+--- a/libgo/config/libtool.m4
++++ b/libgo/config/libtool.m4
+@@ -6010,20 +6010,20 @@ if test "$_lt_caught_CXX_error" != yes; then
+ 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libgo/config/ltmain.sh b/libgo/config/ltmain.sh
+index ce66b44906a..0f81c401407 100644
+--- a/libgo/config/ltmain.sh
++++ b/libgo/config/ltmain.sh
+@@ -2917,7 +2917,7 @@ func_extract_archives ()
+ 	    darwin_file=
+ 	    darwin_files=
+ 	    for darwin_file in $darwin_filelist; do
+-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
++	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ 	      $LIPO -create -output "$darwin_file" $darwin_files
+ 	    done # $darwin_filelist
+ 	    $RM -rf unfat-$$
+@@ -2932,7 +2932,7 @@ func_extract_archives ()
+         func_extract_an_archive "$my_xdir" "$my_xabs"
+ 	;;
+       esac
+-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
++      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+     done
+ 
+     func_extract_archives_result="$my_oldobjs"
+diff --git a/libhsail-rt/configure b/libhsail-rt/configure
+index a4fcc10c1f9..8e671229fcd 100755
+--- a/libhsail-rt/configure
++++ b/libhsail-rt/configure
+@@ -12244,20 +12244,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libitm/configure b/libitm/configure
+index dbf386db434..29d4f10611f 100644
+--- a/libitm/configure
++++ b/libitm/configure
+@@ -13067,20 +13067,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/liboffloadmic/configure b/liboffloadmic/configure
+index f873716991b..7aa9186b10e 100644
+--- a/liboffloadmic/configure
++++ b/liboffloadmic/configure
+@@ -12379,20 +12379,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/liboffloadmic/plugin/configure b/liboffloadmic/plugin/configure
+index c031eb3e7fa..67fc7368f21 100644
+--- a/liboffloadmic/plugin/configure
++++ b/liboffloadmic/plugin/configure
+@@ -12086,20 +12086,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libsanitizer/configure b/libsanitizer/configure
+index 4695bc7d4f7..cb7d25c07e6 100755
+--- a/libsanitizer/configure
++++ b/libsanitizer/configure
+@@ -13308,20 +13308,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
+index 61457e940ec..21ef1f61e41 100755
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -13087,20 +13087,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libtool.m4 b/libtool.m4
+index 24d13f34409..940faaa161d 100644
+--- a/libtool.m4
++++ b/libtool.m4
+@@ -6005,20 +6005,20 @@ if test "$_lt_caught_CXX_error" != yes; then
+ 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/libvtv/configure b/libvtv/configure
+index a197f750453..31ab3a0637b 100755
+--- a/libvtv/configure
++++ b/libvtv/configure
+@@ -13339,20 +13339,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ 	      prelink_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ 	      old_archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ 		$RANLIB $oldlib'
+ 	      archive_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+ 		rm -rf $tpldir~
+ 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ 	      ;;
+ 	    *) # Version 6 and above use weak symbols
+ 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+diff --git a/ltmain.sh b/ltmain.sh
+index 9503ec85d70..79f9ba89af5 100644
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -2917,7 +2917,7 @@ func_extract_archives ()
+ 	    darwin_file=
+ 	    darwin_files=
+ 	    for darwin_file in $darwin_filelist; do
+-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
++	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ 	      $LIPO -create -output "$darwin_file" $darwin_files
+ 	    done # $darwin_filelist
+ 	    $RM -rf unfat-$$
+@@ -2932,7 +2932,7 @@ func_extract_archives ()
+         func_extract_an_archive "$my_xdir" "$my_xabs"
+ 	;;
+       esac
+-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
++      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+     done
+ 
+     func_extract_archives_result="$my_oldobjs"
diff --git a/gnu/packages/patches/grub-cross-system-i686.patch b/gnu/packages/patches/grub-cross-system-i686.patch
deleted file mode 100644
index 2715345d63..0000000000
--- a/gnu/packages/patches/grub-cross-system-i686.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-Not upstreamed.
-Fixes cross-build for the Hurd, from i686-linux,
-see <https://bugs.gnu.org/41982>.
-
-From 17b242e7b80108f1467037e15b605595e4823b2e Mon Sep 17 00:00:00 2001
-From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
-Date: Sun, 21 Jun 2020 15:10:40 +0200
-Subject: [PATCH v2] grub-core: Build fixes for i386
-Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset=UTF-8
-
-* grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386.
----
- grub-core/lib/i386/relocator64.S | 33 +++++++++++++++++++++++++++++++-
- 1 file changed, 32 insertions(+), 1 deletion(-)
-
-diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S
-index 148f38adb..ea39908c1 100644
---- a/grub-core/lib/i386/relocator64.S
-+++ b/grub-core/lib/i386/relocator64.S
-@@ -63,7 +63,9 @@ VARIABLE(grub_relocator64_cr3)
- 	movq	%rax, %cr3
- #endif
- 
-+#ifdef __x86_64__
- 	.code64
-+#endif
- 
- 	/* mov imm64, %rax */
- 	.byte 	0x48
-@@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3)
- VARIABLE(grub_relocator64_rsp)
- 	.quad	0
- 
-+#ifndef __x86_64__
-+	/* movq	%rax, %rsp */
-+	.byte 	0x48
-+	.byte	0x89
-+	.byte	0xc4
-+#else
- 	movq	%rax, %rsp
-+#endif
- 
- #ifdef GRUB_MACHINE_EFI
- 	jmp	LOCAL(skip_efi_stack_align)
-@@ -85,7 +94,14 @@ VARIABLE(grub_relocator64_rsp)
- 	 */
- VARIABLE(grub_relocator64_efi_start)
- 	/* Align the stack as UEFI spec requires. */
-+#ifndef __x86_64__
-+	.byte 0x48
-+        .byte 0x83
-+        .byte 0xe4
-+        .byte 0xf0
-+#else
- 	andq	$~15, %rsp
-+#endif
- 
- LOCAL(skip_efi_stack_align):
- #endif
-@@ -95,8 +111,15 @@ LOCAL(skip_efi_stack_align):
- VARIABLE(grub_relocator64_rsi)
- 	.quad	0
- 
-+#ifndef	__x86_64__
-+	/* movq	%rax, %rsi */
-+	.byte 	0x48
-+	.byte	0x89
-+	.byte 	0xc6
-+#else
- 	movq	%rax, %rsi
--	
-+#endif
-+
- 	/* mov imm64, %rax */
- 	.byte 	0x48
- 	.byte	0xb8
-@@ -128,6 +151,14 @@ VARIABLE(grub_relocator64_rdx)
- #ifdef __APPLE__
- 	.byte 0xff, 0x25
- 	.quad 0
-+#elif !defined (__x86_64__)
-+	/* jmp *LOCAL(jump_addr) (%rip) */
-+	.byte 0xff
-+        .byte 0x25
-+	.byte 0
-+	.byte 0
-+	.byte 0
-+	.byte 0
- #else
- 	jmp *LOCAL(jump_addr) (%rip)
- #endif
--- 
-Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
-Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
-
diff --git a/gnu/packages/patches/grub-setup-root.patch b/gnu/packages/patches/grub-setup-root.patch
index 1abe9c383a..e64a7dd6be 100644
--- a/gnu/packages/patches/grub-setup-root.patch
+++ b/gnu/packages/patches/grub-setup-root.patch
@@ -1,9 +1,53 @@
 This patch is taken from OpenWrt, see:
 
-https://github.com/openwrt/openwrt/blob/master/package/boot/grub2/patches/100-grub_setup_root.patch.
+https://github.com/openwrt/openwrt/blob/master/package/boot/grub2/patches/100-grub_setup_root.patch
+
+nckx changed `char *root' to lazily pacify -Werror=discarded-qualifiers.
 
 It allows to use grub-bios-setup on a raw disk-images, without root permissions.
 
+--- a/include/grub/util/install.h
++++ b/include/grub/util/install.h
+@@ -198,13 +198,13 @@ grub_install_get_image_target (const char *arg);
+ void
+ grub_util_bios_setup (const char *dir,
+ 		      const char *boot_file, const char *core_file,
+-		      const char *dest, int force,
++		      char *root, const char *dest, int force,
+ 		      int fs_probe, int allow_floppy,
+ 		      int add_rs_codes, int warn_short_mbr_gap);
+ void
+ grub_util_sparc_setup (const char *dir,
+ 		       const char *boot_file, const char *core_file,
+-		       const char *dest, int force,
++		       char *root, const char *dest, int force,
+ 		       int fs_probe, int allow_floppy,
+ 		       int add_rs_codes, int warn_short_mbr_gap);
+ 
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 0fbe7f78c..7f06aa1e3 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -1721,7 +1721,7 @@ main (int argc, char *argv[])
+ 	if (install_bootsector)
+ 	  {
+ 	    grub_util_bios_setup (platdir, "boot.img", "core.img",
+-				  install_drive, force,
++				  NULL, install_drive, force,
+ 				  fs_probe, allow_floppy, add_rs_codes,
+ 				  !grub_install_is_short_mbrgap_supported ());
+ 
+@@ -1752,7 +1752,7 @@ main (int argc, char *argv[])
+ 	if (install_bootsector)
+ 	  {
+ 	    grub_util_sparc_setup (platdir, "boot.img", "core.img",
+-				   install_drive, force,
++				   NULL, install_drive, force,
+ 				   fs_probe, allow_floppy,
+ 				   0 /* unused */, 0 /* unused */ );
+ 
+diff --git a/util/grub-setup.c b/util/grub-setup.c
+index 1783224dd..48cde4950 100644
 --- a/util/grub-setup.c
 +++ b/util/grub-setup.c
 @@ -87,6 +87,8 @@ static struct argp_option options[] = {
@@ -23,7 +67,7 @@ It allows to use grub-bios-setup on a raw disk-images, without root permissions.
    int  force;
    int  fs_probe;
    int allow_floppy;
-@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct
+@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct argp_state *state)
          arguments->dev_map = xstrdup (arg);
          break;
  
@@ -44,18 +88,21 @@ It allows to use grub-bios-setup on a raw disk-images, without root permissions.
 -		   dest_dev, arguments.force,
 +		   arguments.root_dev, dest_dev, arguments.force,
  		   arguments.fs_probe, arguments.allow_floppy,
- 		   arguments.add_rs_codes);
+ 		   arguments.add_rs_codes, 0);
  
+diff --git a/util/setup.c b/util/setup.c
+index da5f2c07f..193745a9c 100644
 --- a/util/setup.c
 +++ b/util/setup.c
-@@ -252,13 +252,12 @@ identify_partmap (grub_disk_t disk __att
+@@ -252,14 +252,13 @@ identify_partmap (grub_disk_t disk __attribute__ ((unused)),
  void
  SETUP (const char *dir,
         const char *boot_file, const char *core_file,
 -       const char *dest, int force,
 +       char *root, const char *dest, int force,
         int fs_probe, int allow_floppy,
-        int add_rs_codes __attribute__ ((unused))) /* unused on sparc64 */
+        int add_rs_codes __attribute__ ((unused)), /* unused on sparc64 */
+        int warn_small)
  {
    char *core_path;
    char *boot_img, *core_img, *boot_path;
@@ -63,7 +110,7 @@ It allows to use grub-bios-setup on a raw disk-images, without root permissions.
    size_t boot_size, core_size;
    grub_uint16_t core_sectors;
    grub_device_t root_dev = 0, dest_dev, core_dev;
-@@ -307,7 +306,10 @@ SETUP (const char *dir,
+@@ -311,7 +310,10 @@ SETUP (const char *dir,
  
    core_dev = dest_dev;
  
@@ -75,7 +122,7 @@ It allows to use grub-bios-setup on a raw disk-images, without root permissions.
      char **root_devices = grub_guess_root_devices (dir);
      char **cur;
      int found = 0;
-@@ -320,6 +322,8 @@ SETUP (const char *dir,
+@@ -324,6 +326,8 @@ SETUP (const char *dir,
  	char *drive;
  	grub_device_t try_dev;
  
@@ -84,41 +131,3 @@ It allows to use grub-bios-setup on a raw disk-images, without root permissions.
  	drive = grub_util_get_grub_dev (*cur);
  	if (!drive)
  	  continue;
---- a/include/grub/util/install.h
-+++ b/include/grub/util/install.h
-@@ -191,13 +191,13 @@ grub_install_get_image_target (const cha
- void
- grub_util_bios_setup (const char *dir,
- 		      const char *boot_file, const char *core_file,
--		      const char *dest, int force,
-+		      char *root, const char *dest, int force,
- 		      int fs_probe, int allow_floppy,
- 		      int add_rs_codes);
- void
- grub_util_sparc_setup (const char *dir,
- 		       const char *boot_file, const char *core_file,
--		       const char *dest, int force,
-+		       char *root, const char *dest, int force,
- 		       int fs_probe, int allow_floppy,
- 		       int add_rs_codes);
- 
---- a/util/grub-install.c
-+++ b/util/grub-install.c
-@@ -1712,7 +1712,7 @@ main (int argc, char *argv[])
- 	/*  Now perform the installation.  */
- 	if (install_bootsector)
- 	  grub_util_bios_setup (platdir, "boot.img", "core.img",
--				install_drive, force,
-+				NULL, install_drive, force,
- 				fs_probe, allow_floppy, add_rs_codes);
- 	break;
-       }
-@@ -1738,7 +1738,7 @@ main (int argc, char *argv[])
- 	/*  Now perform the installation.  */
- 	if (install_bootsector)
- 	  grub_util_sparc_setup (platdir, "boot.img", "core.img",
--				 install_drive, force,
-+				 NULL, install_drive, force,
- 				 fs_probe, allow_floppy,
- 				 0 /* unused */ );
- 	break;
diff --git a/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch b/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch
deleted file mode 100644
index 2bea74ea95..0000000000
--- a/gnu/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-This patch is needed to build Grub on the Hurd.
-
-Taken from upstream: https://git.savannah.gnu.org/cgit/grub.git/commit//?id=dabdfa1c6a80639197d05f683a445fa8615517fe
-
-From 7606547586b2d6ca1b384e15e0358d3a3ddc48a6 Mon Sep 17 00:00:00 2001
-From: David Michael <fedora.dm0@gmail.com>
-Date: Fri, 5 Jul 2019 07:45:59 -0400
-Subject: verifiers: Blocklist fallout cleanup
-
-Blocklist fallout cleanup after commit 5c6f9bc15 (generic/blocklist: Fix
-implicit declaration of function grub_file_filter_disable_compression()).
-
-Signed-off-by: David Michael <fedora.dm0@gmail.com>
-Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
-
----
- grub-core/osdep/generic/blocklist.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/grub-core/osdep/generic/blocklist.c b/grub-core/osdep/generic/blocklist.c
-index ea2a511b6..2d9040302 100644
---- a/grub-core/osdep/generic/blocklist.c
-+++ b/grub-core/osdep/generic/blocklist.c
-@@ -59,7 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
- 
-       grub_disk_cache_invalidate_all ();
- 
--      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
-+      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
-       if (file)
- 	{
- 	  if (grub_file_size (file) != core_size)
-@@ -116,7 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
- 
-   grub_file_t file;
-   /* Now read the core image to determine where the sectors are.  */
--  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
-+  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
-   if (! file)
-     grub_util_error ("%s", grub_errmsg);
- 
diff --git a/gnu/packages/patches/hexchat-add-libera-chat.patch b/gnu/packages/patches/hexchat-add-libera-chat.patch
new file mode 100644
index 0000000000..2bbb3137ba
--- /dev/null
+++ b/gnu/packages/patches/hexchat-add-libera-chat.patch
@@ -0,0 +1,76 @@
+Add libera.chat to the list of available networks and make it the
+default.
+
+Patches copied from upstream source repository:
+
+https://github.com/hexchat/hexchat/commit/a25f2381689d2c2279a0e43b33f6c0ec8305a096
+https://github.com/hexchat/hexchat/commit/d3545f37cd5f551ed8bc0ab7b20e5c8140adc0a6
+
+From a25f2381689d2c2279a0e43b33f6c0ec8305a096 Mon Sep 17 00:00:00 2001
+From: Panagiotis Vasilopoulos <hello@alwayslivid.com>
+Date: Wed, 19 May 2021 16:25:16 +0300
+Subject: [PATCH] Add Libera Chat to network list
+
+---
+ src/common/servlist.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/common/servlist.c b/src/common/servlist.c
+index e44a3f2df..33bd80f2d 100644
+--- a/src/common/servlist.c
++++ b/src/common/servlist.c
+@@ -239,6 +239,9 @@ static const struct defaultserver def[] =
+ 	/* Self signed */
+ 	{0,			"irc.librairc.net"},
+ 
++	{"Libera Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
++	{0,			"irc.libera.chat"},
++
+ #ifdef USE_OPENSSL
+ 	{"LinkNet",	0},
+ 	{0,			"irc.link-net.org/+7000"},
+From d3545f37cd5f551ed8bc0ab7b20e5c8140adc0a6 Mon Sep 17 00:00:00 2001
+From: Patrick Griffis <pgriffis@igalia.com>
+Date: Sun, 23 May 2021 21:15:43 -0500
+Subject: [PATCH] Change default network to Libera.Chat
+
+---
+ src/common/servlist.c | 4 ++--
+ src/fe-gtk/joind.c    | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/common/servlist.c b/src/common/servlist.c
+index de75c8b9a..93557f975 100644
+--- a/src/common/servlist.c
++++ b/src/common/servlist.c
+@@ -240,7 +240,7 @@ static const struct defaultserver def[] =
+ 	/* Self signed */
+ 	{0,			"irc.librairc.net"},
+ 
+-	{"Libera Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
++	{"Libera.Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
+ 	{0,			"irc.libera.chat"},
+ 
+ #ifdef USE_OPENSSL
+@@ -942,7 +942,7 @@ servlist_load_defaults (void)
+ {
+ 	int i = 0, j = 0;
+ 	ircnet *net = NULL;
+-	guint def_hash = g_str_hash ("freenode");
++	guint def_hash = g_str_hash ("Libera.Chat");
+ 
+ 	while (1)
+ 	{
+diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c
+index f1d3da504..ce3cbcaec 100644
+--- a/src/fe-gtk/joind.c
++++ b/src/fe-gtk/joind.c
+@@ -247,7 +247,7 @@ joind_show_dialog (server *serv)
+ 							G_CALLBACK (joind_ok_cb), serv);
+ 							
+ 	if (serv->network)
+-		if (g_ascii_strcasecmp(((ircnet*)serv->network)->name, "freenode") == 0)
++		if (g_ascii_strcasecmp(((ircnet*)serv->network)->name, "Libera.Chat") == 0)
+ 		{
+ 			gtk_entry_set_text (GTK_ENTRY (entry1), "#hexchat");
+ 		}
diff --git a/gnu/packages/patches/inkscape-1.1-fix-build-witch-gcc7.5.patch b/gnu/packages/patches/inkscape-1.1-fix-build-witch-gcc7.5.patch
new file mode 100644
index 0000000000..bd7b01f856
--- /dev/null
+++ b/gnu/packages/patches/inkscape-1.1-fix-build-witch-gcc7.5.patch
@@ -0,0 +1,24 @@
+From 0ae15d7e89b984f72780ff7afa8e57dd6ae7765a Mon Sep 17 00:00:00 2001
+From: "Boris A. Dekshteyn" <boris.dekshteyn@gmail.com>
+Date: Mon, 14 Jun 2021 23:52:16 +1200
+Subject: [PATCH] Fix build witch GCC@7.5.
+
+---
+ src/object/sp-use-reference.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/object/sp-use-reference.h b/src/object/sp-use-reference.h
+index 5958632059..f07c2a3721 100644
+--- a/src/object/sp-use-reference.h
++++ b/src/object/sp-use-reference.h
+@@ -14,6 +14,7 @@
+ 
+ #include "sp-item.h"
+ #include "uri-references.h"
++#include "display/curve.h"
+ 
+ #include <memory>
+ 
+-- 
+2.32.0
+
diff --git a/gnu/packages/patches/isc-dhcp-gcc-compat.patch b/gnu/packages/patches/isc-dhcp-gcc-compat.patch
new file mode 100644
index 0000000000..82cb572d17
--- /dev/null
+++ b/gnu/packages/patches/isc-dhcp-gcc-compat.patch
@@ -0,0 +1,72 @@
+Add minor fixes for compiling with GCC 10.
+
+Taken from upstream:
+https://gitlab.isc.org/isc-projects/dhcp/-/commit/6c7e61578b1b449272dbb40dd8b98d03dad8a57a
+
+diff --git a/client/dhclient.c b/client/dhclient.c
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -83,8 +83,9 @@ static const char message [] = "Internet Systems Consortium DHCP Client";
+ static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/";
+ #endif /* UNIT_TEST */
+ 
+-u_int16_t local_port = 0;
+-u_int16_t remote_port = 0;
++extern u_int16_t local_port;
++extern u_int16_t remote_port;
++
+ #if defined(DHCPv6) && defined(DHCP4o6)
+ int dhcp4o6_state = -1; /* -1 = stopped, 0 = polling, 1 = started */
+ #endif
+diff --git a/common/discover.c b/common/discover.c
+--- a/common/discover.c
++++ b/common/discover.c
+@@ -45,8 +45,8 @@ struct interface_info *fallback_interface = 0;
+ 
+ int interfaces_invalidated;
+ int quiet_interface_discovery;
+-u_int16_t local_port;
+-u_int16_t remote_port;
++u_int16_t local_port = 0;
++u_int16_t remote_port = 0;
+ u_int16_t relay_port = 0;
+ int dhcpv4_over_dhcpv6 = 0;
+ int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
+diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
+--- a/relay/dhcrelay.c
++++ b/relay/dhcrelay.c
+@@ -95,8 +95,8 @@ enum { forward_and_append,	/* Forward and append our own relay option. */
+        forward_untouched,	/* Forward without changes. */
+        discard } agent_relay_mode = forward_and_replace;
+ 
+-u_int16_t local_port;
+-u_int16_t remote_port;
++extern u_int16_t local_port;
++extern u_int16_t remote_port;
+ 
+ /* Relay agent server list. */
+ struct server_list {
+diff --git a/server/mdb.c b/server/mdb.c
+--- a/server/mdb.c
++++ b/server/mdb.c
+@@ -67,7 +67,7 @@ static host_id_info_t *host_id_info = NULL;
+ 
+ int numclasseswritten;
+ 
+-omapi_object_type_t *dhcp_type_host;
++extern omapi_object_type_t *dhcp_type_host;
+ 
+ isc_result_t enter_class(cd, dynamicp, commit)
+ 	struct class *cd;
+diff --git a/server/mdb6.c b/server/mdb6.c
+--- a/server/mdb6.c
++++ b/server/mdb6.c
+@@ -1945,7 +1945,7 @@ create_prefix6(struct ipv6_pool *pool, struct iasubopt **pref,
+ 		}
+ 		new_ds.data = new_ds.buffer->data;
+ 		memcpy(new_ds.buffer->data, ds.data, ds.len);
+-		memcpy(new_ds.buffer->data + ds.len, &tmp, sizeof(tmp));
++		memcpy(&new_ds.buffer->data[0] + ds.len, &tmp, sizeof(tmp));
+ 		data_string_forget(&ds, MDL);
+ 		data_string_copy(&ds, &new_ds, MDL);
+ 		data_string_forget(&new_ds, MDL);
diff --git a/gnu/packages/patches/jfsutils-gcc-compat.patch b/gnu/packages/patches/jfsutils-gcc-compat.patch
new file mode 100644
index 0000000000..45b6ec25a1
--- /dev/null
+++ b/gnu/packages/patches/jfsutils-gcc-compat.patch
@@ -0,0 +1,72 @@
+Various fixes for building with GCC 10.
+
+Taken from Debian:
+https://sources.debian.org/patches/jfsutils/1.1.15-5/gcc10_fix-1.patch/
+
+--- jfsutils-1.1.15.old/fscklog/display.c	2005-11-22 21:43:54.000000000 +0100
++++ jfsutils-1.1.15.new/fscklog/display.c	2020-05-21 18:15:13.410617620 +0200
+@@ -54,7 +54,7 @@
+  * output: fsck extracted service log I/O buffer
+  *
+  */
+-char xchklog_buffer[XCHKLOG_BUFSIZE];
++static char xchklog_buffer[XCHKLOG_BUFSIZE];
+ 
+ /* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+  *
+diff -ur --exclude '*.o' --exclude '*.a' jfsutils-1.1.15.old/libfs/logredo.c jfsutils-1.1.15.new/libfs/logredo.c
+--- jfsutils-1.1.15.old/libfs/logredo.c	2005-11-22 21:43:55.000000000 +0100
++++ jfsutils-1.1.15.new/libfs/logredo.c	2020-05-21 18:19:44.927703271 +0200
+@@ -87,9 +87,9 @@
+  *    S T U F F    F O R    T H E    L O G
+  *
+  */
+-struct logsuper logsup;		/* log super block */
+-int32_t numdoblk;		/* number of do blocks used     */
+-int32_t numnodofile;		/* number of nodo file blocks used  */
++static struct logsuper logsup;		/* log super block */
++static int32_t numdoblk;		/* number of do blocks used     */
++static int32_t numnodofile;		/* number of nodo file blocks used  */
+ int32_t numExtDtPg = 0;		/* number of extended dtpage blocks used  */
+ 
+ /*
+@@ -129,7 +129,7 @@
+  */
+ 
+ /* buffer header table */
+-struct bufhdr {
++static struct bufhdr {
+ 	int16_t next;		/* 2: next on free/lru list */
+ 	int16_t prev;		/* 2: previous on free/lru list */
+ 	int16_t hnext;		/* 2: next on hash chain */
+@@ -142,7 +142,7 @@
+ } bufhdr[NBUFPOOL];		/* (24) */
+ 
+ /* buffer table */
+-struct bufpool {
++static struct bufpool {
+ 	char bytes[PSIZE];
+ } buffer[NBUFPOOL - 1];
+ 
+@@ -151,15 +151,16 @@
+  *
+  * log has its own 4 page buffer pool.
+  */
+-uint8_t afterdata[LOGPSIZE * 2];	/* buffer to read in redopage data */
++static uint8_t afterdata[LOGPSIZE * 2];	/* buffer to read in redopage data */
+ 
+ /*
+  * Miscellaneous
+  */
+-caddr_t prog;			/* Program name */
+-int32_t mntcnt, bufsize;
+-char *mntinfo;
+-int32_t retcode;		/* return code from logredo    */
++static caddr_t prog;			/* Program name */
++extern int32_t mntcnt;
++static int32_t bufsize;
++static char *mntinfo;
++static int32_t retcode;		/* return code from logredo    */
+ int end_of_transaction = 0;
+ 
+ /*
diff --git a/gnu/packages/patches/libcacard-unknown-variable.patch b/gnu/packages/patches/libcacard-unknown-variable.patch
new file mode 100644
index 0000000000..830a3ee8c0
--- /dev/null
+++ b/gnu/packages/patches/libcacard-unknown-variable.patch
@@ -0,0 +1,50 @@
+Fix Meson error when test dependencies are missing.
+
+Based on this upstream commit, with some adjustments to apply on 2.8.0:
+https://gitlab.freedesktop.org/spice/libcacard/-/commit/cf6121deb47e437aa566cfeb29a03da93c432394
+
+diff --git a/tests/meson.build b/tests/meson.build
+index 87945a2..baefaf5 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -9,15 +9,6 @@ modutil_dep = find_program('modutil', required: false)
+ openssl_dep = find_program('openssl', required: false)
+ softhsm_util_dep = find_program('softhsm2-util', required: false)
+ 
+-if pkcs11_tool_dep.found() and p11tool_dep.found() and modutil_dep.found() and openssl_dep.found() and softhsm_util_dep.found()
+-  softhsm = custom_target(
+-    'softhsm2.conf',
+-    command: find_program('setup-softhsm2.sh'),
+-    capture: true,
+-    output: 'setup-softhsm2.log',
+-  )
+-endif
+-
+ libcacard_test = executable(
+   'libcacard',
+   ['libcacard.c', 'common.c'],
+@@ -64,9 +55,18 @@ hwtests_test = executable(
+   dependencies: [libcacard_dep],
+ )
+ 
+-test(
+-  'hwtests',
+-  hwtests_test,
+-  depends: [softhsm],
+-  env: env,
+-)
++if pkcs11_tool_dep.found() and p11tool_dep.found() and modutil_dep.found() and openssl_dep.found() and softhsm_util_dep.found()
++  softhsm = custom_target(
++    'softhsm2.conf',
++    command: find_program('setup-softhsm2.sh'),
++    capture: true,
++    output: 'setup-softhsm2.log',
++  )
++
++  test(
++    'hwtests',
++    hwtests_test,
++    depends: [softhsm],
++    env: env,
++  )
++endif
diff --git a/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch b/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch
new file mode 100644
index 0000000000..4343c87795
--- /dev/null
+++ b/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch
@@ -0,0 +1,276 @@
+Copied from upstream nettle git repository.
+Removed changes to ChangeLog, to allow this patch to apply to nettle-3.5.
+
+From 485b5e2820a057e873b1ba812fdb39cae4adf98c Mon Sep 17 00:00:00 2001
+From: Niels Möller <nisse@lysator.liu.se>
+Date: Mon, 17 May 2021 20:55:26 +0200
+Subject: [PATCH 1/2] Change _rsa_sec_compute_root_tr to take a fix input size.
+
+Improves consistency with _rsa_sec_compute_root, and fixes zero-input bug.
+---
+ ChangeLog                    | 15 +++++++++
+ rsa-decrypt-tr.c             |  7 ++---
+ rsa-internal.h               |  4 +--
+ rsa-sec-decrypt.c            |  9 ++++--
+ rsa-sign-tr.c                | 61 +++++++++++++++++-------------------
+ testsuite/rsa-encrypt-test.c | 14 ++++++++-
+ 6 files changed, 68 insertions(+), 42 deletions(-)
+
+diff --git a/rsa-decrypt-tr.c b/rsa-decrypt-tr.c
+index 0224c0b7..927a8915 100644
+--- a/rsa-decrypt-tr.c
++++ b/rsa-decrypt-tr.c
+@@ -52,14 +52,13 @@ rsa_decrypt_tr(const struct rsa_public_key *pub,
+   mp_size_t key_limb_size;
+   int res;
+ 
+-  key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
++  key_limb_size = mpz_size(pub->n);
+ 
+   TMP_GMP_ALLOC (m, key_limb_size);
+   TMP_GMP_ALLOC (em, key->size);
++  mpz_limbs_copy(m, gibberish, key_limb_size);
+ 
+-  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
+-				  mpz_limbs_read(gibberish),
+-				  mpz_size(gibberish));
++  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
+ 
+   mpn_get_base256 (em, key->size, m, key_limb_size);
+ 
+diff --git a/rsa-internal.h b/rsa-internal.h
+index b828e451..f66a7df0 100644
+--- a/rsa-internal.h
++++ b/rsa-internal.h
+@@ -78,11 +78,11 @@ _rsa_sec_compute_root(const struct rsa_private_key *key,
+                       mp_limb_t *scratch);
+ 
+ /* Safe side-channel silent variant, using RSA blinding, and checking the
+- * result after CRT. */
++ * result after CRT. In-place calls, with x == m, is allowed. */
+ int
+ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
+ 			 const struct rsa_private_key *key,
+ 			 void *random_ctx, nettle_random_func *random,
+-			 mp_limb_t *x, const mp_limb_t *m, size_t mn);
++			 mp_limb_t *x, const mp_limb_t *m);
+ 
+ #endif /* NETTLE_RSA_INTERNAL_H_INCLUDED */
+diff --git a/rsa-sec-decrypt.c b/rsa-sec-decrypt.c
+index 6866e7c8..fc4757a0 100644
+--- a/rsa-sec-decrypt.c
++++ b/rsa-sec-decrypt.c
+@@ -58,9 +58,12 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
+   TMP_GMP_ALLOC (m, mpz_size(pub->n));
+   TMP_GMP_ALLOC (em, key->size);
+ 
+-  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
+-				  mpz_limbs_read(gibberish),
+-				  mpz_size(gibberish));
++  /* We need a copy because m can be shorter than key_size,
++   * but _rsa_sec_compute_root_tr expect all inputs to be
++   * normalized to a key_size long buffer length */
++  mpz_limbs_copy(m, gibberish, mpz_size(pub->n));
++
++  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
+ 
+   mpn_get_base256 (em, key->size, m, mpz_size(pub->n));
+ 
+diff --git a/rsa-sign-tr.c b/rsa-sign-tr.c
+index f824c4ca..9e137c7a 100644
+--- a/rsa-sign-tr.c
++++ b/rsa-sign-tr.c
+@@ -131,35 +131,34 @@ int
+ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
+ 			 const struct rsa_private_key *key,
+ 			 void *random_ctx, nettle_random_func *random,
+-			 mp_limb_t *x, const mp_limb_t *m, size_t mn)
++			 mp_limb_t *x, const mp_limb_t *m)
+ {
++  mp_size_t nn;
+   mpz_t mz;
+   mpz_t xz;
+   int res;
+ 
+-  mpz_init(mz);
+   mpz_init(xz);
+ 
+-  mpn_copyi(mpz_limbs_write(mz, mn), m, mn);
+-  mpz_limbs_finish(mz, mn);
++  nn = mpz_size (pub->n);
+ 
+-  res = rsa_compute_root_tr(pub, key, random_ctx, random, xz, mz);
++  res = rsa_compute_root_tr(pub, key, random_ctx, random, xz,
++			    mpz_roinit_n(mz, m, nn));
+ 
+   if (res)
+-    mpz_limbs_copy(x, xz, mpz_size(pub->n));
++    mpz_limbs_copy(x, xz, nn);
+ 
+-  mpz_clear(mz);
+   mpz_clear(xz);
+   return res;
+ }
+ #else
+ /* Blinds m, by computing c = m r^e (mod n), for a random r. Also
+-   returns the inverse (ri), for use by rsa_unblind. */
++   returns the inverse (ri), for use by rsa_unblind. Must have c != m,
++   no in-place operation.*/
+ static void
+ rsa_sec_blind (const struct rsa_public_key *pub,
+                void *random_ctx, nettle_random_func *random,
+-               mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m,
+-               mp_size_t mn)
++               mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m)
+ {
+   const mp_limb_t *ep = mpz_limbs_read (pub->e);
+   const mp_limb_t *np = mpz_limbs_read (pub->n);
+@@ -177,15 +176,15 @@ rsa_sec_blind (const struct rsa_public_key *pub,
+ 
+   /* c = m*(r^e) mod n */
+   itch = mpn_sec_powm_itch(nn, ebn, nn);
+-  i2 = mpn_sec_mul_itch(nn, mn);
++  i2 = mpn_sec_mul_itch(nn, nn);
+   itch = MAX(itch, i2);
+-  i2 = mpn_sec_div_r_itch(nn + mn, nn);
++  i2 = mpn_sec_div_r_itch(2*nn, nn);
+   itch = MAX(itch, i2);
+   i2 = mpn_sec_invert_itch(nn);
+   itch = MAX(itch, i2);
+ 
+-  TMP_GMP_ALLOC (tp, nn + mn + itch);
+-  scratch = tp + nn + mn;
++  TMP_GMP_ALLOC (tp, 2*nn  + itch);
++  scratch = tp + 2*nn;
+ 
+   /* ri = r^(-1) */
+   do
+@@ -198,9 +197,8 @@ rsa_sec_blind (const struct rsa_public_key *pub,
+   while (!mpn_sec_invert (ri, tp, np, nn, 2 * nn * GMP_NUMB_BITS, scratch));
+ 
+   mpn_sec_powm (c, rp, nn, ep, ebn, np, nn, scratch);
+-  /* normally mn == nn, but m can be smaller in some cases */
+-  mpn_sec_mul (tp, c, nn, m, mn, scratch);
+-  mpn_sec_div_r (tp, nn + mn, np, nn, scratch);
++  mpn_sec_mul (tp, c, nn, m, nn, scratch);
++  mpn_sec_div_r (tp, 2*nn, np, nn, scratch);
+   mpn_copyi(c, tp, nn);
+ 
+   TMP_GMP_FREE (r);
+@@ -208,7 +206,7 @@ rsa_sec_blind (const struct rsa_public_key *pub,
+   TMP_GMP_FREE (tp);
+ }
+ 
+-/* m = c ri mod n */
++/* m = c ri mod n. Allows x == c. */
+ static void
+ rsa_sec_unblind (const struct rsa_public_key *pub,
+                  mp_limb_t *x, mp_limb_t *ri, const mp_limb_t *c)
+@@ -299,7 +297,7 @@ int
+ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
+ 			 const struct rsa_private_key *key,
+ 			 void *random_ctx, nettle_random_func *random,
+-			 mp_limb_t *x, const mp_limb_t *m, size_t mn)
++			 mp_limb_t *x, const mp_limb_t *m)
+ {
+   TMP_GMP_DECL (c, mp_limb_t);
+   TMP_GMP_DECL (ri, mp_limb_t);
+@@ -307,7 +305,7 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
+   size_t key_limb_size;
+   int ret;
+ 
+-  key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
++  key_limb_size = mpz_size(pub->n);
+ 
+   /* mpz_powm_sec handles only odd moduli. If p, q or n is even, the
+      key is invalid and rejected by rsa_private_key_prepare. However,
+@@ -321,19 +319,18 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
+     }
+ 
+   assert(mpz_size(pub->n) == key_limb_size);
+-  assert(mn <= key_limb_size);
+ 
+   TMP_GMP_ALLOC (c, key_limb_size);
+   TMP_GMP_ALLOC (ri, key_limb_size);
+   TMP_GMP_ALLOC (scratch, _rsa_sec_compute_root_itch(key));
+ 
+-  rsa_sec_blind (pub, random_ctx, random, x, ri, m, mn);
++  rsa_sec_blind (pub, random_ctx, random, c, ri, m);
+ 
+-  _rsa_sec_compute_root(key, c, x, scratch);
++  _rsa_sec_compute_root(key, x, c, scratch);
+ 
+-  ret = rsa_sec_check_root(pub, c, x);
++  ret = rsa_sec_check_root(pub, x, c);
+ 
+-  rsa_sec_unblind(pub, x, ri, c);
++  rsa_sec_unblind(pub, x, ri, x);
+ 
+   cnd_mpn_zero(1 - ret, x, key_limb_size);
+ 
+@@ -357,17 +354,17 @@ rsa_compute_root_tr(const struct rsa_public_key *pub,
+ 		    mpz_t x, const mpz_t m)
+ {
+   TMP_GMP_DECL (l, mp_limb_t);
++  mp_size_t nn = mpz_size(pub->n);
+   int res;
+ 
+-  mp_size_t l_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
+-  TMP_GMP_ALLOC (l, l_size);
++  TMP_GMP_ALLOC (l, nn);
++  mpz_limbs_copy(l, m, nn);
+ 
+-  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l,
+-				  mpz_limbs_read(m), mpz_size(m));
++  res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l, l);
+   if (res) {
+-    mp_limb_t *xp = mpz_limbs_write (x, l_size);
+-    mpn_copyi (xp, l, l_size);
+-    mpz_limbs_finish (x, l_size);
++    mp_limb_t *xp = mpz_limbs_write (x, nn);
++    mpn_copyi (xp, l, nn);
++    mpz_limbs_finish (x, nn);
+   }
+ 
+   TMP_GMP_FREE (l);
+diff --git a/testsuite/rsa-encrypt-test.c b/testsuite/rsa-encrypt-test.c
+index 87525f78..d3bc374b 100644
+--- a/testsuite/rsa-encrypt-test.c
++++ b/testsuite/rsa-encrypt-test.c
+@@ -19,6 +19,7 @@ test_main(void)
+   uint8_t after;
+ 
+   mpz_t gibberish;
++  mpz_t zero;
+ 
+   rsa_private_key_init(&key);
+   rsa_public_key_init(&pub);
+@@ -101,6 +102,17 @@ test_main(void)
+   ASSERT(decrypted[decrypted_length] == after);
+   ASSERT(decrypted[0] == 'A');
+ 
++  /* Test zero input. */
++  mpz_init_set_ui (zero, 0);
++  decrypted_length = msg_length;
++  ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
++  ASSERT(!rsa_decrypt_tr(&pub, &key,
++			 &lfib, (nettle_random_func *) knuth_lfib_random,
++			 &decrypted_length, decrypted, zero));
++  ASSERT(!rsa_sec_decrypt(&pub, &key,
++			  &lfib, (nettle_random_func *) knuth_lfib_random,
++			  decrypted_length, decrypted, zero));
++  ASSERT(decrypted_length == msg_length);
+ 
+   /* Test invalid key. */
+   mpz_add_ui (key.q, key.q, 2);
+@@ -112,6 +124,6 @@ test_main(void)
+   rsa_private_key_clear(&key);
+   rsa_public_key_clear(&pub);
+   mpz_clear(gibberish);
++  mpz_clear(zero);
+   free(decrypted);
+ }
+-  
+-- 
+2.31.1
+
diff --git a/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch b/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch
new file mode 100644
index 0000000000..5f19bd80d3
--- /dev/null
+++ b/gnu/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch
@@ -0,0 +1,163 @@
+Copied from upstream nettle git repository.
+Removed changes to ChangeLog, to allow this patch to apply to nettle-3.5.
+
+From 0ad0b5df315665250dfdaa4a1e087f4799edaefe Mon Sep 17 00:00:00 2001
+From: Niels Möller <nisse@lysator.liu.se>
+Date: Mon, 17 May 2021 22:02:47 +0200
+Subject: [PATCH 2/2] Add input check to rsa_decrypt family of functions.
+
+---
+ ChangeLog                    |  8 ++++++++
+ rsa-decrypt-tr.c             |  4 ++++
+ rsa-decrypt.c                | 10 ++++++++++
+ rsa-sec-decrypt.c            |  4 ++++
+ rsa.h                        |  5 +++--
+ testsuite/rsa-encrypt-test.c | 38 ++++++++++++++++++++++++++++++------
+ 6 files changed, 61 insertions(+), 8 deletions(-)
+
+diff --git a/rsa-decrypt-tr.c b/rsa-decrypt-tr.c
+index 927a8915..4a9e9d74 100644
+--- a/rsa-decrypt-tr.c
++++ b/rsa-decrypt-tr.c
+@@ -52,6 +52,10 @@ rsa_decrypt_tr(const struct rsa_public_key *pub,
+   mp_size_t key_limb_size;
+   int res;
+ 
++  /* First check that input is in range. */
++  if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
++    return 0;
++
+   key_limb_size = mpz_size(pub->n);
+ 
+   TMP_GMP_ALLOC (m, key_limb_size);
+diff --git a/rsa-decrypt.c b/rsa-decrypt.c
+index 7681439d..540d8baa 100644
+--- a/rsa-decrypt.c
++++ b/rsa-decrypt.c
+@@ -48,6 +48,16 @@ rsa_decrypt(const struct rsa_private_key *key,
+   int res;
+ 
+   mpz_init(m);
++
++  /* First check that input is in range. Since we don't have the
++     public key available here, we need to reconstruct n. */
++  mpz_mul (m, key->p, key->q);
++  if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, m) >= 0)
++    {
++      mpz_clear (m);
++      return 0;
++    }
++
+   rsa_compute_root(key, m, gibberish);
+ 
+   res = pkcs1_decrypt (key->size, m, length, message);
+diff --git a/rsa-sec-decrypt.c b/rsa-sec-decrypt.c
+index fc4757a0..4c98958d 100644
+--- a/rsa-sec-decrypt.c
++++ b/rsa-sec-decrypt.c
+@@ -55,6 +55,10 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
+   TMP_GMP_DECL (em, uint8_t);
+   int res;
+ 
++  /* First check that input is in range. */
++  if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
++    return 0;
++
+   TMP_GMP_ALLOC (m, mpz_size(pub->n));
+   TMP_GMP_ALLOC (em, key->size);
+ 
+diff --git a/rsa.h b/rsa.h
+index 3b10155f..2dd35a2d 100644
+--- a/rsa.h
++++ b/rsa.h
+@@ -428,13 +428,14 @@ rsa_sec_decrypt(const struct rsa_public_key *pub,
+ 	        size_t length, uint8_t *message,
+ 	        const mpz_t gibberish);
+ 
+-/* Compute x, the e:th root of m. Calling it with x == m is allowed. */
++/* Compute x, the e:th root of m. Calling it with x == m is allowed.
++   It is required that 0 <= m < n. */
+ void
+ rsa_compute_root(const struct rsa_private_key *key,
+ 		 mpz_t x, const mpz_t m);
+ 
+ /* Safer variant, using RSA blinding, and checking the result after
+-   CRT. */
++   CRT. It is required that 0 <= m < n. */
+ int
+ rsa_compute_root_tr(const struct rsa_public_key *pub,
+ 		    const struct rsa_private_key *key,
+diff --git a/testsuite/rsa-encrypt-test.c b/testsuite/rsa-encrypt-test.c
+index d3bc374b..d1a440f6 100644
+--- a/testsuite/rsa-encrypt-test.c
++++ b/testsuite/rsa-encrypt-test.c
+@@ -19,11 +19,12 @@ test_main(void)
+   uint8_t after;
+ 
+   mpz_t gibberish;
+-  mpz_t zero;
++  mpz_t bad_input;
+ 
+   rsa_private_key_init(&key);
+   rsa_public_key_init(&pub);
+   mpz_init(gibberish);
++  mpz_init(bad_input);
+ 
+   knuth_lfib_init(&lfib, 17);
+   
+@@ -103,15 +104,40 @@ test_main(void)
+   ASSERT(decrypted[0] == 'A');
+ 
+   /* Test zero input. */
+-  mpz_init_set_ui (zero, 0);
++  mpz_set_ui (bad_input, 0);
+   decrypted_length = msg_length;
+-  ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
++  ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
+   ASSERT(!rsa_decrypt_tr(&pub, &key,
+ 			 &lfib, (nettle_random_func *) knuth_lfib_random,
+-			 &decrypted_length, decrypted, zero));
++			 &decrypted_length, decrypted, bad_input));
+   ASSERT(!rsa_sec_decrypt(&pub, &key,
+ 			  &lfib, (nettle_random_func *) knuth_lfib_random,
+-			  decrypted_length, decrypted, zero));
++			  decrypted_length, decrypted, bad_input));
++  ASSERT(decrypted_length == msg_length);
++
++  /* Test input that is slightly larger than n */
++  mpz_add(bad_input, gibberish, pub.n);
++  decrypted_length = msg_length;
++  ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
++  ASSERT(!rsa_decrypt_tr(&pub, &key,
++			 &lfib, (nettle_random_func *) knuth_lfib_random,
++			 &decrypted_length, decrypted, bad_input));
++  ASSERT(!rsa_sec_decrypt(&pub, &key,
++			  &lfib, (nettle_random_func *) knuth_lfib_random,
++			  decrypted_length, decrypted, bad_input));
++  ASSERT(decrypted_length == msg_length);
++
++  /* Test input that is considerably larger than n */
++  mpz_mul_2exp (bad_input, pub.n, 100);
++  mpz_add (bad_input, bad_input, gibberish);
++  decrypted_length = msg_length;
++  ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
++  ASSERT(!rsa_decrypt_tr(&pub, &key,
++			 &lfib, (nettle_random_func *) knuth_lfib_random,
++			 &decrypted_length, decrypted, bad_input));
++  ASSERT(!rsa_sec_decrypt(&pub, &key,
++			  &lfib, (nettle_random_func *) knuth_lfib_random,
++			  decrypted_length, decrypted, bad_input));
+   ASSERT(decrypted_length == msg_length);
+ 
+   /* Test invalid key. */
+@@ -124,6 +150,6 @@ test_main(void)
+   rsa_private_key_clear(&key);
+   rsa_public_key_clear(&pub);
+   mpz_clear(gibberish);
+-  mpz_clear(zero);
++  mpz_clear(bad_input);
+   free(decrypted);
+ }
+-- 
+2.31.1
+
diff --git a/gnu/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch b/gnu/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch
new file mode 100644
index 0000000000..297816e698
--- /dev/null
+++ b/gnu/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch
@@ -0,0 +1,78 @@
+Copied from upstream nettle git repository.
+Removed changes to ChangeLog, to allow this patch to apply to nettle-3.5.
+
+From 7616541e6eff73353bf682c62e3a68e4fe696707 Mon Sep 17 00:00:00 2001
+From: Niels Möller <nisse@lysator.liu.se>
+Date: Thu, 6 May 2021 21:29:56 +0200
+Subject: [PATCH] Add check that message length to _pkcs1_sec_decrypt is valid.
+
+* pkcs1-sec-decrypt.c (_pkcs1_sec_decrypt): Check that message
+length is valid, for given key size.
+* testsuite/rsa-sec-decrypt-test.c (test_main): Add test cases for
+calls to rsa_sec_decrypt specifying a too large message length.
+---
+ ChangeLog                        |  7 +++++++
+ pkcs1-sec-decrypt.c              |  4 +++-
+ testsuite/rsa-sec-decrypt-test.c | 17 ++++++++++++++++-
+ 3 files changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/pkcs1-sec-decrypt.c b/pkcs1-sec-decrypt.c
+index 4f13080e..16833691 100644
+--- a/pkcs1-sec-decrypt.c
++++ b/pkcs1-sec-decrypt.c
+@@ -63,7 +63,9 @@ _pkcs1_sec_decrypt (size_t length, uint8_t *message,
+   volatile int ok;
+   size_t i, t;
+ 
+-  assert (padded_message_length >= length);
++  /* Message independent branch */
++  if (length + 11 > padded_message_length)
++    return 0;
+ 
+   t = padded_message_length - length - 1;
+ 
+diff --git a/testsuite/rsa-sec-decrypt-test.c b/testsuite/rsa-sec-decrypt-test.c
+index fb0ed3a1..3419322e 100644
+--- a/testsuite/rsa-sec-decrypt-test.c
++++ b/testsuite/rsa-sec-decrypt-test.c
+@@ -55,6 +55,7 @@ rsa_decrypt_for_test(const struct rsa_public_key *pub,
+ #endif
+ 
+ #define PAYLOAD_SIZE 50
++#define DECRYPTED_SIZE 256
+ void
+ test_main(void)
+ {
+@@ -63,7 +64,7 @@ test_main(void)
+   struct knuth_lfib_ctx random_ctx;
+ 
+   uint8_t plaintext[PAYLOAD_SIZE];
+-  uint8_t decrypted[PAYLOAD_SIZE];
++  uint8_t decrypted[DECRYPTED_SIZE];
+   uint8_t verifybad[PAYLOAD_SIZE];
+   unsigned n_size = 1024;
+   mpz_t gibberish;
+@@ -99,6 +100,20 @@ test_main(void)
+                                     PAYLOAD_SIZE, decrypted, gibberish) == 1);
+       ASSERT (MEMEQ (PAYLOAD_SIZE, plaintext, decrypted));
+ 
++      ASSERT (pub.size > 10);
++      ASSERT (pub.size <= DECRYPTED_SIZE);
++
++      /* Check that too large message length is rejected, largest
++	 valid size is pub.size - 11. */
++      ASSERT (!rsa_decrypt_for_test (&pub, &key, &random_ctx,
++				     (nettle_random_func *) knuth_lfib_random,
++				     pub.size - 10, decrypted, gibberish));
++
++      /* This case used to result in arithmetic underflow and a crash. */
++      ASSERT (!rsa_decrypt_for_test (&pub, &key, &random_ctx,
++				     (nettle_random_func *) knuth_lfib_random,
++				     pub.size, decrypted, gibberish));
++
+       /* bad one */
+       memcpy(decrypted, verifybad, PAYLOAD_SIZE);
+       nettle_mpz_random_size(garbage, &random_ctx,
+-- 
+2.31.1
+
diff --git a/gnu/packages/patches/polkit-CVE-2021-3560.patch b/gnu/packages/patches/polkit-CVE-2021-3560.patch
new file mode 100644
index 0000000000..9aa0373fda
--- /dev/null
+++ b/gnu/packages/patches/polkit-CVE-2021-3560.patch
@@ -0,0 +1,21 @@
+This patch fixes CVE-2021-3560, "local privilege escalation using
+polkit_system_bus_name_get_creds_sync()":
+
+  https://www.openwall.com/lists/oss-security/2021/06/03/1
+
+Patch from <https://gitlab.freedesktop.org/polkit/polkit/-/commit/a04d13a>.
+
+diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c
+index 8daa12cb9093c1d765c7b83654a2b8d0d382378e..8ed13631508dd96624898df90ee2ece4dcf3e1e5 100644
+--- a/src/polkit/polkitsystembusname.c
++++ b/src/polkit/polkitsystembusname.c
+@@ -435,6 +435,9 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName           *system_bus
+   while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error))
+     g_main_context_iteration (tmp_context, TRUE);
+ 
++  if (data.caught_error)
++    goto out;
++
+   if (out_uid)
+     *out_uid = data.uid;
+   if (out_pid)
diff --git a/gnu/packages/patches/qemu-build-info-manual.patch b/gnu/packages/patches/qemu-build-info-manual.patch
index f2bee30ab0..945c48a0e2 100644
--- a/gnu/packages/patches/qemu-build-info-manual.patch
+++ b/gnu/packages/patches/qemu-build-info-manual.patch
@@ -13,17 +13,11 @@ configuring the directory under which the info manuals are installed.
 * docs/meson.build (texi, info): New targets.
 
 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
----
- configure        |  7 ++++++-
- docs/meson.build | 21 +++++++++++++++++++++
- meson.build      |  2 ++
- 3 files changed, 29 insertions(+), 1 deletion(-)
 
 diff --git a/configure b/configure
-index 18c26e0389..d1ab2c19d1 100755
 --- a/configure
 +++ b/configure
-@@ -948,6 +948,8 @@ for opt do
+@@ -951,6 +951,8 @@ for opt do
      static="yes"
      QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
    ;;
@@ -32,7 +26,7 @@ index 18c26e0389..d1ab2c19d1 100755
    --mandir=*) mandir="$optarg"
    ;;
    --bindir=*) bindir="$optarg"
-@@ -975,7 +977,7 @@ for opt do
+@@ -978,7 +980,7 @@ for opt do
    --host=*|--build=*|\
    --disable-dependency-tracking|\
    --sbindir=*|--sharedstatedir=*|\
@@ -41,35 +35,26 @@ index 18c26e0389..d1ab2c19d1 100755
    --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
      # These switches are silently ignored, for compatibility with
      # autoconf-generated configure scripts. This allows QEMU's
-@@ -1540,6 +1542,7 @@ includedir="${includedir:-$prefix/include}"
- if test "$mingw32" = "yes" ; then
-     mandir="$prefix"
-     datadir="$prefix"
-+    infodir="$prefix"
-     docdir="$prefix"
-     bindir="$prefix"
-     sysconfdir="$prefix"
-@@ -1547,6 +1550,7 @@ if test "$mingw32" = "yes" ; then
- else
-     mandir="${mandir:-$prefix/share/man}"
-     datadir="${datadir:-$prefix/share}"
-+    infodir="${infodir:-$datadir/info}"
-     docdir="${docdir:-$prefix/share/doc}"
-     bindir="${bindir:-$prefix/bin}"
-     sysconfdir="${sysconfdir:-$prefix/etc}"
-@@ -1683,6 +1687,7 @@ Advanced options (experts only):
-   --smbd=SMBD              use specified smbd [$smbd]
-   --with-git=GIT           use specified git [$git]
+@@ -1599,6 +1601,7 @@ else
+ fi
+ mandir="${mandir:-$prefix/share/man}"
+ datadir="${datadir:-$prefix/share}"
++infodir="${infodir:-$datadir/info}"
+ docdir="${docdir:-$prefix/share/doc}"
+ sysconfdir="${sysconfdir:-$prefix/etc}"
+ local_statedir="${local_statedir:-$prefix/var}"
+@@ -1736,6 +1739,7 @@ Advanced options (experts only):
+   --with-git-submodules=validate fail if git submodules are not up to date
+   --with-git-submodules=ignore   do not update or check git submodules (default if no .git dir)
    --static                 enable static build [$static]
 +  --infodir=PATH           install info manual in PATH
    --mandir=PATH            install man pages in PATH
    --datadir=PATH           install firmware in PATH/$qemu_suffix
    --localedir=PATH         install translation in PATH/$qemu_suffix
 diff --git a/docs/meson.build b/docs/meson.build
-index ebd85d59f9..1243839461 100644
 --- a/docs/meson.build
 +++ b/docs/meson.build
-@@ -114,4 +114,25 @@ if build_docs
+@@ -104,4 +104,25 @@ if build_docs
    alias_target('sphinxdocs', sphinxdocs)
    alias_target('html', sphinxdocs)
    alias_target('man', sphinxmans)
@@ -96,10 +81,9 @@ index ebd85d59f9..1243839461 100644
 +  endif
  endif
 diff --git a/meson.build b/meson.build
-index e3386196ba..d64a125ad9 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -32,6 +32,7 @@ endif
+@@ -35,6 +35,7 @@ endif
  qemu_confdir = get_option('sysconfdir') / get_option('qemu_suffix')
  qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
  qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
@@ -107,14 +91,11 @@ index e3386196ba..d64a125ad9 100644
  qemu_moddir = get_option('libdir') / get_option('qemu_suffix')
  
  qemu_desktopdir = get_option('datadir') / 'applications'
-@@ -1995,6 +1996,7 @@ else
+@@ -2433,6 +2434,7 @@ else
    summary_info += {'local state directory': 'queried at runtime'}
  endif
  summary_info += {'Doc directory':     get_option('docdir')}
 +summary_info += {'Info directory':    get_option('infodir')}
  summary_info += {'Build directory':   meson.current_build_dir()}
  summary_info += {'Source path':       meson.current_source_dir()}
- summary_info += {'GIT binary':        config_host['GIT']}
--- 
-2.30.1
-
+ summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
diff --git a/gnu/packages/patches/qemu-meson-compat.patch b/gnu/packages/patches/qemu-meson-compat.patch
new file mode 100644
index 0000000000..e6968c57dc
--- /dev/null
+++ b/gnu/packages/patches/qemu-meson-compat.patch
@@ -0,0 +1,27 @@
+Fix a build failure that occurs with newer versions of Meson when
+gdbus-codegen is unavailable.
+
+Taken from upstream:
+https://gitlab.com/qemu-project/qemu/-/commit/5ecfb76ccc056eb6127e44268e475827ae73b9e0
+
+diff --git a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -3341,7 +3341,7 @@ if ! test "$gio" = "no"; then
+         gio_cflags=$($pkg_config --cflags gio-2.0)
+         gio_libs=$($pkg_config --libs gio-2.0)
+         gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
+-        if [ ! -x "$gdbus_codegen" ]; then
++        if ! has "$gdbus_codegen"; then
+             gdbus_codegen=
+         fi
+         # Check that the libraries actually work -- Ubuntu 18.04 ships
+@@ -5704,6 +5704,8 @@ if test "$gio" = "yes" ; then
+     echo "CONFIG_GIO=y" >> $config_host_mak
+     echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
+     echo "GIO_LIBS=$gio_libs" >> $config_host_mak
++fi
++if test "$gdbus_codegen" != "" ; then
+     echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
+ fi
+ echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
diff --git a/gnu/packages/patches/qemu-sphinx-compat.patch b/gnu/packages/patches/qemu-sphinx-compat.patch
new file mode 100644
index 0000000000..7342ebee4e
--- /dev/null
+++ b/gnu/packages/patches/qemu-sphinx-compat.patch
@@ -0,0 +1,18 @@
+Prevent Sphinx 4 and later from creating subdirectories, which
+the build scripts are not equipped to deal with.
+
+Taken from upstream:
+https://gitlab.com/qemu-project/qemu/-/issues/256
+https://gitlab.com/qemu-project/qemu/-/commit/269a7e97865cb863c9ca19e5f2e6a40ac9eddf82
+
+diff --git a/docs/conf.py b/docs/conf.py
+--- a/docs/conf.py
++++ b/docs/conf.py
+@@ -279,6 +279,7 @@
+      ['Stefan Hajnoczi <stefanha@redhat.com>',
+       'Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>'], 1),
+ ]
++man_make_section_directory = False
+ 
+ # -- Options for Texinfo output -------------------------------------------
+ 
diff --git a/gnu/packages/patches/rust-ndarray-0.13-remove-blas-src.patch b/gnu/packages/patches/rust-ndarray-0.13-remove-blas-src.patch
new file mode 100644
index 0000000000..936c099ce4
--- /dev/null
+++ b/gnu/packages/patches/rust-ndarray-0.13-remove-blas-src.patch
@@ -0,0 +1,28 @@
+ Cargo.toml | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index 1f3e1b6..36bc816 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -43,11 +43,6 @@
+ version = "0.3.2"
+ optional = true
+ 
+-[dependencies.blas-src]
+-version = "0.2.0"
+-optional = true
+-default-features = false
+-
+ [dependencies.cblas-sys]
+ version = "0.1.4"
+ optional = true
+@@ -91,7 +86,7 @@
+ default-features = false
+ 
+ [features]
+-blas = ["cblas-sys", "blas-src"]
++blas = ["cblas-sys"]
+ docs = ["approx", "serde", "rayon"]
+ serde-1 = ["serde"]
+ test = ["test-blas-openblas-sys"]
diff --git a/gnu/packages/patches/tor-fix-build-with-gcc-7.patch b/gnu/packages/patches/tor-fix-build-with-gcc-7.patch
new file mode 100644
index 0000000000..5481695a63
--- /dev/null
+++ b/gnu/packages/patches/tor-fix-build-with-gcc-7.patch
@@ -0,0 +1,30 @@
+From 810c0616d59809b89f5144d4afdbf70391df7a7f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexander=20F=C3=A6r=C3=B8y?= <ahf@torproject.org>
+Date: Thu, 10 Jun 2021 20:04:13 +0000
+Subject: [PATCH] Fix compilation on OpenSUSE.
+
+This patch fixes a build error with GCC 7.x which doesn't seem to accept
+const int's as constants in macro initialization.
+
+See: tpo/core/tor#40410
+---
+ src/feature/dirclient/dirclient.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c
+index 74c6452061..a2b20621a0 100644
+--- a/src/feature/dirclient/dirclient.c
++++ b/src/feature/dirclient/dirclient.c
+@@ -1907,8 +1907,7 @@ dir_client_decompress_response_body(char **bodyp, size_t *bodylenp,
+   /* If we're pretty sure that we have a compressed directory, and
+    * we didn't manage to uncompress it, then warn and bail. */
+   if (!plausible && !new_body) {
+-    const int LOG_INTERVAL = 3600;
+-    static ratelim_t warning_limit = RATELIM_INIT(LOG_INTERVAL);
++    static ratelim_t warning_limit = RATELIM_INIT(60 * 60);
+     log_fn_ratelim(&warning_limit, LOG_WARN, LD_HTTP,
+            "Unable to decompress HTTP body (tried %s%s%s, on %s).",
+            description1,
+-- 
+GitLab
+
diff --git a/gnu/packages/patches/xpra-4.0.1-systemd-run.patch b/gnu/packages/patches/xpra-4.0.1-systemd-run.patch
deleted file mode 100644
index 1ea11830a5..0000000000
--- a/gnu/packages/patches/xpra-4.0.1-systemd-run.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Disable systemd-run if the command is not found.
-
-diff -Naur xpra-4.0.1/xpra/scripts/main.py xpra-4.0.1.patched/xpra/scripts/main.py
---- xpra-4.0.1/xpra/scripts/main.py	2020-05-17 18:12:15.000000000 +0200
-+++ xpra-4.0.1.patched/xpra/scripts/main.py	2020-06-01 12:12:18.500257507 +0200
-@@ -312,16 +312,18 @@
-     if not is_systemd_pid1():
-         return False
-     #test it:
--    cmd = ["systemd-run", "--quiet", "--user", "--scope", "--", "true"]
--    proc = Popen(cmd, stdin=None, stdout=None, stderr=None, shell=False)
--    r = pollwait(proc, timeout=1)
--    if r is None:
--        try:
--            proc.terminate()
--        except Exception:
--            pass
--    return r==0
--
-+    try:
-+        cmd = ["systemd-run", "--quiet", "--user", "--scope", "--", "true"]
-+        proc = Popen(cmd, stdin=None, stdout=None, stderr=None, shell=False)
-+        r = pollwait(proc, timeout=1)
-+        if r is None:
-+            try:
-+                proc.terminate()
-+            except Exception:
-+                pass
-+        return r==0
-+    except FileNotFoundError:
-+        return False
- 
- def run_mode(script_file, error_cb, options, args, mode, defaults):
-     #configure default logging handler:
diff --git a/gnu/packages/patches/xpra-4.2-systemd-run.patch b/gnu/packages/patches/xpra-4.2-systemd-run.patch
new file mode 100644
index 0000000000..8dfd9c82f0
--- /dev/null
+++ b/gnu/packages/patches/xpra-4.2-systemd-run.patch
@@ -0,0 +1,45 @@
+Disable systemd-run if the command is not found.
+
+diff -ru xpra-4.2~/xpra/scripts/main.py xpra-4.2/xpra/scripts/main.py
+--- xpra-4.2~/xpra/scripts/main.py	2021-06-06 08:51:13.756815842 -0700
++++ xpra-4.2/xpra/scripts/main.py	2021-06-06 16:07:13.371024486 -0700
+@@ -331,23 +331,26 @@
+     if not is_systemd_pid1():
+         return False    # pragma: no cover
+     #test it:
+-    cmd = ["systemd-run", "--quiet", "--user", "--scope", "--", "true"]
+-    proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=False)
+     try:
+-        proc.communicate(timeout=2)
+-        r = proc.returncode
+-    except TimeoutExpired:  # pragma: no cover
+-        r = None
+-    if r is None:
++        cmd = ["systemd-run", "--quiet", "--user", "--scope", "--", "true"]
++        proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=False)
+         try:
+-            proc.terminate()
+-        except Exception:
+-            pass
+-        try:
+-            proc.communicate(timeout=1)
++            proc.communicate(timeout=2)
++            r = proc.returncode
+         except TimeoutExpired:  # pragma: no cover
+             r = None
+-    return r==0
++        if r is None:
++            try:
++                proc.terminate()
++            except Exception:
++                pass
++            try:
++                proc.communicate(timeout=1)
++            except TimeoutExpired:  # pragma: no cover
++                r = None
++        return r==0
++    except FileNotFoundError:
++        return False
+ 
+ 
+ def run_mode(script_file, error_cb, options, args, mode, defaults):