[binutils-gdb] Fix the calculation of AMD64_PCRQUAD relocations.

Nick Clifton nickc@sourceware.org
Mon Sep 26 15:17:00 GMT 2016


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=384f7503344b1d07561f801ced7493858cde6164

commit 384f7503344b1d07561f801ced7493858cde6164
Author: Awson <kyrab@mail.ru>
Date:   Mon Sep 26 16:16:25 2016 +0100

    Fix the calculation of AMD64_PCRQUAD relocations.
    
    	PR ld/17955
    	* coff-x86_64.c (coff_amd64_rtype_to_howto): Use an 8 byte offset
    	for R_AMD64_PCRQUAD relocations.

Diff:
---
 bfd/ChangeLog     | 6 ++++++
 bfd/coff-x86_64.c | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index da0d7a0..ce06702 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-26  Awson  <kyrab@mail.ru>
+
+	PR ld/17955
+	* coff-x86_64.c (coff_amd64_rtype_to_howto): Use an 8 byte offset
+	for R_AMD64_PCRQUAD relocations.
+
 2016-09-26  Alan Modra  <amodra@gmail.com>
 
 	* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Declare.
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 398bc48..d92e03d 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -614,7 +614,12 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
 #if defined(COFF_WITH_PE)
   if (howto->pc_relative)
     {
-      *addendp -= 4;
+#ifndef DONT_EXTEND_AMD64
+      if (rel->r_type == R_AMD64_PCRQUAD)
+	*addendp -= 8;
+      else
+#endif
+	*addendp -= 4;
 
       /* If the symbol is defined, then the generic code is going to
          add back the symbol value in order to cancel out an



More information about the Binutils-cvs mailing list