PR 10237
authorIan Lance Taylor <ian@airs.com>
Wed, 24 Jun 2009 05:01:17 +0000 (05:01 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 24 Jun 2009 05:01:17 +0000 (05:01 +0000)
* options.cc (General_options::parse_V): Set printed_version_.
(General_options::General_options): Initialize printed_version_.
* options.h (class General_options): Add printed_version_ field.
* gold.cc (queue_initial_tasks): If there are no input files,
don't give a fatal error if we printed the version information.
(queue_middle_tasks): If using -r with a shared object, give a
fatal error rather than an ordinary error.

gold/ChangeLog
gold/gold.cc
gold/options.cc
gold/options.h

index 56a4da6426fc7e55bc3b2ee951f71b61d6f7bbf3..55073175a4c6d62f3aa12d322bc04b4b528c8642 100644 (file)
@@ -1,3 +1,14 @@
+2009-06-23  Ian Lance Taylor  <iant@google.com>
+
+       PR 10237
+       * options.cc (General_options::parse_V): Set printed_version_.
+       (General_options::General_options): Initialize printed_version_.
+       * options.h (class General_options): Add printed_version_ field.
+       * gold.cc (queue_initial_tasks): If there are no input files,
+       don't give a fatal error if we printed the version information.
+       (queue_middle_tasks): If using -r with a shared object, give a
+       fatal error rather than an ordinary error.
+
 2009-06-23  Ian Lance Taylor  <iant@google.com>
 
        PR 10219
index 93d03586c01361c7c3ac8ab5a20fdc1569d5de1d..ae4b8b8629ec30222a0a366048e42faa10b9ba15 100644 (file)
@@ -164,7 +164,11 @@ queue_initial_tasks(const General_options& options,
                    Symbol_table* symtab, Layout* layout, Mapfile* mapfile)
 {
   if (cmdline.begin() == cmdline.end())
-    gold_fatal(_("no input files"));
+    {
+      if (options.printed_version())
+       gold_exit(true);
+      gold_fatal(_("no input files"));
+    }
 
   int thread_count = options.thread_count_initial();
   if (thread_count == 0)
@@ -364,7 +368,7 @@ queue_middle_tasks(const General_options& options,
                 (*input_objects->dynobj_begin())->name().c_str());
     }
   if (!doing_static_link && parameters->options().relocatable())
-    gold_error(_("cannot mix -r with dynamic object %s"),
+    gold_fatal(_("cannot mix -r with dynamic object %s"),
               (*input_objects->dynobj_begin())->name().c_str());
   if (!doing_static_link
       && options.oformat_enum() != General_options::OBJECT_FORMAT_ELF)
index ef2aa7163f0d9aae922cecdca6033f03825cfef7..f09dccb9367e71b7d1d3b9ae9b8c482be14fd5f5 100644 (file)
@@ -273,6 +273,7 @@ void
 General_options::parse_V(const char*, const char*, Command_line*)
 {
   gold::print_version(true);
+  this->printed_version_ = true;
   printf(_("  Supported targets:\n"));
   std::vector<const char*> supported_names;
   gold::supported_target_names(&supported_names);
@@ -708,7 +709,8 @@ namespace gold
 {
 
 General_options::General_options()
-  : execstack_status_(General_options::EXECSTACK_FROM_INPUT), static_(false),
+  : printed_version_(false),
+    execstack_status_(General_options::EXECSTACK_FROM_INPUT), static_(false),
     do_demangle_(false), plugins_(),
     incremental_disposition_(INCREMENTAL_CHECK), implicit_incremental_(false)
 {
index aac0439c07df7af5581ebd309874102c6388a6be..deec2ba871e6f2b78e31b85f96f9e2b77d3678b2 100644 (file)
@@ -946,6 +946,11 @@ class General_options
   // any problems.
   void finalize();
 
+  // True if we printed the version information.
+  bool
+  printed_version() const
+  { return this->printed_version_; }
+
   // The macro defines output() (based on --output), but that's a
   // generic name.  Provide this alternative name, which is clearer.
   const char*
@@ -1090,6 +1095,8 @@ class General_options
   void
   add_plugin_option(const char* opt);
 
+  // Whether we printed version information.
+  bool printed_version_;
   // Whether to mark the stack as executable.
   Execstack execstack_status_;
   // Whether to do a static link.
@@ -1106,7 +1113,7 @@ class General_options
   // --incremental-unchanged or --incremental-unknown option.  The
   // value may change as we proceed parsing the command line flags.
   Incremental_disposition incremental_disposition_;
-  // Wheater we have seen one of the options that require incremental
+  // Whether we have seen one of the options that require incremental
   // build (--incremental-changed, --incremental-unchanged or
   // --incremental-unknown)
   bool implicit_incremental_;
This page took 0.032958 seconds and 4 git commands to generate.