]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/
authorTristan Gingold <gingold@adacore.com>
Mon, 24 Sep 2012 12:24:44 +0000 (12:24 +0000)
committerTristan Gingold <gingold@adacore.com>
Mon, 24 Sep 2012 12:24:44 +0000 (12:24 +0000)
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.

bfd/ChangeLog
bfd/elf32-tilepro.c
bfd/elfxx-tilegx.c

index 0309325f0fed3236c3c975183de32a0d0f438c9c..b542abd106d07be33af0855fc02ec285efcde6f5 100644 (file)
@@ -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-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/14591
index 3d5a09e8fe7b0bf5b51c6daec2b622fd58297719..9dff9e52838417923d2022dae4ac2b4791fa9ed0 100644 (file)
@@ -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;
index 425f9d88683c6e105389db9284d5def1c3b5955c..df63569ed3e04f9bf85f8359a555f6bfffa606b1 100644 (file)
@@ -3051,6 +3051,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;
@@ -3062,6 +3063,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;
@@ -3430,7 +3436,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:
@@ -3863,7 +3869,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;