Message ID | 1452189189-31188-1-git-send-email-mst@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jan 07, 2016 at 07:55:24PM +0200, Michael S. Tsirkin wrote: > On Fedora 23, ld --version outputs: > GNU ld version 2.25-15.fc23 > > But ld-version.sh fails to parse this, so e.g. mips build fails to > enable VDSO, printing a warning that binutils >= 2.24 is required. > > To fix, teach ld-version to parse this format. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > > Which tree should this be merged through? Mine? MIPS? MIPS is the sole user of ld-ifversion at this time and taking this through the MIPS tree will avoid possible merge conflicts with James Hogan's pending d5ece1cb074b2c7082c9a2948ac598dd0ad40657 fix ("Fix ld-version.sh to handle large 3rd version part"). So I think I should take this through the MIPS tree. Thanks! Ralf -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Jan 7, 2016, "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Fedora 23, ld --version outputs: > GNU ld version 2.25-15.fc23 > But ld-version.sh fails to parse this On gnewsense 3, ld --version outputs: GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303 Copyright [...] The date at the end severely confuses the version parser. Furthermore, awk is mawk, whose gsub takes ')' as grouping, so it complains about the missing '('. Also, once a[1] is multiplied by 1e7, mawk's print spits out the number in exponential notation, which confuses the -lt test. In order to avoid that falling back to floating-point numbers, I've used smaller multipliers and concatenated (truncated) integers. Yuck. I've modified the script so that it takes the - as a separator too, and so that it works on both gawk and mawk. Here's the ld-version.sh that worked for me. I guess this will have to be combined with your patch somehow. #!/usr/bin/awk -f # extract linker version number from stdin and turn into single number { gsub(".*[)]", ""); split($1,a, "[-.]"); printf "%i%04i\n", a[1]*10000 + a[2]*100 + a[3], (a[4]*100 + a[5])%10000; exit }
Cc'ing Daniel, who has hit further breakage due to unusual version numbers. On 7 January 2016 at 17:55, Michael S. Tsirkin <mst@redhat.com> wrote: > On Fedora 23, ld --version outputs: > GNU ld version 2.25-15.fc23 > > But ld-version.sh fails to parse this, so e.g. mips build fails to > enable VDSO, printing a warning that binutils >= 2.24 is required. > > To fix, teach ld-version to parse this format. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > > Which tree should this be merged through? Mine? MIPS? > > scripts/ld-version.sh | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh > index 198580d..25d23c8 100755 > --- a/scripts/ld-version.sh > +++ b/scripts/ld-version.sh > @@ -2,6 +2,8 @@ > # extract linker version number from stdin and turn into single number > { > gsub(".*)", ""); > + gsub(".*version ", ""); > + gsub("-.*", ""); > split($1,a, "."); > print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; > exit > -- > MST > -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, The version number that's giving me problems is 2.24.51.20140217 which ld-version.sh converts to 2036931700 (20000000+2400000+510000+2014021700). At the moment, I'm wondering whether we really need to handle more than three version number components. Another thought is that the comparison could be inside ld-version.sh (or a replacement) so that it can compare the array of version components directly instead of using a constructed integer as a proxy. > -----Original Message----- > From: james@albanarts.com [mailto:james@albanarts.com] On Behalf Of > James Hogan > Sent: 13 January 2016 17:06 > To: Michael S. Tsirkin > Cc: LKML; Michal Marek; linux-kbuild@vger.kernel.org; Linux MIPS Mailing > List; Ralf Baechle; Daniel Sanders > Subject: Re: [PATCH] ld-version: fix it on Fedora > > Cc'ing Daniel, who has hit further breakage due to unusual version numbers. > > On 7 January 2016 at 17:55, Michael S. Tsirkin <mst@redhat.com> wrote: > > On Fedora 23, ld --version outputs: > > GNU ld version 2.25-15.fc23 > > > > But ld-version.sh fails to parse this, so e.g. mips build fails to > > enable VDSO, printing a warning that binutils >= 2.24 is required. > > > > To fix, teach ld-version to parse this format. > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > --- > > > > Which tree should this be merged through? Mine? MIPS? > > > > scripts/ld-version.sh | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh > > index 198580d..25d23c8 100755 > > --- a/scripts/ld-version.sh > > +++ b/scripts/ld-version.sh > > @@ -2,6 +2,8 @@ > > # extract linker version number from stdin and turn into single number > > { > > gsub(".*)", ""); > > + gsub(".*version ", ""); > > + gsub("-.*", ""); > > split($1,a, "."); > > print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; > > exit > > -- > > MST > >
> From: Alexander Kapshuk [alexander.kapshuk@gmail.com] > Sent: 23 January 2016 14:41 > To: Daniel Sanders > Cc: James Hogan; Michael S. Tsirkin; LKML; Michal Marek; linux-kbuild@vger.kernel.org; Linux MIPS Mailing List; Ralf Baechle > Subject: Re: [PATCH] ld-version: fix it on Fedora > > On Wed, Jan 13, 2016 at 7:30 PM, Daniel Sanders <Daniel.Sanders@imgtec.com<mailto:Daniel.Sanders@imgtec.com>> wrote: > Hi, > > The version number that's giving me problems is 2.24.51.20140217 which ld-version.sh converts to 2036931700 (20000000+2400000+510000+2014021700). > > At the moment, I'm wondering whether we really need to handle more than three version number components. Another thought is that the comparison could be inside ld-version.sh (or a replacement) so that it can compare the array of version components directly instead of using a constructed integer as a proxy. > > > -----Original Message----- > > From: james@albanarts.com<mailto:james@albanarts.com> [mailto:james@albanarts.com<mailto:james@albanarts.com>] On Behalf Of > > James Hogan > > Sent: 13 January 2016 17:06 > > To: Michael S. Tsirkin > > Cc: LKML; Michal Marek; linux-kbuild@vger.kernel.org<mailto:linux-kbuild@vger.kernel.org>; Linux MIPS Mailing > > List; Ralf Baechle; Daniel Sanders > > Subject: Re: [PATCH] ld-version: fix it on Fedora > > > > Cc'ing Daniel, who has hit further breakage due to unusual version numbers. > > > > On 7 January 2016 at 17:55, Michael S. Tsirkin <mst@redhat.com<mailto:mst@redhat.com>> wrote: > > > On Fedora 23, ld --version outputs: > > > GNU ld version 2.25-15.fc23 > > > > > > But ld-version.sh fails to parse this, so e.g. mips build fails to > > > enable VDSO, printing a warning that binutils >= 2.24 is required. > > > > > > To fix, teach ld-version to parse this format. > > > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com<mailto:mst@redhat.com>> > > > --- > > > > > > Which tree should this be merged through? Mine? MIPS? > > > > > > scripts/ld-version.sh | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh > > > index 198580d..25d23c8 100755 > > > --- a/scripts/ld-version.sh > > > +++ b/scripts/ld-version.sh > > > @@ -2,6 +2,8 @@ > > > # extract linker version number from stdin and turn into single number > > > { > > > gsub(".*)", ""); > > > + gsub(".*version ", ""); > > > + gsub("-.*", ""); > > > split($1,a, "."); > > > print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; > > > exit > > > -- > > > MST > > > > > Is this the output you're looking for? > > % echo 'GNU ld version 2.25-15.fc23' | > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > bin=substr($0,RSTART,RLENGTH) > > split(bin, a, ".") > > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' > 22500000 > > % echo 2.25.1.20140217 | > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > bin=substr($0,RSTART,RLENGTH) > > split(bin, a, ".") > > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' > 22510000 > > awk parsing code taken from ver_linux: > /usr/src/linux/scripts/ver_linux:28,33 > ld -v 2>&1 | > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > match($0, /[0-9]+([.]?[0-9]+)+/) > printf("Binutils\t\t%s\n", > substr($0,RSTART,RLENGTH)) > }' > It's close. That code doesn't quite work for my version number because the third component has two digits and overflows into the second component in the proxy integer: $ echo 2.24.51.20140217 | > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > match($0, /[0-9]+([.]?[0-9]+)+/) > bin=substr($0,RSTART,RLENGTH) > split(bin, a, ".") > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' 22910000 but adding a zero to the first two scale factors, or removing one from the third works for me. $ echo 2.24.51.20140217 | awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > match($0, /[0-9]+([.]?[0-9]+)+/) > bin=substr($0,RSTART,RLENGTH) > split(bin, a, ".") > print a[1]*100000000 + a[2]*1000000 + a[3]*10000}' 224510000 $ echo 2.24.51.20140217 | awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > match($0, /[0-9]+([.]?[0-9]+)+/) > bin=substr($0,RSTART,RLENGTH) > split(bin, a, ".") > print a[1]*10000000 + a[2]*100000 + a[3]*1000}' 22451000-- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 25, 2016 at 12:49 PM, Daniel Sanders <Daniel.Sanders@imgtec.com> wrote: > > > From: Alexander Kapshuk [alexander.kapshuk@gmail.com] > > Sent: 23 January 2016 14:41 > > To: Daniel Sanders > > Cc: James Hogan; Michael S. Tsirkin; LKML; Michal Marek; linux-kbuild@vger.kernel.org; Linux MIPS Mailing List; Ralf Baechle > > Subject: Re: [PATCH] ld-version: fix it on Fedora > > > > On Wed, Jan 13, 2016 at 7:30 PM, Daniel Sanders <Daniel.Sanders@imgtec.com<mailto:Daniel.Sanders@imgtec.com>> wrote: > > Hi, > > > > The version number that's giving me problems is 2.24.51.20140217 which ld-version.sh converts to 2036931700 (20000000+2400000+510000+2014021700). > > > > At the moment, I'm wondering whether we really need to handle more than three version number components. Another thought is that the comparison could be inside ld-version.sh (or a replacement) so that it can compare the array of version components directly instead of using a constructed integer as a proxy. > > > > > -----Original Message----- > > > From: james@albanarts.com<mailto:james@albanarts.com> [mailto:james@albanarts.com<mailto:james@albanarts.com>] On Behalf Of > > > James Hogan > > > Sent: 13 January 2016 17:06 > > > To: Michael S. Tsirkin > > > Cc: LKML; Michal Marek; linux-kbuild@vger.kernel.org<mailto:linux-kbuild@vger.kernel.org>; Linux MIPS Mailing > > > List; Ralf Baechle; Daniel Sanders > > > Subject: Re: [PATCH] ld-version: fix it on Fedora > > > > > > Cc'ing Daniel, who has hit further breakage due to unusual version numbers. > > > > > > On 7 January 2016 at 17:55, Michael S. Tsirkin <mst@redhat.com<mailto:mst@redhat.com>> wrote: > > > > On Fedora 23, ld --version outputs: > > > > GNU ld version 2.25-15.fc23 > > > > > > > > But ld-version.sh fails to parse this, so e.g. mips build fails to > > > > enable VDSO, printing a warning that binutils >= 2.24 is required. > > > > > > > > To fix, teach ld-version to parse this format. > > > > > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com<mailto:mst@redhat.com>> > > > > --- > > > > > > > > Which tree should this be merged through? Mine? MIPS? > > > > > > > > scripts/ld-version.sh | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh > > > > index 198580d..25d23c8 100755 > > > > --- a/scripts/ld-version.sh > > > > +++ b/scripts/ld-version.sh > > > > @@ -2,6 +2,8 @@ > > > > # extract linker version number from stdin and turn into single number > > > > { > > > > gsub(".*)", ""); > > > > + gsub(".*version ", ""); > > > > + gsub("-.*", ""); > > > > split($1,a, "."); > > > > print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; > > > > exit > > > > -- > > > > MST > > > > > > > > Is this the output you're looking for? > > > > % echo 'GNU ld version 2.25-15.fc23' | > > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > > match($0, /[0-9]+([.]?[0-9]+)+/) > > > bin=substr($0,RSTART,RLENGTH) > > > split(bin, a, ".") > > > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' > > 22500000 > > > > % echo 2.25.1.20140217 | > > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > > match($0, /[0-9]+([.]?[0-9]+)+/) > > > bin=substr($0,RSTART,RLENGTH) > > > split(bin, a, ".") > > > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' > > 22510000 > > > > awk parsing code taken from ver_linux: > > /usr/src/linux/scripts/ver_linux:28,33 > > ld -v 2>&1 | > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > printf("Binutils\t\t%s\n", > > substr($0,RSTART,RLENGTH)) > > }' > > > > It's close. That code doesn't quite work for my version number because the third component has two > digits and overflows into the second component in the proxy integer: > $ echo 2.24.51.20140217 | > > awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > bin=substr($0,RSTART,RLENGTH) > > split(bin, a, ".") > > print a[1]*10000000 + a[2]*100000 + a[3]*10000}' > 22910000 > > but adding a zero to the first two scale factors, or removing one from the third works for me. > $ echo 2.24.51.20140217 | awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > bin=substr($0,RSTART,RLENGTH) > > split(bin, a, ".") > > print a[1]*100000000 + a[2]*1000000 + a[3]*10000}' > 224510000 > $ echo 2.24.51.20140217 | awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > > match($0, /[0-9]+([.]?[0-9]+)+/) > > bin=substr($0,RSTART,RLENGTH) > > split(bin, a, ".") > > print a[1]*10000000 + a[2]*100000 + a[3]*1000}' > 22451000 I put the latter of the two methods that worked for you it into a script, shown below: #!/usr/bin/awk -f # extract linker version number from stdin and turn into single number /[0-9]+([.]?[0-9]+)+/ && !/not found$/{ match($0, /[0-9]+([.]?[0-9]+)+/) ver=substr($0,RSTART,RLENGTH) split(ver, a, ".") print a[1]*10000000 + a[2]*100000 + a[3]*1000 exit } And tried it out on the following input: % echo 2.24.51.20140217 | ld-version.sh 22451000 % echo 'GNU ld version 2.25-15.fc23' | ld-version.sh 22500000 -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 25 Jan 2016, Alexander Kapshuk wrote: > > > At the moment, I'm wondering whether we really need to handle more > > > than three version number components. Another thought is that the > > > comparison could be inside ld-version.sh (or a replacement) so that > > > it can compare the array of version components directly instead of > > > using a constructed integer as a proxy. I don't think going beyond three version number components makes sense, to be honest. Any such numbers will be non-standard third-party releases. Upstream binutils use a three-component versioning scheme. Even the third component only makes sense because sometime we may actually rely on a bug fix first available with a maintenance release; these reach single-digit numbers only and hardly ever above 1 actually as another base release is usually made quickly enough (the usual schedule was annual, although as from 2.26, out last Monday, it has been switched to a semi-annual cycle). > I put the latter of the two methods that worked for you it into a > script, shown below: > > #!/usr/bin/awk -f > # extract linker version number from stdin and turn into single number > > /[0-9]+([.]?[0-9]+)+/ && !/not found$/{ > match($0, /[0-9]+([.]?[0-9]+)+/) > ver=substr($0,RSTART,RLENGTH) > split(ver, a, ".") > print a[1]*10000000 + a[2]*100000 + a[3]*1000 > exit > } > > And tried it out on the following input: > > % echo 2.24.51.20140217 | ld-version.sh > 22451000 So the above version is a non-release snapshot from the development tree as the repository trunk is switched to x.y+1.51 once a release branch for x.y has been made. Then the release branch is switched to x.y-1.90 for prereleases, before settling on x.y or x.y.0 (this hasn't been consistent) for the actual base release. Any subsequent maintenance releases will then have their version set to x.y.1, x.y.2, and so on. We shouldn't ever rely on versions that are not proper releases. > % echo 'GNU ld version 2.25-15.fc23' | ld-version.sh > 22500000 So this is a base 2.25 release (obviously with vendor patches, hopefully not breaking what we might rely on). FWIW, Maciej -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, 30 Jan 2016, Maciej W. Rozycki wrote: > > % echo 2.24.51.20140217 | ld-version.sh > > 22451000 > > So the above version is a non-release snapshot from the development tree > as the repository trunk is switched to x.y+1.51 once a release branch for > x.y has been made. Then the release branch is switched to x.y-1.90 for > prereleases, before settling on x.y or x.y.0 (this hasn't been consistent) > for the actual base release. Any subsequent maintenance releases will > then have their version set to x.y.1, x.y.2, and so on. We shouldn't ever > rely on versions that are not proper releases. I need to correct myself here for unclear notation or off-by-one errors, the flow is of course as follows: trunk x.y-1.51 | | | release branchpoint | \ x.y.51 x.y-1.90 | prerelease | | | | v x.y-1.91 . prerelease . | . | | x.y-1.92 prerelease . . . x.y.0 base release | | | x.y.1 maintenance release | | | x.y.2 maintenance release | v . . . The revision number is sometimes bumped up on trunk as well, to 52, 53, etc., though the criteria are not completely clear to me; perhaps to make a trunk snapshot "release". And last but not least for non-release builds the snapshot date is automatically appended to the version number reported, as seen above. Maciej -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 7 Jan 2016, Ralf Baechle wrote: > > GNU ld version 2.25-15.fc23 > > > > But ld-version.sh fails to parse this, so e.g. mips build fails to > > enable VDSO, printing a warning that binutils >= 2.24 is required. > > > > To fix, teach ld-version to parse this format. > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > --- > > > > Which tree should this be merged through? Mine? MIPS? > > MIPS is the sole user of ld-ifversion at this time and taking this through > the MIPS tree will avoid possible merge conflicts with James Hogan's > pending d5ece1cb074b2c7082c9a2948ac598dd0ad40657 fix ("Fix ld-version.sh to > handle large 3rd version part"). So I think I should take this through > the MIPS tree. FYI, I'm still getting a failure here, with: $ mips64el-linux-ld --version GNU ld (GNU Binutils) 2.20.1.20100303 [...] $ -- so this is a plain upstream development snapshot as these have their date appended. Can we just get rid of the subversion components beyond the third, as I already suggested? I.e. stop on the third point and in any case on a non-point-non-digit. I'll post a minimal fix shortly, feel free to enhance it if needed. Maciej -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh index 198580d..25d23c8 100755 --- a/scripts/ld-version.sh +++ b/scripts/ld-version.sh @@ -2,6 +2,8 @@ # extract linker version number from stdin and turn into single number { gsub(".*)", ""); + gsub(".*version ", ""); + gsub("-.*", ""); split($1,a, "."); print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; exit
On Fedora 23, ld --version outputs: GNU ld version 2.25-15.fc23 But ld-version.sh fails to parse this, so e.g. mips build fails to enable VDSO, printing a warning that binutils >= 2.24 is required. To fix, teach ld-version to parse this format. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- Which tree should this be merged through? Mine? MIPS? scripts/ld-version.sh | 2 ++ 1 file changed, 2 insertions(+)