summaryrefslogtreecommitdiff
path: root/dev-util/debugedit/files/debugedit-5.0-readelf.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/debugedit/files/debugedit-5.0-readelf.patch')
-rw-r--r--dev-util/debugedit/files/debugedit-5.0-readelf.patch330
1 files changed, 330 insertions, 0 deletions
diff --git a/dev-util/debugedit/files/debugedit-5.0-readelf.patch b/dev-util/debugedit/files/debugedit-5.0-readelf.patch
new file mode 100644
index 000000000000..547b68710324
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.0-readelf.patch
@@ -0,0 +1,330 @@
+From 56e41d7c716a3657bdcce05146f7509d8a4e4a74 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sun, 1 Aug 2021 21:15:35 +0100
+Subject: [PATCH] use $READELF, not readelf
+
+Allow user to specify own readelf. Use detected readelf,
+not 'readelf'.
+
+Noticed as a set of test failures on system with only
+$host-prefixed tools:
+
+ debugedit/tests/testsuite.dir/at-groups/4/test-source:
+ line 40: readelf: command not found
+
+ * configure.ac: Add READELF user override.
+ * scripts/find-debuginfo.in: Use @READELF@ instead of 'readelf'.
+ * tests/atlocal.in: Populate READELF variable detected by configure.
+ * tests/debugedit.at: Use $READELF instad of 'readelf' in tests.
+ * Makefile.am (do_subst): Add READELF substitution.
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ Makefile.am | 3 ++-
+ configure.ac | 1 +
+ scripts/find-debuginfo.in | 2 +-
+ tests/atlocal.in | 1 +
+ tests/debugedit.at | 54 +++++++++++++++++++--------------------
+ 5 files changed, 32 insertions(+), 29 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 98b2f20..2060b96 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -32,7 +32,8 @@ CLEANFILES = $(bin_SCRIPTS)
+
+ # Some standard substitutions for scripts
+ do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
+- -e 's,[@]VERSION[@],$(VERSION),g')
++ -e 's,[@]VERSION[@],$(VERSION),g' \
++ -e 's,[@]READELF[@],$(READELF),g')
+
+ find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile
+ $(do_subst) < "$(top_srcdir)/scripts/$@.in" > "$@"
+diff --git a/configure.ac b/configure.ac
+index 85f2c4f..e5c9230 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,6 +44,7 @@ AC_PROG_SED
+ AC_PROG_CC_C99
+ AC_PROG_LN_S
+ AC_CHECK_TOOL([LD], [ld])
++AC_CHECK_TOOL([READELF], [readelf])
+ AM_MISSING_PROG(HELP2MAN, help2man)
+
+ # Only really an issue on 32bit platforms. Makes sure we'll get large off_t.
+diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
+index 8b9ce77..9c0a735 100755
+--- a/scripts/find-debuginfo.in
++++ b/scripts/find-debuginfo.in
+@@ -338,7 +338,7 @@ add_minidebug()
+ # symbol and NOBITS sections so cannot use --keep-only because that is
+ # too aggressive. Field $2 is the section name, $3 is the section type
+ # and $8 are the section flags.
+- local remove_sections=`readelf -W -S "$debuginfo" \
++ local remove_sections=`@READELF@ -W -S "$debuginfo" \
+ | awk '{ if (index($2,".debug_") != 1 \
+ && ($3 == "PROGBITS" || $3 == "NOTE" || $3 == "NOBITS") \
+ && index($8,"A") == 0) \
+diff --git a/tests/atlocal.in b/tests/atlocal.in
+index 0eec351..8399f8d 100644
+--- a/tests/atlocal.in
++++ b/tests/atlocal.in
+@@ -9,6 +9,7 @@ CC="@CC@"
+ CFLAGS=""
+ LD="@LD@"
+ LDFLAGS=""
++READELF="@READELF@"
+
+ GDWARF_5_FLAG=@GDWARF_5_FLAG@
+ GZ_NONE_FLAG=@GZ_NONE_FLAG@
+diff --git a/tests/debugedit.at b/tests/debugedit.at
+index 608b1d0..0311d26 100644
+--- a/tests/debugedit.at
++++ b/tests/debugedit.at
+@@ -93,7 +93,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
+ | grep ^$(pwd) | sort \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+
+@@ -108,7 +108,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
++$READELF -p.debug_str foo.o subdir_bar/bar.o baz.o | cut -c13- \
+ | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+
+@@ -125,7 +125,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
+ | cut -c13- \
+ | grep ^$(pwd) | sort | uniq \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+@@ -141,7 +141,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
++$READELF -p.debug_str -p.debug_line_str foo.o subdir_bar/bar.o baz.o \
+ | cut -c13- \
+ | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+@@ -160,7 +160,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+ # (and replace that textually with /foo/bar/baz)
+ # Note that partially linked files, might have multiple duplicate
+ # strings, but debugedit will merge them. So use sort -u.
+-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \
+ | grep ^$(pwd) | sort -u \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+
+@@ -173,7 +173,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf -p.debug_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str ./foobarbaz.part.o | cut -c13- \
+ | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+
+@@ -192,7 +192,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+ # (and replace that textually with /foo/bar/baz)
+ # Note that partially linked files, might have multiple duplicate
+ # strings, but debugedit will merge them. So use sort -u.
+-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
+ | grep ^$(pwd) | sort -u | uniq \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+
+@@ -205,7 +205,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str ./foobarbaz.part.o | cut -c13- \
+ | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+
+@@ -221,7 +221,7 @@ DEBUGEDIT_SETUP([-gdwarf-4])
+
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str foobarbaz.exe | cut -c13- \
+ | grep ^$(pwd) | sort \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+
+@@ -235,7 +235,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf -p.debug_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str foobarbaz.exe | cut -c13- \
+ | grep ^/foo/bar/baz | sort
+ ]],[0],[expout])
+
+@@ -252,7 +252,7 @@ DEBUGEDIT_SETUP([-gdwarf-5])
+
+ # Capture strings that start with the testdir (pwd) directory path
+ # (and replace that textually with /foo/bar/baz)
+-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
+ | grep ^$(pwd) | sort | uniq \
+ | sed -e "s@$(pwd)@/foo/bar/baz@" > expout
+
+@@ -266,7 +266,7 @@ fi
+ # Check the replaced strings are all there.
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
++$READELF -p.debug_str -p.debug_line_str foobarbaz.exe | cut -c13- \
+ | grep ^/foo/bar/baz | sort | uniq
+ ]],[0],[expout],[ignore])
+
+@@ -305,7 +305,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf --debug-dump=info foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=info foo.o subdir_bar/bar.o baz.o \
+ | grep -E 'DW_AT_(name|comp_dir)' \
+ | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+@@ -328,7 +328,7 @@ AT_DATA([expout],
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.part.o \
++$READELF --debug-dump=info ./foobarbaz.part.o \
+ | grep -E 'DW_AT_(name|comp_dir)' \
+ | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+@@ -351,7 +351,7 @@ AT_DATA([expout],
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \
++$READELF --debug-dump=info ./foobarbaz.exe | grep -E 'DW_AT_(name|comp_dir)' \
+ | rev | cut -d: -f1 | rev | cut -c2- | grep ^/foo/bar/baz | sort -u
+ ]],[0],[expout])
+
+@@ -385,7 +385,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+ for i in ./foo.o ./subdir_bar/bar.o ./baz.o;do \
+- readelf --debug-dump=info $i \
++ $READELF --debug-dump=info $i \
+ | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+ | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+ | sort;
+@@ -415,7 +415,7 @@ stz
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.part.o \
++$READELF --debug-dump=info ./foobarbaz.part.o \
+ | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+ | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+ | sort
+@@ -444,7 +444,7 @@ stz
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=info ./foobarbaz.exe \
++$READELF --debug-dump=info ./foobarbaz.exe \
+ | awk '/Abbrev Number:.*DW_TAG_type_unit/{p=1}{if(p)print}/^$/{p=0}' \
+ | sed -n 's/^.*> *DW_AT_name *:.* \(stringp[^ ]*\|st.\)$/\1/p' \
+ | sort
+@@ -474,7 +474,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \
+ | grep -A3 "The Directory Table" | grep "^ [123]" \
+ | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -499,7 +499,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \
+ | grep -A5 "The Directory Table" | grep "^ [123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort
+ ]],[0],[expout])
+@@ -521,7 +521,7 @@ AT_DATA([expout],
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.part.o \
++$READELF --debug-dump=line ./foobarbaz.part.o \
+ | grep -A3 "The Directory Table" | grep "^ [123]" \
+ | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -544,7 +544,7 @@ foo/bar/baz/subdir_headers
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.part.o \
++$READELF --debug-dump=line ./foobarbaz.part.o \
+ | grep -A5 "The Directory Table" | grep "^ [123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort
+ ]],[0],[expout])
+@@ -566,7 +566,7 @@ AT_DATA([expout],
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.exe \
++$READELF --debug-dump=line ./foobarbaz.exe \
+ | grep -A3 "The Directory Table" | grep "^ [123]" \
+ | grep /foo/ | cut -c5- | sort
+ ]],[0],[expout])
+@@ -589,7 +589,7 @@ foo/bar/baz/subdir_headers
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=line ./foobarbaz.exe \
++$READELF --debug-dump=line ./foobarbaz.exe \
+ | grep -A5 "The Directory Table" | grep "^ [123]" \
+ | cut -f2- -d/ | grep ^foo/ | sort
+ ]],[0],[expout])
+@@ -615,7 +615,7 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
+ AT_CHECK([[
+-readelf --debug-dump=macro foo.o subdir_bar/bar.o baz.o \
++$READELF --debug-dump=macro foo.o subdir_bar/bar.o baz.o \
+ | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+
+@@ -638,7 +638,7 @@ NUMBER 42
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
+ AT_CHECK([[
+-readelf --debug-dump=macro ./foobarbaz.part.o \
++$READELF --debug-dump=macro ./foobarbaz.part.o \
+ | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+
+@@ -661,7 +661,7 @@ NUMBER 42
+
+ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
+ AT_CHECK([[
+-readelf --debug-dump=macro ./foobarbaz.exe \
++$READELF --debug-dump=macro ./foobarbaz.exe \
+ | grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
+ ]],[0],[expout])
+
+--
+2.27.0
+