This is the mail archive of the binutils@sources.redhat.com 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]

[PATCH] Update relocation values for ARC platform.


Hi ,

This patch corrects the values of the relocation types for
the ARC platform. Tested by building cross arc-elf32 and running the tests with no regressions.


Ok to commit. ?

cheers
Ramana
---
Ramana Radhakrishnan
GNU Tools
codito ergo sum (www.codito.com)



2005-04-21  Ramana Radhakrishnan  <ramana.radhakrishnan@codito.com>

	* arc.h: Correct relocation values for R_ARC_32,R_ARC_B26,
	R_ARC_B22_PCREL. 
	* elf32-arc.c(R_ARC_standard):Define.
	(bfd_elf32_bfd_reloc_type_lookup):Use it.
	(arc_info_to_howto_rel):Use it.



Index: include/elf/arc.h
===================================================================
RCS file: /cvs/src/src/include/elf/arc.h,v
retrieving revision 1.5
diff -a -u -r1.5 arc.h
--- include/elf/arc.h	14 Mar 2001 02:27:44 -0000	1.5
+++ include/elf/arc.h	21 Apr 2005 09:49:44 -0000
@@ -29,9 +29,10 @@
 
 START_RELOC_NUMBERS (elf_arc_reloc_type)
   RELOC_NUMBER (R_ARC_NONE, 0)
-  RELOC_NUMBER (R_ARC_32, 1)
-  RELOC_NUMBER (R_ARC_B26, 2)
-  RELOC_NUMBER (R_ARC_B22_PCREL, 3)
+     /* We have a gap here.  */
+  RELOC_NUMBER (R_ARC_32, 4)
+  RELOC_NUMBER (R_ARC_B26, 5)
+  RELOC_NUMBER (R_ARC_B22_PCREL, 6)
 END_RELOC_NUMBERS (R_ARC_max)
 
 /* Processor specific flags for the ELF header e_flags field.  */
Index: bfd/elf32-arc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arc.c,v
retrieving revision 1.14
diff -a -u -r1.14 elf32-arc.c
--- bfd/elf32-arc.c	30 Nov 2002 08:39:37 -0000	1.14
+++ bfd/elf32-arc.c	21 Apr 2005 09:49:44 -0000
@@ -58,7 +58,8 @@
 	 0,			/* src_mask  */
 	 0,			/* dst_mask  */
 	 FALSE),		/* pcrel_offset  */
-
+  /* There is a gap of 3 here between R_ARC_NONE and R_ARC_32.  */
+  #define R_ARC_standard (R_ARC_32 - 1)
   /* A standard 32 bit relocation.  */
   HOWTO (R_ARC_32,		/* type  */
 	 0,			/* rightshift  */
@@ -131,7 +132,8 @@
 
   for (i = ARRAY_SIZE (arc_reloc_map); i--;)
     if (arc_reloc_map[i].bfd_reloc_val == code)
-      return elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val;
+      return (elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val 
+	      - R_ARC_standard);
 
   return NULL;
 }
@@ -148,7 +150,7 @@
 
   r_type = ELF32_R_TYPE (dst->r_info);
   BFD_ASSERT (r_type < (unsigned int) R_ARC_max);
-  cache_ptr->howto = &elf_arc_howto_table[r_type];
+  cache_ptr->howto = &elf_arc_howto_table[r_type - R_ARC_standard];
 }
 
 /* Set the right machine number for an ARC ELF file.  */



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