This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't combine relocs for groups with -r
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Sat, 24 Apr 2010 07:33:34 -0700
- Subject: gold patch committed: Don't combine relocs for groups with -r
When doing a relocatable link, grouped sections are, of course, not
merged. This means that relocs for grouped sections must also not be
merged. I committed this patch to gold to fix this.
Ian
2010-04-24 Ian Lance Taylor <iant@google.com>
* layout.cc (Layout::layout_reloc): In relocatable link don't
combine reloc sections for grouped sections.
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.168
diff -p -u -r1.168 layout.cc
--- layout.cc 9 Apr 2010 17:32:58 -0000 1.168
+++ layout.cc 24 Apr 2010 14:31:35 -0000
@@ -699,11 +699,20 @@ Layout::layout_reloc(Sized_relobj<size,
gold_unreachable();
name += data_section->name();
- Output_section* os = this->choose_output_section(object, name.c_str(),
- sh_type,
- shdr.get_sh_flags(),
- false, false, false,
- false, false, false);
+ // In a relocatable link relocs for a grouped section must not be
+ // combined with other reloc sections.
+ Output_section* os;
+ if (!parameters->options().relocatable()
+ || (data_section->flags() & elfcpp::SHF_GROUP) == 0)
+ os = this->choose_output_section(object, name.c_str(), sh_type,
+ shdr.get_sh_flags(), false, false,
+ false, false, false, false);
+ else
+ {
+ const char* n = this->namepool_.add(name.c_str(), true, NULL);
+ os = this->make_output_section(n, sh_type, shdr.get_sh_flags(),
+ false, false, false, false, false);
+ }
os->set_should_link_to_symtab();
os->set_info_section(data_section);