Properly move kept relocations when deleting relocations
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 10 Nov 2015 07:49:02 +0000 (23:49 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 10 Nov 2015 08:17:59 +0000 (00:17 -0800)
* elf32-i386.c (elf_i386_relocate_section): Properly move
kept relocations when deleting relocations.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

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

index d7000cbf03a6daf270bccedb269bd8ea65c7ac45..8dbe72b9374cb9329448d6c0b09003c296e72ddd 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-i386.c (elf_i386_relocate_section): Properly move
+       kept relocations when deleting relocations.
+       * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
+
 2015-11-09  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf32-i386.c (elf_i386_relocate_section): Use read and write
index 6c353e9af848b407e814bea56e48b29458c46150..ee45ed161a5ef1bf8090a92946ee635122e9abde 100644 (file)
@@ -3791,7 +3791,11 @@ elf_i386_relocate_section (bfd *output_bfd,
        }
 
       if (bfd_link_relocatable (info))
-       continue;
+       {
+         if (wrel != rel)
+           *wrel = *rel;
+         continue;
+       }
 
       /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
         it here if it is defined in a non-shared object.  */
index 8e62d3d6aa6379a4825ed0ba20519598cf4fe581..dfa12769ef7c31f54cf914ff421c6167f392a92d 100644 (file)
@@ -3980,7 +3980,11 @@ elf_x86_64_relocate_section (bfd *output_bfd,
        }
 
       if (bfd_link_relocatable (info))
-       continue;
+       {
+         if (wrel != rel)
+           *wrel = *rel;
+         continue;
+       }
 
       if (rel->r_addend == 0 && !ABI_64_P (output_bfd))
        {