-/* Update the relocation information for the relocations of the section
- being removed. */
-
-static bfd_boolean
-bfinfdpic_gc_sweep_hook (bfd *abfd,
- struct bfd_link_info *info,
- asection *sec,
- const Elf_Internal_Rela *relocs)
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
- const Elf_Internal_Rela *rel;
- const Elf_Internal_Rela *rel_end;
- struct bfinfdpic_relocs_info *picrel;
-
- BFD_ASSERT (IS_FDPIC (abfd));
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (abfd);
- sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
- if (!elf_bad_symtab (abfd))
- sym_hashes_end -= symtab_hdr->sh_info;
-
- rel_end = relocs + sec->reloc_count;
- for (rel = relocs; rel < rel_end; rel++)
- {
- struct elf_link_hash_entry *h;
- unsigned long r_symndx;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
- if (h != NULL)
- picrel = bfinfdpic_relocs_info_for_global (bfinfdpic_relocs_info (info),
- abfd, h,
- rel->r_addend, NO_INSERT);
- else
- picrel = bfinfdpic_relocs_info_for_local (bfinfdpic_relocs_info
- (info), abfd, r_symndx,
- rel->r_addend, NO_INSERT);
-
- if (!picrel)
- return TRUE;
-
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_BFIN_PCREL24:
- case R_BFIN_PCREL24_JUMP_L:
- picrel->call--;
- break;
-
- case R_BFIN_FUNCDESC_VALUE:
- picrel->relocsfdv--;
- if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
- picrel->relocs32++;
- /* Fall through. */
-
- case R_BFIN_BYTE4_DATA:
- picrel->sym--;
- if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
- picrel->relocs32--;
- break;
-
- case R_BFIN_GOT17M4:
- picrel->got17m4--;
- break;
-
- case R_BFIN_GOTHI:
- case R_BFIN_GOTLO:
- picrel->gothilo--;
- break;
-
- case R_BFIN_FUNCDESC_GOT17M4:
- picrel->fdgot17m4--;
- break;
-
- case R_BFIN_FUNCDESC_GOTHI:
- case R_BFIN_FUNCDESC_GOTLO:
- picrel->fdgothilo--;
- break;
-
- case R_BFIN_GOTOFF17M4:
- case R_BFIN_GOTOFFHI:
- case R_BFIN_GOTOFFLO:
- picrel->gotoff--;
- break;
-
- case R_BFIN_FUNCDESC_GOTOFF17M4:
- picrel->fdgoff17m4--;
- break;
-
- case R_BFIN_FUNCDESC_GOTOFFHI:
- case R_BFIN_FUNCDESC_GOTOFFLO:
- picrel->fdgoffhilo--;
- break;
-
- case R_BFIN_FUNCDESC:
- picrel->fd--;
- picrel->relocsfd--;
- break;
-
- default:
- break;
- }
- }
-
- return TRUE;
-}
-