From 6168c2a1c6636d0897e055d77d807dbd14b34485 Mon Sep 17 00:00:00 2001 From: Rafael Ávila de Espíndola Date: Wed, 17 Sep 2014 17:53:49 -0400 Subject: Fix handling of common symbols with plugins. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gold/ChangeLog: 2014-09-17 Rafael Ávila de Espíndola * 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 | 6 ++++++ gold/plugin.cc | 4 +--- gold/resolve.cc | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'gold') diff --git a/gold/ChangeLog b/gold/ChangeLog index 98fa100d3c8..02e95caf6f9 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2014-09-17 Rafael Ávila de Espíndola + + * 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 Jing Yu diff --git a/gold/plugin.cc b/gold/plugin.cc index 65197322dd2..0339d4289d4 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -1053,8 +1053,6 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, elfcpp::Sym sym(symbuf); elfcpp::Sym_write osym(symbuf); - typedef typename elfcpp::Elf_types::Elf_WXword Elf_size_type; - this->symbols_.resize(this->nsyms_); for (int i = 0; i < this->nsyms_; ++i) @@ -1125,7 +1123,7 @@ Sized_pluginobj::do_add_symbols(Symbol_table* symtab, osym.put_st_name(0); osym.put_st_value(0); - osym.put_st_size(static_cast(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); diff --git a/gold/resolve.cc b/gold/resolve.cc index 8cc637a0f0d..abb5d90d772 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -303,11 +303,14 @@ Symbol_table::resolve(Sized_symbol* 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; -- cgit v1.2.3-65-gdbad