This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: When merging common symbols, keep larger align


This patch to gold changes it so that when merging common symbols, it
keeps the larger alignment just as it keeps the larger size.  Not doing
this was an oversight.  Committed to mainline.

Ian


2012-03-13  Ian Lance Taylor  <iant@google.com>

	* resolve.cc (Symbol_table::resolve): When merging common symbols,
	keep the larger alignment.


Index: resolve.cc
===================================================================
RCS file: /cvs/src/src/gold/resolve.cc,v
retrieving revision 1.65
diff -u -r1.65 resolve.cc
--- resolve.cc	17 Dec 2011 22:39:52 -0000	1.65
+++ resolve.cc	13 Mar 2012 16:05:28 -0000
@@ -356,9 +356,15 @@
 				    &adjust_dyndef))
     {
       elfcpp::STB tobinding = to->binding();
+      typename Sized_symbol<size>::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 @@
     }
   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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]