summaryrefslogtreecommitdiff
path: root/bfd/elf32-tilepro.c
diff options
context:
space:
mode:
authorwalt <walt>2012-09-20 06:55:02 +0000
committerwalt <walt>2012-09-20 06:55:02 +0000
commit7709f18457b8252974e499df759e0de8c3e250b5 (patch)
tree8cbf1ead88ea90accad36b9e5a0a9f1fe4227b47 /bfd/elf32-tilepro.c
parentaaa5e5b08be9a1123d31d5ba0779d046f400c3a1 (diff)
downloadbinutils-redhat-7709f18457b8252974e499df759e0de8c3e250b5.tar.gz
Fix computation of got relocations for .got sections greater than
0x8000 bytes.
Diffstat (limited to 'bfd/elf32-tilepro.c')
-rw-r--r--bfd/elf32-tilepro.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 90fdacea9b..1c6e3d3155 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -2785,6 +2785,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
+ bfd_vma got_base;
asection *sreloc;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
@@ -2796,6 +2797,11 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
+ if (elf_hash_table (info)->hgot == NULL)
+ got_base = 0;
+ else
+ got_base = elf_hash_table (info)->hgot->root.u.def.value;
+
sreloc = elf_section_data (input_section)->sreloc;
rel = relocs;
@@ -3086,7 +3092,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
local_got_offsets[r_symndx] |= 1;
}
}
- relocation = off;
+ relocation = off - got_base;
break;
case R_TILEPRO_JOFFLONG_X1_PLT:
@@ -3505,7 +3511,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (off >= (bfd_vma) -2)
abort ();
- relocation = off;
+ relocation = off - got_base;
unresolved_reloc = FALSE;
howto = tilepro_elf_howto_table + r_type;
break;