about summary refs log tree commit diff
path: root/pkgs/development/tools/misc
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/misc')
-rw-r--r--pkgs/development/tools/misc/acr/default.nix33
-rw-r--r--pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch137
-rw-r--r--pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch47
-rw-r--r--pkgs/development/tools/misc/binutils/CVE-2020-35448.patch77
-rw-r--r--pkgs/development/tools/misc/binutils/CVE-2021-3487.patch73
-rw-r--r--pkgs/development/tools/misc/binutils/CVE-2021-45078.patch239
-rw-r--r--pkgs/development/tools/misc/binutils/bfd-elf-Dont-read-non-existing-secondary-relocs.patch26
-rw-r--r--pkgs/development/tools/misc/binutils/build-components-separately.patch67
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix216
-rw-r--r--pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch23
-rw-r--r--pkgs/development/tools/misc/binutils/gold-Update-GNU_PROPERTY_X86_XXX-macros.patch292
-rw-r--r--pkgs/development/tools/misc/binutils/mips64-default-n64.patch82
-rw-r--r--pkgs/development/tools/misc/blackfire/default.nix94
-rw-r--r--pkgs/development/tools/misc/circleci-cli/default.nix4
-rw-r--r--pkgs/development/tools/misc/clojure-lsp/default.nix6
-rw-r--r--pkgs/development/tools/misc/devspace/default.nix37
-rw-r--r--pkgs/development/tools/misc/gef/default.nix8
-rw-r--r--pkgs/development/tools/misc/go-license-detector/default.nix15
-rw-r--r--pkgs/development/tools/misc/grcov/default.nix6
-rw-r--r--pkgs/development/tools/misc/libtool/libtool2-macos11.patch32
-rw-r--r--pkgs/development/tools/misc/libtool/libtool2.nix26
-rw-r--r--pkgs/development/tools/misc/nix-bisect/default.nix44
-rw-r--r--pkgs/development/tools/misc/nxpmicro-mfgtools/default.nix1
-rw-r--r--pkgs/development/tools/misc/patchelf/0.13.nix23
-rw-r--r--pkgs/development/tools/misc/patchelf/default.nix6
-rw-r--r--pkgs/development/tools/misc/patchelf/unstable.nix14
-rw-r--r--pkgs/development/tools/misc/pkgconf/default.nix45
-rw-r--r--pkgs/development/tools/misc/saleae-logic-2/default.nix6
-rw-r--r--pkgs/development/tools/misc/sccache/default.nix3
-rw-r--r--pkgs/development/tools/misc/semver-tool/default.nix1
-rw-r--r--pkgs/development/tools/misc/texinfo/6.8.nix4
-rw-r--r--pkgs/development/tools/misc/texinfo/common.nix4
-rw-r--r--pkgs/development/tools/misc/texinfo/fix-glibc-2.34.patch186
33 files changed, 897 insertions, 980 deletions
diff --git a/pkgs/development/tools/misc/acr/default.nix b/pkgs/development/tools/misc/acr/default.nix
new file mode 100644
index 0000000000000..47a980caddfb9
--- /dev/null
+++ b/pkgs/development/tools/misc/acr/default.nix
@@ -0,0 +1,33 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "acr";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "radareorg";
+    repo = "acr";
+    rev = version;
+    hash = "sha256-ma4KhwGFlLCfRQvQ11OdyovgGbKQUBo6qVRrE7V2pNo=";
+  };
+
+  preConfigure = ''
+    chmod +x ./autogen.sh && ./autogen.sh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/radareorg/acr/";
+    description = "Pure shell autoconf replacement";
+    longDescription = ''
+      ACR tries to replace autoconf functionality generating a full-compatible
+      'configure' script (runtime flags). But using shell-script instead of
+      m4. This means that ACR is faster, smaller and easy to use.
+    '';
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = with platforms; all;
+  };
+}
diff --git a/pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch b/pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
new file mode 100644
index 0000000000000..f9c6e88d97b45
--- /dev/null
+++ b/pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
@@ -0,0 +1,137 @@
+From beca4a2c25ee86e4020f8b8bddc4d8e0ed3430b3 Mon Sep 17 00:00:00 2001
+From: Andrew Childs <andrew.childs@bibo.com.ph>
+Date: Tue, 22 Feb 2022 11:28:04 +0900
+Subject: [PATCH] Revert "libtool.m4: fix nm BSD flag detection"
+
+This reverts commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7.
+---
+ ChangeLog  |  9 ------
+ libtool.m4 | 88 ++++++++++++++++++++++++++----------------------------
+ 2 files changed, 43 insertions(+), 54 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 18e8b6835da..c12f07403c3 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -375,15 +375,6 @@
+ 
+ 	* src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace.
+ 
+-2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
+-
+-	PR libctf/27967
+-	* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
+-	NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
+-	errors from nms that refuse to work on non-regular files.  Remove
+-	other workarounds for this problem.  Strip out blank lines from the
+-	nm output.
+-
+ 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
+ 
+ 	PR libctf/27967
+diff --git a/libtool.m4 b/libtool.m4
+index a216bb14e99..7a711249304 100644
+--- a/libtool.m4
++++ b/libtool.m4
+@@ -3200,55 +3200,53 @@ _LT_DECL([], [file_magic_cmd], [1],
+ 
+ # LT_PATH_NM
+ # ----------
+-# find the pathname to a BSD- or MS-compatible name lister, and any flags
+-# needed to make it compatible
++# find the pathname to a BSD- or MS-compatible name lister
+ AC_DEFUN([LT_PATH_NM],
+ [AC_REQUIRE([AC_PROG_CC])dnl
+ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+ [if test -n "$NM"; then
+-   # Let the user override the nm to test.
+-   lt_nm_to_check="$NM"
+- else
+-   lt_nm_to_check="${ac_tool_prefix}nm"
+-   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+-     lt_nm_to_check="$lt_nm_to_check nm"
+-   fi
+- fi
+- for lt_tmp_nm in $lt_nm_to_check; do
+-   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+-   for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+-     IFS="$lt_save_ifs"
+-     test -z "$ac_dir" && ac_dir=.
+-     case "$lt_tmp_nm" in
+-     */*|*\\*) tmp_nm="$lt_tmp_nm";;
+-     *) tmp_nm="$ac_dir/$lt_tmp_nm";;
+-     esac
+-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+-       # Check to see if the nm accepts a BSD-compat flag.
+-       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+-       #   nm: unknown option "B" ignored
+-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+-       *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
+-	 break
+-	 ;;
+-       *)
+-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+-	 *$tmp_nm*)
+-	   lt_cv_path_NM="$tmp_nm -p"
+-	   break
+-	   ;;
+-	 *)
+-	   lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+-	   continue # so that we can try to find one that supports BSD flags
+-	   ;;
+-	 esac
+-	 ;;
+-       esac
+-     fi
+-   done
+-   IFS="$lt_save_ifs"
+- done
+- : ${lt_cv_path_NM=no}])
++  # Let the user override the test.
++  lt_cv_path_NM="$NM"
++else
++  lt_nm_to_check="${ac_tool_prefix}nm"
++  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
++    lt_nm_to_check="$lt_nm_to_check nm"
++  fi
++  for lt_tmp_nm in $lt_nm_to_check; do
++    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
++    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
++      IFS="$lt_save_ifs"
++      test -z "$ac_dir" && ac_dir=.
++      tmp_nm="$ac_dir/$lt_tmp_nm"
++      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
++	# Check to see if the nm accepts a BSD-compat flag.
++	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
++	#   nm: unknown option "B" ignored
++	# Tru64's nm complains that /dev/null is an invalid object file
++	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
++	*/dev/null* | *'Invalid file or object type'*)
++	  lt_cv_path_NM="$tmp_nm -B"
++	  break
++	  ;;
++	*)
++	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
++	  */dev/null*)
++	    lt_cv_path_NM="$tmp_nm -p"
++	    break
++	    ;;
++	  *)
++	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
++	    continue # so that we can try to find one that supports BSD flags
++	    ;;
++	  esac
++	  ;;
++	esac
++      fi
++    done
++    IFS="$lt_save_ifs"
++  done
++  : ${lt_cv_path_NM=no}
++fi])
+ if test "$lt_cv_path_NM" != "no"; then
+   NM="$lt_cv_path_NM"
+ else
+-- 
+2.34.1
+
diff --git a/pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch b/pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch
new file mode 100644
index 0000000000000..e601be3a33082
--- /dev/null
+++ b/pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch
@@ -0,0 +1,47 @@
+From 33a8dc728eb5da3e1d3439c96810d1f6b2660b89 Mon Sep 17 00:00:00 2001
+From: Andrew Childs <andrew.childs@bibo.com.ph>
+Date: Tue, 22 Feb 2022 12:24:46 +0900
+Subject: [PATCH] libtool.m4: update macos version detection block
+
+Includes upstream change
+9e8c882517082fe5755f2524d23efb02f1522490
+---
+ libtool.m4 | 21 ++++++++-------------
+ 1 file changed, 8 insertions(+), 13 deletions(-)
+
+diff --git a/libtool.m4 b/libtool.m4
+index 7a711249304..f452efb4300 100644
+--- a/libtool.m4
++++ b/libtool.m4
+@@ -996,20 +996,15 @@ _LT_EOF
+     ])
+     case $host_os in
+     rhapsody* | darwin1.[[012]])
+-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
++      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
+     darwin1.*)
+-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+-    darwin*) # darwin 5.x on
+-      # if running on 10.5 or later, the deployment target defaults
+-      # to the OS version, if on x86, and 10.4, the deployment
+-      # target defaults to 10.4. Don't you love it?
+-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+-	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+-	10.[[012]][[,.]]*)
+-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+-	10.*)
+-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
++      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
++    darwin*)
++      case $MACOSX_DEPLOYMENT_TARGET,$host in
++        10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
++          _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
++        *)
++          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       esac
+     ;;
+   esac
+-- 
+2.34.1
+
diff --git a/pkgs/development/tools/misc/binutils/CVE-2020-35448.patch b/pkgs/development/tools/misc/binutils/CVE-2020-35448.patch
deleted file mode 100644
index 2eba7b51849f5..0000000000000
--- a/pkgs/development/tools/misc/binutils/CVE-2020-35448.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From 8642dafaef21aa6747cec01df1977e9c52eb4679 Mon Sep 17 00:00:00 2001
-From: Alan Modra <amodra@gmail.com>
-Date: Fri, 4 Sep 2020 19:19:18 +0930
-Subject: [PATCH] PR26574, heap buffer overflow in
- _bfd_elf_slurp_secondary_reloc_section
-
-A horribly fuzzed object with section headers inside the ELF header.
-Disallow that, and crazy reloc sizes.
-
-	PR 26574
-	* elfcode.h (elf_object_p): Sanity check section header offset.
-	* elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check
-	sh_entsize.
----
- bfd/elf.c     | 4 +++-
- bfd/elfcode.h | 8 ++++----
- 3 files changed, 14 insertions(+), 5 deletions(-)
-
-diff --git a/bfd/elf.c b/bfd/elf.c
-index ac2095f787d..5a02f8dc309 100644
---- a/bfd/elf.c
-+++ b/bfd/elf.c
-@@ -12576,7 +12576,9 @@ _bfd_elf_slurp_secondary_reloc_section (bfd *      abfd,
-       Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr;
- 
-       if (hdr->sh_type == SHT_SECONDARY_RELOC
--	  && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
-+	  && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx
-+	  && (hdr->sh_entsize == ebd->s->sizeof_rel
-+	      || hdr->sh_entsize == ebd->s->sizeof_rela))
- 	{
- 	  bfd_byte * native_relocs;
- 	  bfd_byte * native_reloc;
-diff --git a/bfd/elfcode.h b/bfd/elfcode.h
-index 2ed2f135c34..606ff64fd4d 100644
---- a/bfd/elfcode.h
-+++ b/bfd/elfcode.h
-@@ -571,7 +571,7 @@ elf_object_p (bfd *abfd)
- 
-   /* If this is a relocatable file and there is no section header
-      table, then we're hosed.  */
--  if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
-+  if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_type == ET_REL)
-     goto got_wrong_format_error;
- 
-   /* As a simple sanity check, verify that what BFD thinks is the
-@@ -581,7 +581,7 @@ elf_object_p (bfd *abfd)
-     goto got_wrong_format_error;
- 
-   /* Further sanity check.  */
--  if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0)
-+  if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_shnum != 0)
-     goto got_wrong_format_error;
- 
-   ebd = get_elf_backend_data (abfd);
-@@ -618,7 +618,7 @@ elf_object_p (bfd *abfd)
-       && ebd->elf_osabi != ELFOSABI_NONE)
-     goto got_wrong_format_error;
- 
--  if (i_ehdrp->e_shoff != 0)
-+  if (i_ehdrp->e_shoff >= sizeof (x_ehdr))
-     {
-       file_ptr where = (file_ptr) i_ehdrp->e_shoff;
- 
-@@ -819,7 +819,7 @@ elf_object_p (bfd *abfd)
- 	}
-     }
- 
--  if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0)
-+  if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff >= sizeof (x_ehdr))
-     {
-       unsigned int num_sec;
- 
--- 
-2.27.0
-
-
diff --git a/pkgs/development/tools/misc/binutils/CVE-2021-3487.patch b/pkgs/development/tools/misc/binutils/CVE-2021-3487.patch
deleted file mode 100644
index 004271bd45abe..0000000000000
--- a/pkgs/development/tools/misc/binutils/CVE-2021-3487.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From: Nick Clifton <nickc@redhat.com>
-Date: Thu, 26 Nov 2020 17:08:33 +0000 (+0000)
-Subject: Prevent a memory allocation failure when parsing corrupt DWARF debug sections.
-X-Git-Tag: binutils-2_36~485
-X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=647cebce12a6b0a26960220caff96ff38978cf24;hp=239ca5e497dda2c151009d664d500086a5c2173a
-
-Prevent a memory allocation failure when parsing corrupt DWARF debug sections.
-
-	PR 26946
-	* dwarf2.c (read_section): Check for debug sections with excessive
-	sizes.
----
-
-diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
-index 977bf43a6a1..8bbfc81d3e7 100644
---- a/bfd/dwarf2.c
-+++ b/bfd/dwarf2.c
-@@ -531,22 +531,24 @@ read_section (bfd *	      abfd,
- 	      bfd_byte **     section_buffer,
- 	      bfd_size_type * section_size)
- {
--  asection *msec;
-   const char *section_name = sec->uncompressed_name;
-   bfd_byte *contents = *section_buffer;
--  bfd_size_type amt;
- 
-   /* The section may have already been read.  */
-   if (contents == NULL)
-     {
-+      bfd_size_type amt;
-+      asection *msec;
-+      ufile_ptr filesize;
-+
-       msec = bfd_get_section_by_name (abfd, section_name);
--      if (! msec)
-+      if (msec == NULL)
- 	{
- 	  section_name = sec->compressed_name;
- 	  if (section_name != NULL)
- 	    msec = bfd_get_section_by_name (abfd, section_name);
- 	}
--      if (! msec)
-+      if (msec == NULL)
- 	{
- 	  _bfd_error_handler (_("DWARF error: can't find %s section."),
- 			      sec->uncompressed_name);
-@@ -554,12 +556,23 @@ read_section (bfd *	      abfd,
- 	  return FALSE;
- 	}
- 
--      *section_size = msec->rawsize ? msec->rawsize : msec->size;
-+      amt = bfd_get_section_limit_octets (abfd, msec);
-+      filesize = bfd_get_file_size (abfd);
-+      if (amt >= filesize)
-+	{
-+	  /* PR 26946 */
-+	  _bfd_error_handler (_("DWARF error: section %s is larger than its filesize! (0x%lx vs 0x%lx)"),
-+			      section_name, (long) amt, (long) filesize);
-+	  bfd_set_error (bfd_error_bad_value);
-+	  return FALSE;
-+	}
-+      *section_size = amt;
-       /* Paranoia - alloc one extra so that we can make sure a string
- 	 section is NUL terminated.  */
--      amt = *section_size + 1;
-+      amt += 1;
-       if (amt == 0)
- 	{
-+	  /* Paranoia - this should never happen.  */
- 	  bfd_set_error (bfd_error_no_memory);
- 	  return FALSE;
- 	}
-
diff --git a/pkgs/development/tools/misc/binutils/CVE-2021-45078.patch b/pkgs/development/tools/misc/binutils/CVE-2021-45078.patch
deleted file mode 100644
index af1c95fac8066..0000000000000
--- a/pkgs/development/tools/misc/binutils/CVE-2021-45078.patch
+++ /dev/null
@@ -1,239 +0,0 @@
-based on upstream https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=161e87d12167b1e36193385485c1f6ce92f74f02;hp=d5c94731766bf4f276146fd29c1df8eebc2aaf69
-
-adapted by ris to apply to 2.35.2 (simply capitalizing booleans)
-
-diff --git a/binutils/stabs.c b/binutils/stabs.c
-index 274bfb0e7fa..83ee3ea5fa4 100644
---- a/binutils/stabs.c
-+++ b/binutils/stabs.c
-@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *, struct stab_handle *, const int *);
- static bool stab_record_type
-   (void *, struct stab_handle *, const int *, debug_type);
- static debug_type stab_xcoff_builtin_type
--  (void *, struct stab_handle *, int);
-+  (void *, struct stab_handle *, unsigned int);
- static debug_type stab_find_tagged_type
-   (void *, struct stab_handle *, const char *, int, enum debug_type_kind);
- static debug_type *stab_demangle_argtypes
-@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUTE_UNUSED, struct stab_handle *info,
- 
- static debug_type
- stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
--			 int typenum)
-+			 unsigned int typenum)
- {
-   debug_type rettype;
-   const char *name;
- 
--  if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)
-+  typenum = -typenum - 1;
-+  if (typenum >= XCOFF_TYPE_COUNT)
-     {
--      fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum);
-+      fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1);
-       return DEBUG_TYPE_NULL;
-     }
--  if (info->xcoff_types[-typenum] != NULL)
--    return info->xcoff_types[-typenum];
-+  if (info->xcoff_types[typenum] != NULL)
-+    return info->xcoff_types[typenum];
- 
--  switch (-typenum)
-+  switch (typenum)
-     {
--    case 1:
-+    case 0:
-       /* The size of this and all the other types are fixed, defined
- 	 by the debugging format.  */
-       name = "int";
-       rettype = debug_make_int_type (dhandle, 4, FALSE);
-       break;
--    case 2:
-+    case 1:
-       name = "char";
-       rettype = debug_make_int_type (dhandle, 1, FALSE);
-       break;
--    case 3:
-+    case 2:
-       name = "short";
-       rettype = debug_make_int_type (dhandle, 2, FALSE);
-       break;
--    case 4:
-+    case 3:
-       name = "long";
-       rettype = debug_make_int_type (dhandle, 4, FALSE);
-       break;
--    case 5:
-+    case 4:
-       name = "unsigned char";
-       rettype = debug_make_int_type (dhandle, 1, TRUE);
-       break;
--    case 6:
-+    case 5:
-       name = "signed char";
-       rettype = debug_make_int_type (dhandle, 1, FALSE);
-       break;
--    case 7:
-+    case 6:
-       name = "unsigned short";
-       rettype = debug_make_int_type (dhandle, 2, TRUE);
-       break;
--    case 8:
-+    case 7:
-       name = "unsigned int";
-       rettype = debug_make_int_type (dhandle, 4, TRUE);
-       break;
--    case 9:
-+    case 8:
-       name = "unsigned";
-       rettype = debug_make_int_type (dhandle, 4, TRUE);
-       break;
--    case 10:
-+    case 9:
-       name = "unsigned long";
-       rettype = debug_make_int_type (dhandle, 4, TRUE);
-       break;
--    case 11:
-+    case 10:
-       name = "void";
-       rettype = debug_make_void_type (dhandle);
-       break;
--    case 12:
-+    case 11:
-       /* IEEE single precision (32 bit).  */
-       name = "float";
-       rettype = debug_make_float_type (dhandle, 4);
-       break;
--    case 13:
-+    case 12:
-       /* IEEE double precision (64 bit).  */
-       name = "double";
-       rettype = debug_make_float_type (dhandle, 8);
-       break;
--    case 14:
-+    case 13:
-       /* This is an IEEE double on the RS/6000, and different machines
- 	 with different sizes for "long double" should use different
- 	 negative type numbers.  See stabs.texinfo.  */
-       name = "long double";
-       rettype = debug_make_float_type (dhandle, 8);
-       break;
--    case 15:
-+    case 14:
-       name = "integer";
-       rettype = debug_make_int_type (dhandle, 4, FALSE);
-       break;
--    case 16:
-+    case 15:
-       name = "boolean";
-       rettype = debug_make_bool_type (dhandle, 4);
-       break;
--    case 17:
-+    case 16:
-       name = "short real";
-       rettype = debug_make_float_type (dhandle, 4);
-       break;
--    case 18:
-+    case 17:
-       name = "real";
-       rettype = debug_make_float_type (dhandle, 8);
-       break;
--    case 19:
-+    case 18:
-       /* FIXME */
-       name = "stringptr";
-       rettype = NULL;
-       break;
--    case 20:
-+    case 19:
-       /* FIXME */
-       name = "character";
-       rettype = debug_make_int_type (dhandle, 1, TRUE);
-       break;
--    case 21:
-+    case 20:
-       name = "logical*1";
-       rettype = debug_make_bool_type (dhandle, 1);
-       break;
--    case 22:
-+    case 21:
-       name = "logical*2";
-       rettype = debug_make_bool_type (dhandle, 2);
-       break;
--    case 23:
-+    case 22:
-       name = "logical*4";
-       rettype = debug_make_bool_type (dhandle, 4);
-       break;
--    case 24:
-+    case 23:
-       name = "logical";
-       rettype = debug_make_bool_type (dhandle, 4);
-       break;
--    case 25:
-+    case 24:
-       /* Complex type consisting of two IEEE single precision values.  */
-       name = "complex";
-       rettype = debug_make_complex_type (dhandle, 8);
-       break;
--    case 26:
-+    case 25:
-       /* Complex type consisting of two IEEE double precision values.  */
-       name = "double complex";
-       rettype = debug_make_complex_type (dhandle, 16);
-       break;
--    case 27:
-+    case 26:
-       name = "integer*1";
-       rettype = debug_make_int_type (dhandle, 1, FALSE);
-       break;
--    case 28:
-+    case 27:
-       name = "integer*2";
-       rettype = debug_make_int_type (dhandle, 2, FALSE);
-       break;
--    case 29:
-+    case 28:
-       name = "integer*4";
-       rettype = debug_make_int_type (dhandle, 4, FALSE);
-       break;
--    case 30:
-+    case 29:
-       /* FIXME */
-       name = "wchar";
-       rettype = debug_make_int_type (dhandle, 2, FALSE);
-       break;
--    case 31:
-+    case 30:
-       name = "long long";
-       rettype = debug_make_int_type (dhandle, 8, FALSE);
-       break;
--    case 32:
-+    case 31:
-       name = "unsigned long long";
-       rettype = debug_make_int_type (dhandle, 8, TRUE);
-       break;
--    case 33:
-+    case 32:
-       name = "logical*8";
-       rettype = debug_make_bool_type (dhandle, 8);
-       break;
--    case 34:
-+    case 33:
-       name = "integer*8";
-       rettype = debug_make_int_type (dhandle, 8, FALSE);
-       break;
-@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
-     }
- 
-   rettype = debug_name_type (dhandle, name, rettype);
--
--  info->xcoff_types[-typenum] = rettype;
--
-+  info->xcoff_types[typenum] = rettype;
-   return rettype;
- }
- 
--- 
-2.27.0
-
diff --git a/pkgs/development/tools/misc/binutils/bfd-elf-Dont-read-non-existing-secondary-relocs.patch b/pkgs/development/tools/misc/binutils/bfd-elf-Dont-read-non-existing-secondary-relocs.patch
deleted file mode 100644
index c166066c9803c..0000000000000
--- a/pkgs/development/tools/misc/binutils/bfd-elf-Dont-read-non-existing-secondary-relocs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd%2Felf.c;h=af62aadc3d446cd5b1f0201b207c90c22e7809b1;hp=36733e080dd9d9be28b576b246aaf5bd8c8569c7;hb=84fd26d8209e99fc3a432dd0b09b6c053de1ce65;hpb=abe2a28aaa7a2bfd0f3061c72a98eb898976b721
-
-diff --git a/bfd/elf.c b/bfd/elf.c
-index 36733e080dd..af62aadc3d4 100644
---- a/bfd/elf.c
-+++ b/bfd/elf.c
-@@ -2454,6 +2454,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
- 		     "for section %pA found - ignoring"),
- 		   abfd, name, target_sect);
- 	      }
-+	    else
-+	      esdt->has_secondary_relocs = TRUE;
- 	    goto success;
- 	  }
- 
-@@ -12587,6 +12589,9 @@ _bfd_elf_slurp_secondary_reloc_section (bfd *       abfd,
- #endif
-     r_sym = elf32_r_sym;
-   
-+  if (!elf_section_data (sec)->has_secondary_relocs)
-+    return TRUE;
-+
-   /* Discover if there are any secondary reloc sections
-      associated with SEC.  */
-   for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)
-
diff --git a/pkgs/development/tools/misc/binutils/build-components-separately.patch b/pkgs/development/tools/misc/binutils/build-components-separately.patch
index 38fa4934a28a6..0b4162d848803 100644
--- a/pkgs/development/tools/misc/binutils/build-components-separately.patch
+++ b/pkgs/development/tools/misc/binutils/build-components-separately.patch
@@ -1,8 +1,8 @@
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index c5bfbd5d..45ad4c26 100644
+index fec067b2135..377e1f5443f 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
-@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
+@@ -292,30 +292,16 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
  
  LT_LIB_M
  
