Don't try to delete the output file if we don't know its name yet.
authorIan Lance Taylor <iant@google.com>
Wed, 28 Nov 2007 19:39:40 +0000 (19:39 +0000)
committerIan Lance Taylor <iant@google.com>
Wed, 28 Nov 2007 19:39:40 +0000 (19:39 +0000)
gold/gold.cc
gold/parameters.h

index 9baebaf6022a2f71212698ce688f2b018e18c816..0b7c2ecfee38784606a301e7eed6623588f165a7 100644 (file)
@@ -47,7 +47,7 @@ const char* program_name;
 void
 gold_exit(bool status)
 {
-  if (!status && parameters != NULL)
+  if (!status && parameters != NULL && parameters->options_valid())
     unlink_if_ordinary(parameters->output_file_name());
   exit(status ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 4e135c61e27504233c971040de210d387afab845..4b764e3214908c795b53e36f07241417f7ff86a9 100644 (file)
@@ -47,6 +47,12 @@ class Parameters
   errors() const
   { return this->errors_; }
 
+  // Whether the options are valid.  This should not normally be
+  // called, but it is needed by gold_exit.
+  bool
+  options_valid() const
+  { return this->options_valid_; }
+
   // Whether to use threads.
   bool
   threads() const