This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: update dwarf2 asm unwind info [hppa64-*-* failures]


Richard Henderson wrote:
John David Anglin wrote:
readelf: Warning: unable to apply unsupported reloc type 9 to section .eh_frame

R_PARISC_PCREL32 is reloc 9. Before the change, the reloc was R_PARISC_NONE.

The change in reloc type is good. The warning can be fixed by adding the appropriate support to readelf's relocation interpretation functions, like is_32bit_pcrel_reloc.

Like so.



r~
Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.423
diff -u -r1.423 readelf.c
--- readelf.c	8 Aug 2008 19:24:48 -0000	1.423
+++ readelf.c	13 Aug 2008 15:25:04 -0000
@@ -8156,7 +8156,7 @@
     case EM_ARM:
       return reloc_type == 3;  /* R_ARM_REL32 */
     case EM_PARISC:
-      return reloc_type == 0;  /* R_PARISC_NONE.  *//* FIXME: This reloc is generated, but it may be a bug.  */
+      return reloc_type == 9;  /* R_PARISC_PCREL32.  */
     case EM_PPC:
       return reloc_type == 26; /* R_PPC_REL32.  */
     case EM_PPC64:
@@ -8219,6 +8219,36 @@
     }
 }
 
+/* Like is_32bit_pcrel_reloc except that it returns TRUE iff RELOC_TYPE is
+   a 64-bit pc-relative RELA relocation used in DWARF debug sections.  */
+
+static bfd_boolean
+is_64bit_pcrel_reloc (unsigned int reloc_type)
+{
+  switch (elf_header.e_machine)
+    {
+    case EM_ALPHA:
+      return reloc_type == 11; /* R_ALPHA_SREL64 */
+    case EM_IA_64:
+      return reloc_type == 0x4f; /* R_IA64_PCREL64LSB */
+    case EM_PARISC:
+      return reloc_type == 72; /* R_PARISC_PCREL64 */
+    case EM_PPC64:
+      return reloc_type == 44; /* R_PPC64_REL64 */
+    case EM_SPARC32PLUS:
+    case EM_SPARCV9:
+    case EM_SPARC:
+      return reloc_type == 46; /* R_SPARC_DISP64 */
+    case EM_X86_64:
+      return reloc_type == 24; /* R_X86_64_PC64 */
+    case EM_S390_OLD:
+    case EM_S390:
+      return reloc_type == 23;	/* R_S390_PC64 */
+    default:
+      return FALSE;
+    }
+}
+
 /* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
    a 16-bit absolute RELA relocation used in DWARF debug sections.  */
 
@@ -8392,7 +8422,8 @@
 	  if (is_32bit_abs_reloc (reloc_type)
 	      || is_32bit_pcrel_reloc (reloc_type))
 	    reloc_size = 4;
-	  else if (is_64bit_abs_reloc (reloc_type))
+	  else if (is_64bit_abs_reloc (reloc_type)
+		   || is_64bit_pcrel_reloc (reloc_type))
 	    reloc_size = 8;
 	  else if (is_16bit_abs_reloc (reloc_type))
 	    reloc_size = 2;
@@ -8436,7 +8467,8 @@
 
 	  addend = is_rela ? rp->r_addend : byte_get (loc, reloc_size);
 	  
-	  if (is_32bit_pcrel_reloc (reloc_type))
+	  if (is_32bit_pcrel_reloc (reloc_type)
+	      || is_64bit_pcrel_reloc (reloc_type))
 	    byte_put (loc, (addend + sym->st_value) - rp->r_offset,
 		      reloc_size);
 	  else

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