@@ -21,24 +21,22 @@ index c5bfbd5d..45ad4c26 100644
 -  if test -n "$x"; then
 -    SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
 -  fi
+-fi
 -
+ SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+ 
+-if test "$enable_shared" = "yes"; then
    case "${host}" in
    # More hacks to build DLLs on Windows.
    *-*-cygwin*)
      SHARED_LDFLAGS="-no-undefined"
--    SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
-+    SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32"
-   ;;
- 
-   # Use built-in libintl on macOS, since it is not provided by libc.
-   *-*-darwin*)
--    SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
-+    SHARED_LIBADD="-liberty -lintl"
+-    SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32"
++    SHARED_LIBADD="-liberty $SHARED_LIBADD -lcygwin -lkernel32"
    ;;
    esac
  
 diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
-index 4f06074a..6836c589 100644
+index 0e04b4c05c4..848a02662e7 100644
 --- a/opcodes/Makefile.am
 +++ b/opcodes/Makefile.am
 @@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir)
@@ -50,7 +48,7 @@ index 4f06074a..6836c589 100644
  
  BUILD_LIBS = @BUILD_LIBS@
  BUILD_LIB_DEPS = @BUILD_LIB_DEPS@
-@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@
+@@ -303,7 +303,7 @@ OFILES = @BFD_MACHINES@
  # development.sh is used to determine -Werror default.
  CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
  
