{
unsigned long r_symndx;
struct elf_link_hash_entry *h;
+ enum elf_ppc_reloc_type r_type;
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- switch (ELF64_R_TYPE (rel->r_info))
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
{
/* GOT16 relocations */
case R_PPC64_GOT16:
symbol. */
if ((info->shared
&& (sec->flags & SEC_ALLOC) != 0
- && (IS_ABSOLUTE_RELOC (ELF64_R_TYPE (rel->r_info))
+ && (IS_ABSOLUTE_RELOC (r_type)
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
}
p->count += 1;
- if (!IS_ABSOLUTE_RELOC (ELF64_R_TYPE (rel->r_info)))
+ if (!IS_ABSOLUTE_RELOC (r_type))
p->pc_count += 1;
}
else
{
if (h != NULL)
{
- switch (ELF64_R_TYPE (rel->r_info))
+ enum elf_ppc_reloc_type r_type;
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
{
case R_PPC64_GNU_VTINHERIT:
case R_PPC64_GNU_VTENTRY:
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;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_PPC64_GOT16:
- case R_PPC64_GOT16_DS:
- case R_PPC64_GOT16_HA:
- case R_PPC64_GOT16_HI:
- case R_PPC64_GOT16_LO:
- case R_PPC64_GOT16_LO_DS:
- r_symndx = ELF64_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[r_symndx] > 0)
- local_got_refcounts[r_symndx]--;
- }
- break;
-
- case R_PPC64_PLT16_HA:
- case R_PPC64_PLT16_HI:
- case R_PPC64_PLT16_LO:
- case R_PPC64_PLT32:
- case R_PPC64_PLT64:
- r_symndx = ELF64_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;
+ {
+ unsigned long r_symndx;
+ enum elf_ppc_reloc_type r_type;
+ struct elf_link_hash_entry *h;
- case R_PPC64_REL14:
- case R_PPC64_REL14_BRNTAKEN:
- case R_PPC64_REL14_BRTAKEN:
- case R_PPC64_REL24:
- case R_PPC64_REL32:
- case R_PPC64_REL64:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC64_GOT16:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_GOT16_HI:
+ case R_PPC64_GOT16_LO:
+ case R_PPC64_GOT16_LO_DS:
+ 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[r_symndx] > 0)
+ local_got_refcounts[r_symndx]--;
+ }
+ break;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_link_hash_entry *) h;
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_PLT16_HI:
+ case R_PPC64_PLT16_LO:
+ case R_PPC64_PLT32:
+ case R_PPC64_PLT64:
+ 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;
- for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
- if (p->sec == sec)
- {
- p->pc_count -= 1;
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
+ case R_PPC64_REL14:
+ case R_PPC64_REL14_BRNTAKEN:
+ case R_PPC64_REL14_BRTAKEN:
+ case R_PPC64_REL24:
+ case R_PPC64_REL32:
+ case R_PPC64_REL64:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
- case R_PPC64_ADDR14:
- case R_PPC64_ADDR14_BRNTAKEN:
- case R_PPC64_ADDR14_BRTAKEN:
- case R_PPC64_ADDR16:
- case R_PPC64_ADDR16_DS:
- case R_PPC64_ADDR16_HA:
- case R_PPC64_ADDR16_HI:
- case R_PPC64_ADDR16_HIGHER:
- case R_PPC64_ADDR16_HIGHERA:
- case R_PPC64_ADDR16_HIGHEST:
- case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_ADDR16_LO:
- case R_PPC64_ADDR16_LO_DS:
- case R_PPC64_ADDR24:
- case R_PPC64_ADDR30:
- case R_PPC64_ADDR32:
- case R_PPC64_ADDR64:
- case R_PPC64_UADDR16:
- case R_PPC64_UADDR32:
- case R_PPC64_UADDR64:
- case R_PPC64_TOC:
- r_symndx = ELF64_R_SYM (rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct ppc_link_hash_entry *eh;
- struct ppc_dyn_relocs **pp;
- struct ppc_dyn_relocs *p;
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_link_hash_entry *) h;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- eh = (struct ppc_link_hash_entry *) h;
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ 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)
- {
- p->count -= 1;
- if (p->count == 0)
- *pp = p->next;
- break;
- }
- }
- break;
+ case R_PPC64_ADDR14:
+ case R_PPC64_ADDR14_BRNTAKEN:
+ case R_PPC64_ADDR14_BRTAKEN:
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR24:
+ case R_PPC64_ADDR30:
+ case R_PPC64_ADDR32:
+ case R_PPC64_ADDR64:
+ case R_PPC64_UADDR16:
+ case R_PPC64_UADDR32:
+ case R_PPC64_UADDR64:
+ case R_PPC64_TOC:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
- default:
- break;
- }
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
return true;
}
ppc64_elf_reloc_type_class (rela)
const Elf_Internal_Rela *rela;
{
- switch ((int) ELF64_R_TYPE (rela->r_info))
+ enum elf_ppc_reloc_type r_type;
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rela->r_info);
+ switch (r_type)
{
case R_PPC64_RELATIVE:
return reloc_class_relative;