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]

[PATCH] [gold] Do not attempt to merge sections with an entsize of 0.


It seems to be invalid for a section to have the SHF_MERGE flag set and an
entsize of 0, but we should cope with this gracefully instead of crashing.

2015-02-04  Peter Collingbourne  <pcc@google.com>

	* merge.cc (Output_merge_data::do_add_input_section): Do not attempt to
	merge sections with an entsize of 0.
---
 gold/merge.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gold/merge.cc b/gold/merge.cc
index 269e6bf..450fd62 100644
--- a/gold/merge.cc
+++ b/gold/merge.cc
@@ -412,7 +412,7 @@ Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx)
 
   section_size_type entsize = convert_to_section_size_type(this->entsize());
 
-  if (len % entsize != 0)
+  if (entsize == 0 || len % entsize != 0)
     {
       if (is_new)
 	delete[] p;
-- 
2.2.0.rc0.207.ga3a616c


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