Subject: [bug#38803] [PATCH] gnu: elfutils: Update to 0.178

From: Mark Wielaard <[email-masked]>
Date: Mon, 13 Jan 2020 01:03:45 +0100

Hi,

On Sun, Jan 12, 2020 at 09:54:52PM +0100, Marius Bakke wrote:
> Mark Wielaard <[email-masked]> writes:
> 
> > This introduces debuginfod support which requires a couple of new inputs.
> >
> > * gnu/local.ml (dist_patch_DATA): Remove elfutils-tests-ptrace.patch.
> >   Add elfutils-0.178-tests-build-id.patch.
> > * gnu/packages/elf.scm (elfutils): Update to 0.178
> >   [native-inputs]: Add iproute and pkg-config.
> >   [inputs]: Add cpio, libarchive, libmicrohttpd, libcurl, rpm and sqlite.
> >   [synopsis]: Updated.
> >   [description]: Updated.
> >   [license]: List all licenses used.
> > * gnu/packages/patches/elfutils-tests-ptrace.patch: Removed. Fixed upstream.
> > * gnu/packages/patches/elfutils-0.178-tests-build-id.patch: New. Patches
> >   backported from upstream git.
> 
> Thank you for these improvements.  Could you submit the synopsis and
> description update separately?

Sure. Split patch as attached.

> I worry about all the new inputs.  This patch effectively makes us
> unable to update all these inputs outside of the 'staging' or
> 'core-updates' cycles.

I am not sure I follow. This is my first patch.  It simply adds some
inputs needed for a new client/server program added upstream in the
new version.

> What is the difference in 'guix size elfutils' with and without this
> patch?

$ guix size elfutils
store item                                                       total    self
/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29              37.4    35.8  47.2%
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib           70.0    32.6  43.0%
/gnu/store/w0c5bcygj73chk2f6h0g8zhzpm80p1a5-elfutils-0.176          75.8     3.2   4.2%
/gnu/store/cp72ncw4prnsga65n3pzll07hpsg524f-bash-static-5.0.7        1.6     1.6   2.1%
/gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7      38.4     1.0   1.4%
/gnu/store/lbip9isk25isymvnb159l115xnacb5j8-xz-5.2.4                72.0     0.9   1.2%
/gnu/store/l86azr7r3p5631wj3kk329jl1y1mpjgy-bzip2-1.0.6             71.5     0.4   0.5%
/gnu/store/qx7p7hiq90mi7r78hcr9cyskccy2j4bg-zlib-1.2.11             70.2     0.2   0.3%
total: 75.8 MiB

$ ./pre-inst-env guix size elfutils
store item                                                       total    self
/gnu/store/1mkkv2caiqbdbbd256c4dirfi4kwsacv-guile-2.2.6            123.9    44.4  22.7%
/gnu/store/352q0n1rrymfdk49mfr0cym3d8svz824-icu4c-64.2             108.6    37.5  19.2%
/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29              37.4    35.8  18.3%
/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib           70.0    32.6  16.7%
/gnu/store/k2m4q2av9hw73hw2jx6qrxqdyh855398-openssl-1.1.1c          76.4     6.4   3.3%
/gnu/store/hfvz18igm68p5yz7z4asn6ph363blp1z-gnutls-3.6.9           130.6     5.1   2.6%
/gnu/store/slvjkd3brr6n554r2gk9djsjpm7l7xbs-bdb-5.3.28              74.4     4.4   2.2%
/gnu/store/4rs159kgsa0l1svi5vbvn86in7z28bpl-mit-krb5-1.17           75.3     4.3   2.2%
/gnu/store/bjxd9jzc560d6i3i35f5yy5mljk0ib6m-openldap-2.4.47        188.5     3.7   1.9%
/gnu/store/w8qacdh5fqrzn08wz3n43d0czi00c4c6-elfutils-0.178         195.8     3.6   1.9%
/gnu/store/y7qk8raalgvdnxcglvxa320cfxrjk1x6-gmp-6.1.2               72.6     2.6   1.3%
/gnu/store/nsikjxykcaqa0zjpfmkqd569bngbv5nl-libunistring-0.9.10     72.4     2.4   1.2%
/gnu/store/cp72ncw4prnsga65n3pzll07hpsg524f-bash-static-5.0.7        1.6     1.6   0.8%
/gnu/store/i1cqaixp79vd3qwnyj1ll10pq6skm2wk-pkg-config-0.29.2       71.3     1.3   0.7%
/gnu/store/3xs3dnc28p9fi8in7hkfcdx20incrdvq-libgc-7.6.12            71.9     1.2   0.6%
/gnu/store/29jhbbg1hf557x8j53f9sxd9imlmf02a-bash-minimal-5.0.7      38.4     1.0   0.5%
/gnu/store/4m8dlhrzis07787xznx73ang35c3lly1-curl-7.65.3            190.8     1.0   0.5%
/gnu/store/lbip9isk25isymvnb159l115xnacb5j8-xz-5.2.4                72.0     0.9   0.5%
/gnu/store/lvnybsygfd6gya6xbdv48g72lb0iqqzx-nettle-3.5.1            73.5     0.9   0.5%
/gnu/store/f8aljw2qhv3d1br9czn8v5afbgfdrxkg-cyrus-sasl-2.1.27       83.3     0.9   0.4%
/gnu/store/2792g0vczwsxnvqm9ja5g9hwvbrjlc4w-gdbm-1.18.1             70.7     0.7   0.4%
/gnu/store/bvpnq3alwbavyk4663j4p9x9hakxwc4d-libatomic-ops-7.6.10     0.7     0.7   0.4%
/gnu/store/33f8qhxa69dmd43yqdx3wq1b2hqjddgb-curl-7.65.3-doc          0.7     0.7   0.3%
/gnu/store/7gabmw9siqrz79slpi1f8i90v3w1638x-libidn2-2.2.0           72.8     0.5   0.2%
/gnu/store/l86azr7r3p5631wj3kk329jl1y1mpjgy-bzip2-1.0.6             71.5     0.4   0.2%
/gnu/store/zavdh2z5mwkakjf1v98x43w1hzjzxkhl-nghttp2-1.39.1-lib      70.4     0.4   0.2%
/gnu/store/qx7p7hiq90mi7r78hcr9cyskccy2j4bg-zlib-1.2.11             70.2     0.2   0.1%
/gnu/store/lwz8fygpmmsw6h8vrllr56p7ssi5qx33-libtasn1-4.14           70.2     0.2   0.1%
/gnu/store/zasz52va238yyaq68rjm8ljwl4ikij4p-libltdl-2.4.6           70.2     0.2   0.1%
/gnu/store/ain96mrdwqd4s9shdd3s7m4syp5icdx5-libffi-3.2.1            70.1     0.1   0.1%
total: 195.8 MiB

> Would it make sense to have a separate 'elfutils-minimal' for use in
> Mesa, and expose the debuginfod-enabled variant as a separate package?
> We could "hide" the minimal variant so that end users get the expected
> package.

Sure. Other distros split elfutils into multiple packages. For example fedora has:

%package libs
%package devel
%package devel-static
%package libelf
%package libelf-devel
%package libelf-devel-static
%package default-yama-scope
%package debuginfod-client
%package debuginfod-client-devel
%package debuginfod

With the main elfutils package containing all binaries except for
debuginfod-find (the client) and debuginfod (the server). With
appropriate requires/recommends (I don't yet know how those work in
guix).

> Also, for the patches, please add links to upstream commits in the patch
> files, see some of the other patches for examples.  I would also prefer
> if they were separate files, seeing as the two commits do different
> things.

OK split in two. The tests patches are together, because they do the
same thing. I am not sure an upstream git commit id link is better
than simply the commit id, but added if it is more convenient.

Cheers,

Mark

>From 2f75d90d59542fdc31bb9cc4d477eb90c7986e99 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <[email-masked]>
Date: Sun, 12 Jan 2020 23:54:18 +0100
Subject: [PATCH 1/2] gnu: elfutils: Update synopsis and description

* gnu/packages/elf.scm (elfutils): Update summaries.
  [synopsis]: Updated.
  [description]: Updated.
---
 gnu/packages/elf.scm | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index 75caa54296..01bf0fcf89 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2017 Leo Famulari <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Marius Bakke <[email-masked]>
+;;; Copyright © 2020 Mark Wielaard <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -54,9 +55,10 @@
     (build-system gnu-build-system)
 
     ;; Separate programs because that's usually not what elfutils users want,
-    ;; and because they duplicate what Binutils provides.
+    ;; and because they duplicate what Binutils proAvides (but are named
+    ;; differently, using the eu- prefix and can be installed in parallel).
     (outputs '("out"                           ; libelf.so, elfutils/*.h, etc.
-               "bin"))                         ; ld, nm, objdump, etc.
+               "bin"))                         ; eu-nm, eu-objdump, etc.
 
     (arguments
      ;; Programs don't have libelf.so in their RUNPATH and libraries don't
@@ -84,11 +86,21 @@
     (native-inputs `(("m4" ,m4)))
     (inputs `(("zlib" ,zlib)))
     (home-page "https://sourceware.org/elfutils/")
-    (synopsis "Linker and ELF manipulation tools")
+    (synopsis "Collection of utilities and libraries to handle ELF files and
+DWARF data")
     (description
-     "This package provides command-line tools to manipulate binaries in the
-Executable and Linkable Format (@dfn{ELF}).  This includes @command{ld},
-@command{ar}, @command{objdump}, @command{addr2line}, and more.")
+     "A collection of utilities and libraries to read, create and modify
+Executable and Linkable Format (@dfn{ELF}) binary files, find and handle
+Debugging With Arbitrary Record Formats (@dfn{DWARF}) debug data, symbols,
+thread state and stacktraces for processes and core files on GNU/Linux.
+Includes @file{libelf} for manipulating ELF files, @file{libdw} for inspecting
+DWARF data and process state and utilities like @command{eu-stack} (to show
+backtraces), @command{eu-nm} (for listing symbols from object files),
+@command{eu-size} (for listing the section sizes of an object or archive
+file), @command{eu-strip} (for discarding symbols), @command{eu-readelf} (to
+see the raw ELF file structures), @command{eu-elflint} (to check for
+well-formed ELF files), @command{eu-elfcompress} (to compress or decompress
+ELF sections), and more.")
 
     ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
     (license lgpl3+)))
-- 
2.20.1

>From f3573f3ce83dad4958673ded37fc44607c9fd910 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <[email-masked]>
Date: Mon, 13 Jan 2020 00:55:10 +0100
Subject: [PATCH 2/2] gnu: elfutils: Update to 0.178

This introduces debuginfod support which requires a couple of new inputs.

* gnu/local.ml (dist_patch_DATA): Remove elfutils-tests-ptrace.patch.
  Add elfutils-0.178-tests.patch and elfutils-0.178-build-id.patch.
* gnu/packages/elf.scm (elfutils): Update to 0.178
  [native-inputs]: Add iproute and pkg-config.
  [inputs]: Add cpio, libarchive, libmicrohttpd, libcurl, rpm and sqlite.
  [license]: List all licenses used.
* gnu/packages/patches/elfutils-tests-ptrace.patch: Removed. Fixed upstream.
* gnu/packages/patches/elfutils-0.178-tests-build-id.patch: New. Patches
  backported from upstream git.
* gnu/packages/patches/elfutils-0.178-build-id.patch: Likewise.
---
 gnu/local.mk                                  |   3 +-
 gnu/packages/elf.scm                          |  29 +++--
 .../patches/elfutils-0.178-build-id.patch     | 102 ++++++++++++++++++
 .../patches/elfutils-0.178-tests.patch        |  63 +++++++++++
 .../patches/elfutils-tests-ptrace.patch       |  64 -----------
 5 files changed, 190 insertions(+), 71 deletions(-)
 create mode 100644 gnu/packages/patches/elfutils-0.178-build-id.patch
 create mode 100644 gnu/packages/patches/elfutils-0.178-tests.patch
 delete mode 100644 gnu/packages/patches/elfutils-tests-ptrace.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 33cf439870..2d64b483ee 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -813,7 +813,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/dstat-skip-devices-without-io.patch	\
   %D%/packages/patches/dvd+rw-tools-add-include.patch 		\
   %D%/packages/patches/einstein-build.patch			\
-  %D%/packages/patches/elfutils-tests-ptrace.patch		\
+  %D%/packages/patches/elfutils-0.178-tests.patch		\
+  %D%/packages/patches/elfutils-0.178-build-id.patch		\
   %D%/packages/patches/elixir-path-length.patch			\
   %D%/packages/patches/elm-compiler-disable-reactor.patch	\
   %D%/packages/patches/elm-compiler-fix-map-key.patch		\
diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index 01bf0fcf89..05068c00a1 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -28,30 +28,39 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
-  #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
+  #:use-module ((guix licenses) #:select (gpl2+ gpl3+ lgpl3+ lgpl2.0+ fdl1.3+))
   #:use-module (gnu packages)
+  #:use-module (gnu packages backup)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpio)
+  #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gnunet) ; for libmicrohttpd
+  #:use-module (gnu packages linux)  ; for iproute
   #:use-module (gnu packages m4)
+  #:use-module (gnu packages package-management) ; for rpm
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages sphinx)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xml))
 
 (define-public elfutils
   (package
     (name "elfutils")
-    (version "0.176")
+    (version "0.178")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://sourceware.org/elfutils/ftp/"
                                   version "/elfutils-" version ".tar.bz2"))
               (sha256
                (base32
-                "08qhrl4g6qqr4ga46jhh78y56a47p3msa5b2x1qhzbxhf71lfmzb"))
-              (patches (search-patches "elfutils-tests-ptrace.patch"))))
+                "1wm0yfcih4rjwbg59qgm4jyqmbsdmk6z5qajljyw9sfljq7a1rri"))
+              (patches (search-patches "elfutils-0.178-tests.patch"
+                                       "elfutils-0.178-build-id.patch"))))
     (build-system gnu-build-system)
 
     ;; Separate programs because that's usually not what elfutils users want,