@@ -59,10 +57,7 @@ index 4f06074a..6836c589 100644
  
  disassemble.lo: disassemble.c
  if am__fastdepCC
-@@ -322,12 +322,21 @@ libopcodes_la_SOURCES =  dis-buf.c disassemble.c dis-init.c
- # old version of libbfd, or to pick up libbfd for the wrong architecture
- # if host != build. So for building with shared libraries we use a
- # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
+@@ -327,9 +327,18 @@ libopcodes_la_SOURCES =  dis-buf.c disassemble.c dis-init.c
 -libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
 +libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ libtool-soversion
  libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
@@ -84,18 +79,19 @@ index 4f06074a..6836c589 100644
  # the build directory so that we don't have to convert all the
  # programs that use libopcodes.a simultaneously.  This is a hack which
 diff --git a/opcodes/configure.ac b/opcodes/configure.ac
-index 00be9c88..6e589ae4 100644
+index e564f067334..5da62a3d58b 100644
 --- a/opcodes/configure.ac
 +++ b/opcodes/configure.ac
-@@ -86,6 +86,7 @@ AC_PROG_INSTALL
+@@ -98,6 +98,8 @@ BFD_64_BIT
+ AC_SUBST(HDEFINES)
+ AC_PROG_INSTALL
  
- AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h)
- ACX_HEADER_STRING
 +GCC_HEADER_STDINT(bfd_stdint.h)
- 
++
  AC_CHECK_DECLS([basename, stpcpy])
  
-@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
+ # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
+@@ -148,44 +150,21 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
  
  LT_LIB_M
  
@@ -122,7 +118,7 @@ index 00be9c88..6e589ae4 100644
 -SHARED_LIBADD=
 +SHARED_LIBADD=-liberty
  SHARED_DEPENDENCIES=
- if test "$enable_shared" = "yes"; then
+-if test "$enable_shared" = "yes"; then
 -# When building a shared libopcodes, link against the pic version of libiberty
 -# so that apps that use libopcodes won't need libiberty just to satisfy any
 -# libopcodes references.
@@ -131,32 +127,27 @@ index 00be9c88..6e589ae4 100644
  # Note that linking against libbfd as we do here, which is itself linked
  # against libiberty, may not satisfy all the libopcodes libiberty references
  # since libbfd may not pull in the entirety of libiberty.
+ # Also, jam libintl into the right place in all of this: after libiberty,
+ # which uses it, but before -lcygwin, which it uses.
 -changequote(,)dnl
 -  x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
 -changequote([,])dnl
 -  if test -n "$x"; then
 -    SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
 -  fi
--
+-fi
+ 
+ SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+ 
+@@ -193,11 +172,10 @@ if test "$enable_shared" = "yes"; then
    case "${host}" in
      *-*-cygwin*)
        SHARED_LDFLAGS="-no-undefined"
--      SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
-+      SHARED_LIBADD="-lbfd -liberty -lintl -lcygwin"
+-      SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
++      SHARED_LIBADD="-lbfd -liberty $SHARED_LIBADD"
        ;;
--   *-*-darwin*)
--     SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
--     SHARED_DEPENDENCIES="../bfd/libbfd.la"
--     ;;
      *)
--      case "$host_vendor" in
--        hp)
--          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
--	  ;;
--	*)
--          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
--	  ;;
--      esac
+-      SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
 -      SHARED_DEPENDENCIES="../bfd/libbfd.la"
 +      SHARED_LIBADD="-lbfd ${SHARED_LIBADD}"
        ;;
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 8d759457fa111..93b018b0d8b09 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -2,64 +2,78 @@ let
   execFormatIsELF = platform: platform.parsed.kernel.execFormat.name == "elf";
 in
 
