aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-06-17 18:26:08 +0100
committerThomas Preud'homme <thomas.preudhomme@arm.com>2016-06-17 18:28:08 +0100
commit80c135e55489435f47bbeeb3715b42289c51e30e (patch)
tree7f3062bede1cd44d29cd9b932faa159b8e4b636f /bfd/elf32-arm.c
parent21a770913c24ab085fe66a5274ebe7cf9e031982 (diff)
downloadgdb-80c135e55489435f47bbeeb3715b42289c51e30e.zip
gdb-80c135e55489435f47bbeeb3715b42289c51e30e.tar.gz
gdb-80c135e55489435f47bbeeb3715b42289c51e30e.tar.bz2
Add support for Thumb-2 long branch veneers
2016-06-17 Thomas Preud'homme <thomas.preudhomme@arm.com> Tony Wang <tony.wang@arm.com> bfd/ * elf32-arm.c (elf32_arm_stub_long_branch_thumb2_only): Define stub sequence. (stub_long_branch_thumb2_only): Define stub. (arm_stub_is_thumb): Add case for arm_stub_long_branch_thumb2_only. (arm_stub_long_branch_thumb2_only): Likewise. (arm_type_of_stub): Use arm_stub_long_branch_thumb2_only for Thumb-2 capable targets. ld/ * testsuite/ld-arm/arm-elf.exp (Thumb-Thumb farcall M profile): Assemble for ARMv6-M. (Thumb2-Thumb2 farcall M profile): New testcase. * testsuite/ld-arm/farcall-thumb2-thumb2-m.d: New file. * testsuite/ld-arm/jump-reloc-veneers-cond-long-backward.d: Update to reflect the use of Thumb-2 veneers for Thumb-2 capable targets. * testsuite/ld-arm/jump-reloc-veneers-cond-long.d: Likewise.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 8de01b4..a7964c1 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -2402,6 +2402,13 @@ static const insn_sequence elf32_arm_stub_long_branch_thumb_only[] =
DATA_WORD (0, R_ARM_ABS32, 0), /* dcd R_ARM_ABS32(X) */
};
+/* Thumb -> Thumb long branch stub in thumb2 encoding. Used on armv7. */
+static const insn_sequence elf32_arm_stub_long_branch_thumb2_only[] =
+{
+ THUMB32_INSN (0xf85ff000), /* ldr.w pc, [pc, #-0] */
+ DATA_WORD (0, R_ARM_ABS32, 0), /* dcd R_ARM_ABS32(x) */
+};
+
/* V4T Thumb -> Thumb long branch stub. Using the stack is not
allowed. */
static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_thumb[] =
@@ -2625,7 +2632,8 @@ static const insn_sequence elf32_arm_stub_a8_veneer_blx[] =
DEF_STUB(a8_veneer_b_cond) \
DEF_STUB(a8_veneer_b) \
DEF_STUB(a8_veneer_bl) \
- DEF_STUB(a8_veneer_blx)
+ DEF_STUB(a8_veneer_blx) \
+ DEF_STUB(long_branch_thumb2_only) \
#define DEF_STUB(x) arm_stub_##x,
enum elf32_arm_stub_type
@@ -3781,6 +3789,7 @@ arm_stub_is_thumb (enum elf32_arm_stub_type stub_type)
switch (stub_type)
{
case arm_stub_long_branch_thumb_only:
+ case arm_stub_long_branch_thumb2_only:
case arm_stub_long_branch_v4t_thumb_arm:
case arm_stub_short_branch_v4t_thumb_arm:
case arm_stub_long_branch_v4t_thumb_arm_pic:
@@ -3945,7 +3954,8 @@ arm_type_of_stub (struct bfd_link_info *info,
/* PIC stub. */
? arm_stub_long_branch_thumb_only_pic
/* non-PIC stub. */
- : arm_stub_long_branch_thumb_only;
+ : (thumb2 ? arm_stub_long_branch_thumb2_only
+ : arm_stub_long_branch_thumb_only);
}
}
else
@@ -4418,6 +4428,7 @@ arm_stub_required_alignment (enum elf32_arm_stub_type stub_type)
case arm_stub_long_branch_any_any:
case arm_stub_long_branch_v4t_arm_thumb:
case arm_stub_long_branch_thumb_only:
+ case arm_stub_long_branch_thumb2_only:
case arm_stub_long_branch_v4t_thumb_thumb:
case arm_stub_long_branch_v4t_thumb_arm:
case arm_stub_short_branch_v4t_thumb_arm: