- unsigned long r_symndx;
- unsigned int r_type;
- struct elf_link_hash_entry *h = NULL;
-
- r_symndx = TILEGX_ELF_R_SYMNDX (htab, rel->r_info);
- if (r_symndx >= symtab_hdr->sh_info)
- {
- struct tilegx_elf_link_hash_entry *eh;
- struct tilegx_elf_dyn_relocs **pp;
- struct tilegx_elf_dyn_relocs *p;
-
- 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;
- eh = (struct tilegx_elf_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 = TILEGX_ELF_R_TYPE (rel->r_info);
- r_type = tilegx_elf_tls_transition (info, r_type, h != NULL,
- sec->sec_flg0);
- switch (r_type)
- {
- case R_TILEGX_IMM16_X0_HW0_GOT:
- case R_TILEGX_IMM16_X1_HW0_GOT:
- case R_TILEGX_IMM16_X0_HW0_LAST_GOT:
- case R_TILEGX_IMM16_X1_HW0_LAST_GOT:
- case R_TILEGX_IMM16_X0_HW1_LAST_GOT:
- case R_TILEGX_IMM16_X1_HW1_LAST_GOT:
- case R_TILEGX_IMM16_X0_HW0_TLS_GD:
- case R_TILEGX_IMM16_X1_HW0_TLS_GD:
- case R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD:
- case R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD:
- case R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD:
- case R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD:
- case R_TILEGX_IMM16_X0_HW0_TLS_IE:
- case R_TILEGX_IMM16_X1_HW0_TLS_IE:
- case R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE:
- case R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE:
- case R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE:
- case R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE:
- 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_TILEGX_64_PCREL:
- case R_TILEGX_32_PCREL:
- case R_TILEGX_16_PCREL:
- case R_TILEGX_8_PCREL:
- case R_TILEGX_IMM16_X0_HW0_PCREL:
- case R_TILEGX_IMM16_X1_HW0_PCREL:
- case R_TILEGX_IMM16_X0_HW1_PCREL:
- case R_TILEGX_IMM16_X1_HW1_PCREL:
- case R_TILEGX_IMM16_X0_HW2_PCREL:
- case R_TILEGX_IMM16_X1_HW2_PCREL:
- case R_TILEGX_IMM16_X0_HW3_PCREL:
- case R_TILEGX_IMM16_X1_HW3_PCREL:
- case R_TILEGX_IMM16_X0_HW0_LAST_PCREL:
- case R_TILEGX_IMM16_X1_HW0_LAST_PCREL:
- case R_TILEGX_IMM16_X0_HW1_LAST_PCREL:
- case R_TILEGX_IMM16_X1_HW1_LAST_PCREL:
- case R_TILEGX_IMM16_X0_HW2_LAST_PCREL:
- case R_TILEGX_IMM16_X1_HW2_LAST_PCREL:
- if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
- break;
- /* Fall through. */
-
- case R_TILEGX_64:
- case R_TILEGX_32:
- case R_TILEGX_16:
- case R_TILEGX_8:
- case R_TILEGX_HW0:
- case R_TILEGX_HW1:
- case R_TILEGX_HW2:
- case R_TILEGX_HW3:
- case R_TILEGX_HW0_LAST:
- case R_TILEGX_HW1_LAST:
- case R_TILEGX_HW2_LAST:
- case R_TILEGX_COPY:
- case R_TILEGX_GLOB_DAT:
- case R_TILEGX_JMP_SLOT:
- case R_TILEGX_RELATIVE:
- case R_TILEGX_BROFF_X1:
- case R_TILEGX_JUMPOFF_X1:
- case R_TILEGX_IMM8_X0:
- case R_TILEGX_IMM8_Y0:
- case R_TILEGX_IMM8_X1:
- case R_TILEGX_IMM8_Y1:
- case R_TILEGX_DEST_IMM8_X1:
- case R_TILEGX_MT_IMM14_X1:
- case R_TILEGX_MF_IMM14_X1:
- case R_TILEGX_MMSTART_X0:
- case R_TILEGX_MMEND_X0:
- case R_TILEGX_SHAMT_X0:
- case R_TILEGX_SHAMT_X1:
- case R_TILEGX_SHAMT_Y0:
- case R_TILEGX_SHAMT_Y1:
- case R_TILEGX_IMM16_X0_HW0:
- case R_TILEGX_IMM16_X1_HW0:
- case R_TILEGX_IMM16_X0_HW1:
- case R_TILEGX_IMM16_X1_HW1:
- case R_TILEGX_IMM16_X0_HW2:
- case R_TILEGX_IMM16_X1_HW2:
- case R_TILEGX_IMM16_X0_HW3:
- case R_TILEGX_IMM16_X1_HW3:
- case R_TILEGX_IMM16_X0_HW0_LAST:
- case R_TILEGX_IMM16_X1_HW0_LAST:
- case R_TILEGX_IMM16_X0_HW1_LAST:
- case R_TILEGX_IMM16_X1_HW1_LAST:
- case R_TILEGX_IMM16_X0_HW2_LAST:
- case R_TILEGX_IMM16_X1_HW2_LAST:
- if (info->shared)
- break;
- /* Fall through. */
-
- case R_TILEGX_JUMPOFF_X1_PLT:
- case R_TILEGX_IMM16_X0_HW0_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW0_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW1_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW1_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW2_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW2_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW3_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW3_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL:
- case R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL:
- case R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
- h->plt.refcount--;
- }
- break;