[PATCH] binutils: Require GNU tail for 'objdump -Wi' test
H.J. Lu
hjl.tools@gmail.com
Sun Sep 7 12:10:40 GMT 2025
testsuite/binutils-all/objdump.exp has
set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]
But the default Solaris tail doesn't support "tail -n +4". Add
ACX_PROG_GNU_TAIL to use GNU tail for 'objdump -Wi' test.
Tested on Linux and Solaris.
binutils/
PR binutils/33396
* Makefile.am (check-DEJAGNU): Also export TAIL.
* Makefile.in: Regenerated.
* aclocal.m4: Likewise.
* configure: Likewise.
* configure.ac: Add ACX_PROG_GNU_TAIL.
* testsuite/binutils-all/objdump.exp: Require GNU tail for
'objdump -Wi' test and replace tail with $env(TAIL).
config/
PR binutils/33396
* acx.m4 (ACX_PROG_GNU_TAIL): New.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
binutils/Makefile.am | 1 +
binutils/Makefile.in | 4 +-
binutils/aclocal.m4 | 1 +
binutils/configure | 50 ++++++++++++++++++++-
binutils/configure.ac | 2 +
binutils/testsuite/binutils-all/objdump.exp | 9 +++-
config/acx.m4 | 13 ++++++
7 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 1528302ea61..f1df54ffcaf 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -208,6 +208,7 @@ check-DEJAGNU: site.exp
r=`pwd`; export r; \
LC_ALL=C; export LC_ALL; \
EXPECT=$(EXPECT); export EXPECT; \
+ TAIL=$(TAIL); export TAIL; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 549b5a361c8..bad324fb118 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -138,7 +138,7 @@ EXTRA_PROGRAMS = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) \
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
- $(top_srcdir)/../bfd/warning.m4 \
+ $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
@@ -573,6 +573,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+TAIL = @TAIL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
@@ -1836,6 +1837,7 @@ check-DEJAGNU: site.exp
r=`pwd`; export r; \
LC_ALL=C; export LC_ALL; \
EXPECT=$(EXPECT); export EXPECT; \
+ TAIL=$(TAIL); export TAIL; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
index eb1433a68bd..5909ff0d361 100644
--- a/binutils/aclocal.m4
+++ b/binutils/aclocal.m4
@@ -1187,6 +1187,7 @@ AC_SUBST([am__untar])
m4_include([../bfd/acinclude.m4])
m4_include([../bfd/warning.m4])
+m4_include([../config/acx.m4])
m4_include([../config/depstand.m4])
m4_include([../config/enable.m4])
m4_include([../config/gettext-sister.m4])
diff --git a/binutils/configure b/binutils/configure
index 6f54be99066..e7fce6858b5 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -656,6 +656,7 @@ zlibdir
DEMANGLER_NAME
EXEEXT_FOR_BUILD
CC_FOR_BUILD
+TAIL
HDEFINES
GENINSRC_NEVER_FALSE
GENINSRC_NEVER_TRUE
@@ -863,6 +864,7 @@ DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
YACC
YFLAGS
+TAIL
ZSTD_CFLAGS
ZSTD_LIBS
MSGPACK_CFLAGS
@@ -1567,6 +1569,8 @@ Some influential environment variables:
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
+ TAIL Location of GNU tail. Defaults to the first GNU version of
+ `tail', `gtail' on PATH.
ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
ZSTD_LIBS linker flags for ZSTD, overriding pkg-config
MSGPACK_CFLAGS
@@ -11081,7 +11085,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11084 "configure"
+#line 11088 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11187,7 +11191,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11190 "configure"
+#line 11194 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14820,6 +14824,48 @@ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU tail" >&5
+$as_echo_n "checking for GNU tail... " >&6; }
+if ${ac_cv_path_TAIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$TAIL"; then
+ ac_path_TAIL_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in tail gtail; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_TAIL="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_TAIL" || continue
+# Check for GNU $ac_path_TAIL
+case `"$ac_path_TAIL" --version 2>&1` in
+*GNU*)
+ ac_cv_path_TAIL=$ac_path_TAIL && ac_path_TAIL_found=:;;
+esac
+
+ $ac_path_TAIL_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_TAIL"; then
+ :
+ fi
+else
+ ac_cv_path_TAIL=$TAIL
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_TAIL" >&5
+$as_echo "$ac_cv_path_TAIL" >&6; }
+ TAIL=$ac_cv_path_TAIL
+
+
# Put a plausible default for CC_FOR_BUILD in Makefile.
if test -z "$CC_FOR_BUILD"; then
if test "x$cross_compiling" = "xno"; then
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 93e8a4b0934..ba1ab4e6d7f 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -180,6 +180,8 @@ AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_INSTALL
+ACX_PROG_GNU_TAIL
+
BFD_CC_FOR_BUILD
DEMANGLER_NAME=c++filt
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index f3142b10442..95c09fe2b9c 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -595,7 +595,14 @@ if { ![is_elf_format] } then {
send_log "\n"
}
- set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]
+ if {![info exists env(TAIL)]} {
+ # If no GNU tail is available, skip this test.
+ verbose "Need GNU tail for 'objdump -Wi' test"
+ untested "objdump -Wi"
+ return
+ }
+
+ set got [remote_exec host "$env(TAIL) -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]
set output [remote_upload host tmpdir/objdump.tail]
if ![file size $output] then {
diff --git a/config/acx.m4 b/config/acx.m4
index db54ccf1c7c..3c4960cedf6 100644
--- a/config/acx.m4
+++ b/config/acx.m4
@@ -684,3 +684,16 @@ export SHELLOPTS
])
fi
])
+
+# ACX_PROG_GNU_TAIL
+# --------------------
+# Check for GNU tail.
+AC_DEFUN([ACX_PROG_GNU_TAIL],
+ [AC_ARG_VAR([TAIL], [Location of GNU tail. Defaults to the first
+ GNU version of `tail', `gtail' on PATH.])
+ AC_CACHE_CHECK([for GNU tail], [ac_cv_path_TAIL],
+ [AC_PATH_PROGS_FEATURE_CHECK([TAIL], [tail gtail],
+ [_AC_PATH_PROG_FLAVOR_GNU([$ac_path_TAIL],
+ [ac_cv_path_TAIL=$ac_path_TAIL && ac_path_TAIL_found=:])])])
+ TAIL=$ac_cv_path_TAIL
+])
--
2.51.0
More information about the Binutils
mailing list