This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch: Don't try to merge empty input sections
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Tue, 22 Jul 2008 01:12:00 -0700
- Subject: gold patch: Don't try to merge empty input sections
When gold saw an empty merge input section it would add it to the
merge data for the output section. Unfortunately an empty input
section would have no maps, and this would cause a crash in
Output_section::starting_output_address looking for the position of
the input section in the output section. There is nothing to merge
for an empty merge input section, so I patched the code to simply
handle it as an ordinary input section. I committed this patch.
Ian
2008-07-22 Ian Lance Taylor <iant@google.com>
* output.cc (Output_section::add_input_section): Don't try to
merge empty merge sections.
Index: output.cc
===================================================================
RCS file: /cvs/src/src/gold/output.cc,v
retrieving revision 1.80
diff -u -p -r1.80 output.cc
--- output.cc 10 Jul 2008 23:01:19 -0000 1.80
+++ output.cc 22 Jul 2008 08:08:28 -0000
@@ -1819,9 +1819,11 @@ Output_section::add_input_section(Sized_
// 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))