This is the mail archive of the binutils@sourceware.org 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]

PATCH: fix crashing bug in 'ld -L. --help'


ld --help verifies that no -z flag has a shortname.  However, the
psuedo-flag 'Z-OPTIONS', which is registered in parse_short_options(),
does have a shortname.  Since it's a pseudo-flag, --help should ignore
it.  This patch does that.
   ld -L. --help
crashes without the patch, but succeeds with it.

Look ok to submit?

craig

2009-03-05  Craig Silverstein  <csilvers@google.com>

	* options.cc (help): Don't print pseudo-option '-z'.

--cut here--

Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.83
diff -u -r1.83 options.cc
--- options.cc  28 Feb 2009 04:39:57 -0000      1.83
+++ options.cc  6 Mar 2009 00:17:30 -0000
@@ -144,7 +144,12 @@
 
   std::vector<const One_option*>::const_iterator it;
   for (it = registered_options.begin(); it !=
   registered_options.end(); ++it)
-    (*it)->print();
+    {
+      // The pseudo-flag "dash_z" may have gotten registered ihn
+      // parse_short_options().  Don't print it if we see it.
+      if (!((*it)->dashes == DASH_Z && (*it)->shortname == 'z'))
+        (*it)->print();
+    }
 
   // config.guess and libtool.m4 look in ld --help output for the
   // string "supported targets".


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