Fix resolution of R_ARM_THM_ALU_PREL_11_0 relocation against Thumb symbols.
authorAndrew Goedhart <Andrewgoedhart@simplepowersolutions.co.za>
Tue, 9 May 2017 11:14:48 +0000 (12:14 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 9 May 2017 11:15:22 +0000 (12:15 +0100)
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.

bfd/ChangeLog
bfd/elf32-arm.c

index 5205548a2364b22b62c4ea5f300a913a53d4b711..917a34977e3556b2b95b9cde94d4a1d181adb879 100644 (file)
@@ -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
index 8dcaf45523e726dc71ff8df8bdbd07ba759120fb..23a02c03f212e474c7636f0a4f2583d71c782c8f 100644 (file)
@@ -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);