[PATCH] use $READELF, not readelf

Mark Wielaard mark@klomp.org
Sun Aug 1 21:30:04 GMT 2021


Hi Sergei,

On Sun, Aug 01, 2021 at 09:15:35PM +0100, Sergei Trofimovich wrote:
> 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.

Good idea. I applied it with two small fixups.
We really need tests for the find-debuginfo script.
There was a typo in the substution name.
And the scripts use a special Makefile rule to do the substitutions.

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/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
index 34f62ed..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=`@REAADELF@ -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) \

Thanks,

Mark


More information about the Debugedit mailing list