PR gold/14726
authorAlan Modra <amodra@gmail.com>
Wed, 17 Oct 2012 11:58:39 +0000 (11:58 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 17 Oct 2012 11:58:39 +0000 (11:58 +0000)
* gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.

gold/ChangeLog
gold/gold.cc

index 7f7c01206bc9b9c20202546abfd0eda0054008dd..1f13f224ab6f29ab6420079346ece9713c64a357 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-17  Alan Modra  <amodra@gmail.com>
+
+       PR gold/14726
+       * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
+
 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
 
        * layout.cc (Layout::include_section): Keep sections marked
index 0f9a228043140a9e6a3e9e18ed2f407d4153621f..30d623e7fe29d02d6c8395a0a4ff28a963f76398 100644 (file)
@@ -502,9 +502,15 @@ queue_middle_tasks(const General_options& options,
   if (parameters->options().gc_sections())
     {
       // Find the start symbol if any.
-      Symbol* start_sym = symtab->lookup(parameters->entry());
-      if (start_sym != NULL)
-       symtab->gc_mark_symbol(start_sym);
+      Symbol* sym = symtab->lookup(parameters->entry());
+      if (sym != NULL)
+       symtab->gc_mark_symbol(sym);
+      sym = symtab->lookup(parameters->options().init());
+      if (sym != NULL && sym->is_defined() && !sym->is_from_dynobj())
+       symtab->gc_mark_symbol(sym);
+      sym = symtab->lookup(parameters->options().fini());
+      if (sym != NULL && sym->is_defined() && !sym->is_from_dynobj())
+       symtab->gc_mark_symbol(sym);
       // Symbols named with -u should not be considered garbage.
       symtab->gc_mark_undef_symbols(layout);
       gold_assert(symtab->gc() != NULL);