Fix handling of common symbols with plugins.
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Wed, 17 Sep 2014 21:53:49 +0000 (17:53 -0400)
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Wed, 17 Sep 2014 21:53:49 +0000 (17:53 -0400)
gold/ChangeLog:
2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

* plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
* resolve.cc (Symbol_table::resolve): Don't override common symbols
during the replacement phase.

gold/ChangeLog
gold/plugin.cc
gold/resolve.cc

index 98fa100d3c86706ca3f8d3273599d3c3ab8c000b..02e95caf6f920dd93d9635151bfa64ee520257dd 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+
+       * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
+       * resolve.cc (Symbol_table::resolve): Don't override common symbols
+       during the replacement phase.
+
 2014-09-17  Han Shen  <shenhan@google.com>
            Jing Yu  <jingyu@google.com>
 
index 65197322dd226da544ae3e174a6551e88cd7c627..0339d4289d4c6ecb87d7c0cf9a245a37bfe3ef95 100644 (file)
@@ -1053,8 +1053,6 @@ Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
   elfcpp::Sym<size, big_endian> sym(symbuf);
   elfcpp::Sym_write<size, big_endian> osym(symbuf);
 
-  typedef typename elfcpp::Elf_types<size>::Elf_WXword Elf_size_type;
-
   this->symbols_.resize(this->nsyms_);
 
   for (int i = 0; i < this->nsyms_; ++i)
@@ -1125,7 +1123,7 @@ Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
 
       osym.put_st_name(0);
       osym.put_st_value(0);
-      osym.put_st_size(static_cast<Elf_size_type>(isym->size));
+      osym.put_st_size(0);
       osym.put_st_info(bind, elfcpp::STT_NOTYPE);
       osym.put_st_other(vis, 0);
       osym.put_st_shndx(shndx);
index 8cc637a0f0de1cf281b7fae725117286d48b5def..abb5d90d772536caf0333e464e087249121123c2 100644 (file)
@@ -303,11 +303,14 @@ Symbol_table::resolve(Sized_symbol<size>* to,
 
   // If we're processing replacement files, allow new symbols to override
   // the placeholders from the plugin objects.
+  // Treat common symbols specially since it is possible that an ELF
+  // file increased the size of the alignment.
   if (to->source() == Symbol::FROM_OBJECT)
     {
       Pluginobj* obj = to->object()->pluginobj();
       if (obj != NULL
-          && parameters->options().plugins()->in_replacement_phase())
+          && parameters->options().plugins()->in_replacement_phase()
+          && !to->is_common())
         {
           this->override(to, sym, st_shndx, is_ordinary, object, version);
           return;
This page took 0.03529 seconds and 4 git commands to generate.