aboutsummaryrefslogtreecommitdiff
path: root/gold/object.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-05-05 19:16:43 +0000
committerIan Lance Taylor <ian@airs.com>2008-05-05 19:16:43 +0000
commit8825ac63ef01c08e4668e652d461f94e6761a312 (patch)
tree535e0e766b8a0a6473bd103a911c07f6c80fff9b /gold/object.cc
parentb3dc826bc7308d6e556424dd369d57fe8acc8a96 (diff)
downloadgdb-8825ac63ef01c08e4668e652d461f94e6761a312.zip
gdb-8825ac63ef01c08e4668e652d461f94e6761a312.tar.gz
gdb-8825ac63ef01c08e4668e652d461f94e6761a312.tar.bz2
* object.cc (Sized_relobj::include_section_group): Adjust section
indexes read from group data. Build vector to pass to layout_group. * layout.cc (Layout::layout_group): Add flags and shndxes parameters. Remove contents parameter. Change caller. Update explicit instantiations. * layout.h (class Layout): Update layout_group declaration. * output.cc (Output_data_group::Output_data_group): Add flags and input_shndxes parameters. Remove contents parameter. Change caller. (Output_data_group::do_write): Change input_sections_ to input_shndxes_. * output.h (class Output_data_group): Update constructor declaration. Rename input_sections_ to input_shndxes_. * testsuite/many_sections_test.cc: Add template.
Diffstat (limited to 'gold/object.cc')
-rw-r--r--gold/object.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/gold/object.cc b/gold/object.cc
index 8f44411..b49bee1 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -604,10 +604,6 @@ Sized_relobj<size, big_endian>::include_section_group(
bool include_group = ((flags & elfcpp::GRP_COMDAT) == 0
|| layout->add_comdat(this, index, signature, true));
- if (include_group && parameters->options().relocatable())
- layout->layout_group(symtab, this, index, name, signature.c_str(),
- shdr, pword);
-
Relobj* kept_object = NULL;
Comdat_group* kept_group = NULL;
@@ -629,10 +625,20 @@ Sized_relobj<size, big_endian>::include_section_group(
}
size_t count = shdr.get_sh_size() / sizeof(elfcpp::Elf_Word);
+
+ std::vector<unsigned int> shndxes;
+ bool relocate_group = include_group && parameters->options().relocatable();
+ if (relocate_group)
+ shndxes.reserve(count - 1);
+
for (size_t i = 1; i < count; ++i)
{
elfcpp::Elf_Word secnum =
- elfcpp::Swap<32, big_endian>::readval(pword + i);
+ this->adjust_shndx(elfcpp::Swap<32, big_endian>::readval(pword + i));
+
+ if (relocate_group)
+ shndxes.push_back(secnum);
+
if (secnum >= this->shnum())
{
this->error(_("section %u in section group %u out of range"),
@@ -681,6 +687,10 @@ Sized_relobj<size, big_endian>::include_section_group(
}
}
+ if (relocate_group)
+ layout->layout_group(symtab, this, index, name, signature.c_str(),
+ shdr, flags, &shndxes);
+
return include_group;
}