aboutsummaryrefslogtreecommitdiff
path: root/bfd/arc-got.h
diff options
context:
space:
mode:
authorCupertino Miranda <cmiranda@synopsys.com>2016-12-29 17:10:01 +0100
committerCupertino Miranda <cmiranda@synopsys.com>2017-06-08 19:00:36 +0200
commita0abe74332bd25aeb68acfadd74280c0f117c493 (patch)
tree2128997f00605dde87150541393c9df49932aae4 /bfd/arc-got.h
parentf4e6805f98d2b3eae305f66ba26ab25aae1485f2 (diff)
downloadgdb-a0abe74332bd25aeb68acfadd74280c0f117c493.zip
gdb-a0abe74332bd25aeb68acfadd74280c0f117c493.tar.gz
gdb-a0abe74332bd25aeb68acfadd74280c0f117c493.tar.bz2
[ARC] Fixed TLS for IE model.
In the case of static relocation, the GOT entries are fixed at link time and are set by the linker. In order to compute the right TLS offset it is necessary to add TCB_SIZE to the offset, just in case the dynamic linker is not expected to be executed (static linked case). This problem does appear in dynamic linked applications, as the dynamic linker is adding this TCB_SIZE by operating the TCB block structure. Problem revealed in GLIBC with static linking. bfd/ChangeLog: Cupertino Miranda <cmiranda@synopsys.com> arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to patched section contents for TLS IE reloc. elf32-arc.c: Remove TCB_SIZE preprocessor macro. Rebase to 0006
Diffstat (limited to 'bfd/arc-got.h')
-rw-r--r--bfd/arc-got.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index b8a6d15..f1f6c0e 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -22,6 +22,8 @@
#ifndef ARC_GOT_H
#define ARC_GOT_H
+#define TCB_SIZE (8)
+
enum tls_type_e
{
GOT_UNKNOWN = 0,
@@ -354,7 +356,8 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
= tls_sec->output_section->vma;
bfd_put_32 (output_bfd,
- sym_value - sec_vma,
+ sym_value - sec_vma
+ + (elf_hash_table (info)->dynamic_sections_created ? 0 : TCB_SIZE),
htab->sgot->contents + entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0));
@@ -478,8 +481,10 @@ GOT_OFFSET = %#lx, GOT_VMA = %#lx, INDEX = %ld, ADDEND = 0x0\n",
{
bfd_vma addend = 0;
if (list->type == GOT_TLS_IE)
+ {
addend = bfd_get_32 (output_bfd,
htab->sgot->contents + got_offset);
+ }
ADD_RELA (output_bfd, got,
got_offset + (e == TLS_GOT_MOD_AND_OFF ? 4 : 0),