aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-09-14 12:11:33 +0000
committerAlan Modra <amodra@gmail.com>2006-09-14 12:11:33 +0000
commit30288845d67c64d07905c1e4ca9de4768d3b2dd8 (patch)
treedbc93e964bb76b24a80197160527adddab2827e1 /bfd/elf.c
parent87699a25a2e69dd4a5e7bc599ed37a88fd55ac88 (diff)
downloadgdb-30288845d67c64d07905c1e4ca9de4768d3b2dd8.zip
gdb-30288845d67c64d07905c1e4ca9de4768d3b2dd8.tar.gz
gdb-30288845d67c64d07905c1e4ca9de4768d3b2dd8.tar.bz2
PR 3182
* elf.c (_bfd_elf_copy_private_header_data): Fix group members that have had their SHT_GROUP section removed. * objcopy.c (group_signature): New function, split out from.. (setup_section): ..here. (is_strip_section): Return true for SHT_GROUP sections that are going to lose their group signature symbol.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index e47f266..ce8f4bc 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6012,6 +6012,8 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
bfd_boolean
_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
{
+ asection *isec;
+
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
@@ -6027,6 +6029,27 @@ _bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
return FALSE;
}
+ /* _bfd_elf_copy_private_section_data copied over the SHF_GROUP flag
+ but this might be wrong if we deleted the group section. */
+ for (isec = ibfd->sections; isec != NULL; isec = isec->next)
+ if (elf_section_type (isec) == SHT_GROUP
+ && isec->output_section == NULL)
+ {
+ asection *first = elf_next_in_group (isec);
+ asection *s = first;
+ while (s != NULL)
+ {
+ if (s->output_section != NULL)
+ {
+ elf_section_flags (s->output_section) &= ~SHF_GROUP;
+ elf_group_name (s->output_section) = NULL;
+ }
+ s = elf_next_in_group (s);
+ if (s == first)
+ break;
+ }
+ }
+
return TRUE;
}