Patch to fix bug in gold ICF due to string merge sections.

Sriraman Tallam tmsriram@google.com
Wed Mar 10 01:25:00 GMT 2010


Hi,

     I spotted a bug in ICF today. When ICF spots a relocation to a
string merge section it inlines the section contents. However, if the
string is empty there is nothing to mark that a relocation was
present. This caused a program to incorrectly fold sections. This
trivial patch fixes the problem.

2010-03-09  Sriraman Tallam  <tmsriram@google.com>

	* icf.cc (get_section_contents): Add '@' marker after processing the
	merge reloc.

Index: icf.cc
===================================================================
RCS file: /cvs/src/src/gold/icf.cc,v
retrieving revision 1.10
diff -u -u -p -r1.10 icf.cc
--- icf.cc	22 Feb 2010 18:26:29 -0000	1.10
+++ icf.cc	10 Mar 2010 00:48:49 -0000
@@ -389,6 +389,7 @@ get_section_contents(bool first_iteratio
                                                      char*>(str_contents),
                                     entsize);
                     }
+		  buffer.append("@");
                 }
               else if ((*it_s) != NULL)



Is this alright to commit ?

Thanks,
-Sriraman.



More information about the Binutils mailing list