-{ stdenv, lib, buildPackages
-, fetchFromGitHub, fetchurl, zlib, autoreconfHook, gettext
-# Enabling all targets increases output size to a multiple.
-, withAllTargets ? false, libbfd, libopcodes
-, enableShared ? !stdenv.hostPlatform.isStatic
-, noSysDirs
-, gold ? execFormatIsELF stdenv.targetPlatform
-, bison ? null
+{ stdenv
+, autoreconfHook
+, autoconf269, automake, libtool
+, bison
+, buildPackages
+, fetchFromGitHub
+, fetchurl
 , flex
-, texinfo
+, gettext
+, lib
+, noSysDirs
 , perl
+, substitute
+, texinfo
+, zlib
+
+, enableGold ? execFormatIsELF stdenv.targetPlatform
+, enableShared ? !stdenv.hostPlatform.isStatic
+  # WARN: Enabling all targets increases output size to a multiple.
+, withAllTargets ? false, libbfd, libopcodes
 }:
 
-# configure silently disables ld.gold if it's unsupported,
-# so we need to make sure that intent matches result ourselves.
-assert gold -> execFormatIsELF stdenv.targetPlatform;
+# WARN: configure silently disables ld.gold if it's unsupported, so we need to
+# make sure that intent matches result ourselves.
+assert enableGold -> execFormatIsELF stdenv.targetPlatform;
 
-# Note: this package is used for bootstrapping fetchurl, and thus
-# cannot use fetchpatch! All mutable patches (generated by GitHub or
-# cgit) that are needed here should be included directly in Nixpkgs as
-# files.
 
 let
-  reuseLibs = enableShared && withAllTargets;
-
-  version = "2.35.2";
-  basename = "binutils";
-  # The targetPrefix prepended to binary names to allow multiple binuntils on the
-  # PATH to both be usable.
-  targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
-                  "${stdenv.targetPlatform.config}-";
-  vc4-binutils-src = fetchFromGitHub {
-    owner = "itszor";
-    repo = "binutils-vc4";
-    rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
-    sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
+  inherit (stdenv) buildPlatform hostPlatform targetPlatform;
+
+  version = "2.38";
+
+  srcs = {
+    normal = fetchurl {
+      url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
+      sha256 = "sha256-Bw7HHPB3pqWOC5WfBaCaNQFTeMLYpR6Q866r/jBZDvg=";
+    };
+    vc4-none = fetchFromGitHub {
+      owner = "itszor";
+      repo = "binutils-vc4";
+      rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
+      sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
+    };
   };
-  # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
-  normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
-    url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2";
-    sha256 = "sha256-z6dkTb7PRZHhNutAfBwdoWV4vSsD8MLorNzroZS7nWE=";
-  });
+
+  #INFO: The targetPrefix prepended to binary names to allow multiple binuntils
+  # on the PATH to both be usable.
+  targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
 in
 
 stdenv.mkDerivation {
-  pname = targetPrefix + basename;
+  pname = targetPrefix + "binutils";
   inherit version;
 
-  src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src;
+  # HACK: Ensure that we preserve source from bootstrap binutils to not rebuild LLVM
+  src = stdenv.__bootPackages.binutils-unwrapped.src
+    or srcs.${targetPlatform.system}
+    or srcs.normal;
 
+  # WARN: this package is used for bootstrapping fetchurl, and thus cannot use
+  # fetchpatch! All mutable patches (generated by GitHub or cgit) that are
+  # needed here should be included directly in Nixpkgs as files.
   patches = [
     # Make binutils output deterministic by default.
     ./deterministic.patch
 
-    # Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and
-    # elf32-littlearm-vxworks in favor of the first.
-    # https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766
-    ./disambiguate-arm-targets.patch
+
+    # Breaks nm BSD flag detection
+    ./0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
+
+    # Required for newer macos versions
+    ./0001-libtool.m4-update-macos-version-detection-block.patch
 
     # For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
     # not clear why this behavior was decided upon but it has the unfortunate
@@ -68,34 +82,24 @@ stdenv.mkDerivation {
     # override this behavior, forcing ld to search DT_RPATH even when
     # cross-compiling.
     ./always-search-rpath.patch
-
-    # Fix quadratic slowdown in `strip` performance.
-    # See #129467 and https://sourceware.org/bugzilla/show_bug.cgi?id=28058
-    # Remove when we're on binutils > 2.36.1.
-    # The patch is downloaded from
-    #     https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd/elf.c;h=af62aadc3d446cd5b1f0201b207c90c22e7809b1;hp=36733e080dd9d9be28b576b246aaf5bd8c8569c7;hb=84fd26d8209e99fc3a432dd0b09b6c053de1ce65;hpb=abe2a28aaa7a2bfd0f3061c72a98eb898976b721
-    # which is the 2.36 backport (using `TRUE` instead of `true` of binutils master commit:
-    #     https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=956ea65cd707707c0f725930214cbc781367a831
-    ./bfd-elf-Dont-read-non-existing-secondary-relocs.patch
-
-    # Fix building plv8’s v8.
-    # https://github.com/NixOS/nixpkgs/issues/134190
-    # Obtained from: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=586e30940e640f67bd55bd72e1d1355a4faf8079
-    ./gold-Update-GNU_PROPERTY_X86_XXX-macros.patch
-
-    ./CVE-2020-35448.patch
-    ./CVE-2021-3487.patch
-    ./CVE-2021-45078.patch
-  ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch
-    ++ # This patch was suggested by Nick Clifton to fix
-       # https://sourceware.org/bugzilla/show_bug.cgi?id=16177
-       # It can be removed when that 7-year-old bug is closed.
-       # This binutils bug causes GHC to emit broken binaries on armv7, and
-       # indeed GHC will refuse to compile with a binutils suffering from it. See
-       # this comment for more information:
-       # https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
-       lib.optional (stdenv.targetPlatform.isAarch32 && stdenv.hostPlatform.system != stdenv.targetPlatform.system) ./R_ARM_COPY.patch
-    ++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch;
+  ]
+  ++ lib.optional targetPlatform.isiOS ./support-ios.patch
+  # This patch was suggested by Nick Clifton to fix
+  # https://sourceware.org/bugzilla/show_bug.cgi?id=16177
+  # It can be removed when that 7-year-old bug is closed.
+  # This binutils bug causes GHC to emit broken binaries on armv7, and indeed
+  # GHC will refuse to compile with a binutils suffering from it. See this
+  # comment for more information:
+  # https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
+  ++ lib.optional (targetPlatform.isAarch32 && hostPlatform.system != targetPlatform.system) ./R_ARM_COPY.patch
+  ++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch
+  ++ lib.optional stdenv.targetPlatform.isMips64n64
+     # this patch is from debian:
+     # https://sources.debian.org/data/main/b/binutils/2.38-3/debian/patches/mips64-default-n64.diff
+     (if stdenv.targetPlatform.isMusl
+      then substitute { src = ./mips64-default-n64.patch; replacements = [ "--replace" "gnuabi64" "muslabi64" ]; }
+      else ./mips64-default-n64.patch)
+  ;
 
   outputs = [ "out" "info" "man" ];
 
@@ -104,14 +108,26 @@ stdenv.mkDerivation {
     bison
     perl
     texinfo
-  ] ++ (lib.optionals stdenv.targetPlatform.isiOS [
-    autoreconfHook
-  ]) ++ lib.optionals stdenv.targetPlatform.isVc4 [ flex ];
+  ]
+  ++ lib.optionals targetPlatform.isiOS [ autoreconfHook ]
+  ++ lib.optionals buildPlatform.isDarwin [ autoconf269 automake gettext libtool ]
+  ++ lib.optionals targetPlatform.isVc4 [ flex ]
+  ;
+
   buildInputs = [ zlib gettext ];
 
   inherit noSysDirs;
 
-  preConfigure = ''
+  preConfigure = (lib.optionalString buildPlatform.isDarwin ''
+    for i in */configure.ac; do
+      pushd "$(dirname "$i")"
+      echo "Running autoreconf in $PWD"
+      # autoreconf doesn't work, don't know why
+      # autoreconf ''${autoreconfFlags:---install --force --verbose}
+      autoconf
+      popd
+    done
+  '') + ''
     # Clear the default library search path.
     if test "$noSysDirs" = "1"; then
         echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
@@ -126,7 +142,8 @@ stdenv.mkDerivation {
 
   # As binutils takes part in the stdenv building, we don't want references
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
-  NIX_CFLAGS_COMPILE = if stdenv.hostPlatform.isDarwin
+  NIX_CFLAGS_COMPILE =
+    if hostPlatform.isDarwin
     then "-Wno-string-plus-int -Wno-deprecated-declarations"
     else "-static-libgcc";
 
@@ -134,11 +151,7 @@ stdenv.mkDerivation {
 
   configurePlatforms = [ "build" "host" "target" ];
 
-  configureFlags =
-    (if enableShared then [ "--enable-shared" "--disable-static" ]
-                     else [ "--disable-shared" "--enable-static" ])
-  ++ lib.optional withAllTargets "--enable-targets=all"
-  ++ [
+  configureFlags = [
     "--enable-64-bit-bfd"
     "--with-system-zlib"
 
@@ -151,35 +164,40 @@ stdenv.mkDerivation {
     # RUNPATH can be overriden using LD_LIBRARY_PATH at runtime.
     "--enable-new-dtags"
 
-    # force target prefix. Some versions of binutils will make it empty
-    # if `--host` and `--target` are too close, even if Nixpkgs thinks
-    # the platforms are different (e.g. because not all the info makes
-    # the `config`). Other versions of binutils will always prefix if
-    # `--target` is passed, even if `--host` and `--target` are the same.
-    # The easiest thing for us to do is not leave it to chance, and force
-    # the program prefix to be what we want it to be.
+    # force target prefix. Some versions of binutils will make it empty if
+    # `--host` and `--target` are too close, even if Nixpkgs thinks the
+    # platforms are different (e.g. because not all the info makes the
+    # `config`). Other versions of binutils will always prefix if `--target` is
+    # passed, even if `--host` and `--target` are the same. The easiest thing
+    # for us to do is not leave it to chance, and force the program prefix to be
+    # what we want it to be.
     "--program-prefix=${targetPrefix}"
-  ] ++ lib.optionals gold [
-    "--enable-gold"
-    "--enable-plugins"
-  ];
-
-  doCheck = false; # fails
-
-  postFixup = lib.optionalString reuseLibs ''
+  ]
+  ++ lib.optionals withAllTargets [ "--enable-targets=all" ]
+  ++ lib.optionals enableGold [ "--enable-gold" "--enable-plugins" ]
+  ++ (if enableShared
+      then [ "--enable-shared" "--disable-static" ]
+      else [ "--disable-shared" "--enable-static" ])
+  ;
+
+  # Fails
+  doCheck = false;
+
+  postFixup = lib.optionalString (enableShared && withAllTargets) ''
     rm "$out"/lib/lib{bfd,opcodes}-${version}.so
     ln -s '${lib.getLib libbfd}/lib/libbfd-${version}.so' "$out/lib/"
     ln -s '${lib.getLib libopcodes}/lib/libopcodes-${version}.so' "$out/lib/"
   '';
 
-  # else fails with "./sanity.sh: line 36: $out/bin/size: not found"
-  doInstallCheck = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform == stdenv.targetPlatform;
+  # INFO: Otherwise it fails with:
+  # `./sanity.sh: line 36: $out/bin/size: not found`
+  doInstallCheck = (buildPlatform == hostPlatform) && (hostPlatform == targetPlatform);
 
   enableParallelBuilding = true;
 
   passthru = {
     inherit targetPrefix;
-    hasGold = gold;
+    hasGold = enableGold;
     isGNU = true;
   };
 
@@ -193,11 +211,11 @@ stdenv.mkDerivation {
     '';
     homepage = "https://www.gnu.org/software/binutils/";
     license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ ericson2314 ];
+    maintainers = with maintainers; [ ericson2314 lovesegfault ];
     platforms = platforms.unix;
 
-    /* Give binutils a lower priority than gcc-wrapper to prevent a
-       collision due to the ld/as wrappers/symlinks in the latter. */
+    # INFO: Give binutils a lower priority than gcc-wrapper to prevent a
+    # collision due to the ld/as wrappers/symlinks in the latter.
     priority = 10;
   };
 }
diff --git a/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch b/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch
deleted file mode 100644
index abbfa73da05dc..0000000000000
--- a/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
-index 9f956d3..f5b61f1 100644
---- a/bfd/elf32-arm.c
-+++ b/bfd/elf32-arm.c
-@@ -19585,7 +19585,10 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
- #undef  ELF_MAXPAGESIZE
- #define ELF_MAXPAGESIZE			0x1000
- 
-+/* Prioritize elf32-*arm (priority 1) over elf32-*arm-vxworks (priority 2) */
-+#define elf_match_priority 2
- #include "elf32-target.h"
-+#undef  elf_match_priority
- 
- 
- /* Merge backend specific data from an object file to the output
-@@ -19974,4 +19977,7 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt,
- #undef  ELF_MAXPAGESIZE
- #define ELF_MAXPAGESIZE			0x8000
- 
-+/* Prioritize elf32-*arm (priority 1) over elf32-*arm-symbian (priority 2) */
-+#define elf_match_priority 2
- #include "elf32-target.h"
-+#undef  elf_match_priority
diff --git a/pkgs/development/tools/misc/binutils/gold-Update-GNU_PROPERTY_X86_XXX-macros.patch b/pkgs/development/tools/misc/binutils/gold-Update-GNU_PROPERTY_X86_XXX-macros.patch
deleted file mode 100644
index c4eef87a0c8d7..0000000000000
--- a/pkgs/development/tools/misc/binutils/gold-Update-GNU_PROPERTY_X86_XXX-macros.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From 586e30940e640f67bd55bd72e1d1355a4faf8079 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Tue, 13 Oct 2020 05:20:49 -0700
-Subject: [PATCH] gold: Update GNU_PROPERTY_X86_XXX macros
-
-This patch updates GNU_PROPERTY_X86_XXX macros for gold:
-
-1. GNU_PROPERTY_X86_UINT32_AND_XXX: A 4-byte unsigned integer property.
-A bit is set if it is set in all relocatable inputs:
-
- #define GNU_PROPERTY_X86_UINT32_AND_LO      0xc0000002
- #define GNU_PROPERTY_X86_UINT32_AND_HI      0xc0007fff
-
-2. GNU_PROPERTY_X86_UINT32_OR_XXX: A 4-byte unsigned integer property.
-A bit is set if it is set in any relocatable inputs:
-
- #define GNU_PROPERTY_X86_UINT32_OR_LO    0xc0008000
- #define GNU_PROPERTY_X86_UINT32_OR_HI    0xc000ffff
-
-3. GNU_PROPERTY_X86_UINT32_OR_AND_XXX: A 4-byte unsigned integer property.
-A bit is set if it is set in any relocatable inputs and the property is
-present in all relocatable inputs:
-
- #define GNU_PROPERTY_X86_UINT32_OR_AND_LO   0xc0010000
- #define GNU_PROPERTY_X86_UINT32_OR_AND_HI   0xc0017fff
-
-4. GNU_PROPERTY_X86_FEATURE_2_NEEDED, GNU_PROPERTY_X86_FEATURE_2_USED
-and GNU_PROPERTY_X86_FEATURE_2_XXX bits.
-
-GNU_PROPERTY_X86_FEATURE_1_AND is unchanged.  GNU_PROPERTY_X86_ISA_1_USED
-and GNU_PROPERTY_X86_ISA_1_NEEDED are updated to better support targeted
-processors since GNU_PROPERTY_X86_ISA_1_?86 aren't isn't very useful.
-A new set of GNU_PROPERTY_X86_ISA_1_XXX bits are defined.  The previous
-GNU_PROPERTY_X86_ISA_1_XXX macros are deprecated and renamed to
-GNU_PROPERTY_X86_COMPAT_ISA_1_XXX and GNU_PROPERTY_X86_COMPAT_2_ISA_1_XXX.
-
-elfcpp/
-
-	* elfcpp.h (GNU_PROPERTY_X86_ISA_1_USED): Renamed to ...
-	(GNU_PROPERTY_X86_COMPAT_ISA_1_USED): This.
-	(GNU_PROPERTY_X86_ISA_1_NEEDED): Renamed to ...
-	(GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED): This.
-	(GNU_PROPERTY_X86_UINT32_AND_LO): New.
-	(GNU_PROPERTY_X86_UINT32_AND_HI): Likewise.
-	(GNU_PROPERTY_X86_UINT32_OR_LO): Likewise.
-	(GNU_PROPERTY_X86_UINT32_OR_HI): Likewise.
-	(GNU_PROPERTY_X86_UINT32_OR_AND_LO): Likewise.
-	(GNU_PROPERTY_X86_UINT32_OR_AND_HI): Likewise.
-	(GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED): New.
-	(GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED): Likewise.
-	(GNU_PROPERTY_X86_FEATURE_1_AND): Updated to
-	(GNU_PROPERTY_X86_UINT32_AND_LO + 0).
-	(GNU_PROPERTY_X86_ISA_1_NEEDED): New.  Defined to
-	GNU_PROPERTY_X86_UINT32_OR_LO + 2.
-	(GNU_PROPERTY_X86_FEATURE_2_NEEDED): New.  Defined to
-	(GNU_PROPERTY_X86_UINT32_OR_LO + 1).
-	(GNU_PROPERTY_X86_ISA_1_USED): New.  Defined to
-	GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2.
-	(GNU_PROPERTY_X86_FEATURE_2_USED): New.  Defined to
-	(GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1).
-
-gold/
-
-	* x86_64.cc (Target_x86_64::Target_x86_64): Initialize
-	feature_2_used_, feature_2_needed_ and object_feature_2_used_.
-	(Target_x86_64::feature_2_used_): New data member.
-	(Target_x86_64::feature_2_needed_): Likewise.
-	(Target_x86_64::object_isa_1_used_): Likewise.
-	(Target_x86_64::record_gnu_property): Support
-	GNU_PROPERTY_X86_COMPAT_ISA_1_USED,
-	GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED,
-	GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED,
-	GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED,
-	GNU_PROPERTY_X86_FEATURE_2_USED and
-	GNU_PROPERTY_X86_FEATURE_2_NEEDED.
-	(Target_x86_64::merge_gnu_properties): Merge FEATURE_2_USED bits.
-	Initialize object_feature_2_used_.
-	(Target_x86_64::do_finalize_gnu_properties): Support
-	GNU_PROPERTY_X86_FEATURE_2_USED and
-	GNU_PROPERTY_X86_FEATURE_2_NEEDED.
-	* testsuite/gnu_property_a.S (GNU_PROPERTY_X86_ISA_1_USED): Set
-	to 0xc0010002.
-	(GNU_PROPERTY_X86_ISA_1_NEEDED): Set to 0xc0008002.
-	* testsuite/gnu_property_b.S (GNU_PROPERTY_X86_ISA_1_USED): Set
-	to 0xc0010002.
-	(GNU_PROPERTY_X86_ISA_1_NEEDED): Set to 0xc0008002.
-	* testsuite/gnu_property_c.S (GNU_PROPERTY_X86_ISA_1_USED): Set
-	to 0xc0010002.
-	(GNU_PROPERTY_X86_ISA_1_NEEDED): Set to 0xc0008002.
-	* testsuite/gnu_property_test.sh: Updated.
----
- elfcpp/ChangeLog                    | [omitted]
- elfcpp/elfcpp.h                     | 18 ++++++++++++---
- gold/ChangeLog                      | [omitted]
- gold/testsuite/gnu_property_a.S     |  4 ++--
- gold/testsuite/gnu_property_b.S     |  4 ++--
- gold/testsuite/gnu_property_c.S     |  4 ++--
- gold/testsuite/gnu_property_test.sh |  4 ++--
- gold/x86_64.cc                      | 34 +++++++++++++++++++++++++++--
- 8 files changed, 110 insertions(+), 13 deletions(-)
-
-diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
-index 65d803c00e2..4b6ff94a654 100644
---- a/elfcpp/elfcpp.h
-+++ b/elfcpp/elfcpp.h
-@@ -1013,9 +1013,21 @@ enum
-   GNU_PROPERTY_STACK_SIZE = 1,
-   GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
-   GNU_PROPERTY_LOPROC = 0xc0000000,
--  GNU_PROPERTY_X86_ISA_1_USED = 0xc0000000,
--  GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0000001,
--  GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
-+  GNU_PROPERTY_X86_COMPAT_ISA_1_USED = 0xc0000000,
-+  GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED = 0xc0000001,
-+  GNU_PROPERTY_X86_UINT32_AND_LO = 0xc0000002,
-+  GNU_PROPERTY_X86_UINT32_AND_HI = 0xc0007fff,
-+  GNU_PROPERTY_X86_UINT32_OR_LO = 0xc0008000,
-+  GNU_PROPERTY_X86_UINT32_OR_HI = 0xc000ffff,
-+  GNU_PROPERTY_X86_UINT32_OR_AND_LO = 0xc0010000,
-+  GNU_PROPERTY_X86_UINT32_OR_AND_HI = 0xc0017fff,
-+  GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 0,
-+  GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0,
-+  GNU_PROPERTY_X86_FEATURE_1_AND = GNU_PROPERTY_X86_UINT32_AND_LO + 0,
-+  GNU_PROPERTY_X86_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 2,
-+  GNU_PROPERTY_X86_FEATURE_2_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 1,
-+  GNU_PROPERTY_X86_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2,
-+  GNU_PROPERTY_X86_FEATURE_2_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1,
-   GNU_PROPERTY_HIPROC = 0xdfffffff,
-   GNU_PROPERTY_LOUSER = 0xe0000000,
-   GNU_PROPERTY_HIUSER = 0xffffffff
-diff --git a/gold/testsuite/gnu_property_a.S b/gold/testsuite/gnu_property_a.S
-index 463bc8e52fe..5fbbbc9c4bb 100644
---- a/gold/testsuite/gnu_property_a.S
-+++ b/gold/testsuite/gnu_property_a.S
-@@ -1,8 +1,8 @@
- #define NT_GNU_PROPERTY_TYPE_0 5
- 
- #define GNU_PROPERTY_STACK_SIZE 1
--#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
--#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
-+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
-+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
- #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
- 
- #if __SIZEOF_PTRDIFF_T__  == 8
-diff --git a/gold/testsuite/gnu_property_b.S b/gold/testsuite/gnu_property_b.S
-index 0c0c038ead1..7028f73d7ab 100644
---- a/gold/testsuite/gnu_property_b.S
-+++ b/gold/testsuite/gnu_property_b.S
-@@ -2,8 +2,8 @@
- 
- #define GNU_PROPERTY_STACK_SIZE 1
- #define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
--#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
--#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
-+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
-+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
- #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
- 
- #if __SIZEOF_PTRDIFF_T__  == 8
-diff --git a/gold/testsuite/gnu_property_c.S b/gold/testsuite/gnu_property_c.S
-index ace159a9a9d..c8cbd8bce28 100644
---- a/gold/testsuite/gnu_property_c.S
-+++ b/gold/testsuite/gnu_property_c.S
-@@ -2,8 +2,8 @@
- 
- #define GNU_PROPERTY_STACK_SIZE 1
- #define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
--#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
--#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
-+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
-+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
- #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
- 
- #if __SIZEOF_PTRDIFF_T__  == 8
-diff --git a/gold/testsuite/gnu_property_test.sh b/gold/testsuite/gnu_property_test.sh
-index 1806d3474cc..a4096005b78 100755
---- a/gold/testsuite/gnu_property_test.sh
-+++ b/gold/testsuite/gnu_property_test.sh
-@@ -77,8 +77,8 @@ check_count gnu_property_test.stdout "^  NOTE" 2
- 
- check gnu_property_test.stdout "stack size: 0x111100"
- check gnu_property_test.stdout "no copy on protected"
--check gnu_property_test.stdout "x86 ISA used: i486, SSE2, SSE4_2, AVX512CD"
--check gnu_property_test.stdout "x86 ISA needed: i486, SSE2, SSE4_2, AVX512CD"
-+check gnu_property_test.stdout "x86 ISA used: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
-+check gnu_property_test.stdout "x86 ISA needed: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
- check gnu_property_test.stdout "x86 feature: IBT"
- 
- exit 0
-diff --git a/gold/x86_64.cc b/gold/x86_64.cc
-index 9cb2cf0a322..378bac16f78 100644
---- a/gold/x86_64.cc
-+++ b/gold/x86_64.cc
-@@ -706,8 +706,9 @@ class Target_x86_64 : public Sized_target<size, false>
-       rela_irelative_(NULL), copy_relocs_(elfcpp::R_X86_64_COPY),
-       got_mod_index_offset_(-1U), tlsdesc_reloc_info_(),
-       tls_base_symbol_defined_(false), isa_1_used_(0), isa_1_needed_(0),
--      feature_1_(0), object_isa_1_used_(0), object_feature_1_(0),
--      seen_first_object_(false)
-+      feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
-+      object_isa_1_used_(0), object_feature_1_(0),
-+      object_feature_2_used_(0), seen_first_object_(false)
-   { }
- 
-   // Hook for a new output section.
-@@ -1382,6 +1383,8 @@ class Target_x86_64 : public Sized_target<size, false>
-   uint32_t isa_1_used_;
-   uint32_t isa_1_needed_;
-   uint32_t feature_1_;
-+  uint32_t feature_2_used_;
-+  uint32_t feature_2_needed_;
-   // Target-specific properties from the current object.
-   // These bits get ORed into ISA_1_USED_ after all properties for the object
-   // have been processed. But if either is all zeroes (as when the property
-@@ -1391,6 +1394,7 @@ class Target_x86_64 : public Sized_target<size, false>
-   // These bits get ANDed into FEATURE_1_ after all properties for the object
-   // have been processed.
-   uint32_t object_feature_1_;
-+  uint32_t object_feature_2_used_;
-   // Whether we have seen our first object, for use in initializing FEATURE_1_.
-   bool seen_first_object_;
- };
-@@ -1594,9 +1598,15 @@ Target_x86_64<size>::record_gnu_property(
- 
-   switch (pr_type)
-     {
-+    case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
-+    case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
-+    case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
-+    case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
-     case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
-     case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
-     case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
-+    case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
-+    case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
-       if (pr_datasz != 4)
- 	{
- 	  gold_warning(_("%s: corrupt .note.gnu.property section "
-@@ -1625,6 +1635,12 @@ Target_x86_64<size>::record_gnu_property(
-       // If we see multiple feature props in one object, OR them together.
-       this->object_feature_1_ |= val;
-       break;
-+    case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
-+      this->object_feature_2_used_ |= val;
-+      break;
-+    case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
-+      this->feature_2_needed_ |= val;
-+      break;
-     }
- }
- 
-@@ -1642,15 +1658,23 @@ Target_x86_64<size>::merge_gnu_properties(const Object*)
-       else if (this->isa_1_used_ != 0)
- 	this->isa_1_used_ |= this->object_isa_1_used_;
-       this->feature_1_ &= this->object_feature_1_;
-+      // If any object is missing the FEATURE_2_USED property, we must
-+      // omit it from the output file.
-+      if (this->object_feature_2_used_ == 0)
-+	this->feature_2_used_ = 0;
-+      else if (this->feature_2_used_ != 0)
-+	this->feature_2_used_ |= this->object_feature_2_used_;
-     }
-   else
-     {
-       this->isa_1_used_ = this->object_isa_1_used_;
-       this->feature_1_ = this->object_feature_1_;
-+      this->feature_2_used_ = this->object_feature_2_used_;
-       this->seen_first_object_ = true;
-     }
-   this->object_isa_1_used_ = 0;
-   this->object_feature_1_ = 0;
-+  this->object_feature_2_used_ = 0;
- }
- 
- static inline void
-@@ -1676,6 +1700,12 @@ Target_x86_64<size>::do_finalize_gnu_properties(Layout* layout) const
-   if (this->feature_1_ != 0)
-     add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
- 		 this->feature_1_);
-+  if (this->feature_2_used_ != 0)
-+    add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
-+		 this->feature_2_used_);
-+  if (this->feature_2_needed_ != 0)
-+    add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
-+		 this->feature_2_needed_);
- }
- 
- // Write the first three reserved words of the .got.plt section.
--- 
-2.27.0
-
diff --git a/pkgs/development/tools/misc/binutils/mips64-default-n64.patch b/pkgs/development/tools/misc/binutils/mips64-default-n64.patch
new file mode 100644
index 0000000000000..00581279f85e5
--- /dev/null
+++ b/pkgs/development/tools/misc/binutils/mips64-default-n64.patch
@@ -0,0 +1,82 @@
+--- a/bfd/config.bfd
++++ b/bfd/config.bfd
+@@ -927,11 +927,21 @@ case "${targ}" in
+     targ_defvec=mips_elf32_be_vec
+     targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
+     ;;
+-  mips64*el-*-linux*)
++  mips*64*el-*-linux*-gnuabi64)
++    targ_defvec=mips_elf64_trad_le_vec
++    targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec"
++    want64=true
++    ;;
++  mips*64*-*-linux*-gnuabi64)
++    targ_defvec=mips_elf64_trad_be_vec
++    targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
++    want64=true
++    ;;
++  mips*64*el-*-linux*)
+     targ_defvec=mips_elf32_ntrad_le_vec
+     targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
+     ;;
+-  mips64*-*-linux*)
++  mips*64*-*-linux*)
+     targ_defvec=mips_elf32_ntrad_be_vec
+     targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+     ;;
+--- a/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
++++ b/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
+@@ -1,4 +1,5 @@
+ #PROG: objcopy
++#as: -n32
+ #readelf: --notes --wide
+ #objcopy: --merge-notes
+ #name: MIPS merge notes section (n32)
+--- a/gas/configure
++++ b/gas/configure
+@@ -12167,6 +12167,9 @@ _ACEOF
+ 	esac
+ 	# Decide which ABI to target by default.
+ 	case ${target} in
++	  mips*64*-linux-gnuabi64)
++	    mips_default_abi=N64_ABI
++	    ;;
+ 	  mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
+ 	  | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
+ 	    mips_default_abi=N32_ABI
+--- a/gas/configure.ac
++++ b/gas/configure.ac
+@@ -384,6 +384,9 @@ changequote([,])dnl
+ 	esac
+ 	# Decide which ABI to target by default.
+ 	case ${target} in
++	  mips*64*-linux-gnuabi64)
++	    mips_default_abi=N64_ABI
++	    ;;
+ 	  mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
+ 	  | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
+ 	    mips_default_abi=N32_ABI
+--- a/ld/configure.tgt
++++ b/ld/configure.tgt
+@@ -543,11 +543,19 @@ mips*-*-vxworks*)	targ_emul=elf32ebmipvx
+ 			;;
+ mips*-*-windiss)	targ_emul=elf32mipswindiss
+ 			;;
+-mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
++mips*64*el-*-linux-gnuabi64)	targ_emul=elf64ltsmip
++			targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
++			targ_extra_libpath=$targ_extra_emuls
++			;;
++mips*64*el-*-linux-*)	targ_emul=elf32ltsmipn32
+ 			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+ 			targ_extra_libpath=$targ_extra_emuls
+ 			;;
+-mips64*-*-linux-*)	targ_emul=elf32btsmipn32
++mips*64*-*-linux-gnuabi64)	targ_emul=elf64btsmip
++			targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
++			targ_extra_libpath=$targ_extra_emuls
++			;;
++mips*64*-*-linux-*)	targ_emul=elf32btsmipn32
+ 			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+ 			targ_extra_libpath=$targ_extra_emuls
+ 			;;
diff --git a/pkgs/development/tools/misc/blackfire/default.nix b/pkgs/development/tools/misc/blackfire/default.nix
index 6f82e0731088d..16ea9bfabd477 100644
--- a/pkgs/development/tools/misc/blackfire/default.nix
+++ b/pkgs/development/tools/misc/blackfire/default.nix
@@ -2,56 +2,96 @@
 , lib
 , fetchurl
 , dpkg
