This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] TILE-Gx/TILEPro: fix relocations for large .got


This patch fixes relocations for .got sections greater than 0x8000
bytes.  This is a regression introduced in:

http://sourceware.org/ml/binutils-cvs/2012-09/msg00100.html

        bfd/
	* elf32-tilepro.c (tilepro_elf_relocate_section): Adjust got
	relocations with value of hgot.
	* elfxx-tilegx.c (tilegx_elf_relocate_section): Ditto.

Index: bfd/elf32-tilepro.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tilepro.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-tilepro.c
--- bfd/elf32-tilepro.c	17 Sep 2012 18:01:18 -0000	1.14
+++ bfd/elf32-tilepro.c	20 Sep 2012 06:45:16 -0000
@@ -2785,6 +2785,7 @@ tilepro_elf_relocate_section (bfd *outpu
   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 *outpu
   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 *outpu
 		  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 *outpu
 	  if (off >= (bfd_vma) -2)
 	    abort ();
 
-	  relocation = off;
+	  relocation = off - got_base;
 	  unresolved_reloc = FALSE;
 	  howto = tilepro_elf_howto_table + r_type;
 	  break;
Index: bfd/elfxx-tilegx.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-tilegx.c,v
retrieving revision 1.16
diff -u -p -r1.16 elfxx-tilegx.c
--- bfd/elfxx-tilegx.c	17 Sep 2012 18:01:18 -0000	1.16
+++ bfd/elfxx-tilegx.c	20 Sep 2012 06:45:16 -0000
@@ -3094,6 +3094,7 @@ tilegx_elf_relocate_section (bfd *output
   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
   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
 		  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
 	  if (off >= (bfd_vma) -2)
 	    abort ();
 
-	  relocation = off;
+	  relocation = off - got_base;
 	  unresolved_reloc = FALSE;
 	  howto = tilegx_elf_howto_table + r_type;
 	  break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]