PATCH: [4.1/4.2/4.3]: Gcc failed to detect Linux linker version

H.J. Lu hjl@lucon.org
Sun Sep 23 16:55:00 GMT 2007


On Fri, Sep 21, 2007 at 05:48:32PM +0200, Richard Guenther wrote:
> On 9/13/07, H.J. Lu <hjl@lucon.org> wrote:
> > On Thu, Sep 13, 2007 at 12:09:44PM -0700, H.J. Lu wrote:
> > > On Thu, Sep 13, 2007 at 11:45:11AM -0700, Mark Mitchell wrote:
> > > > Paolo Bonzini wrote:
> > > > > H.J. Lu wrote:
> > > > >> Linux linker version is reported as 2.18.50.0.2.20070912. configure
> > > > >> failed to parse it. This patch fixes. Tested on Linux/x86-64. OK
> > > > >> to install to 4.1/4.2/4.3?
> > > > >
> > > > > Ok for 4.1 and 4.3.  For 4.2, ask Mark.
> > > >
> > > > OK.
> > > >
> > > > (But, can we please stop making the GNU/Linux linker version numbers
> > > > ever weirder?  We seem to have a patch like this rather often...)
> > > >
> > >
> > > I will see if I can come up with a better approach to parse linker
> > > version.
> > >
> > >
> >
> > I have seen
> >
> > GNU ld version 2.17.50.0.6-5.fc6 20061020
> > GNU ld version 2.17.50.0.12-4 20070128
> > GNU ld version 2.15.92.0.2 20040927
> > GNU ld (GNU Binutils) 2.18.50.20070913
> > GNU ld (Linux/GNU Binutils) 2.18.50.0.1.20070906
> >
> > This patch can handle any GNU linker version starting with xx.xx.*
> 
> It doesn't handle
> 
> > ld --version
> GNU ld (GNU Binutils) 2.17.50.20070726-12 (SUSE Linux)
> 

Have you tried my patch? I got

# ./check "GNU ld (GNU Binutils) 2.17.50.20070726-12 (SUSE Linux)"
ld_ver: GNU ld (GNU Binutils) 2.17.50.20070726-12 (SUSE Linux)
ld_vers: 2.17.50.20070726-12 (SUSE Linux)
ld_date: 20070726
ld_vers_major: 2
ld_vers_minor: 17
ld_vers_patch: 50


H.J.
---
-----
#! /bin/sh

ld_ver="$1"
    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]*\)[	 ].*$,\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]*\.[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'`
    ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
    ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
    ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
echo ld_ver: $ld_ver
echo ld_vers: $ld_vers
echo ld_date: $ld_date
echo ld_vers_major: $ld_vers_major
echo ld_vers_minor: $ld_vers_minor
echo ld_vers_patch: $ld_vers_patch



More information about the Gcc-patches mailing list