diff options
author | Alan Modra <amodra@bigpond.net.au> | 2005-01-11 09:32:53 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2005-01-11 09:32:53 +0000 |
commit | cef27e59e3fe874c4afb3481acd94aee850dfdd8 (patch) | |
tree | fc0b699f53abf401d70a716d4ed16a33004bcdb8 /bfd/elf32-m32r.c | |
parent | e5542126197fc54a9b8a8543ab4322d4f274d3c3 (diff) | |
download | gdb-cef27e59e3fe874c4afb3481acd94aee850dfdd8.tar.gz |
* elf64-ppc.c (ppc64_elf_gc_sweep_hook): Follow indirect and warning
symbols.
* elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise.
* elf32-cris.c (cris_elf_gc_sweep_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise.
* elf32-i386.c (elf_i386_gc_sweep_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise.
* elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise.
* elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
* elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
* elf32-sparc.c (elf32_sparc_gc_sweep_hook): Likewise.
* elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
* elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise.
* elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
* elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
Diffstat (limited to 'bfd/elf32-m32r.c')
-rw-r--r-- | bfd/elf32-m32r.c | 153 |
1 files changed, 79 insertions, 74 deletions
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 3b1cf26572f..c74980b4314 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1,5 +1,5 @@ /* M32R-specific support for 32-bit ELF. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -4341,8 +4341,6 @@ m32r_elf_gc_sweep_hook (abfd, info, sec, relocs) struct elf_link_hash_entry **sym_hashes; bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; elf_section_data (sec)->local_dynrel = NULL; @@ -4352,84 +4350,91 @@ m32r_elf_gc_sweep_hook (abfd, info, sec, relocs) relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_M32R_GOT16_HI_ULO: - case R_M32R_GOT16_HI_SLO: - case R_M32R_GOT16_LO: - case R_M32R_GOTOFF: - case R_M32R_GOTOFF_HI_ULO: - case R_M32R_GOTOFF_HI_SLO: - case R_M32R_GOTOFF_LO: - case R_M32R_GOT24: - case R_M32R_GOTPC_HI_ULO: - case R_M32R_GOTPC_HI_SLO: - case R_M32R_GOTPC_LO: - case R_M32R_GOTPC24: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->got.refcount > 0) - h->got.refcount--; - } - else - { - if (local_got_refcounts && local_got_refcounts[r_symndx] > 0) - local_got_refcounts[r_symndx]--; - } - break; + { + unsigned long r_symndx; + struct elf_link_hash_entry *h = NULL; - case R_M32R_16_RELA: - case R_M32R_24_RELA: - case R_M32R_32_RELA: - case R_M32R_HI16_ULO_RELA: - case R_M32R_HI16_SLO_RELA: - case R_M32R_LO16_RELA: - case R_M32R_SDA16_RELA: - case R_M32R_18_PCREL_RELA: - case R_M32R_26_PCREL_RELA: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - struct elf_m32r_link_hash_entry *eh; - struct elf_m32r_dyn_relocs **pp; - struct elf_m32r_dyn_relocs *p; + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOTOFF: + case R_M32R_GOTOFF_HI_ULO: + case R_M32R_GOTOFF_HI_SLO: + case R_M32R_GOTOFF_LO: + case R_M32R_GOT24: + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + case R_M32R_GOTPC24: + if (h != NULL) + { + if (h->got.refcount > 0) + h->got.refcount--; + } + else + { + if (local_got_refcounts && local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx]--; + } + break; + + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_HI16_SLO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + if (h != NULL) + { + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs **pp; + struct elf_m32r_dyn_relocs *p; - if (!info->shared && h->plt.refcount > 0) - h->plt.refcount -= 1; + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; - eh = (struct elf_m32r_link_hash_entry *) h; + eh = (struct elf_m32r_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) - if (p->sec == sec) - { - if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA - || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA) - p->pc_count -= 1; - p->count -= 1; - if (p->count == 0) - *pp = p->next; - break; - } - } - break; + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA + || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; - case R_M32R_26_PLTREL: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->plt.refcount > 0) - h->plt.refcount--; - } - break; + case R_M32R_26_PLTREL: + if (h != NULL) + { + if (h->plt.refcount > 0) + h->plt.refcount--; + } + break; - default: - break; - } + default: + break; + } + } return TRUE; } |