* merge.h (Output_merge_string::Merged_string): Remove object, shndx,
[binutils-gdb.git] / gold / gold.cc
index 275d0f92e235b419ed626a8f2389a808c46d8437..ba02db2f1bfd1398acede50bea46b5177df2bce4 100644 (file)
@@ -206,7 +206,7 @@ queue_initial_tasks(const General_options& options,
       next_blocker->add_blocker();
       workqueue->queue(new Read_symbols(input_objects, symtab, layout,
                                        &search_path, 0, mapfile, &*p, NULL,
-                                       this_blocker, next_blocker));
+                                       NULL, this_blocker, next_blocker));
       this_blocker = next_blocker;
     }
 
@@ -276,6 +276,16 @@ queue_middle_gc_tasks(const General_options& options,
                                       next_blocker));
       this_blocker = next_blocker;
     }
+
+  // If we are given only archives in input, we have no regular
+  // objects and THIS_BLOCKER is NULL here.  Create a dummy
+  // blocker here so that we can run the middle tasks immediately.
+  if (this_blocker == NULL)
+    {
+      gold_assert(input_objects->number_of_relobjs() == 0);
+      this_blocker = new Task_token(true);
+    }
+
   workqueue->queue(new Task_function(new Middle_runner(options,
                                                        input_objects,
                                                        symtab,
@@ -532,6 +542,25 @@ queue_middle_tasks(const General_options& options,
         }
     }
 
+  if (this_blocker == NULL)
+    {
+      if (input_objects->number_of_relobjs() == 0)
+       {
+         // If we are given only archives in input, we have no regular
+         // objects and THIS_BLOCKER is NULL here.  Create a dummy
+         // blocker here so that we can run the layout task immediately.
+         this_blocker = new Task_token(true);
+       }
+      else 
+       {
+         // If we failed to open any input files, it's possible for
+         // THIS_BLOCKER to be NULL here.  There's no real point in
+         // continuing if that happens.
+         gold_assert(parameters->errors()->error_count() > 0);
+         gold_exit(false);
+       }
+    }
+
   // When all those tasks are complete, we can start laying out the
   // output file.
   // TODO(csilvers): figure out a more principled way to get the target