From Craig Silverstein: error if we see a dynamic object when the
authorIan Lance Taylor <iant@google.com>
Sun, 14 Oct 2007 02:52:13 +0000 (02:52 +0000)
committerIan Lance Taylor <iant@google.com>
Sun, 14 Oct 2007 02:52:13 +0000 (02:52 +0000)
-static option was given.

gold/gold.cc

index 5c8ce50d5c838d72fb8e90941f0190fd847c44fd..97e5d3d043e722c606ff83271ebc7ecc496c8108 100644 (file)
@@ -161,7 +161,15 @@ queue_middle_tasks(const General_options& options,
                   Workqueue* workqueue)
 {
   // Now we have seen all the input files.
-  set_parameters_doing_static_link(!input_objects->any_dynamic());
+  const bool doing_static_link = !input_objects->any_dynamic();
+  set_parameters_doing_static_link(doing_static_link);
+  if (!doing_static_link && options.is_static())
+    {
+      // We print out just the first .so we see; there may be others.
+      fprintf(stderr, _("%s: cannot mix -static with dynamic object %s\n"),
+              program_name, (*input_objects->dynobj_begin())->name().c_str());
+      gold_exit(false);
+    }
 
   // Define some sections and symbols needed for a dynamic link.  This
   // handles some cases we want to see before we read the relocs.