]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Mask off the least significant bit in GOT offset
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 11 Feb 2016 03:33:52 +0000 (19:33 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 11 Feb 2016 03:43:25 +0000 (19:43 -0800)
The least significant bit in GOT offset is to record whether we have
initialized the GOT entry in R_386_GOT32 processing.  We need to mask
it off for R_386_GOT32X.

Backport from master

PR ld/19601
* elf32-i386.c (elf_i386_relocate_section): Mask off the least
significant bit in GOT offset for R_386_GOT32X.

bfd/ChangeLog
bfd/elf32-i386.c

index 1704438c2296fcc301be0d85079201a69b15872d..9bd29253c1a7901a334ab5d4d98e037ce1c4b755 100644 (file)
@@ -1,3 +1,12 @@
+2016-02-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from master
+       2016-02-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/19601
+       * elf32-i386.c (elf_i386_relocate_section): Mask off the least
+       significant bit in GOT offset for R_386_GOT32X.
+
 2016-02-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from master
index 300839b2794f01e6731b0f45824e6b2bd7ea4342..0c79d1673c8d1f53c2f3c1da9f490006bb1259f1 100644 (file)
@@ -4016,10 +4016,12 @@ elf_i386_relocate_section (bfd *output_bfd,
 
          /* It is relative to .got.plt section.  */
          if (h->got.offset != (bfd_vma) -1)
-           /* Use GOT entry.  */
+           /* Use GOT entry.  Mask off the least significant bit in
+              GOT offset which may be set by R_386_GOT32 processing
+              below.  */
            relocation = (htab->elf.sgot->output_section->vma
                          + htab->elf.sgot->output_offset
-                         + h->got.offset - offplt);
+                         + (h->got.offset & ~1) - offplt);
          else
            /* Use GOTPLT entry.  */
            relocation = (h->plt.offset / plt_entry_size - 1 + 3) * 4;