* 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.
This commit is contained in:
Ian Lance Taylor 2008-05-05 19:16:43 +00:00
parent b3dc826bc7
commit 8825ac63ef
7 changed files with 73 additions and 25 deletions

View file

@ -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;
}