aboutsummaryrefslogtreecommitdiff
path: root/bfd/arc-got.h
diff options
context:
space:
mode:
authorCupertino Miranda <cmiranda@synopsys.com>2018-10-04 10:17:03 +0100
committerCupertino Miranda <cmiranda@synopsys.com>2018-11-09 15:34:37 +0000
commitd07b621f4cc585607c7eee7cc58ce54a7dde52f5 (patch)
tree766c99bcb5938ebb172201b347c5ecf2fb42e183 /bfd/arc-got.h
parentfda57deda7cc82d89ceee1afa966313247e60b1e (diff)
downloadgdb-d07b621f4cc585607c7eee7cc58ce54a7dde52f5.zip
gdb-d07b621f4cc585607c7eee7cc58ce54a7dde52f5.tar.gz
gdb-d07b621f4cc585607c7eee7cc58ce54a7dde52f5.tar.bz2
[ARC] More fixes for TLS.
Added warning for static TLS reloc. Fixed issue related to TLS and partial static linking of libraries: This issue was detected when throwing exceptions in C++ while linking with -static-libstdc++. TLS relocation from the libstdc++ wasn't being patched as local now that it was static linked with the executable. Fix for TLS with static and pie. Problem introduced by earlier patch: Fixes the following glibc tests: - elf/tst-tls1-static bfd/ xxxx-xx-xx Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (arc_got_entry_type_for_reloc): Changed to correct static TLS relocs. * elf32-arc.c (elf_arc_check_relocs): Introduced warning to TLS relocs which require -fPIC. (arc_create_forced_local_got_entries_for_tls): Created. Traverses list of GOT entries to be resolved statically when needed. (elf_arc_finish_dynamic_sections): Changed. Calls arc_create_forced_local_got_entries_for_tls for each known possibly GOT symbol.
Diffstat (limited to 'bfd/arc-got.h')
-rw-r--r--bfd/arc-got.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index 69e9aa3..253578b 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -208,7 +208,7 @@ arc_got_entry_type_for_reloc (reloc_howto_type *howto)
__LINE__, name_for_global_symbol (H)); \
} \
if (H) \
- if (h->dynindx == -1 && !h->forced_local) \
+ if (H->dynindx == -1 && !H->forced_local) \
if (! bfd_elf_link_record_dynamic_symbol (info, H)) \
return FALSE; \
htab->s##SECNAME->size += 4; \
@@ -284,6 +284,7 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
BFD_ASSERT (entry);
if (h == NULL
+ || h->forced_local == TRUE
|| (! elf_hash_table (info)->dynamic_sections_created
|| (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))))
@@ -331,27 +332,31 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
BFD_ASSERT (tls_sec && tls_sec->output_section);
bfd_vma sec_vma = tls_sec->output_section->vma;
- bfd_put_32 (output_bfd,
+ if (h == NULL || h->forced_local
+ || !elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_put_32 (output_bfd,
sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created
? 0
- : (align_power (TCB_SIZE,
+ : (align_power (0,
tls_sec->alignment_power))),
htab->sgot->contents + entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0));
- ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
- "@ %lx, for symbol %s\n",
- (entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
- "GOT_TLS_IE"),
- (long) (sym_value - sec_vma),
- (long) (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + entry->offset
- + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
- ? 4 : 0)),
- symbol_name);
+ ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
+ "@ %lx, for symbol %s\n",
+ (entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
+ "GOT_TLS_IE"),
+ (long) (sym_value - sec_vma),
+ (long) (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + entry->offset
+ + (entry->existing_entries == TLS_GOT_MOD_AND_OFF
+ ? 4 : 0)),
+ symbol_name);
+ }
}
break;