summaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorAndrew Goedhart <Andrewgoedhart@simplepowersolutions.co.za>2017-05-09 12:14:48 +0100
committerNick Clifton <nickc@redhat.com>2017-05-09 12:15:22 +0100
commite645cf40b111daef4518a58547de577eb9379ccb (patch)
tree3d1a4523e01d9f62a7b05b81acb02b45956c77a4 /bfd/elf32-arm.c
parentd2732b697fe56ff4274a4bc45add9386c17f8a07 (diff)
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.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 8dcaf45523..23a02c03f2 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);