From fd325007590a9f768fa93840eb1f6af48e9d25f7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 13 Mar 2012 16:08:53 +0000 Subject: [PATCH] * resolve.cc (Symbol_table::resolve): When merging common symbols, keep the larger alignment. --- gold/ChangeLog | 5 +++++ gold/resolve.cc | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 0a72132fe02..47d15a93ed2 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2012-03-13 Ian Lance Taylor + + * resolve.cc (Symbol_table::resolve): When merging common symbols, + keep the larger alignment. + 2012-03-12 Cary Coutant * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix diff --git a/gold/resolve.cc b/gold/resolve.cc index 780038aee5e..0da8da2218a 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -356,9 +356,15 @@ Symbol_table::resolve(Sized_symbol* to, &adjust_dyndef)) { elfcpp::STB tobinding = to->binding(); + typename Sized_symbol::Value_type tovalue = to->value(); this->override(to, sym, st_shndx, is_ordinary, object, version); - if (adjust_common_sizes && tosize > to->symsize()) - to->set_symsize(tosize); + if (adjust_common_sizes) + { + if (tosize > to->symsize()) + to->set_symsize(tosize); + if (tovalue > to->value()) + to->set_value(tovalue); + } if (adjust_dyndef) { // We are overriding an UNDEF or WEAK UNDEF with a DYN DEF. @@ -368,8 +374,13 @@ Symbol_table::resolve(Sized_symbol* to, } else { - if (adjust_common_sizes && sym.get_st_size() > tosize) - to->set_symsize(sym.get_st_size()); + if (adjust_common_sizes) + { + if (sym.get_st_size() > tosize) + to->set_symsize(sym.get_st_size()); + if (sym.get_st_value() > to->value()) + to->set_value(sym.get_st_value()); + } if (adjust_dyndef) { // We are keeping a DYN DEF after seeing an UNDEF or WEAK UNDEF. -- 2.30.2