This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix calculation of R_ARM_RHM_ALU_PREL_11_0 relocation when used with a SUB instruction.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8c65b54f18c03ffb844e1cbaa3b46b43444ff9e7

commit 8c65b54f18c03ffb844e1cbaa3b46b43444ff9e7
Author: Casey Smith <clegg89@gmail.com>
Date:   Tue May 30 15:07:56 2017 +0100

    Fix calculation of R_ARM_RHM_ALU_PREL_11_0 relocation when used with a SUB instruction.
    
    	PR ld/21523
    	* elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
    	value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.

Diff:
---
 bfd/ChangeLog   | 6 ++++++
 bfd/elf32-arm.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7879a48..11a474e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-05-30  Casey Smith  <clegg89@gmail.com>
+
+	PR ld/21523
+	* elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
+	value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
+
 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
 
 	* cpu-arc.c (arc_compatible): New function.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 1725c22..9cd34ca 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -10506,7 +10506,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 			  + input_section->output_offset
 			  + rel->r_offset);
 
-	value = relocation;
+	/* PR 21523: Use an absolute value.  The user of this reloc will
+	   have already selected an ADD or SUB insn appropriately.  */
+	value = abs (relocation);
 
 	if (value >= 0x1000)
 	  return bfd_reloc_overflow;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]