-, autoPatchelfHook
 , writeShellScript
 , curl
 , jq
 , common-updater-scripts
 }:
 
+let
+  version = "2.8.0";
+
+  sources = {
+    "x86_64-linux" = fetchurl {
+      url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire/blackfire_${version}_amd64.deb";
+      sha256 = "0bgd4hnpaxrqw0s0y2qiak8lbskfi2cqp147vj1kbhvm8834hwhg";
+    };
+    "i686-linux" = fetchurl {
+      url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire/blackfire_${version}_i386.deb";
+      sha256 = "06lf642m4imz8xvwipflmvjy1ih7k8bx8jpay0xawvilh14pqz8f";
+    };
+    "aarch64-linux" = fetchurl {
+      url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire/blackfire_${version}_arm64.deb";
+      sha256 = "0rddafjgdnj3na96x83paq5z14grj46v4iv38qbkvmdllrj26a0a";
+    };
+    "aarch64-darwin" = fetchurl {
+      url = "https://packages.blackfire.io/blackfire/${version}/blackfire-darwin_arm64.pkg.tar.gz";
+      sha256 = "YWiZnYdsW7dyQ0IeKeC1U00ZIdJRnzs9keeQTEU2ozA=";
+    };
+    "x86_64-darwin" = fetchurl {
+      url = "https://packages.blackfire.io/blackfire/${version}/blackfire-darwin_amd64.pkg.tar.gz";
+      sha256 = "391b0d239b11095bb8515cb60ee95f02d5862fcb509724081f314819967206b6";
+    };
+  };
+in
 stdenv.mkDerivation rec {
   pname = "blackfire";
-  version = "2.5.2";
+  inherit version;
 
-  src = fetchurl {
-    url = "https://packages.blackfire.io/debian/pool/any/main/b/blackfire/blackfire_${version}_amd64.deb";
-    sha256 = "1RO5yabSNpIz5lWXngMOZ1S2vtnLEkXIj1ZoIinRrQ0=";
-  };
+  src = sources.${stdenv.hostPlatform.system};
 
-  nativeBuildInputs = [
-    dpkg
-    autoPatchelfHook
-  ];
+  nativeBuildInputs = lib.optionals stdenv.isLinux [ dpkg ];
 
   dontUnpack = true;
 
   installPhase = ''
     runHook preInstall
 
-    dpkg-deb -x $src $out
-    mv $out/usr/* $out
-    rmdir $out/usr
+    if ${ lib.boolToString stdenv.isLinux }
+    then
+      dpkg-deb -x $src $out
+      mv $out/usr/* $out
+      rmdir $out/usr
+
+      # Fix ExecStart path and replace deprecated directory creation method,
+      # use dynamic user.
+      substituteInPlace "$out/lib/systemd/system/blackfire-agent.service" \
+        --replace '/usr/' "$out/" \
+        --replace 'ExecStartPre=/bin/mkdir -p /var/run/blackfire' 'RuntimeDirectory=blackfire' \
+        --replace 'ExecStartPre=/bin/chown blackfire: /var/run/blackfire' "" \
+        --replace 'User=blackfire' 'DynamicUser=yes' \
+        --replace 'PermissionsStartOnly=true' ""
 
-    # Fix ExecStart path and replace deprecated directory creation method,
-    # use dynamic user.
-    substituteInPlace "$out/lib/systemd/system/blackfire-agent.service" \
-      --replace '/usr/' "$out/" \
-      --replace 'ExecStartPre=/bin/mkdir -p /var/run/blackfire' 'RuntimeDirectory=blackfire' \
-      --replace 'ExecStartPre=/bin/chown blackfire: /var/run/blackfire' "" \
-      --replace 'User=blackfire' 'DynamicUser=yes' \
-      --replace 'PermissionsStartOnly=true' ""
+      # Modernize socket path.
+      substituteInPlace "$out/etc/blackfire/agent" \
+        --replace '/var/run' '/run'
+    else
+      mkdir $out
 
-    # Modernize socket path.
-    substituteInPlace "$out/etc/blackfire/agent" \
-      --replace '/var/run' '/run'
+      tar -zxvf $src
+
+      mv etc $out
+      mv usr/* $out
+    fi
 
     runHook postInstall
   '';
 
   passthru = {
     updateScript = writeShellScript "update-${pname}" ''
+      set -o errexit
       export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}"
-      update-source-version "$UPDATE_NIX_ATTR_PATH" "$(curl https://blackfire.io/api/v1/releases | jq .cli --raw-output)"
+      NEW_VERSION=$(curl -s https://blackfire.io/api/v1/releases | jq .cli --raw-output)
+
+      if [[ "${version}" = "$NEW_VERSION" ]]; then
+          echo "The new version same as the old version."
+          exit 0
+      fi
+
+      for platform in ${lib.concatStringsSep " " meta.platforms}; do
+        update-source-version "blackfire" "0" "${lib.fakeSha256}" "--system=$platform"
+        update-source-version "blackfire" "$NEW_VERSION" "--system=$platform" --ignore-same-hash
+      done
     '';
   };
 
@@ -59,7 +99,7 @@ stdenv.mkDerivation rec {
     description = "Blackfire Profiler agent and client";
     homepage = "https://blackfire.io/";
     license = licenses.unfree;
-    maintainers = with maintainers; [ jtojnar ];
-    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ jtojnar shyim ];
+    platforms = [ "x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin" "aarch64-darwin" ];
   };
 }
diff --git a/pkgs/development/tools/misc/circleci-cli/default.nix b/pkgs/development/tools/misc/circleci-cli/default.nix
index 5184f22aecdc5..19984886207c7 100644
--- a/pkgs/development/tools/misc/circleci-cli/default.nix
+++ b/pkgs/development/tools/misc/circleci-cli/default.nix
@@ -2,13 +2,13 @@
 
 buildGoModule rec {
   pname = "circleci-cli";
-  version = "0.1.16947";
+  version = "0.1.17142";
 
   src = fetchFromGitHub {
     owner = "CircleCI-Public";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-RGkC1XhrssrX4IBh1OrzEowvbPPUK7jXZxxa+FEV/WE=";
+    sha256 = "sha256-69GGJfnOHry+N3hKZapKz6eFSerqIHt4wRAhm/q/SOQ=";
   };
 
   vendorSha256 = "sha256-7u2y1yBVpXf+D19tslD4s3B1KmABl4OWNzzLaBNL/2U=";
diff --git a/pkgs/development/tools/misc/clojure-lsp/default.nix b/pkgs/development/tools/misc/clojure-lsp/default.nix
index 307bcd273a40e..4dc63d54f145e 100644
--- a/pkgs/development/tools/misc/clojure-lsp/default.nix
+++ b/pkgs/development/tools/misc/clojure-lsp/default.nix
@@ -2,18 +2,18 @@
 
 buildGraalvmNativeImage rec {
   pname = "clojure-lsp";
-  version = "2022.03.31-20.00.20";
+  version = "2022.04.18-00.59.32";
 
   src = fetchFromGitHub {
     owner = pname;
     repo = pname;
     rev = version;
-    sha256 = "sha256-UQA/BXf6hTTxZ504e1faPdS8mKYS8WrY5L/zgaGCxpU=";
+    sha256 = "sha256-14EsJIKYl8TWbDqM9PyVrbs/4EssqXp0EK70RrFz+RE=";
   };
 
   jar = fetchurl {
     url = "https://github.com/clojure-lsp/clojure-lsp/releases/download/${version}/clojure-lsp-standalone.jar";
-    sha256 = "e66689326c39ae74f0e8d9f5a8229c7ebebe010849870a47faf88e81cbaa37e0";
+    sha256 = "d78094b015bd9e671eea2eb89ca0bb3ec58d39802ad1bfdf875b50e1cdd4995e";
   };
 
   extraNativeImageBuildArgs = [
diff --git a/pkgs/development/tools/misc/devspace/default.nix b/pkgs/development/tools/misc/devspace/default.nix
new file mode 100644
index 0000000000000..df59686b2b97a
--- /dev/null
+++ b/pkgs/development/tools/misc/devspace/default.nix
@@ -0,0 +1,37 @@
+{
+  lib,
+  buildGoModule,
+  fetchFromGitHub
+}:
+
+buildGoModule rec {
+  pname = "devspace";
+  version = "5.18.4";
+
+  src = fetchFromGitHub {
+    owner = "loft-sh";
+    repo = "devspace";
+    rev = "v${version}";
+    sha256 = "0s5117cgxgrxfki5drvg6d22dvrjffa03bi644zdl1p631r599r1";
+  };
+
+  vendorSha256 = null;
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X main.version=${version}"
+  ];
+
+  # Check are disable since they requiered a working K8S cluster
+  # TODO: add a nixosTest to be able to perform the package check
+  doCheck = false;
+
+  meta = with lib; {
+    description = "DevSpace is an open-source developer tool for Kubernetes that lets you develop and deploy cloud-native software faster";
+    homepage = "https://devspace.sh/";
+    changelog = "https://github.com/loft-sh/devspace/releases/tag/v${version}";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ darkonion0 ];
+  };
+}
diff --git a/pkgs/development/tools/misc/gef/default.nix b/pkgs/development/tools/misc/gef/default.nix
index 0352ebc7cf327..b09cc795d8c08 100644
--- a/pkgs/development/tools/misc/gef/default.nix
+++ b/pkgs/development/tools/misc/gef/default.nix
@@ -4,6 +4,7 @@
 , makeWrapper
 , gdb
 , python3
+, bintools-unwrapped
 , file
 , ps
 , git
@@ -39,7 +40,12 @@ in stdenv.mkDerivation rec {
     makeWrapper ${gdb}/bin/gdb $out/bin/gef \
       --add-flags "-q -x $out/share/gef/gef.py" \
       --set NIX_PYTHONPATH ${pythonPath} \
-      --prefix PATH : ${lib.makeBinPath [ python3 file ps ]}
+      --prefix PATH : ${lib.makeBinPath [
+        python3
+        bintools-unwrapped # for readelf
+        file
+        ps
+      ]}
   '';
 
   checkInputs = [
diff --git a/pkgs/development/tools/misc/go-license-detector/default.nix b/pkgs/development/tools/misc/go-license-detector/default.nix
index 91c6518bc26d4..11e7547afc4c5 100644
--- a/pkgs/development/tools/misc/go-license-detector/default.nix
+++ b/pkgs/development/tools/misc/go-license-detector/default.nix
@@ -1,24 +1,25 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, git }:
 
 buildGoModule rec {
   pname = "go-license-detector";
-  version = "3.1.0";
+  version = "4.3.0";
 
   src = fetchFromGitHub {
-    owner = "src-d";
+    owner = "go-enry";
     repo = pname;
     rev = "v${version}";
-    sha256 = "0ln1z3y9q5igf9djkxw05ql2hb1ijcvvz0mrbwz11cdv9xrsa4z4";
+    sha256 = "sha256-MubQpxpUCPDBVsEz4NmY8MFEoECXQtzAaZJ89vv5bDc=";
   };
 
-  vendorSha256 = "0gan5l7vsq0hixxcymhhs8p07v92w60r0lhgvrr9a99nic12vmia";
+  vendorSha256 = "sha256-a9yCnGg+4f+UoHbGG8a47z2duBD3qXcAzPKnE4PQsvM=";
 
-  doCheck = false;
+  checkInputs = [ git ];
 
   meta = with lib; {
     description = "Reliable project licenses detector";
-    homepage = "https://github.com/src-d/go-license-detector";
+    homepage = "https://github.com/go-enry/go-license-detector";
     license = licenses.asl20;
     maintainers = with maintainers; [ dtzWill ];
+    mainProgram = "license-detector";
   };
 }
diff --git a/pkgs/development/tools/misc/grcov/default.nix b/pkgs/development/tools/misc/grcov/default.nix
index 04ed4a1046b77..2ca092fa659d8 100644
--- a/pkgs/development/tools/misc/grcov/default.nix
+++ b/pkgs/development/tools/misc/grcov/default.nix
@@ -2,16 +2,16 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "grcov";
-  version = "0.8.8";
+  version = "0.8.9";
 
   src = fetchFromGitHub {
     owner = "mozilla";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-OITtZdI9d5zQVI02s5gJF9lWCjZZgE7YZRfFROU040o=";
+    sha256 = "sha256-VSjKZoK/o05kYX5mRCnaS6r/+4dZep9Bp9Im1Zw7piM=";
   };
 
-  cargoSha256 = "sha256-AZVkS/huEsA1wdVB/xUGCCjY5AWJxaU1DD/OlEURw/c=";
+  cargoSha256 = "sha256-7I0BizeDbikpog0YG/X8vwoO4PGE1qYzRTWTr0RUQws=";
 
   # tests do not find grcov path correctly
   checkFlags = let
diff --git a/pkgs/development/tools/misc/libtool/libtool2-macos11.patch b/pkgs/development/tools/misc/libtool/libtool2-macos11.patch
deleted file mode 100644
index 1552ae7a949f3..0000000000000
--- a/pkgs/development/tools/misc/libtool/libtool2-macos11.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
----
- m4/libtool.m4 | 13 ++++---------
- 1 file changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/m4/libtool.m4 b/m4/libtool.m4
-index f2d1f398..b971e8e7 100644
---- a/m4/libtool.m4
-+++ b/m4/libtool.m4
-@@ -1067,16 +1067,11 @@ _LT_EOF
-       _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
-     darwin1.*)
-       _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
--    darwin*) # darwin 5.x on
--      # if running on 10.5 or later, the deployment target defaults
--      # to the OS version, if on x86, and 10.4, the deployment
--      # target defaults to 10.4. Don't you love it?
--      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
--	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
--	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
--	10.[[012]][[,.]]*)
-+    darwin*)
-+      case ${MACOSX_DEPLOYMENT_TARGET},$host in
-+	10.[[012]],*|,*powerpc*)
- 	  _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
--	10.*)
-+	*)
- 	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
-       esac
-     ;;
--- 
-2.24.3 (Apple Git-128)
diff --git a/pkgs/development/tools/misc/libtool/libtool2.nix b/pkgs/development/tools/misc/libtool/libtool2.nix
index 44e4c8665c839..3d15752fc0a63 100644
--- a/pkgs/development/tools/misc/libtool/libtool2.nix
+++ b/pkgs/development/tools/misc/libtool/libtool2.nix
@@ -1,4 +1,6 @@
 { lib, stdenv, fetchurl, fetchpatch, autoconf, automake, m4, perl, help2man
+, runtimeShell
+, file
 }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
@@ -8,20 +10,18 @@
 
 stdenv.mkDerivation rec {
   pname = "libtool";
-  version = "2.4.6";
+  version = "2.4.7";
 
   src = fetchurl {
     url = "mirror://gnu/libtool/${pname}-${version}.tar.gz";
-    sha256 = "1qq61k6lp1fp75xs398yzi6wvbx232l7xbyn3p13cnh27mflvgg3";
+    sha256 = "sha256-BOlsJATqcMWQxUbrpCAqThJyLGQAFsErmy8c49SB6ag=";
   };
 
   outputs = [ "out" "lib" ];
 
-  patches = [
-    # Suport macOS version 11.0
-    # https://lists.gnu.org/archive/html/libtool-patches/2020-06/msg00001.html
-    ./libtool2-macos11.patch
-  ];
+  # FILECMD was added in libtool 2.4.7; previous versions hardwired `/usr/bin/file`
+  #   https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
+  FILECMD = "${file}/bin/file";
 
   # Normally we'd use autoreconfHook, but that includes libtoolize.
   postPatch = ''
@@ -34,10 +34,18 @@ stdenv.mkDerivation rec {
     automake
     autoconf
     popd
+  '' +
+  # libtool commit da2e352735722917bf0786284411262195a6a3f6 changed
+  # the shebang from `/bin/sh` (which is a special sandbox exception)
+  # to `/usr/bin/env sh`, meaning that we now need to patch shebangs
+  # in libtoolize and ltmain.sh since `dontPatchShebangs` is set:
+  ''
+    substituteInPlace libtoolize.in       --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
+    substituteInPlace build-aux/ltmain.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
   '';
 
-  nativeBuildInputs = [ perl help2man m4 ] ++ [ autoconf automake ];
-  propagatedBuildInputs = [ m4 ];
+  nativeBuildInputs = [ autoconf automake help2man m4 perl ];
+  propagatedBuildInputs = [ m4 file ];
 
   # Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
   # "fixed" path in generated files!
diff --git a/pkgs/development/tools/misc/nix-bisect/default.nix b/pkgs/development/tools/misc/nix-bisect/default.nix
new file mode 100644
index 0000000000000..23efce44cff80
--- /dev/null
+++ b/pkgs/development/tools/misc/nix-bisect/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, fetchpatch
+, fetchFromGitHub
+, python3
+}:
+
+let
+  pname = "nix-bisect";
+  version = "0.4.1";
+in
+python3.pkgs.buildPythonApplication {
+  inherit pname version;
+  format = "setuptools";
+
+  src = fetchFromGitHub {
+    owner = "timokau";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-01vj35mMakqKi5zbMIPQ+R8xdkOWbzpnigd3/SU+svw=";
+  };
+
+  patches = [
+    (fetchpatch {
+      # Fixes compatibility with recent nix versions
+      url = "https://github.com/timokau/nix-bisect/commit/01eefe174b740cb90e48b06d67d5582d51786b96.patch";
+      hash = "sha256-Gls/NtHH7LujdEgLbcIRZ12KsJDrasXIMcHeeBVns4A=";
+    })
+  ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    appdirs
+    numpy
+    pexpect
+  ];
+
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Bisect nix builds";
+    homepage = "https://github.com/timokau/nix-bisect";
+    license = licenses.mit;
+    maintainers = with maintainers; [ hexa ];
+  };
+}
diff --git a/pkgs/development/tools/misc/nxpmicro-mfgtools/default.nix b/pkgs/development/tools/misc/nxpmicro-mfgtools/default.nix
index 63f42ffe07cc9..9041d1f8c589e 100644
--- a/pkgs/development/tools/misc/nxpmicro-mfgtools/default.nix
+++ b/pkgs/development/tools/misc/nxpmicro-mfgtools/default.nix
@@ -52,6 +52,7 @@ stdenv.mkDerivation rec {
     homepage = "https://github.com/NXPmicro/mfgtools";
     license = licenses.bsd3;
     maintainers = with maintainers; [ bmilanov jraygauthier ];
+    mainProgram = "uuu";
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/tools/misc/patchelf/0.13.nix b/pkgs/development/tools/misc/patchelf/0.13.nix
new file mode 100644
index 0000000000000..0111a4b065c47
--- /dev/null
+++ b/pkgs/development/tools/misc/patchelf/0.13.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, patchelf }:
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+stdenv.mkDerivation rec {
+  pname = "patchelf";
+  version = "0.13.1";
+
+  src = fetchurl {
+    url = "https://github.com/NixOS/${pname}/releases/download/${version}/${pname}-${version}.tar.bz2";
+    sha256 = "sha256-OeiuzNdJXVTfCU0rSnwIAQ/3d3A2+q8k8o4Hd30VmOI=";
+  };
+
+  setupHook = [ ./setup-hook.sh ];
+
+  # fails 8 out of 24 tests, problems when loading libc.so.6
+  doCheck = stdenv.name == "stdenv-linux";
+
+  inherit (patchelf) meta;
+}
diff --git a/pkgs/development/tools/misc/patchelf/default.nix b/pkgs/development/tools/misc/patchelf/default.nix
index dcb4d2362c8e0..03e3d003ad1e8 100644
--- a/pkgs/development/tools/misc/patchelf/default.nix
+++ b/pkgs/development/tools/misc/patchelf/default.nix
@@ -7,11 +7,11 @@
 
 stdenv.mkDerivation rec {
   pname = "patchelf";
-  version = "0.14.3";
+  version = "0.14.5";
 
   src = fetchurl {
     url = "https://github.com/NixOS/${pname}/releases/download/${version}/${pname}-${version}.tar.bz2";
-    sha256 = "sha256-oBfsPSFSoZ/ZacDYez+LQ+MqZuT/q9yHZ6VgYrmuwnA=";
+    sha256 = "sha256-uaRvKYkyLrifpPYjfiCDbFe0VapDoyVF6gk7Qx2YL1w=";
   };
 
   setupHook = [ ./setup-hook.sh ];
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     homepage = "https://github.com/NixOS/patchelf";
-    license = licenses.gpl3;
+    license = licenses.gpl3Plus;
     description = "A small utility to modify the dynamic linker and RPATH of ELF executables";
     maintainers = [ maintainers.eelco ];
     platforms = platforms.all;
diff --git a/pkgs/development/tools/misc/patchelf/unstable.nix b/pkgs/development/tools/misc/patchelf/unstable.nix
index e62805867504e..350424747e883 100644
--- a/pkgs/development/tools/misc/patchelf/unstable.nix
+++ b/pkgs/development/tools/misc/patchelf/unstable.nix
@@ -1,14 +1,14 @@
-{ lib, stdenv, fetchurl, autoreconfHook, fetchFromGitHub }:
+{ lib, stdenv, fetchurl, autoreconfHook, fetchFromGitHub, unstableGitUpdater }:
 
 stdenv.mkDerivation rec {
   pname = "patchelf";
-  version = "2021-11-16";
+  version = "unstable-2022-02-21";
 
   src = fetchFromGitHub {
     owner = "NixOS";
     repo = "patchelf";
-    rev = "a174cf3006baf31e0e9eaa62bc9adead93af63f7";
-    sha256 = "sha256-cKZ4DE70R5XiIqfnIVAl2s7a1bJxaaPpuCmxs3pxFRU=";
+    rev = "a35054504293f9ff64539850d1ed0bfd2f5399f2";
+    sha256 = "sha256-/hD/abmzWSkDhAWPLHiLQQ9cwJF8oFDuovNzRqs3Bho=";
   };
 
   # Drop test that fails on musl (?)
@@ -24,6 +24,12 @@ stdenv.mkDerivation rec {
 
   doCheck = !stdenv.isDarwin;
 
+  passthru = {
+    updateScript = unstableGitUpdater {
+      url = "https://github.com/NixOS/patchelf.git";
+    };
+  };
+
   meta = with lib; {
     homepage = "https://github.com/NixOS/patchelf";
     license = licenses.gpl3;
diff --git a/pkgs/development/tools/misc/pkgconf/default.nix b/pkgs/development/tools/misc/pkgconf/default.nix
index e3e0de4e7f16f..8db8a709bb6e0 100644
--- a/pkgs/development/tools/misc/pkgconf/default.nix
+++ b/pkgs/development/tools/misc/pkgconf/default.nix
@@ -1,31 +1,35 @@
-{ lib, stdenv, fetchurl, removeReferencesTo }:
+{ lib
+, stdenv
+, fetchurl
+, removeReferencesTo
+}:
 
 stdenv.mkDerivation rec {
   pname = "pkgconf";
   version = "1.8.0";
 
-  nativeBuildInputs = [ removeReferencesTo ];
+  src = fetchurl {
+    url = "https://distfiles.dereferenced.org/${pname}/${pname}-${version}.tar.xz";
+    hash = "sha256-75x+YYIrfLg1bm6eHcpY2VVvMgDXisqzXkNH6dTCu68=";
+  };
 
   outputs = [ "out" "lib" "dev" "man" "doc" ];
 
-  enableParallelBuilding = true;
+  nativeBuildInputs = [ removeReferencesTo ];
 
-  src = fetchurl {
-    url = "https://distfiles.dereferenced.org/${pname}/${pname}-${version}.tar.xz";
-    sha256 = "sha256-75x+YYIrfLg1bm6eHcpY2VVvMgDXisqzXkNH6dTCu68=";
-  };
+  enableParallelBuilding = true;
 
-  # Debian has outputs like these too:
-  # https://packages.debian.org/source/buster/pkgconf, so take it this
-  # reference removing is safe.
+  # Debian has outputs like these too
+  # (https://packages.debian.org/source/bullseye/pkgconf), so it is safe to
+  # remove those references
   postFixup = ''
     remove-references-to \
+      -t "${placeholder "out"}" \
+      "${placeholder "lib"}"/lib/*
+    remove-references-to \
       -t "${placeholder "dev"}" \
       "${placeholder "lib"}"/lib/* \
       "${placeholder "out"}"/bin/*
-    remove-references-to \
-      -t "${placeholder "out"}" \
-      "${placeholder "lib"}"/lib/*
   ''
   # Move back share/aclocal. Yes, this normally goes in the dev output for good
   # reason, but in this case the dev output is for the `libpkgconf` library,
@@ -37,10 +41,19 @@ stdenv.mkDerivation rec {
   '';
 
   meta = with lib; {
+    homepage = "https://github.com/pkgconf/pkgconf";
     description = "Package compiler and linker metadata toolkit";
-    homepage = "https://git.dereferenced.org/pkgconf/pkgconf";
-    platforms = platforms.all;
+    longDescription = ''
+      pkgconf is a program which helps to configure compiler and linker flags
+      for development libraries. It is similar to pkg-config from
+      freedesktop.org.
+
+      libpkgconf is a library which provides access to most of pkgconf's
+      functionality, to allow other tooling such as compilers and IDEs to
+      discover and use libraries configured by pkgconf.
+    '';
     license = licenses.isc;
-    maintainers = with maintainers; [ zaninime ];
+    maintainers = with maintainers; [ zaninime AndersonTorres ];
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/tools/misc/saleae-logic-2/default.nix b/pkgs/development/tools/misc/saleae-logic-2/default.nix
index 242d76174ce9d..f90f6b067b7ea 100644
--- a/pkgs/development/tools/misc/saleae-logic-2/default.nix
+++ b/pkgs/development/tools/misc/saleae-logic-2/default.nix
@@ -1,10 +1,10 @@
 { lib, fetchurl, makeDesktopItem, appimageTools, gtk3 }:
 let
   name = "saleae-logic-2";
-  version = "2.3.45";
+  version = "2.3.50";
   src = fetchurl {
     url = "https://downloads.saleae.com/logic2/Logic-${version}-master.AppImage";
-    sha256 = "sha256-kX8jMCUkz7B0muxsEwEttEX+DA2P+6swdZJGHyo7ScA=";
+    sha256 = "sha256-jkdFdgiSP2ssrUajl85FA4E21Qi6BUgrjKFdlBYyG7c=";
   };
   desktopItem = makeDesktopItem {
     inherit name;
@@ -70,6 +70,6 @@ appimageTools.wrapType2 {
     description = "Software for Saleae logic analyzers";
     license = licenses.unfree;
     platforms = [ "x86_64-linux" ];
-    maintainers = [ maintainers.j-hui ];
+    maintainers = with maintainers; [ j-hui newam ];
   };
 }
diff --git a/pkgs/development/tools/misc/sccache/default.nix b/pkgs/development/tools/misc/sccache/default.nix
index d2833ce9da62a..a8f7f63d0222a 100644
--- a/pkgs/development/tools/misc/sccache/default.nix
+++ b/pkgs/development/tools/misc/sccache/default.nix
@@ -16,7 +16,8 @@ rustPlatform.buildRustPackage rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;
 
-  buildFeatures = lib.optionals (!stdenv.isDarwin) [ "dist-client" "dist-server" ];
+  # sccache-dist is only supported on x86_64 Linux machines.
+  buildFeatures = lib.optionals (stdenv.system == "x86_64-linux") [ "dist-client" "dist-server" ];
 
   # Tests fail because of client server setup which is not possible inside the pure environment,
   # see https://github.com/mozilla/sccache/issues/460
diff --git a/pkgs/development/tools/misc/semver-tool/default.nix b/pkgs/development/tools/misc/semver-tool/default.nix
index 407185a474b9e..434fba18c5921 100644
--- a/pkgs/development/tools/misc/semver-tool/default.nix
+++ b/pkgs/development/tools/misc/semver-tool/default.nix
@@ -28,5 +28,6 @@ stdenv.mkDerivation rec {
     license = licenses.asl20;
     platforms = platforms.unix;
     maintainers = [ maintainers.qyliss ];
+    mainProgram = "semver";
   };
 }
diff --git a/pkgs/development/tools/misc/texinfo/6.8.nix b/pkgs/development/tools/misc/texinfo/6.8.nix
index 11435bf329f66..992f695bc92ca 100644
--- a/pkgs/development/tools/misc/texinfo/6.8.nix
+++ b/pkgs/development/tools/misc/texinfo/6.8.nix
@@ -1,4 +1,8 @@
 import ./common.nix {
   version = "6.8";
   sha256 = "1i7yb7mrp3inz25zbzv2pllr4y7d58v818f1as7iz8mw53nm7dwf";
+  patches = [
+    # glibc 2.34 compat
+    ./fix-glibc-2.34.patch
+  ];
 }
diff --git a/pkgs/development/tools/misc/texinfo/common.nix b/pkgs/development/tools/misc/texinfo/common.nix
index b379df09a4b06..26732657eb9f5 100644
--- a/pkgs/development/tools/misc/texinfo/common.nix
+++ b/pkgs/development/tools/misc/texinfo/common.nix
@@ -1,4 +1,4 @@
-{ version, sha256 }:
+{ version, sha256, patches ? [] }:
 
 { lib, stdenv, buildPackages, fetchurl, perl, xz, gettext
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     inherit sha256;
   };
 
-  patches = optional crossBuildTools ./cross-tools-flags.patch;
+  patches = patches ++ optional crossBuildTools ./cross-tools-flags.patch;
 
   # ncurses is required to build `makedoc'
   # this feature is introduced by the ./cross-tools-flags.patch
diff --git a/pkgs/development/tools/misc/texinfo/fix-glibc-2.34.patch b/pkgs/development/tools/misc/texinfo/fix-glibc-2.34.patch
new file mode 100644
index 0000000000000..60f2e63b7ce03
--- /dev/null
+++ b/pkgs/development/tools/misc/texinfo/fix-glibc-2.34.patch
@@ -0,0 +1,186 @@
+
+Patch by Vitezslav Crhonek <vcrhonek@redhat.com>
+Source: https://src.fedoraproject.org/rpms/texinfo/c/9b2cca4817fa4bd8d520fed05e9560fc7183dcdf?branch=rawhide
+
+diff -up texinfo-6.8/gnulib/lib/cdefs.h.orig texinfo-6.8/gnulib/lib/cdefs.h
+--- texinfo-6.8/gnulib/lib/cdefs.h.orig	2021-03-11 19:57:53.000000000 +0100
++++ texinfo-6.8/gnulib/lib/cdefs.h	2021-07-19 12:26:46.985176475 +0200
+@@ -321,15 +321,15 @@
+ 
+ /* The nonnull function attribute marks pointer parameters that
+    must not be NULL.  */
+-#ifndef __attribute_nonnull__
++#ifndef __nonnull
+ # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
+-#  define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
++#  define __nonnull(params) __attribute__ ((__nonnull__ params))
+ # else
+-#  define __attribute_nonnull__(params)
++#  define __nonnull(params)
+ # endif
+-#endif
+-#ifndef __nonnull
+-# define __nonnull(params) __attribute_nonnull__ (params)
++#elif !defined __GLIBC__
++# undef __nonnull
++# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
+ #endif
+ 
+ /* If fortification mode, we warn about unused results of certain
+diff -up texinfo-6.8/gnulib/lib/libc-config.h.orig texinfo-6.8/gnulib/lib/libc-config.h
+--- texinfo-6.8/gnulib/lib/libc-config.h.orig	2021-03-11 19:57:54.000000000 +0100
++++ texinfo-6.8/gnulib/lib/libc-config.h	2021-07-19 12:27:58.810590975 +0200
+@@ -33,9 +33,9 @@
+ #include <config.h>
+ 
+ /* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
+-   _FEATURES_H, __WORDSIZE, and __set_errno.  On FreeBSD 11 and
+-   DragonFlyBSD 5.9 it includes <sys/cdefs.h> which defines __nonnull.
+-   Elsewhere it is harmless.  */
++   _FEATURES_H, __WORDSIZE, and __set_errno.  On FreeBSD 11 it
++   includes <sys/cdefs.h> which defines __nonnull.  Elsewhere it
++   is harmless.  */
+ #include <errno.h>
+ 
+ /* From glibc <errno.h>.  */
+diff -up texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c.orig texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c
+--- texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c.orig	2021-03-11 19:57:54.000000000 +0100
++++ texinfo-6.8/gnulib/lib/malloc/dynarray-skeleton.c	2021-07-19 12:24:46.878419397 +0200
+@@ -192,7 +192,7 @@ DYNARRAY_NAME (free__array__) (struct DY
+ 
+ /* Initialize a dynamic array object.  This must be called before any
+    use of the object.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static void
+ DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -202,7 +202,7 @@ DYNARRAY_NAME (init) (struct DYNARRAY_ST
+ }
+ 
+ /* Deallocate the dynamic array and its elements.  */
+-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __nonnull ((1))
+ static void
+ DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
+ {
+@@ -213,7 +213,7 @@ DYNARRAY_FREE (struct DYNARRAY_STRUCT *l
+ }
+ 
+ /* Return true if the dynamic array is in an error state.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline bool
+ DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
+ {
+@@ -222,7 +222,7 @@ DYNARRAY_NAME (has_failed) (const struct
+ 
+ /* Mark the dynamic array as failed.  All elements are deallocated as
+    a side effect.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static void
+ DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -236,7 +236,7 @@ DYNARRAY_NAME (mark_failed) (struct DYNA
+ 
+ /* Return the number of elements which have been added to the dynamic
+    array.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline size_t
+ DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
+ {
+@@ -245,7 +245,7 @@ DYNARRAY_NAME (size) (const struct DYNAR
+ 
+ /* Return a pointer to the array element at INDEX.  Terminate the
+    process if INDEX is out of bounds.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline DYNARRAY_ELEMENT *
+ DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
+ {
+@@ -257,7 +257,7 @@ DYNARRAY_NAME (at) (struct DYNARRAY_STRU
+ /* Return a pointer to the first array element, if any.  For a
+    zero-length array, the pointer can be NULL even though the dynamic
+    array has not entered the failure state.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline DYNARRAY_ELEMENT *
+ DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -267,7 +267,7 @@ DYNARRAY_NAME (begin) (struct DYNARRAY_S
+ /* Return a pointer one element past the last array element.  For a
+    zero-length array, the pointer can be NULL even though the dynamic
+    array has not entered the failure state.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline DYNARRAY_ELEMENT *
+ DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -294,7 +294,7 @@ DYNARRAY_NAME (add__) (struct DYNARRAY_S
+ /* Add ITEM at the end of the array, enlarging it by one element.
+    Mark *LIST as failed if the dynamic array allocation size cannot be
+    increased.  */
+-__attribute_nonnull__ ((1))
++__nonnull ((1))
+ static inline void
+ DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
+ {
+@@ -348,8 +348,7 @@ DYNARRAY_NAME (emplace__) (struct DYNARR
+ /* Allocate a place for a new element in *LIST and return a pointer to
+    it.  The pointer can be NULL if the dynamic array cannot be
+    enlarged due to a memory allocation failure.  */
+-__attribute_maybe_unused__ __attribute_warn_unused_result__
+-__attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1))
+ static
+ /* Avoid inlining with the larger initialization code.  */
+ #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE))
+@@ -373,7 +372,7 @@ DYNARRAY_NAME (emplace) (struct DYNARRAY
+    existing size, new elements are added (which can be initialized).
+    Otherwise, the list is truncated, and elements are freed.  Return
+    false on memory allocation failure (and mark *LIST as failed).  */
+-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __nonnull ((1))
+ static bool
+ DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
+ {
+@@ -418,7 +417,7 @@ DYNARRAY_NAME (resize) (struct DYNARRAY_
+ }
+ 
+ /* Remove the last element of LIST if it is present.  */
+-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __nonnull ((1))
+ static void
+ DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -435,7 +434,7 @@ DYNARRAY_NAME (remove_last) (struct DYNA
+ 
+ /* Remove all elements from the list.  The elements are freed, but the
+    list itself is not.  */
+-__attribute_maybe_unused__ __attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __nonnull ((1))
+ static void
+ DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
+ {
+@@ -453,8 +452,7 @@ DYNARRAY_NAME (clear) (struct DYNARRAY_S
+    stored in *RESULT if LIST refers to an empty list.  On success, the
+    pointer in *RESULT is heap-allocated and must be deallocated using
+    free.  */
+-__attribute_maybe_unused__ __attribute_warn_unused_result__
+-__attribute_nonnull__ ((1, 2))
++__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1, 2))
+ static bool
+ DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
+                           DYNARRAY_FINAL_TYPE *result)
+@@ -485,8 +483,7 @@ DYNARRAY_NAME (finalize) (struct DYNARRA
+    have a sentinel at the end).  If LENGTHP is not NULL, the array
+    length is written to *LENGTHP.  *LIST is re-initialized and can be
+    reused.  */
+-__attribute_maybe_unused__ __attribute_warn_unused_result__
+-__attribute_nonnull__ ((1))
++__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1))
+ static DYNARRAY_ELEMENT *
+ DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp)
+ {