aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-04-20 17:12:46 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-04-20 17:14:02 -0700
commite66cdd681f47dc51beaeee3d813f1c9cba27dedf (patch)
tree77e6f89a37fb2d7df3c59e3b9ffa21cf90302fd3 /bfd/elf32-i386.c
parent5ce03cea78d4d8bf00e29e4dfa4952d53f3b1064 (diff)
downloadgdb-e66cdd681f47dc51beaeee3d813f1c9cba27dedf.zip
gdb-e66cdd681f47dc51beaeee3d813f1c9cba27dedf.tar.gz
gdb-e66cdd681f47dc51beaeee3d813f1c9cba27dedf.tar.bz2
Remove x86 gc_sweep_hook
Since x86 backends never see the removed sections, there is no need for gc_sweep_hook. * elf32-i386.c (elf_i386_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elf64-x86-64.c (elf_x86_64_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c158
1 files changed, 0 insertions, 158 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 0a2ac9d..7948fa9 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2038,163 +2038,6 @@ elf_i386_gc_mark_hook (asection *sec,
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf_i386_gc_sweep_hook (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- struct elf_i386_link_hash_table *htab;
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
- const Elf_Internal_Rela *rel, *relend;
-
- if (bfd_link_relocatable (info))
- return TRUE;
-
- htab = elf_i386_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- elf_section_data (sec)->local_dynrel = NULL;
-
- symtab_hdr = &elf_symtab_hdr (abfd);
- sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
-
- relend = relocs + sec->reloc_count;
- for (rel = relocs; rel < relend; rel++)
- {
- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- 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;
- }
- else
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
-
- isym = bfd_sym_from_r_symndx (&htab->sym_cache,
- abfd, r_symndx);
-
- /* Check relocation against local STT_GNU_IFUNC symbol. */
- if (isym != NULL
- && ELF32_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
- {
- h = elf_i386_get_local_sym_hash (htab, abfd, rel, FALSE);
- if (h == NULL)
- abort ();
- }
- }
-
- if (h)
- {
- struct elf_i386_link_hash_entry *eh;
- struct elf_dyn_relocs **pp;
- struct elf_dyn_relocs *p;
-
- eh = (struct elf_i386_link_hash_entry *) h;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- /* Everything must go for SEC. */
- *pp = p->next;
- break;
- }
- }
-
- r_type = ELF32_R_TYPE (rel->r_info);
- if (! elf_i386_tls_transition (info, abfd, sec, NULL,
- symtab_hdr, sym_hashes,
- &r_type, GOT_UNKNOWN,
- rel, relend, h, r_symndx))
- return FALSE;
-
- switch (r_type)
- {
- case R_386_TLS_LDM:
- if (htab->tls_ldm_got.refcount > 0)
- htab->tls_ldm_got.refcount -= 1;
- break;
-
- case R_386_TLS_GD:
- case R_386_TLS_GOTDESC:
- case R_386_TLS_DESC_CALL:
- case R_386_TLS_IE_32:
- case R_386_TLS_IE:
- case R_386_TLS_GOTIE:
- case R_386_GOT32:
- case R_386_GOT32X:
- if (h != NULL)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- if (h->type == STT_GNU_IFUNC)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- }
- else if (local_got_refcounts != NULL)
- {
- if (local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
- }
- break;
-
- case R_386_32:
- case R_386_PC32:
- case R_386_SIZE32:
- if (bfd_link_pic (info)
- && (h == NULL || h->type != STT_GNU_IFUNC))
- break;
- /* Fall through */
-
- case R_386_PLT32:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- if (r_type == R_386_32
- && (sec->flags & SEC_READONLY) == 0)
- {
- struct elf_i386_link_hash_entry *eh
- = (struct elf_i386_link_hash_entry *) h;
- if (eh->func_pointer_refcount > 0)
- eh->func_pointer_refcount -= 1;
- }
- }
- break;
-
- case R_386_GOTOFF:
- if (h != NULL && h->type == STT_GNU_IFUNC)
- {
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
- if (h->plt.refcount > 0)
- h->plt.refcount -= 1;
- }
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-
/* Remove undefined weak symbol from the dynamic symbol table if it
is resolved to 0. */
@@ -5981,7 +5824,6 @@ elf_i386_add_symbol_hook (bfd * abfd,
#define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_i386_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_i386_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook
#define elf_backend_grok_prstatus elf_i386_grok_prstatus
#define elf_backend_grok_psinfo elf_i386_grok_psinfo
#define elf_backend_reloc_type_class elf_i386_reloc_type_class