Convert mov to lea only if r_offset >= 2
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Oct 2014 15:03:32 +0000 (08:03 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Oct 2014 15:03:32 +0000 (08:03 -0700)
* 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.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index f9e81d3ef5595869671495cb101a2b796f43de20..780cfabbf75cb5769b338af5ff2aa33f23401cad 100644 (file)
@@ -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
index afa21b5b6e0ec0076e10ce19303f84c1a8bc1eb6..dddd9dccf480224a9fb3246c203f2981bf838443 100644 (file)
@@ -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)
        {
index 9d18a545a9f7f313db81e7d23bb8bc8e13ccf519..38c837a76040a01b75281ef0a28d7e54004b65c4 100644 (file)
@@ -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)
        {
This page took 0.040263 seconds and 4 git commands to generate.