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 resolution of R_ARM_THM_ALU_PREL_11_0 relocation against Thumb symbols.


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

commit e645cf40b111daef4518a58547de577eb9379ccb
Author: Andrew Goedhart <Andrewgoedhart@simplepowersolutions.co.za>
Date:   Tue May 9 12:14:48 2017 +0100

    Fix resolution of R_ARM_THM_ALU_PREL_11_0 relocation against Thumb symbols.
    
    	PR ld/21458
    	* elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
    	of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
    	and the destination is a Thumb symbol.

Diff:
---
 bfd/ChangeLog   | 7 +++++++
 bfd/elf32-arm.c | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5205548..917a349 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
+
+	PR ld/21458
+	* elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
+	of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
+	and the destination is a Thumb symbol.
+
 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 8dcaf45..23a02c0 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -10511,6 +10511,10 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
 	if (value >= 0x1000)
 	  return bfd_reloc_overflow;
 
+	/* Destination is Thumb.  Force bit 0 to 1 to reflect this.  */
+	if (branch_type == ST_BRANCH_TO_THUMB)
+	  value |= 1;
+
 	insn = (insn & 0xfb0f8f00) | (value & 0xff)
 	     | ((value & 0x700) << 4)
 	     | ((value & 0x800) << 15);


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