aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorWalter Lee <walt@tilera.com>2012-09-20 06:55:02 +0000
committerWalter Lee <walt@tilera.com>2012-09-20 06:55:02 +0000
commit535127d2b811022d80855b0b57d3f32ab5a3dc9f (patch)
tree4227b1f0c88eafb9b2aa39f4d28a696b0be21bb2 /bfd
parent2bf680c405655ff9bffa0b80e12e0d73cb7d799e (diff)
downloadgdb-535127d2b811022d80855b0b57d3f32ab5a3dc9f.zip
gdb-535127d2b811022d80855b0b57d3f32ab5a3dc9f.tar.gz
gdb-535127d2b811022d80855b0b57d3f32ab5a3dc9f.tar.bz2
Fix computation of got relocations for .got sections greater than
0x8000 bytes.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-tilepro.c10
-rw-r--r--bfd/elfxx-tilegx.c10
3 files changed, 22 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index aeb0951..4c3e181 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-20 Walter Lee <walt@tilera.com>
+
+ * elf32-tilepro.c (tilepro_elf_relocate_section): Adjust got
+ relocations with value of hgot.
+ * elfxx-tilegx.c (tilegx_elf_relocate_section): Ditto.
+
2012-09-19 Steve Ellcey <sellcey@mips.com>
* config.bfd: Add mips*-mti-elf* target.
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 90fdace..1c6e3d3 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;
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index e22188b..c1b54f9 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -3094,6 +3094,7 @@ tilegx_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;
@@ -3105,6 +3106,11 @@ tilegx_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;
@@ -3473,7 +3479,7 @@ tilegx_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_TILEGX_JUMPOFF_X1_PLT:
@@ -3920,7 +3926,7 @@ tilegx_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 = tilegx_elf_howto_table + r_type;
break;