PATCH: binutils without a date is not handled properly without GNU sed

Loren James Rittle rittle@latour.rsch.comm.mot.com
Fri May 16 01:49:00 GMT 2003


In article <20030515021737.N13397@devserv.devel.redhat.com>,
Jakub Jelinek<jakub@redhat.com> writes:

>> $(ld_vers) is later parsed with expr in a manner that tolerates extra
>> dotted numbers after the patch level. [] Permission to apply to mainline?

Thanks for the quick review Jakub and additional comments from Andreas.

> Certainly not, this breaks the test. [] There were binutils
> 2.12.90.0.xx releases which did not have proper hidden support.

Ah, precisely why I posted it for comments instead of assuming my
patch was somehow "obvious".  Sorry I didn't know about those
releases.  I can see your point and since we are unwilling to discuss
the merits or lack thereof of supporting test releases that were
suppose to be killed upon the release of FSF 2.13 (I do assume that
you and binutils developers know better than I on that point; I don't
want to open that can ;-), I will produce another patch given below.

> If your sed cannot handle \|, then you might try to split setting ld_vers
> into all the alternatives (ie. ld_vers=first_alternative;
> test -z "$ld_vers" && ld_vers=second_alternative, etc.).

Since sed commands with multiple -e options are indeed already found
in gcc/configure.in, I will fix the problem using the later
recommendation from Andreas Schwab.

How about this monster instead?  Tested (outside context) to properly
handle all these forms with native GNU sed (Red Hat 7.X) and with
native non-GNU sed (sparc-sun-solaris5.7, i386-unknown-freebsd4.8,
alpha-dec-osf4.0a) (obviously, I invented some version reports):

GNU ld version 2.14
GNU ld version 2.13.2
GNU ld version 2.13.2.1
GNU ld version 2.14 20030513
GNU ld version 2.13.91 20030513
GNU ld version 2.13.91.2 20030513
GNU ld version 2.12.1 [FreeBSD] 2002-07-20
GNU ld version 2.12 [FreeBSD] 2002-07-20
GNU ld version 2.13.2 [FreeBSD] 2002-11-27
GNU ld version 2.13.2.1 [FreeBSD] 2002-11-27

GNU ld version 2.12.90.0.1
GNU ld version 2.12.90.0.1 20030513

Tested in gcc/configure.in context on alpha-unknown-freebsd4.7 where
it fixed the root issue with an FSF binutils version without date report.

Regards,
Loren
	* configure.in (ld_vers): Manually expand sed regexp for portability.
	* configure: Regenerated.

Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.668
diff -c -r1.668 configure.in
*** gcc/configure.in	12 May 2003 22:30:24 -0000	1.668
--- gcc/configure.in	16 May 2003 01:20:56 -0000
***************
*** 1847,1853 ****
  	ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1`
  	if echo "$ld_ver" | grep GNU > /dev/null; then
  changequote(,)dnl
!                ld_vers=`echo $ld_ver | sed -n 's,^.*[  ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\)\([  ].*\|\)$,\1,p'`
                 ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
  		if test 0"$ld_date" -lt 20020404; then
  			if test -n "$ld_date"; then
--- 1847,1859 ----
  	ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1`
  	if echo "$ld_ver" | grep GNU > /dev/null; then
  changequote(,)dnl
!                ld_vers=`echo $ld_ver | sed -n \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
! 	       -e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p'`
                 ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
  		if test 0"$ld_date" -lt 20020404; then
  			if test -n "$ld_date"; then



More information about the Gcc-patches mailing list