Fix the calculation of AMD64_PCRQUAD relocations.
authorAwson <kyrab@mail.ru>
Mon, 26 Sep 2016 15:16:25 +0000 (16:16 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 26 Sep 2016 15:16:25 +0000 (16:16 +0100)
PR ld/17955
* coff-x86_64.c (coff_amd64_rtype_to_howto): Use an 8 byte offset
for R_AMD64_PCRQUAD relocations.

bfd/ChangeLog
bfd/coff-x86_64.c

index da0d7a0005819de2506dbe0663ed76f8aa942cb4..ce0670244d8afbe571b2dbd5646dfef1b1ec6e88 100644 (file)
@@ -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.
index 398bc48b1987db6d207390fa4da59211a3429be3..d92e03dea1b5933c2ba61346df7d040a0635ae72 100644 (file)
@@ -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