+ if (h->got.glist != NULL)
+ {
+ struct got_entry *entry = h->got.glist;
+
+ if (is_reloc_for_GOT (howto) || is_reloc_for_TLS (howto))
+ {
+ if (! elf_hash_table (info)->dynamic_sections_created
+ || (bfd_link_pic (info)
+ && SYMBOL_REFERENCES_LOCAL (info, h)))
+ {
+ reloc_data.sym_value = h->root.u.def.value;
+ reloc_data.sym_section = h->root.u.def.section;
+
+ if (is_reloc_for_TLS (howto))
+ while (entry->type == GOT_NORMAL && entry->next != NULL)
+ entry = entry->next;
+
+ if (entry->processed == FALSE
+ && (entry->type == GOT_TLS_GD
+ || entry->type == GOT_TLS_IE))
+ {
+ bfd_vma sym_value = h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset;
+
+ bfd_vma sec_vma =
+ elf_hash_table (info)->tls_sec->output_section->vma;
+
+ bfd_put_32 (output_bfd,
+ sym_value - sec_vma,
+ htab->sgot->contents + entry->offset
+ + (entry->existing_entries == MOD_AND_OFF ? 4 : 0));
+
+ ARC_DEBUG ("arc_info: FIXED -> %s value = 0x%x "
+ "@ 0x%x, for symbol %s\n",
+ (entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
+ "GOT_TLS_IE"),
+ sym_value - sec_vma,
+ htab->sgot->contents + entry->offset
+ + (entry->existing_entries == MOD_AND_OFF ? 4 : 0),
+ h->root.root.string);
+
+ entry->processed = TRUE;
+ }
+
+ if (entry->type == GOT_TLS_IE && entry->processed == FALSE)
+ {
+ bfd_vma sec_vma = htab->tls_sec->output_section->vma;
+ bfd_put_32 (output_bfd,
+ reloc_data.sym_value - sec_vma,
+ htab->sgot->contents + entry->offset);
+ }
+
+ if (entry->type == GOT_NORMAL && entry->processed == FALSE)
+ {
+ bfd_vma sec_vma =
+ reloc_data.sym_section->output_section->vma
+ + reloc_data.sym_section->output_offset;
+
+ if (h->root.type != bfd_link_hash_undefweak)
+ {
+ bfd_put_32 (output_bfd,
+ reloc_data.sym_value + sec_vma,
+ htab->sgot->contents + entry->offset);
+
+ ARC_DEBUG ("arc_info: PATCHED: 0x%08x "
+ "@ 0x%08x for sym %s in got offset 0x%x\n",
+ reloc_data.sym_value + sec_vma,
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + entry->offset,
+ h->root.root.string,
+ entry->offset);
+ }
+ else
+ {
+ ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED "
+ "@ 0x%08x for sym %s in got offset 0x%x "
+ "(is undefweak)\n",
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + entry->offset,
+ h->root.root.string,
+ entry->offset);
+ }
+
+ entry->processed = TRUE;
+ }
+ }
+ }
+
+ reloc_data.got_offset_value = entry->offset;
+
+ ARC_DEBUG ("arc_info: GOT_ENTRY = %d, offset = 0x%x, "
+ "vma = 0x%x for symbol %s\n",
+ entry->type, entry->offset,
+ htab->sgot->output_section->vma
+ + htab->sgot->output_offset + entry->offset,
+ h->root.root.string);
+ }
+
+ BFD_ASSERT (htab->sgot != NULL || !is_reloc_for_GOT (howto));
+ if (htab->sgot != NULL)
+ reloc_data.got_symbol_vma = htab->sgot->output_section->vma
+ + htab->sgot->output_offset;