This is the mail archive of the 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]

debug_apply_rela_addends fixme

I thought I had a fix for this, until I ran into the need to apply rel
relocs too.

	* readelf.c (debug_apply_rela_addends): Clarify FIXME.

Index: binutils/readelf.c
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.386
diff -u -p -r1.386 readelf.c
--- binutils/readelf.c	29 Oct 2007 14:44:58 -0000	1.386
+++ binutils/readelf.c	31 Oct 2007 06:17:34 -0000
@@ -8242,14 +8242,13 @@ debug_apply_rela_addends (void *file,
-	  if (is_32bit_pcrel_reloc (reloc_type))
-	    /* FIXME: Not sure how to apply a pc-rel reloc yet.
-	       I think that it ought to be:
-	       (rp->r_addend + sym->st_value) - rp->r_offset
-	       but this breaks GAS CFI tests...  */
-	    byte_put (loc, (rp->r_addend + sym->st_value) /*- rp->r_offset*/, reloc_size);
-	  else
-	    byte_put (loc, rp->r_addend + sym->st_value, reloc_size);
+	  /* FIXME.  We apply pcrel relocs as if they were absolute,
+	     ie. without subtracting the pc.  This is to suit
+	     display_debug_frames which does not add the pc even
+	     though it ought to for DW_EH_PE_pcrel FDEs.  Removing
+	     the hack in display_debug_frames will require that we
+	     apply rel relocs too.  */
+	  byte_put (loc, rp->r_addend + sym->st_value, reloc_size);
       free (symtab);

Alan Modra
Australia Development Lab, IBM

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