Constification of parse_linespec and fallout:
[deliverable/binutils-gdb.git] / gold / archive.cc
index c3f7b946742f4a78ed32c204762606738819db76..f2cd848ce337d5df8090578417e7723afc49ef2e 100644 (file)
@@ -104,6 +104,11 @@ Library_base::should_include_member(Symbol_table* symtab, Layout* layout,
           *why = "-u ";
           *why += sym_name;
         }
+      else if (parameters->options().is_export_dynamic_symbol(sym_name))
+        {
+          *why = "--export-dynamic-symbol ";
+          *why += sym_name;
+        }
       else if (layout->script_options()->is_referenced(sym_name))
        {
          size_t alc = 100 + strlen(sym_name);
@@ -649,32 +654,45 @@ Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
                                 &member_name))
     return NULL;
 
+  const unsigned char* ehdr;
+  int read_size;
+  Object *obj = NULL;
+  bool is_elf_obj = false;
+
+  if (is_elf_object(input_file, memoff, &ehdr, &read_size))
+    {
+      obj = make_elf_object((std::string(this->input_file_->filename())
+                            + "(" + member_name + ")"),
+                           input_file, memoff, ehdr, read_size,
+                           punconfigured);
+      is_elf_obj = true;
+    }
+
   if (parameters->options().has_plugins())
     {
-      Object* obj = parameters->options().plugins()->claim_file(input_file,
-                                                                memoff,
-                                                                memsize);
-      if (obj != NULL)
+      Object* plugin_obj
+       = parameters->options().plugins()->claim_file(input_file,
+                                                     memoff,
+                                                     memsize,
+                                                     obj);
+      if (plugin_obj != NULL)
         {
           // The input file was claimed by a plugin, and its symbols
           // have been provided by the plugin.
-          return obj;
+         // Delete its elf object.
+         if (obj != NULL)
+           delete obj;
+          return plugin_obj;
         }
     }
 
-  const unsigned char* ehdr;
-  int read_size;
-  if (!is_elf_object(input_file, memoff, &ehdr, &read_size))
+  if (!is_elf_obj)
     {
       gold_error(_("%s: member at %zu is not an ELF object"),
                 this->name().c_str(), static_cast<size_t>(off));
       return NULL;
     }
 
-  Object* obj = make_elf_object((std::string(this->input_file_->filename())
-                                + "(" + member_name + ")"),
-                               input_file, memoff, ehdr, read_size,
-                               punconfigured);
   if (obj == NULL)
     return NULL;
   obj->set_no_export(this->no_export());
This page took 0.023512 seconds and 4 git commands to generate.