aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-10-14 08:03:32 -0700
committerH.J. Lu <hjl.tools@gmail.com>2014-10-14 08:03:32 -0700
commit5697705ac6eafb3e3f9dd3ba253231a4d51a1fa4 (patch)
treeccd89744e76b58dcf2882b1ef0330da0d30d6bcd
parent4dc06805c2fa208dc2743099feaacb4230d1b1f7 (diff)
downloadfsf-binutils-gdb-5697705ac6eafb3e3f9dd3ba253231a4d51a1fa4.zip
fsf-binutils-gdb-5697705ac6eafb3e3f9dd3ba253231a4d51a1fa4.tar.gz
fsf-binutils-gdb-5697705ac6eafb3e3f9dd3ba253231a4d51a1fa4.tar.bz2
Convert mov to lea only if r_offset >= 2
* elf32-i386.c (elf_i386_convert_mov_to_lea): Skip if relocation offset is less than 2. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-i386.c2
-rw-r--r--bfd/elf64-x86-64.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f9e81d3..780cfab 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_convert_mov_to_lea): Skip if relocation
+ offset is less than 2.
+ * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+
2014-10-14 Alan Modra <amodra@gmail.com>
PR 17453
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index afa21b5..dddd9dc 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2580,6 +2580,7 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
/* STT_GNU_IFUNC must keep R_386_GOT32 relocation. */
if (ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC
+ && irel->r_offset >= 2
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
{
@@ -2609,6 +2610,7 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
&& h->type != STT_GNU_IFUNC
&& h != htab->elf.hdynamic
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
+ && irel->r_offset >= 2
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
{
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9d18a54..38c837a 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2824,6 +2824,7 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
/* STT_GNU_IFUNC must keep R_X86_64_GOTPCREL relocation. */
if (ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC
+ && irel->r_offset >= 2
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
{
@@ -2854,6 +2855,7 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
&& h->type != STT_GNU_IFUNC
&& h != htab->elf.hdynamic
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
+ && irel->r_offset >= 2
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)
{