From 6f20ed8a6ba1a01fb356eea8ea45310ed8478a27 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 31 Aug 2015 17:50:33 +0930 Subject: ppc64 section group handling Two organizational changes to the array of additional info kept for sections. 1) Move group info into a per-group allocated struct, in preparation for future changes that need per-group accounting. 2) Expand the array to include output sections, which simplifies sizing and removes the need for a separate output section array. * section.c (section_id): Make file scope. (bfd_get_next_section_id): New function. * elf64-ppc.c (struct map_stub): Remove toc_off field. Move decl. (struct ppc_stub_hash_entry): Delete stub_sec and id_sec. Add group. Update all uses. (struct ppc_link_hash_table): Delete top_id, top_index, and input_list. Add sec_info_arr_size. Rename stub_group to sec_info, and make group info indirect. Update stub_group refs throughout file. (ppc_add_stub): Don't look for stub_sec on link_sec stub_group entry. (ppc_build_one_stub): Delete FIXME. (ppc64_elf_setup_section_lists): Size htab->sec_info for all sections, not just input sections. Don't create htab->input_list. (ppc64_elf_next_input_section): Update to use sec_info union as list pointer. (PREV_SEC): Delete. (group_sections): Pass "info" param rather than "htab". Iterate over output sections rather than input_list. Use sec_info union as list pointers. Alloc atruct map_stub, and return fail status. * bfd-in2.h: Regenerate. --- bfd/section.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'bfd/section.c') diff --git a/bfd/section.c b/bfd/section.c index fc6b765..834a9ab 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -821,13 +821,13 @@ _bfd_generic_new_section_hook (bfd *abfd, asection *newsect) return TRUE; } +static unsigned int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ + /* Initializes a new section. NEWSECT->NAME is already set. */ static asection * bfd_section_init (bfd *abfd, asection *newsect) { - static unsigned int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ - newsect->id = section_id; newsect->index = abfd->section_count; newsect->owner = abfd; @@ -1275,6 +1275,23 @@ bfd_make_section (bfd *abfd, const char *name) /* FUNCTION + bfd_get_next_section_id + +SYNOPSIS + int bfd_get_next_section_id (void); + +DESCRIPTION + Returns the id that the next section created will have. +*/ + +int +bfd_get_next_section_id (void) +{ + return section_id; +} + +/* +FUNCTION bfd_set_section_flags SYNOPSIS -- cgit v1.1