about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/gcc/patches
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/gcc/patches')
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/12/mangle-NIX_STORE-in-__FILE__.patch4
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/13/mangle-NIX_STORE-in-__FILE__.patch4
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/6/fix-objdump-check.patch43
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch16
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/9/avoid-cycling-subreg-reloads.patch261
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/9/gcc9-asan-glibc-2.34.patch70
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades.patch83
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/struct-sigaltstack.patch87
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-4.5.patch107
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-libjava.patch33
11 files changed, 25 insertions, 688 deletions
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/12/mangle-NIX_STORE-in-__FILE__.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/12/mangle-NIX_STORE-in-__FILE__.patch
index d938d67a2d06..4e6c392ce76e 100644
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/12/mangle-NIX_STORE-in-__FILE__.patch
+++ b/nixpkgs/pkgs/development/compilers/gcc/patches/12/mangle-NIX_STORE-in-__FILE__.patch
@@ -17,10 +17,10 @@ Ideally we would like to use `-fmacro-prefix-map=` feature of `gcc` as:
   -fmacro-prefix-map=/nix/store/$hash1-nlohmann-json-ver=/nix/store/eeee.eee-nlohmann-json-ver
   -fmacro-prefix-map=/nix/...
 
-In practice it quickly exhausts argument lengtth limit due to `gcc`
+In practice it quickly exhausts argument length limit due to `gcc`
 deficiency: https://gcc.gnu.org/PR111527
 
-Until it;s fixed let's hardcode header mangling if $NIX_STORE variable
+Until it's fixed let's hardcode header mangling if $NIX_STORE variable
 is present in the environment.
 
 Tested as:
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/13/mangle-NIX_STORE-in-__FILE__.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/13/mangle-NIX_STORE-in-__FILE__.patch
index 57ae2111f020..ea0673219eb1 100644
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/13/mangle-NIX_STORE-in-__FILE__.patch
+++ b/nixpkgs/pkgs/development/compilers/gcc/patches/13/mangle-NIX_STORE-in-__FILE__.patch
@@ -17,10 +17,10 @@ Ideally we would like to use `-fmacro-prefix-map=` feature of `gcc` as:
   -fmacro-prefix-map=/nix/store/$hash1-nlohmann-json-ver=/nix/store/eeee.eee-nlohmann-json-ver
   -fmacro-prefix-map=/nix/...
 
-In practice it quickly exhausts argument lengtth limit due to `gcc`
+In practice it quickly exhausts argument length limit due to `gcc`
 deficiency: https://gcc.gnu.org/PR111527
 
