[PATCH for PR20823] fix invalid "tail +16c"

Alan Modra amodra@gmail.com
Mon Nov 21 11:00:00 GMT 2016


On Sat, Nov 19, 2016 at 05:00:00PM +0800, ma.jiang@zte.com.cn wrote:
> Hi all,
>   There are some "tail +16c"  which is invalid now in binutils configure 
> system. "tail" now treat operands with leading '+' as file names, as POSIX 
> has required since 2001.  all "tail +16c" should be changed to "tail -c 
> +16". Ok for trunk?

I think what we should do first is fix the gas Makefile to use the
config/acx.m4 comparison.  Then fixing the "tail" args is just a
matter of changing acx.m4 and regenerating configure and Makefile.in
files.

Now config/acx.m4 is under control of the gcc project, so you should
submit a patch with ChangeLog to gcc-patches@gcc.gnu.org.  Note that
regenerated files are not normally posted, but the ChangeLog should
mention the files that need regenerating in the gcc progect as I've
done below for the gas change.  We'll then import acx.m4 from gcc to
the binutils repository and regenerate binutils files, assuming the
gcc change is accepted.

	* configure.ac: Invoke ACX_PROG_CMP_IGNORE_INITIAL.
	* Makefile.am (comparison): Rewrite using do_compare.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.

diff --git a/gas/configure.ac b/gas/configure.ac
index c0d5989..b830d9e 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -40,6 +40,7 @@ AC_USE_SYSTEM_EXTENSIONS
 
 LT_INIT
 ACX_LARGEFILE
+ACX_PROG_CMP_IGNORE_INITIAL
 
 AC_ARG_ENABLE(targets,
 [  --enable-targets        alternative target configurations besides the primary],
diff --git a/gas/Makefile.am b/gas/Makefile.am
index cdaf9f5..cac7c7f 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -667,21 +667,15 @@ stage3:
 
 against=stage2
 
-# This rule is derived from corresponding code in the Makefile.in for gcc.
-# The "tail +16c" is to bypass headers which may include timestamps or
-# temporary assembly file names.
 comparison:
 	x=0 ; \
 	for file in *.@OBJEXT@ ; do \
-	  tail +16c ./$$file > tmp-foo1; \
-	  if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
-	    if cmp tmp-foo1 tmp-foo2 ; then \
-	      true ; \
-	    else \
-	      echo $$file differs ; \
-	      x=1 ; \
-	    fi ; \
-	  else true; fi ; \
+	  f1=./$$file; f2=${against}/$$file; \
+	  $(do_compare) > /dev/null 2>&1; \
+	  if test $$? -ne 0; then \
+	    echo $$file differs ; \
+	    x=1 ; \
+	  fi ; \
 	done ; \
 	exit $$x
 	-rm -f tmp-foo*

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list