This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New ELF linker code added to GNU binutils

"Joseph S. Myers" <> writes:

> The --version output is a bit strange:
> GNU gold (GNU binutils (GNU Binutils) version 1.4
> (note the "GNU binutils (GNU Binutils)").  BFD_VERSION_STRING includes 
> both the package version ("(GNU Binutils)" by default, possibly overridden 
> by --with-pkgversion) and a version number - it's not expected for 
> binutils components to have their own independent version numbers such as 
> "1.4".  The word "version" isn't part of the standard --version output.

I committed this patch to fix this.  The --version output now looks
like this:

GNU gold (GNU Binutils 1.4
Copyright 2008 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

I think a separate version for gold makes sense during this
development period.  In the future it may make sense to simply fold it
into the usual GNU binutils version number.  I'd be happy to hear
other opinions.


2008-03-25  Ian Lance Taylor  <>

	* (print_version): Adjust output for current value of

RCS file: /cvs/src/src/gold/,v
retrieving revision 1.9
diff -p -u -r1.9
---	21 Mar 2008 17:48:18 -0000	1.9
+++	25 Mar 2008 23:30:01 -0000
@@ -40,9 +40,21 @@ static const char* version_string = "1.4
 print_version(bool print_short)
-  /* xgettext:c-format */
-  printf("GNU gold (GNU binutils %s) version %s\n",
-	 BFD_VERSION_STRING, version_string);
+  // The --version output is intended to follow the GNU coding
+  // standards.  We want to print something like:
+  //    GNU gold (GNU binutils 2.19) 1.4
+  // BFD_VERSION_STRING looks like "(GNU Binutils) 2.19".  We take off
+  // those parentheses.
+  std::string bfd_version(BFD_VERSION_STRING);
+  if (bfd_version[0] == '(')
+    {
+      bfd_version.erase(0, 1);
+      size_t pos = bfd_version.find(')');
+      if (pos != std::string::npos)
+	bfd_version.erase(pos, 1);
+    }
+  printf("GNU gold (%s) %s\n", bfd_version.c_str(), version_string);
   if (!print_short)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]