-Until it;s fixed let's hardcode header mangling if $NIX_STORE variable
+Until it's fixed let's hardcode header mangling if $NIX_STORE variable
 is present in the environment.
 
 Tested as:
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/6/fix-objdump-check.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/6/fix-objdump-check.patch
deleted file mode 100644
index f9adbe9eb1ca..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/6/fix-objdump-check.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-commit 4c38abe0967bad78dd6baa61c86923e4d4b346d3
-Author: Ben Gamari <ben@smart-cactus.org>
-Date:   Sun Nov 5 13:14:19 2017 -0500
-
-    Fix it
-
-diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
-index dd06a58..f4435b8 100644
---- a/config/gcc-plugin.m4
-+++ b/config/gcc-plugin.m4
-@@ -13,6 +13,32 @@ dnl the same distribution terms as the rest of that program.
- # Sets the shell variables enable_plugin and pluginlibs.
- AC_DEFUN([GCC_ENABLE_PLUGINS],
-   [# Check for plugin support
-+
-+   # Figure out what objdump we will be using.
-+   AS_VAR_SET_IF(gcc_cv_objdump,, [
-+   if test -f $gcc_cv_binutils_srcdir/configure.ac \
-+        && test -f ../binutils/Makefile \
-+        && test x$build = x$host; then
-+   	# Single tree build which includes binutils.
-+   	gcc_cv_objdump=../binutils/objdump$build_exeext
-+   elif test -x objdump$build_exeext; then
-+   	gcc_cv_objdump=./objdump$build_exeext
-+   elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
-+           gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
-+   else
-+           AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
-+   fi])
-+   
-+   AC_MSG_CHECKING(what objdump to use)
-+   if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
-+   	# Single tree build which includes binutils.
-+   	AC_MSG_RESULT(newly built objdump)
-+   elif test x$gcc_cv_objdump = x; then
-+   	AC_MSG_RESULT(not found)
-+   else
-+   	AC_MSG_RESULT($gcc_cv_objdump)
-+   fi
-+
-    AC_ARG_ENABLE(plugin,
-    [AS_HELP_STRING([--enable-plugin], [enable plugin support])],
-    enable_plugin=$enableval,
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch
new file mode 100644
index 000000000000..3705ed99c49a
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch
@@ -0,0 +1,16 @@
+From https://gist.githubusercontent.com/DavidEGrayson/88bceb3f4e62f45725ecbb9248366300/raw/c1f515475aff1e1e3985569d9b715edb0f317648/gcc-11-arm-darwin.patch
+
+diff -ur a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
+--- a/gcc/config/host-darwin.c	2021-04-27 03:00:13.000000000 -0700
++++ b/gcc/config/host-darwin.c	2021-06-11 14:49:13.754000000 -0700
+@@ -22,6 +22,10 @@
+ #include "coretypes.h"
+ #include "diagnostic-core.h"
+ #include "config/host-darwin.h"
++#include "hosthooks.h"
++#include "hosthooks-def.h"
++
++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
+ 
+ /* Yes, this is really supposed to work.  */
+ /* This allows for a pagesize of 16384, which we have on Darwin20, but should
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/9/avoid-cycling-subreg-reloads.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/9/avoid-cycling-subreg-reloads.patch
deleted file mode 100644
index 17a4e0a2447b..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/9/avoid-cycling-subreg-reloads.patch
+++ /dev/null
@@ -1,261 +0,0 @@
-From 6001db79c477b03eacc7e7049560921fb54b7845 Mon Sep 17 00:00:00 2001
-From: Richard Sandiford <richard.sandiford@arm.com>
-Date: Mon, 7 Sep 2020 20:15:36 +0100
-Subject: [PATCH] lra: Avoid cycling on certain subreg reloads [PR96796]
-
-This PR is about LRA cycling for a reload of the form:
-
-----------------------------------------------------------------------------
-Changing pseudo 196 in operand 1 of insn 103 on equiv [r105:DI*0x8+r140:DI]
-      Creating newreg=287, assigning class ALL_REGS to slow/invalid mem r287
-      Creating newreg=288, assigning class ALL_REGS to slow/invalid mem r288
-  103: r203:SI=r288:SI<<0x1+r196:DI#0
-      REG_DEAD r196:DI
-    Inserting slow/invalid mem reload before:
-  316: r287:DI=[r105:DI*0x8+r140:DI]
-  317: r288:SI=r287:DI#0
-----------------------------------------------------------------------------
-
-The problem is with r287.  We rightly give it a broad starting class of
-POINTER_AND_FP_REGS (reduced from ALL_REGS by preferred_reload_class).
-However, we never make forward progress towards narrowing it down to
-a specific choice of class (POINTER_REGS or FP_REGS).
-
-I think in practice we rely on two things to narrow a reload pseudo's
-class down to a specific choice:
-
-(1) a restricted class is specified when the pseudo is created
-
-    This happens for input address reloads, where the class is taken
-    from the target's chosen base register class.  It also happens
-    for simple REG reloads, where the class is taken from the chosen
-    alternative's constraints.
-
-(2) uses of the reload pseudo as a direct input operand
-
-    In this case get_reload_reg tries to reuse the existing register
-    and narrow its class, instead of creating a new reload pseudo.
-
-However, neither occurs here.  As described above, r287 rightly
-starts out with a wide choice of class, ultimately derived from
-ALL_REGS, so we don't get (1).  And as the comments in the PR
-explain, r287 is never used as an input reload, only the subreg is,
-so we don't get (2):
-
-----------------------------------------------------------------------------
-         Choosing alt 13 in insn 317:  (0) r  (1) w {*movsi_aarch64}
-      Creating newreg=291, assigning class FP_REGS to r291
-  317: r288:SI=r291:SI
-    Inserting insn reload before:
-  320: r291:SI=r287:DI#0
-----------------------------------------------------------------------------
-
-IMO, in this case we should rely on the reload of r316 to narrow
-down the class of r278.  Currently we do:
-
-----------------------------------------------------------------------------
-         Choosing alt 7 in insn 316:  (0) r  (1) m {*movdi_aarch64}
-      Creating newreg=289 from oldreg=287, assigning class GENERAL_REGS to r289
-  316: r289:DI=[r105:DI*0x8+r140:DI]
-    Inserting insn reload after:
-  318: r287:DI=r289:DI
----------------------------------------------------
-
-i.e. we create a new pseudo register r289 and give *that* pseudo
-GENERAL_REGS instead.  This is because get_reload_reg only narrows
-down the existing class for OP_IN and OP_INOUT, not OP_OUT.
-
-But if we have a reload pseudo in a reload instruction and have chosen
-a specific class for the reload pseudo, I think we should simply install
-it for OP_OUT reloads too, if the class is a subset of the existing class.
-We will need to pick such a register whatever happens (for r289 in the
-example above).  And as explained in the PR, doing this actually avoids
-an unnecessary move via the FP registers too.
-
-The patch is quite aggressive in that it does this for all reload
-pseudos in all reload instructions.  I wondered about reusing the
-condition for a reload move in in_class_p:
-
-          INSN_UID (curr_insn) >= new_insn_uid_start
-          && curr_insn_set != NULL
-          && ((OBJECT_P (SET_SRC (curr_insn_set))
-               && ! CONSTANT_P (SET_SRC (curr_insn_set)))
-              || (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG
-                  && OBJECT_P (SUBREG_REG (SET_SRC (curr_insn_set)))
-                  && ! CONSTANT_P (SUBREG_REG (SET_SRC (curr_insn_set)))))))
-
-but I can't really justify that on first principles.  I think we
-should apply the rule consistently until we have a specific reason
-for doing otherwise.
-
-gcc/
-	PR rtl-optimization/96796
-	* lra-constraints.c (in_class_p): Add a default-false
-	allow_all_reload_class_changes_p parameter.  Do not treat
-	reload moves specially when the parameter is true.
-	(get_reload_reg): Try to narrow the class of an existing OP_OUT
-	reload if we're reloading a reload pseudo in a reload instruction.
-
-gcc/testsuite/
-	PR rtl-optimization/96796
-	* gcc.c-torture/compile/pr96796.c: New test.
----
- gcc/lra-constraints.c                         | 54 ++++++++++++++----
- gcc/testsuite/gcc.c-torture/compile/pr96796.c | 55 +++++++++++++++++++
- 2 files changed, 99 insertions(+), 10 deletions(-)
- create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr96796.c
-
-diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
-index 580da9c3ed6..161b721efb1 100644
---- a/gcc/lra-constraints.c
-+++ b/gcc/lra-constraints.c
-@@ -236,12 +236,17 @@ get_reg_class (int regno)
-    CL.  Use elimination first if REG is a hard register.  If REG is a
-    reload pseudo created by this constraints pass, assume that it will
-    be allocated a hard register from its allocno class, but allow that
--   class to be narrowed to CL if it is currently a superset of CL.
-+   class to be narrowed to CL if it is currently a superset of CL and
-+   if either:
-+
-+   - ALLOW_ALL_RELOAD_CLASS_CHANGES_P is true or
-+   - the instruction we're processing is not a reload move.
- 
-    If NEW_CLASS is nonnull, set *NEW_CLASS to the new allocno class of
-    REGNO (reg), or NO_REGS if no change in its class was needed.  */
- static bool
--in_class_p (rtx reg, enum reg_class cl, enum reg_class *new_class)
-+in_class_p (rtx reg, enum reg_class cl, enum reg_class *new_class,
-+	    bool allow_all_reload_class_changes_p = false)
- {
-   enum reg_class rclass, common_class;
-   machine_mode reg_mode;
-@@ -266,7 +271,8 @@ in_class_p (rtx reg, enum reg_class cl, enum reg_class *new_class)
- 	 typically moves that have many alternatives, and restricting
- 	 reload pseudos for one alternative may lead to situations
- 	 where other reload pseudos are no longer allocatable.  */
--      || (INSN_UID (curr_insn) >= new_insn_uid_start
-+      || (!allow_all_reload_class_changes_p
-+	  && INSN_UID (curr_insn) >= new_insn_uid_start
- 	  && curr_insn_set != NULL
- 	  && ((OBJECT_P (SET_SRC (curr_insn_set))
- 	       && ! CONSTANT_P (SET_SRC (curr_insn_set)))
-@@ -598,13 +604,12 @@ canonicalize_reload_addr (rtx addr)
-   return addr;
- }
- 
--/* Create a new pseudo using MODE, RCLASS, ORIGINAL or reuse already
--   created input reload pseudo (only if TYPE is not OP_OUT).  Don't
--   reuse pseudo if IN_SUBREG_P is true and the reused pseudo should be
--   wrapped up in SUBREG.  The result pseudo is returned through
--   RESULT_REG.  Return TRUE if we created a new pseudo, FALSE if we
--   reused the already created input reload pseudo.  Use TITLE to
--   describe new registers for debug purposes.  */
-+/* Create a new pseudo using MODE, RCLASS, ORIGINAL or reuse an existing
-+   reload pseudo.  Don't reuse an existing reload pseudo if IN_SUBREG_P
-+   is true and the reused pseudo should be wrapped up in a SUBREG.
-+   The result pseudo is returned through RESULT_REG.  Return TRUE if we
-+   created a new pseudo, FALSE if we reused an existing reload pseudo.
-+   Use TITLE to describe new registers for debug purposes.  */
- static bool
- get_reload_reg (enum op_type type, machine_mode mode, rtx original,
- 		enum reg_class rclass, bool in_subreg_p,
-@@ -616,6 +621,35 @@ get_reload_reg (enum op_type type, machine_mode mode, rtx original,
- 
-   if (type == OP_OUT)
-     {
-+      /* Output reload registers tend to start out with a conservative
-+	 choice of register class.  Usually this is ALL_REGS, although
-+	 a target might narrow it (for performance reasons) through
-+	 targetm.preferred_reload_class.  It's therefore quite common
-+	 for a reload instruction to require a more restrictive class
-+	 than the class that was originally assigned to the reload register.
-+
-+	 In these situations, it's more efficient to refine the choice
-+	 of register class rather than create a second reload register.
-+	 This also helps to avoid cycling for registers that are only
-+	 used by reload instructions.  */
-+      if (REG_P (original)
-+	  && (int) REGNO (original) >= new_regno_start
-+	  && INSN_UID (curr_insn) >= new_insn_uid_start
-+	  && in_class_p (original, rclass, &new_class, true))
-+	{
-+	  unsigned int regno = REGNO (original);
-+	  if (lra_dump_file != NULL)
-+	    {
-+	      fprintf (lra_dump_file, "	 Reuse r%d for output ", regno);
-+	      dump_value_slim (lra_dump_file, original, 1);
-+	    }
-+	  if (new_class != lra_get_allocno_class (regno))
-+	    lra_change_class (regno, new_class, ", change to", false);
-+	  if (lra_dump_file != NULL)
-+	    fprintf (lra_dump_file, "\n");
-+	  *result_reg = original;
-+	  return false;
-+	}
-       *result_reg
- 	= lra_create_new_reg_with_unique_value (mode, original, rclass, title);
-       return true;
-diff --git a/gcc/testsuite/gcc.c-torture/compile/pr96796.c b/gcc/testsuite/gcc.c-torture/compile/pr96796.c
-new file mode 100644
-index 00000000000..8808e62fe77
---- /dev/null
-+++ b/gcc/testsuite/gcc.c-torture/compile/pr96796.c
-@@ -0,0 +1,55 @@
-+/* { dg-additional-options "-fcommon" } */
-+
-+struct S0 {
-+  signed f0 : 8;
-+  unsigned f1;
-+  unsigned f4;
-+};
-+struct S1 {
-+  long f3;
-+  char f4;
-+} g_3_4;
-+
-+int g_5, func_1_l_32, func_50___trans_tmp_31;
-+static struct S0 g_144, g_834, g_1255, g_1261;
-+
-+int g_273[120] = {};
-+int *g_555;
-+char **g_979;
-+static int g_1092_0;
-+static int g_1193;
-+int safe_mul_func_int16_t_s_s(int si1, int si2) { return si1 * si2; }
-+static struct S0 *func_50();
-+int func_1() { func_50(g_3_4, g_5, func_1_l_32, 8, 3); }
-+void safe_div_func_int64_t_s_s(int *);
-+void safe_mod_func_uint32_t_u_u(struct S0);
-+struct S0 *func_50(int p_51, struct S0 p_52, struct S1 p_53, int p_54,
-+                   int p_55) {
-+  int __trans_tmp_30;
-+  char __trans_tmp_22;
-+  short __trans_tmp_19;
-+  long l_985_1;
-+  long l_1191[8];
-+  safe_div_func_int64_t_s_s(g_273);
-+  __builtin_printf((char*)g_1261.f4);
-+  safe_mod_func_uint32_t_u_u(g_834);
-+  g_144.f0 += 1;
-+  for (;;) {
-+    struct S1 l_1350 = {&l_1350};
-+    for (; p_53.f3; p_53.f3 -= 1)
-+      for (; g_1193 <= 2; g_1193 += 1) {
-+        __trans_tmp_19 = safe_mul_func_int16_t_s_s(l_1191[l_985_1 + p_53.f3],
-+                                                   p_55 % (**g_979 = 10));
-+        __trans_tmp_22 = g_1255.f1 * p_53.f4;
-+        __trans_tmp_30 = __trans_tmp_19 + __trans_tmp_22;
-+        if (__trans_tmp_30)
-+          g_1261.f0 = p_51;
-+        else {
-+          g_1255.f0 = p_53.f3;
-+          int *l_1422 = g_834.f0 = g_144.f4 != (*l_1422)++ > 0 < 0 ^ 51;
-+          g_555 = ~0;
-+          g_1092_0 |= func_50___trans_tmp_31;
-+        }
-+      }
-+  }
-+}
--- 
-2.18.4
-
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/9/gcc9-asan-glibc-2.34.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/9/gcc9-asan-glibc-2.34.patch
deleted file mode 100644
index 1aea1f9b18a1..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/9/gcc9-asan-glibc-2.34.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 3d0135bf3be416bbe2531dc763d19b749eb2b856 Mon Sep 17 00:00:00 2001
-From: Jakub Jelinek <jakub@redhat.com>
-Date: Sat, 17 Apr 2021 11:27:14 +0200
-Subject: [PATCH] sanitizer: Fix asan against glibc 2.34 [PR100114]
-
-As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in
-glibc 2.34 and later, so
-static const uptr kAltStackSize = SIGSTKSZ * 4;
-needs dynamic initialization, but is used by a function called indirectly
-from .preinit_array and therefore before the variable is constructed.
-This results in using 0 size instead and all asan instrumented programs
-die with:
-==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
-
-Here is a cherry-pick from upstream to fix this.
-
-2021-04-17  Jakub Jelinek  <jakub@redhat.com>
-
-	PR sanitizer/100114
-	* sanitizer_common/sanitizer_posix_libcdep.cc: Cherry-pick
-	llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe
-	and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023.
-
-(cherry picked from commit 950bac27d63c1c2ac3a6ed867692d6a13f21feb3)
----
- .../sanitizer_common/sanitizer_posix_libcdep.cc     | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc
-index d2fd76a6d36..1917e29ced2 100644
---- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc
-+++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc
-@@ -169,7 +169,11 @@ bool SupportsColoredOutput(fd_t fd) {
- 
- #if !SANITIZER_GO
- // TODO(glider): different tools may require different altstack size.
--static const uptr kAltStackSize = SIGSTKSZ * 4;  // SIGSTKSZ is not enough.
-+static uptr GetAltStackSize() {
-+  // SIGSTKSZ is not enough.
-+  static const uptr kAltStackSize = SIGSTKSZ * 4;
-+  return kAltStackSize;
-+}
- 
- void SetAlternateSignalStack() {
-   stack_t altstack, oldstack;
-@@ -180,10 +184,9 @@ void SetAlternateSignalStack() {
-   // TODO(glider): the mapped stack should have the MAP_STACK flag in the
-   // future. It is not required by man 2 sigaltstack now (they're using
-   // malloc()).
--  void* base = MmapOrDie(kAltStackSize, __func__);
--  altstack.ss_sp = (char*) base;
-+  altstack.ss_size = GetAltStackSize();
-+  altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__);
-   altstack.ss_flags = 0;
--  altstack.ss_size = kAltStackSize;
-   CHECK_EQ(0, sigaltstack(&altstack, nullptr));
- }
- 
-@@ -191,7 +194,7 @@ void UnsetAlternateSignalStack() {
-   stack_t altstack, oldstack;
-   altstack.ss_sp = nullptr;
-   altstack.ss_flags = SS_DISABLE;
--  altstack.ss_size = kAltStackSize;  // Some sane value required on Darwin.
-+  altstack.ss_size = GetAltStackSize();  // Some sane value required on Darwin.
-   CHECK_EQ(0, sigaltstack(&altstack, &oldstack));
-   UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
- }
--- 
-2.27.0
-
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/default.nix b/nixpkgs/pkgs/development/compilers/gcc/patches/default.nix
index 32938be376d9..55636b8ab51c 100644
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gcc/patches/default.nix
@@ -215,6 +215,11 @@ in
 # which is not supported by the clang integrated assembler used by default on Darwin.
 ++ optional (is8 && hostPlatform.isDarwin) ./8/gcc8-darwin-as-gstabs.patch
 
+# Make avr-gcc8 build on aarch64-darwin
+# avr-gcc8 is maintained for the `qmk` package
+# https://github.com/osx-cross/homebrew-avr/blob/main/Formula/avr-gcc%408.rb#L69
+++ optional (is8 && targetPlatform.isAvr && hostPlatform.isDarwin && hostPlatform.isAarch64) ./8/avr-gcc-8-darwin.patch
+
 
 ## gcc 7.0 and older ##############################################################################
 
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades.patch
deleted file mode 100644
index e2155cd0c982..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=2bf34b9f4e446bf9be7f04458058dd5319fb396e
-https://gcc.gnu.org/PR100379 
---- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-@@ -366,15 +366,6 @@ static void ioctl_table_fill() {
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
--  _(CYGETDEFTHRESH, WRITE, sizeof(int));
--  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
--  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
--  _(CYGETTHRESH, WRITE, sizeof(int));
--  _(CYGETTIMEOUT, WRITE, sizeof(int));
--  _(CYSETDEFTHRESH, NONE, 0);
--  _(CYSETDEFTIMEOUT, NONE, 0);
--  _(CYSETTHRESH, NONE, 0);
--  _(CYSETTIMEOUT, NONE, 0);
-   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
-   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
-   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -130,7 +130,6 @@ typedef struct user_fpregs elf_fpregset_t;
- # include <sys/procfs.h>
- #endif
- #include <sys/user.h>
--#include <linux/cyclades.h>
- #include <linux/if_eql.h>
- #include <linux/if_plip.h>
- #include <linux/lp.h>
-@@ -443,7 +442,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
--  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
- #if EV_VERSION > (0x010000)
-   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
- #else
-@@ -809,15 +807,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
- #endif // SANITIZER_LINUX
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
--  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
--  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
--  unsigned IOCTL_CYGETMON = CYGETMON;
--  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
--  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
--  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
--  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
--  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
--  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
-   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
-   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
-   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
-+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
-@@ -974,7 +974,6 @@ extern unsigned struct_vt_mode_sz;
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_ax25_parms_struct_sz;
--extern unsigned struct_cyclades_monitor_sz;
- extern unsigned struct_input_keymap_entry_sz;
- extern unsigned struct_ipx_config_data_sz;
- extern unsigned struct_kbdiacrs_sz;
-@@ -1319,15 +1318,6 @@ extern unsigned IOCTL_VT_WAITACTIVE;
- #endif  // SANITIZER_LINUX
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
--extern unsigned IOCTL_CYGETDEFTHRESH;
--extern unsigned IOCTL_CYGETDEFTIMEOUT;
--extern unsigned IOCTL_CYGETMON;
--extern unsigned IOCTL_CYGETTHRESH;
--extern unsigned IOCTL_CYGETTIMEOUT;
--extern unsigned IOCTL_CYSETDEFTHRESH;
--extern unsigned IOCTL_CYSETDEFTIMEOUT;
--extern unsigned IOCTL_CYSETTHRESH;
--extern unsigned IOCTL_CYSETTIMEOUT;
- extern unsigned IOCTL_EQL_EMANCIPATE;
- extern unsigned IOCTL_EQL_ENSLAVE;
- extern unsigned IOCTL_EQL_GETMASTRCFG;
--- 
-2.33.0
-
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-sigaltstack.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/struct-sigaltstack.patch
deleted file mode 100644
index 6e1ddb252c24..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-sigaltstack.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 72edc2c02f8b4768ad660f46a1c7e2400c0a8e06 Mon Sep 17 00:00:00 2001
-From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Mon, 17 Jul 2017 19:41:08 +0000
-Subject: [PATCH] 	Backported from mainline 	2017-07-14  Jakub
- Jelinek  <jakub@redhat.com>
-
-	PR sanitizer/81066
-	* sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
-	* sanitizer_common/sanitizer_linux.cc: Likewise.
-	* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
-	* tsan/tsan_platform_linux.cc: Likewise.
-
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250287 138bc75d-0d04-0410-961f-82ee72b054a4
----
- libsanitizer/ChangeLog  (REMOVED)                             | 11 +++++++++++
- libsanitizer/sanitizer_common/sanitizer_linux.cc              |  3 +--
- libsanitizer/sanitizer_common/sanitizer_linux.h               |  4 +---
- .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc  |  2 +-
- libsanitizer/tsan/tsan_platform_linux.cc                      |  2 +-
- 5 files changed, 15 insertions(+), 7 deletions(-)
-
-diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
-index 806fcd5..5b6f186 100644
---- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
-+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
-@@ -605,8 +605,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
- }
- #endif
- 
--uptr internal_sigaltstack(const struct sigaltstack *ss,
--                         struct sigaltstack *oss) {
-+uptr internal_sigaltstack(const void *ss, void *oss) {
-   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
- }
- 
-diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
-index 895bfc1..a42df57 100644
---- a/libsanitizer/sanitizer_common/sanitizer_linux.h
-+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
-@@ -19,7 +19,6 @@
- #include "sanitizer_platform_limits_posix.h"
- 
- struct link_map;  // Opaque type returned by dlopen().
--struct sigaltstack;
- 
- namespace __sanitizer {
- // Dirent structure for getdents(). Note that this structure is different from
-@@ -28,8 +27,7 @@ struct linux_dirent;
- 
- // Syscall wrappers.
- uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
--uptr internal_sigaltstack(const struct sigaltstack* ss,
--                          struct sigaltstack* oss);
-+uptr internal_sigaltstack(const void* ss, void* oss);
- uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
-     __sanitizer_sigset_t *oldset);
- 
-diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-index 891386dc..234e8c6 100644
---- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
-@@ -273,7 +273,7 @@ static int TracerThread(void* argument) {
- 
-   // Alternate stack for signal handling.
-   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
--  struct sigaltstack handler_stack;
-+  stack_t handler_stack;
-   internal_memset(&handler_stack, 0, sizeof(handler_stack));
-   handler_stack.ss_sp = handler_stack_memory.data();
-   handler_stack.ss_size = kHandlerStackSize;
-diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
-index 2ed5718..6f972ab 100644
---- a/libsanitizer/tsan/tsan_platform_linux.cc
-+++ b/libsanitizer/tsan/tsan_platform_linux.cc
-@@ -287,7 +287,7 @@ void InitializePlatform() {
- int ExtractResolvFDs(void *state, int *fds, int nfd) {
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-   int cnt = 0;
--  __res_state *statp = (__res_state*)state;
-+  struct __res_state *statp = (struct __res_state*)state;
-   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
-     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
-       fds[cnt++] = statp->_u._ext.nssocks[i];
--- 
-2.9.3
-
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-4.5.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-4.5.patch
deleted file mode 100644
index a84e9ffe2681..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-4.5.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Trivally backported the upstream commit
-b685411208e0aaa79190d54faf945763514706b8
-(different directory, some files not present, etc.)
-We only really use x86* from those, probably, so I didn't bother much.
-diff --git a/gcc/config/alpha/linux-unwind.h b/gcc/config/alpha/linux-unwind.h
-index bdbba4a..e84812e 100644
---- a/gcc/config/alpha/linux-unwind.h
-+++ b/gcc/config/alpha/linux-unwind.h
-@@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwind_Context *context,
-     {
-       struct rt_sigframe {
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       sc = &rt_->uc.uc_mcontext;
-     }
-diff --git a/gcc/config/bfin/linux-unwind.h b/gcc/config/bfin/linux-unwind.h
-index 77b7c23..8bf5e82 100644
---- a/gcc/config/bfin/linux-unwind.h
-+++ b/gcc/config/bfin/linux-unwind.h
-@@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwind_Context *context,
- 	void *puc;
- 	char retcode[8];
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
- 
-       /* The void * cast is necessary to avoid an aliasing warning.
-diff --git a/gcc/config/i386/linux-unwind.h b/gcc/config/i386/linux-unwind.h
-index 540a0a2..29efbe3 100644
---- a/gcc/config/i386/linux-unwind.h
-+++ b/gcc/config/i386/linux-unwind.h
-@@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
-   if (*(unsigned char *)(pc+0) == 0x48
-       && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
-     {
--      struct ucontext *uc_ = context->cfa;
-+      ucontext_t *uc_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
-          because it does not alias anything.  */
-@@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind_Context *context,
- 	siginfo_t *pinfo;
- 	void *puc;
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
-diff --git a/gcc/config/m68k/linux-unwind.h b/gcc/config/m68k/linux-unwind.h
-index 75b7cf7..f964e24 100644
---- a/gcc/config/m68k/linux-unwind.h
-+++ b/gcc/config/m68k/linux-unwind.h
-@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
- /* <sys/ucontext.h> is unfortunately broken right now.  */
- struct uw_ucontext {
- 	unsigned long	  uc_flags;
--	struct ucontext  *uc_link;
-+	ucontext_t	 *uc_link;
- 	stack_t		  uc_stack;
- 	mcontext_t	  uc_mcontext;
- 	unsigned long	  uc_filler[80];
-diff --git a/gcc/config/pa/linux-unwind.h b/gcc/config/pa/linux-unwind.h
-index 9a2657f..e47493d 100644
---- a/gcc/config/pa/linux-unwind.h
-+++ b/gcc/config/pa/linux-unwind.h
-@@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwind_Context *context,
-   struct sigcontext *sc;
-   struct rt_sigframe {
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   } *frame;
- 
-   /* rt_sigreturn trampoline:
-diff --git a/gcc/config/sh/linux-unwind.h b/gcc/config/sh/linux-unwind.h
-index e389cac..0bf43ba 100644
---- a/gcc/config/sh/linux-unwind.h
-+++ b/gcc/config/sh/linux-unwind.h
-@@ -180,7 +180,7 @@ sh_fallback_frame_state (struct _Unwind_Context *context,
-     {
-       struct rt_sigframe {
- 	siginfo_t info;
--	struct ucontext uc;
-+	ucontext_t uc;
-       } *rt_ = context->cfa;
-       /* The void * cast is necessary to avoid an aliasing warning.
-          The aliasing warning is correct, but should not be a problem
-diff --git a/gcc/config/xtensa/linux-unwind.h b/gcc/config/xtensa/linux-unwind.h
-index 9872492..586a9d4 100644
---- a/gcc/config/xtensa/linux-unwind.h
-+++ b/gcc/config/xtensa/linux-unwind.h
-@@ -67,7 +67,7 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context,
- 
-   struct rt_sigframe {
-     siginfo_t info;
--    struct ucontext uc;
-+    ucontext_t uc;
-   } *rt_;
- 
-   /* movi a2, __NR_rt_sigreturn; syscall */
--- 
-2.9.3
-
diff --git a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-libjava.patch b/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-libjava.patch
deleted file mode 100644
index 3892a56954e0..000000000000
--- a/nixpkgs/pkgs/development/compilers/gcc/patches/struct-ucontext-libjava.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- a/libjava/include/x86_64-signal.h
-+++ a/libjava/include/x86_64-signal.h
-@@ -28,7 +28,7 @@
- #define HANDLE_DIVIDE_OVERFLOW						\
- do									\
- {									\
--  struct ucontext *_uc = (struct ucontext *)_p;				\
-+  ucontext_t *_uc = (ucontext_t *)_p;					\
-   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
-   unsigned char *_rip = (unsigned char *)_gregs[REG_RIP];		\
- 									\
---- a/libjava/include/i386-signal.h
-+++ a/libjava/include/i386-signal.h
-@@ -29,7 +29,7 @@
- #define HANDLE_DIVIDE_OVERFLOW						\
- do									\
- {									\
--  struct ucontext *_uc = (struct ucontext *)_p;				\
-+  ucontext_t *_uc = (ucontext_t *)_p;					\
-   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
-   unsigned char *_eip = (unsigned char *)_gregs[REG_EIP];		\
- 									\
---- a/libjava/include/s390-signal.h
-+++ a/libjava/include/s390-signal.h
-@@ -51,7 +51,7 @@
-   struct                                                                \
-   {                                                                     \
-     unsigned long int uc_flags;                                         \
--    struct ucontext *uc_link;                                           \
-+    ucontext_t *uc_link;                                                \
-     stack_t uc_stack;                                                   \
-     mcontext_t uc_mcontext;                                             \
-     unsigned long sigmask[2];                                           \