* output.cc (Output_section::add_input_section): Don't try to
authorIan Lance Taylor <ian@airs.com>
Tue, 22 Jul 2008 08:09:48 +0000 (08:09 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 22 Jul 2008 08:09:48 +0000 (08:09 +0000)
merge empty merge sections.

gold/ChangeLog
gold/output.cc

index 297ab894fa0c77fd338045908bed1e47064286ff..c1dc3095c79fe72d32a9e213627ea5d219505566 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-22  Ian Lance Taylor  <iant@google.com>
+
+       * output.cc (Output_section::add_input_section): Don't try to
+       merge empty merge sections.
+
 2008-07-21  Craig Silverstein  <csilvers@google.com>
 
        * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
index 6ec4aef6601b02e02d32e6f38986b8daf8426a56..a24ee5fff951a2c895b14444be5edb7d083fbd46 100644 (file)
@@ -1819,9 +1819,11 @@ Output_section::add_input_section(Sized_relobj<size, big_endian>* object,
 
   // If this is a SHF_MERGE section, we pass all the input sections to
   // a Output_data_merge.  We don't try to handle relocations for such
-  // a section.
+  // a section.  We don't try to handle empty merge sections--they
+  // mess up the mappings, and are useless anyhow.
   if ((sh_flags & elfcpp::SHF_MERGE) != 0
-      && reloc_shndx == 0)
+      && reloc_shndx == 0
+      && shdr.get_sh_size() > 0)
     {
       if (this->add_merge_input_section(object, shndx, sh_flags,
                                        entsize, addralign))