[PR other/79543] Fix GNU ld --version scanning to conform to the GNU Coding Standards

Joseph Myers joseph@codesourcery.com
Tue Oct 31 01:20:00 GMT 2017


On Thu, 19 Oct 2017, Thomas Schwinge wrote:

> | (It's possible some very old binutils versions may
> | not have properly formatted output; my view is that each GCC version should
> | have a minimum corresponding binutils version, no more than say five years old,
> | for targets using GNU binutils.)"
> 
> (Agreed.  That's for another day.)

Specifically, *non-release* versions of binutils predating my patch

commit 066c2a57f5858310c9f12518317aecd4b54e753d
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Mar 1 15:48:36 2007 +0000

would have had a space between the binutils version number and the BFD 
datestamp and the end of the first line of --version output.  That would 
not have been an issue for release versions, and the stray word "version" 
before the version number before that patch would not cause problems for 
the simplified sed expressions.

> Applying the following patch (that is, simplying the sed command), makes
> the problem go away:
> 
>     -sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
>     +sed -e 's/GNU gold /GNU ld /;s/GNU ld .* \(.*\)/\1/; q'`

While I think working properly for binutils versions in the past ten years 
matters more than any issues with old non-release versions that probably 
wouldn't work with current GCC anyway, it seems to me that this patch 
would require *something* surrounded by spaces between "GNU ld" and the 
version number.  If you configure with --without-pkgversion, you get e.g.

GNU ld 2.28

as the complete first line of the output, and that doesn't look like it 
would match the above pattern, as there's only one space not two between 
"GNU ld" and the version number.  So I think you need a pattern that does 
allow the --without-pkgversion form of output.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list