From 6061a67d142a3c3cbe22903abbd24504a8aa80ec Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 23 May 2011 06:22:51 +0000 Subject: [PATCH] * elf-bfd.h: Comment typo fix. * elf32-ppc.c (struct ppc_elf_dyn_relocs): Delete. Replace with struct elf_dyn_relocs throughout. * elf64-ppc.c (struct ppc_dyn_relocs): Likewise. --- bfd/ChangeLog | 7 +++++++ bfd/elf-bfd.h | 4 ++-- bfd/elf32-ppc.c | 48 +++++++++++++----------------------------- bfd/elf64-ppc.c | 56 ++++++++++++++++--------------------------------- 4 files changed, 41 insertions(+), 74 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c29f29ade79..02b47d4a34d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2011-05-23 Alan Modra + + * elf-bfd.h: Comment typo fix. + * elf32-ppc.c (struct ppc_elf_dyn_relocs): Delete. Replace with + struct elf_dyn_relocs throughout. + * elf64-ppc.c (struct ppc_dyn_relocs): Likewise. + 2011-05-23 Alan Modra * elf32-frv.c: Use info->callbacks->einfo throughout file in linker diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 735d2b58e4e..b34845be3a0 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for ELF files. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Written by Cygnus Support. @@ -2260,7 +2260,7 @@ extern bfd_boolean _bfd_elf_merge_unknown_attribute_low (bfd *, bfd *, int); extern bfd_boolean _bfd_elf_merge_unknown_attribute_list (bfd *, bfd *); extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec); -/* The linker may needs to keep track of the number of relocs that it +/* The linker may need to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. This is so that it can later discard them if they are found to be unnecessary. We can store the information in a field extending the diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 5194c6c4316..58178661161 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2562,26 +2562,6 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms, ppc_elf_finish_dynamic_sections is one of the last functions called. */ -/* The PPC linker needs to keep track of the number of relocs that it - decides to copy as dynamic relocs in check_relocs for each symbol. - This is so that it can later discard them if they are found to be - unnecessary. We store the information in a field extending the - regular ELF linker hash table. */ - -struct ppc_elf_dyn_relocs -{ - struct ppc_elf_dyn_relocs *next; - - /* The input section of the reloc. */ - asection *sec; - - /* Total number of relocs copied for the input section. */ - bfd_size_type count; - - /* Number of pc-relative relocs copied for the input section. */ - bfd_size_type pc_count; -}; - /* Track PLT entries needed for a given symbol. We might need more than one glink entry per symbol when generating a pic binary. */ struct plt_entry @@ -2656,7 +2636,7 @@ struct ppc_elf_link_hash_entry elf_linker_section_pointers_t *linker_section_pointer; /* Track dynamic relocs copied for this symbol. */ - struct ppc_elf_dyn_relocs *dyn_relocs; + struct elf_dyn_relocs *dyn_relocs; /* Contexts in which symbol is used in the GOT (or TOC). TLS_GD .. TLS_TLS bits are or'd into the mask as the @@ -2981,14 +2961,14 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, { if (edir->dyn_relocs != NULL) { - struct ppc_elf_dyn_relocs **pp; - struct ppc_elf_dyn_relocs *p; + struct elf_dyn_relocs **pp; + struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { - struct ppc_elf_dyn_relocs *q; + struct elf_dyn_relocs *q; for (q = edir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) @@ -3931,8 +3911,8 @@ ppc_elf_check_relocs (bfd *abfd, && (h->root.type == bfd_link_hash_defweak || !h->def_regular))) { - struct ppc_elf_dyn_relocs *p; - struct ppc_elf_dyn_relocs **rel_head; + struct elf_dyn_relocs *p; + struct elf_dyn_relocs **rel_head; #ifdef DEBUG fprintf (stderr, @@ -3978,7 +3958,7 @@ ppc_elf_check_relocs (bfd *abfd, s = sec; vpp = &elf_section_data (s)->local_dynrel; - rel_head = (struct ppc_elf_dyn_relocs **) vpp; + rel_head = (struct elf_dyn_relocs **) vpp; } p = *rel_head; @@ -4382,7 +4362,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd, r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { - struct ppc_elf_dyn_relocs **pp, *p; + struct elf_dyn_relocs **pp, *p; struct ppc_elf_link_hash_entry *eh; h = sym_hashes[r_symndx - symtab_hdr->sh_info]; @@ -4880,7 +4860,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, static bfd_boolean readonly_dynrelocs (struct elf_link_hash_entry *h) { - struct ppc_elf_dyn_relocs *p; + struct elf_dyn_relocs *p; for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) { @@ -5164,7 +5144,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) struct bfd_link_info *info = inf; struct ppc_elf_link_hash_entry *eh; struct ppc_elf_link_hash_table *htab; - struct ppc_elf_dyn_relocs *p; + struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) return TRUE; @@ -5422,7 +5402,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) then they should avoid writing weird assembly. */ if (SYMBOL_CALLS_LOCAL (info, h)) { - struct ppc_elf_dyn_relocs **pp; + struct elf_dyn_relocs **pp; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) { @@ -5437,7 +5417,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (htab->is_vxworks) { - struct ppc_elf_dyn_relocs **pp; + struct elf_dyn_relocs **pp; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) { @@ -5589,9 +5569,9 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, for (s = ibfd->sections; s != NULL; s = s->next) { - struct ppc_elf_dyn_relocs *p; + struct elf_dyn_relocs *p; - for (p = ((struct ppc_elf_dyn_relocs *) + for (p = ((struct elf_dyn_relocs *) elf_section_data (s)->local_dynrel); p != NULL; p = p->next) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index c5bbac5619f..8fff7fb99d3 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3487,26 +3487,6 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd, calls may use the function descriptor symbol, ie. "bl foo". This behaves exactly as "bl .foo". */ -/* The linker needs to keep track of the number of relocs that it - decides to copy as dynamic relocs in check_relocs for each symbol. - This is so that it can later discard them if they are found to be - unnecessary. We store the information in a field extending the - regular ELF linker hash table. */ - -struct ppc_dyn_relocs -{ - struct ppc_dyn_relocs *next; - - /* The input section of the reloc. */ - asection *sec; - - /* Total number of relocs copied for the input section. */ - bfd_size_type count; - - /* Number of pc-relative relocs copied for the input section. */ - bfd_size_type pc_count; -}; - /* Of those relocs that might be copied as dynamic relocs, this function selects those that must be copied when linking a shared library, even when the symbol is local. */ @@ -3673,7 +3653,7 @@ struct ppc_link_hash_entry } u; /* Track dynamic relocs copied for this symbol. */ - struct ppc_dyn_relocs *dyn_relocs; + struct elf_dyn_relocs *dyn_relocs; /* Link between function code and descriptor symbols. */ struct ppc_link_hash_entry *oh; @@ -4403,14 +4383,14 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, { if (edir->dyn_relocs != NULL) { - struct ppc_dyn_relocs **pp; - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs **pp; + struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { - struct ppc_dyn_relocs *q; + struct elf_dyn_relocs *q; for (q = edir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) @@ -5406,8 +5386,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, || (!info->shared && ifunc != NULL)) { - struct ppc_dyn_relocs *p; - struct ppc_dyn_relocs **head; + struct elf_dyn_relocs *p; + struct elf_dyn_relocs **head; /* We must copy these reloc types into the output file. Create a reloc section in dynobj and make room for @@ -5446,7 +5426,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, s = sec; vpp = &elf_section_data (s)->local_dynrel; - head = (struct ppc_dyn_relocs **) vpp; + head = (struct elf_dyn_relocs **) vpp; } p = *head; @@ -5855,8 +5835,8 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, if (r_symndx >= symtab_hdr->sh_info) { struct ppc_link_hash_entry *eh; - struct ppc_dyn_relocs **pp; - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs **pp; + struct elf_dyn_relocs *p; h = sym_hashes[r_symndx - symtab_hdr->sh_info]; h = elf_follow_link (h); @@ -6474,7 +6454,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (ELIMINATE_COPY_RELOCS) { struct ppc_link_hash_entry * eh; - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs *p; eh = (struct ppc_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) @@ -6814,8 +6794,8 @@ dec_dynrel_count (bfd_vma r_info, asection *sym_sec) { enum elf_ppc64_reloc_type r_type; - struct ppc_dyn_relocs *p; - struct ppc_dyn_relocs **pp; + struct elf_dyn_relocs *p; + struct elf_dyn_relocs **pp; /* Can this reloc be dynamic? This switch, and later tests here should be kept in sync with the code in check_relocs. */ @@ -6900,12 +6880,12 @@ dec_dynrel_count (bfd_vma r_info, if (sym_sec != NULL) { void *vpp = &elf_section_data (sym_sec)->local_dynrel; - pp = (struct ppc_dyn_relocs **) vpp; + pp = (struct elf_dyn_relocs **) vpp; } else { void *vpp = &elf_section_data (sec)->local_dynrel; - pp = (struct ppc_dyn_relocs **) vpp; + pp = (struct elf_dyn_relocs **) vpp; } /* elf_gc_sweep may have already removed all dyn relocs associated @@ -8617,7 +8597,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) struct ppc_link_hash_table *htab; asection *s; struct ppc_link_hash_entry *eh; - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs *p; struct got_entry **pgent, *gent; if (h->root.type == bfd_link_hash_indirect) @@ -8781,7 +8761,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) then they should avoid writing weird assembly. */ if (SYMBOL_CALLS_LOCAL (info, h)) { - struct ppc_dyn_relocs **pp; + struct elf_dyn_relocs **pp; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) { @@ -8864,7 +8844,7 @@ static bfd_boolean readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct ppc_link_hash_entry *eh; - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; @@ -8939,7 +8919,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, for (s = ibfd->sections; s != NULL; s = s->next) { - struct ppc_dyn_relocs *p; + struct elf_dyn_relocs *p; for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) {