This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_26-branch] Mask off the least significant bit in GOT offset
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 11 Feb 2016 03:47:05 -0000
- Subject: [binutils-gdb/binutils-2_26-branch] Mask off the least significant bit in GOT offset
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1861591a75b8a73af1d3df578fb93bbb73c2f42d
commit 1861591a75b8a73af1d3df578fb93bbb73c2f42d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Feb 10 19:33:52 2016 -0800
Mask off the least significant bit in GOT offset
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.
Diff:
---
bfd/ChangeLog | 9 +++++++++
bfd/elf32-i386.c | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1704438..9bd2925 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 300839b..0c79d16 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -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;