elf64-ppc.c *r_offset patch

Alan Modra amodra@bigpond.net.au
Tue Jun 17 00:24:00 GMT 2003


I shouldn't cheat, if only to save confusion on the part of someone
reading this code at a later date.  outrel.r_offset will have the same
value as the new expression I'm using below, except when the sym
concerned is in a stabs or eh section.

	* elf64-ppc.c (ppc64_elf_relocate_section): Correct pcrel section zero.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.102
diff -u -p -r1.102 elf64-ppc.c
--- bfd/elf64-ppc.c	16 Jun 2003 10:50:22 -0000	1.102
+++ bfd/elf64-ppc.c	17 Jun 2003 00:19:44 -0000
@@ -8349,7 +8349,9 @@ ppc64_elf_relocate_section (output_bfd, 
 		    addend = outrel.r_addend;
 		  /* Adjust pc_relative relocs to have zero in *r_offset.  */
 		  else if (ppc64_elf_howto_table[(int) r_type]->pc_relative)
-		    addend = outrel.r_offset;
+		    addend = (input_section->output_section->vma
+			      + input_section->output_offset
+			      + rel->r_offset);
 		}
 	    }
 	  break;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list