return true;
}
+struct arc_static_sym_data {
+ bfd_vma sym_value;
+ const char *symbol_name;
+};
+
+static struct arc_static_sym_data
+get_static_sym_data (unsigned long r_symndx,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections,
+ struct elf_link_hash_entry *h,
+ struct arc_relocation_data *reloc_data)
+{
+ static const char local_name[] = "(local)";
+ struct arc_static_sym_data ret = { 0, NULL };
+
+ if (h != NULL)
+ {
+ BFD_ASSERT (h->root.type != bfd_link_hash_undefweak
+ && h->root.type != bfd_link_hash_undefined);
+ /* TODO: This should not be here. */
+ reloc_data->sym_value = h->root.u.def.value;
+ reloc_data->sym_section = h->root.u.def.section;
+
+ ret.sym_value = h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset;
+
+ ret.symbol_name = h->root.root.string;
+ }
+ else
+ {
+ Elf_Internal_Sym *sym = local_syms + r_symndx;
+ asection *sec = local_sections[r_symndx];
+
+ ret.sym_value = sym->st_value
+ + sec->output_section->vma
+ + sec->output_offset;
+
+ ret.symbol_name = local_name;
+ }
+ return ret;
+}
static bfd_vma
relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
&& SYMBOL_REFERENCES_LOCAL (info, h))))
{
const char ATTRIBUTE_UNUSED *symbol_name;
- static const char local_name[] = "(local)";
- asection *tls_sec = NULL;
- bfd_vma sym_value = 0;
-
- if (h != NULL)
- {
- /* TODO: This should not be here. */
- reloc_data->sym_value = h->root.u.def.value;
- reloc_data->sym_section = h->root.u.def.section;
-
- sym_value = h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset;
-
- tls_sec = elf_hash_table (info)->tls_sec;
-
- symbol_name = h->root.root.string;
- }
- else
- {
- Elf_Internal_Sym *sym = local_syms + r_symndx;
- asection *sec = local_sections[r_symndx];
-
- sym_value = sym->st_value
- + sec->output_section->vma
- + sec->output_offset;
-
- tls_sec = elf_hash_table (info)->tls_sec;
-
- symbol_name = local_name;
- }
-
+ asection *tls_sec = elf_hash_table (info)->tls_sec;
if (entry && !entry->processed)
{
if (h == NULL || h->forced_local
|| !elf_hash_table (info)->dynamic_sections_created)
{
+ struct arc_static_sym_data tmp =
+ get_static_sym_data (r_symndx, local_syms, local_sections,
+ h, reloc_data);
+
bfd_put_32 (output_bfd,
- sym_value - sec_vma
+ tmp.sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created
? 0
: (align_power (0,
+ entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0)),
- symbol_name);
+ tmp.symbol_name);
}
}
break;
bfd_vma ATTRIBUTE_UNUSED sec_vma
= tls_sec->output_section->vma;
+ struct arc_static_sym_data tmp =
+ get_static_sym_data (r_symndx, local_syms, local_sections,
+ h, reloc_data);
+
bfd_put_32 (output_bfd,
- sym_value - sec_vma
+ tmp.sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created
? 0
: (align_power (TCB_SIZE,
+ entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0)),
- symbol_name);
+ tmp.symbol_name);
}
break;
"@ %#08lx for sym %s in got offset %#lx\n",
(long) (reloc_data->sym_value + sec_vma),
(long) (htab->sgot->output_section->vma
- + htab->sgot->output_offset + entry->offset),
+ + htab->sgot->output_offset
+ + entry->offset),
symbol_name,
(long) entry->offset);
}