@@ -83,8 +92,16 @@
                (("run-backtrace-native.sh") ""))
              #t)))))
 
-    (native-inputs `(("m4" ,m4)))
-    (inputs `(("zlib" ,zlib)))
+    (native-inputs `(("iproute", iproute) ;; needed in tests for ss
+                     ("m4", m4)
+                     ("pkg-config", pkg-config)))
+    (inputs `(("cpio", cpio)
+              ("libarchive", libarchive)
+              ("libmicrohttpd", libmicrohttpd)
+              ("libcurl", curl)
+              ("rpm", rpm)
+              ("sqlite", sqlite)
+              ("zlib" ,zlib)))
     (home-page "https://sourceware.org/elfutils/")
     (synopsis "Collection of utilities and libraries to handle ELF files and
 DWARF data")
diff --git a/gnu/packages/patches/elfutils-0.178-build-id.patch b/gnu/packages/patches/elfutils-0.178-build-id.patch
new file mode 100644
index 0000000000..099f55d500
--- /dev/null
+++ b/gnu/packages/patches/elfutils-0.178-build-id.patch
@@ -0,0 +1,102 @@
+https://sourceware.org/git/?p=elfutils.git;a=commit;h=cf1b5fe170fa24f32871ef284ff2968c73816f98 
+
+commit cf1b5fe170fa24f32871ef284ff2968c73816f98
+Author: Mark Wielaard <[email-masked]>
+Date:   Fri Dec 6 17:20:00 2019 +0100
+
+    Make sure to always build with build-ids.
+    
+    We really need build-ids for various things.  If the system compiler
+    doesn't generate build-ids warn and generate them anyway for both the
+    binaries and the tests.
+    
+    Signed-off-by: Mark Wielaard <[email-masked]>
+
+diff --git a/configure.ac b/configure.ac
+index 5a2dc373..36a6b6c2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -197,6 +197,15 @@ if test "$ac_cv_zdefs" = "yes"; then
+ 	dso_LDFLAGS="$dso_LDFLAGS $ZDEFS_LDFLAGS"
+ fi
+ 
++# We really want build-ids. Warn and force generating them if gcc was
++# configure without --enable-linker-build-id
++AC_CACHE_CHECK([whether the compiler generates build-ids], ac_cv_buildid, [dnl
++AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; readelf -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))])
++if test "$ac_cv_buildid" = "no"; then
++	AC_MSG_WARN([compiler doesn't generate build-id by default])
++	LDFLAGS="$LDFLAGS -Wl,--build-id"
++fi
++
+ ZRELRO_LDFLAGS="-Wl,-z,relro"
+ AC_CACHE_CHECK([whether gcc supports $ZRELRO_LDFLAGS], ac_cv_zrelro, [dnl
+ save_LDFLAGS="$LDFLAGS"
+diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
+index 6f92fbf1..6533996a 100755
+--- a/tests/run-debuginfod-find.sh
++++ b/tests/run-debuginfod-find.sh
+@@ -101,7 +101,7 @@ export DEBUGINFOD_TIMEOUT=10
+ # cannot find it without debuginfod.
+ echo "int main() { return 0; }" > ${PWD}/prog.c
+ tempfiles prog.c
+-gcc -g -o prog ${PWD}/prog.c
++gcc -Wl,--build-id -g -o prog ${PWD}/prog.c
+ testrun ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog
+ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
+           -a prog | grep 'Build ID' | cut -d ' ' -f 7`
+@@ -138,7 +138,7 @@ cmp $filename  ${PWD}/prog.c
+ # Build another, non-stripped binary
+ echo "int main() { return 0; }" > ${PWD}/prog2.c
+ tempfiles prog2.c
+-gcc -g -o prog2 ${PWD}/prog2.c
++gcc -Wl,--build-id -g -o prog2 ${PWD}/prog2.c
+ BUILDID2=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
+           -a prog2 | grep 'Build ID' | cut -d ' ' -f 7`
+ 
+--- a/configure	1970-01-01 01:00:00.000000000 +0100
++++ b/configure	2019-12-11 14:18:11.812008097 +0100
+@@ -5325,6 +5325,43 @@
+ 	dso_LDFLAGS="$dso_LDFLAGS $ZDEFS_LDFLAGS"
+ fi
+ 
++# We really want build-ids. Warn and force generating them if gcc was
++# configure without --enable-linker-build-id
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler generates build-ids" >&5
++$as_echo_n "checking whether the compiler generates build-ids... " >&6; }
++if ${ac_cv_buildid+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_buildid=yes; readelf -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no
++else
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "unexpected compile failure
++See \`config.log' for more details" "$LINENO" 5; }
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_buildid" >&5
++$as_echo "$ac_cv_buildid" >&6; }
++if test "$ac_cv_buildid" = "no"; then
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler doesn't generate build-id by default" >&5
++$as_echo "$as_me: WARNING: compiler doesn't generate build-id by default" >&2;}
++	LDFLAGS="$LDFLAGS -Wl,--build-id"
++fi
++
+ ZRELRO_LDFLAGS="-Wl,-z,relro"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc supports $ZRELRO_LDFLAGS" >&5
+ $as_echo_n "checking whether gcc supports $ZRELRO_LDFLAGS... " >&6; }
diff --git a/gnu/packages/patches/elfutils-0.178-tests.patch b/gnu/packages/patches/elfutils-0.178-tests.patch
new file mode 100644
index 0000000000..3faeaf4a4f
--- /dev/null
+++ b/gnu/packages/patches/elfutils-0.178-tests.patch
@@ -0,0 +1,63 @@
+https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f445279b60b16b6cb062921b74ae400344b4a68
+
+commit 3f445279b60b16b6cb062921b74ae400344b4a68
+Author: Mark Wielaard <[email-masked]>
+Date:   Thu Dec 5 14:22:56 2019 +0100
+
+    tests: Run elfcompress under testrun in run-elfclassify.sh
+    
+    Otherwise elfcompress might run against the system libelf which might
+    be too old or missing.
+    
+    Signed-off-by: Mark Wielaard <[email-masked]>
+
+diff --git a/tests/run-elfclassify.sh b/tests/run-elfclassify.sh
+index 5a849bbd..fb14139d 100755
+--- a/tests/run-elfclassify.sh
++++ b/tests/run-elfclassify.sh
+@@ -267,7 +267,7 @@ $(echo $kmod_files | sed -e "s/ /\n/g")
+ EOF
+ 
+ echo "gnu compressed kmods are unstripped"
+-${abs_top_builddir}/src/elfcompress -t gnu --force $kmod_files
++testrun ${abs_top_builddir}/src/elfcompress -t gnu --force $kmod_files
+ testrun ${abs_top_builddir}/src/elfclassify --unstripped $kmod_files
+ testrun_compare ${abs_top_builddir}/src/elfclassify --unstripped --print $kmod_files <<EOF
+ $(echo $kmod_files | sed -e "s/ /\n/g")
+@@ -312,7 +312,7 @@ $(echo $debug_files | sed -e "s/ /\n/g")
+ EOF
+ 
+ echo "compress the debug sections and try again"
+-${abs_top_builddir}/src/elfcompress -t gnu --force $debug_files
++testrun ${abs_top_builddir}/src/elfcompress -t gnu --force $debug_files
+ 
+ echo "again unstripped"
+ testrun ${abs_top_builddir}/src/elfclassify --unstripped $debug_files
+
+https://sourceware.org/git/?p=elfutils.git;a=commit;h=eaffa79d52da7454044be53d28b525cebdb0093b
+
+commit eaffa79d52da7454044be53d28b525cebdb0093b
+Author: Mark Wielaard <[email-masked]>
+Date:   Fri Dec 6 15:48:00 2019 +0100
+
+    tests: Run strip under testrun in run-debuginfod-find.sh
+    
+    Otherwise strip might run against the system libelf which might be too
+    old or missing.
+    
+    Signed-off-by: Mark Wielaard <[email-masked]>
+
+diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
+index 0ade03b7..6f92fbf1 100755
+--- a/tests/run-debuginfod-find.sh
++++ b/tests/run-debuginfod-find.sh
+@@ -102,7 +102,7 @@ export DEBUGINFOD_TIMEOUT=10
+ echo "int main() { return 0; }" > ${PWD}/prog.c
+ tempfiles prog.c
+ gcc -g -o prog ${PWD}/prog.c
+- ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog
++testrun ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog
+ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
+           -a prog | grep 'Build ID' | cut -d ' ' -f 7`
+ 
+
diff --git a/gnu/packages/patches/elfutils-tests-ptrace.patch b/gnu/packages/patches/elfutils-tests-ptrace.patch
deleted file mode 100644
index cd46999063..0000000000
--- a/gnu/packages/patches/elfutils-tests-ptrace.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-This patch allows us to skip tests that require PTRACE_ATTACH in situations
-where PTRACE_ATTACH is only allowed when CAP_SYS_PTRACE is held (i.e., for
-root, by default.)
-
-Reported at <https://bugzilla.redhat.com/show_bug.cgi?id=1210966>.
-
---- elfutils-0.161/tests/run-deleted.sh	2015-04-11 16:38:33.028556235 +0200
-+++ elfutils-0.161/tests/run-deleted.sh	2015-04-11 16:46:15.012442185 +0200
-@@ -17,6 +17,15 @@
- 
- . $srcdir/backtrace-subr.sh
- 
-+# Check whether the Yama policy allows us to use PTRACE_ATTACH.
-+if [ -f /proc/sys/kernel/yama/ptrace_scope ]
-+then
-+    if [ `cat /proc/sys/kernel/yama/ptrace_scope` -ne 0 ]
-+    then
-+	exit 77
-+    fi
-+fi
-+
- tempfiles deleted deleted-lib.so
- cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
- 
---- elfutils-0.161/tests/vdsosyms.c	2015-04-11 16:40:20.633461110 +0200
-+++ elfutils-0.161/tests/vdsosyms.c	2015-04-11 16:45:06.611866677 +0200
-@@ -23,6 +23,8 @@
- #include <stdio.h>
- #include <string.h>
- #include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
- #include <unistd.h>
- #include ELFUTILS_HEADER(dwfl)
- 
-@@ -68,6 +70,7 @@ module_callback (Dwfl_Module *mod, void
- int
- main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
- {
-+  static const char ptrace_scope_file[] = "/proc/sys/kernel/yama/ptrace_scope";
-   static char *debuginfo_path;
-   static const Dwfl_Callbacks proc_callbacks =
-     {
-@@ -76,6 +79,20 @@ main (int argc __attribute__ ((unused)),
- 
-       .find_elf = dwfl_linux_proc_find_elf,
-     };
-+
-+  /* Check whether the Yama policy allows us to use PTRACE_ATTACH.  */
-+  int ptrace_scope = open (ptrace_scope_file, O_RDONLY);
-+  if (ptrace_scope >= 0)
-+    {
-+      char buf[10];
-+      int count = read (ptrace_scope, buf, sizeof buf);
-+      assert (count > 0);
-+      if (buf[0] != '0')
-+	/* We're not allowed, so skip this test.  */
-+	return 77;
-+      close (ptrace_scope);
-+    }
-+
-   Dwfl *dwfl = dwfl_begin (&proc_callbacks);
-   if (dwfl == NULL)
-     error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1));
-- 
2.20.1