PATCH: fix crashing bug in 'ld -L. --help'
Craig Silverstein
csilvers@google.com
Fri Mar 6 00:18:00 GMT 2009
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".
More information about the Binutils
mailing list