Fix elf64-x86-64.c reloc calculation

Andreas Jaeger aj@suse.de
Wed Feb 28 04:33:00 GMT 2001


We forgot to add in some places the relocation to the addend, I've
committed the appended patch to fix this,

Andreas

2001-02-28  Andreas Jaeger  <aj@suse.de>

	* elf64-x86-64.c (elf64_x86_64_relocate_section): Add relocation
	to addend.


============================================================
Index: bfd/elf64-x86-64.c
--- bfd/elf64-x86-64.c	2001/02/26 07:50:22	1.9
+++ bfd/elf64-x86-64.c	2001/02/28 12:30:03
@@ -1495,7 +1495,7 @@
 		  BFD_ASSERT (h != NULL && h->dynindx != -1);
 		  relocate = false;
 		  outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
-		  outrel.r_addend = rela->r_addend;
+		  outrel.r_addend = relocation + rela->r_addend;
 		}
 	      else
 		{
@@ -1508,14 +1508,14 @@
 		    {
 		      relocate = true;
 		      outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
-		      outrel.r_addend = rela->r_addend;
+		      outrel.r_addend = relocation + rela->r_addend;
 		    }
 		  else
 		    {
 		      BFD_ASSERT (h->dynindx != -1);
 		      relocate = false;
 		      outrel.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_32);
-		      outrel.r_addend = rela->r_addend;
+		      outrel.r_addend = relocation + rela->r_addend;
 		    }
 		}
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj



More information about the Binutils mailing list