From dbb410c3e20602a6d4be32a6833a9b7f5b0f1ae9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 9 Oct 2001 06:05:17 +0000 Subject: * elf-bfd.h (struct bfd_elf_section_data): Add "group" and "next_in_group". Fix gp and gp_size comments. * elf.c (union elf_internal_group): New. (setup_group): New function. (_bfd_elf_make_section_from_shdr): Set BFD flags for SHT_GROUP. Call setup_group for SHF_GROUP sections. (bfd_section_from_shdr): Build a BFD section for SHT_GROUP. (elf_fake_sections): Set header type for SEC_GROUP, and header flags for sections in a group. (set_group_contents): New function. (_bfd_elf_compute_section_file_positions): Call it. (assign_section_numbers): Set sh_link for SHT_GROUP. * elflink.h (gc_mark_hook): Handle section groups. * elfxx-target.h: Add SEC_GROUP to applicable_flags. * section.c (SEC_GROUP): Define. (struct sec): Comment fixes. * bfd-in2.h: Regenerate. * elf.c (bfd_elf_print_symbol): Formatting fix; migrate expression out of function args. (_bfd_elf_canonicalize_reloc): Similarly. (_bfd_elf_get_symtab): Here too. (_bfd_elf_canonicalize_dynamic_symtab): And here. * elfcode.h (elf_slurp_symbol_table): Don't recalculate size for bfd_bread, and remove unnecessary cast. --- bfd/elflink.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bfd/elflink.h') diff --git a/bfd/elflink.h b/bfd/elflink.h index a8ffb0b..19fcea7 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -6878,7 +6878,8 @@ static boolean elf_gc_smash_unused_vtentry_relocs PARAMS ((struct elf_link_hash_entry *h, PTR dummy)); /* The mark phase of garbage collection. For a given section, mark - it, and all the sections which define symbols to which it refers. */ + it and any sections in this section's group, and all the sections + which define symbols to which it refers. */ static boolean elf_gc_mark (info, sec, gc_mark_hook) @@ -6888,12 +6889,19 @@ elf_gc_mark (info, sec, gc_mark_hook) PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); { - boolean ret = true; + boolean ret; + asection *group_sec; sec->gc_mark = 1; - /* Look through the section relocs. */ + /* Mark all the sections in the group. */ + group_sec = elf_section_data (sec)->next_in_group; + if (group_sec && !group_sec->gc_mark) + if (!elf_gc_mark (info, group_sec, gc_mark_hook)) + return false; + /* Look through the section relocs. */ + ret = true; if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0) { Elf_Internal_Rela *relstart, *rel, *relend; -- cgit v1.1