This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Properly move kept relocations when deleting relocations
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 10 Nov 2015 08:19:47 -0000
- Subject: [binutils-gdb] Properly move kept relocations when deleting relocations
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2d5da47320d6d22a58b793801999ba33c43c758f
commit 2d5da47320d6d22a58b793801999ba33c43c758f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Nov 9 23:49:02 2015 -0800
Properly move kept relocations when deleting relocations
* elf32-i386.c (elf_i386_relocate_section): Properly move
kept relocations when deleting relocations.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf32-i386.c | 6 +++++-
bfd/elf64-x86-64.c | 6 +++++-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d7000cb..8dbe72b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 6c353e9..ee45ed1 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -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. */
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 8e62d3d..dfa1276 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -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))
{