aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2009-04-02 14:12:46 +0000
committerChristophe Lyon <christophe.lyon@st.com>2009-04-02 14:12:46 +0000
commitd3626fb08bd9456f3252ed95d31f67f83c833cfd (patch)
tree8b1a22ba6c97924b9c309ac9edabeb499aa37138 /bfd
parent0fcc17f8898b6f0b5883882f0bd33198c8dfe96d (diff)
downloadgdb-d3626fb08bd9456f3252ed95d31f67f83c833cfd.zip
gdb-d3626fb08bd9456f3252ed95d31f67f83c833cfd.tar.gz
gdb-d3626fb08bd9456f3252ed95d31f67f83c833cfd.tar.bz2
2009-04-02 Christophe Lyon <christophe.lyon@st.com>
bfd/ * elf32-arm.c (elf32_arm_stub_long_branch_v4t_thumb_thumb, elf32_arm_stub_long_branch_v4t_thumb_thumb_pic): Two new long branch stubs. (elf32_arm_stub_type): New enum values for the two new stubs. (arm_type_of_stub): Make use of the two new stubs. (arm_size_one_stub): Handle the two new stubs. testsuite/ * ld-arm/farcall-thumb-thumb-pic-veneer.d: Update expected results. * ld-arm/farcall-thumb-thumb.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf32-arm.c46
2 files changed, 47 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 89fab56..ba22001 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-02 Christophe Lyon <christophe.lyon@st.com>
+
+ * elf32-arm.c (elf32_arm_stub_long_branch_v4t_thumb_thumb,
+ elf32_arm_stub_long_branch_v4t_thumb_thumb_pic): Two new long
+ branch stubs.
+ (elf32_arm_stub_type): New enum values for the two new stubs.
+ (arm_type_of_stub): Make use of the two new stubs.
+ (arm_size_one_stub): Handle the two new stubs.
+
2009-04-01 Matt Thomas <matt@netbsd.org>
* elf32-vax.c (elf_vax_check_relocs): Do not put relocations against
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index d8106d3..a47d02c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -2049,9 +2049,7 @@ static const insn_sequence elf32_arm_stub_long_branch_v4t_arm_thumb[] =
DATA_WORD(0, R_ARM_ABS32, 0), /* dcd R_ARM_ABS32(X) */
};
-/* Thumb -> Thumb long branch stub. Used on architectures which
- support only this mode, or on V4T where it is expensive to switch
- to ARM. */
+/* Thumb -> Thumb long branch stub. Used on M-profile architectures. */
static const insn_sequence elf32_arm_stub_long_branch_thumb_only[] =
{
THUMB16_INSN(0xb401), /* push {r0} */
@@ -2063,6 +2061,17 @@ static const insn_sequence elf32_arm_stub_long_branch_thumb_only[] =
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[] =
+ {
+ THUMB16_INSN(0x4778), /* bx pc */
+ THUMB16_INSN(0x46c0), /* nop */
+ ARM_INSN(0xe59fc000), /* ldr ip, [pc, #0] */
+ ARM_INSN(0xe12fff1c), /* bx ip */
+ DATA_WORD(0, R_ARM_ABS32, 0), /* dcd R_ARM_ABS32(X) */
+ };
+
/* V4T Thumb -> ARM long branch stub. Used on V4T where blx is not
available. */
static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_arm[] =
@@ -2122,9 +2131,8 @@ static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_arm_pic[] =
DATA_WORD(0, R_ARM_REL32, -4), /* dcd R_ARM_REL32(X) */
};
-/* Thumb -> Thumb long branch stub, PIC. Used on architectures which
- support only this mode, or on V4T where it is expensive to switch
- to ARM. */
+/* Thumb -> Thumb long branch stub, PIC. Used on M-profile
+ architectures. */
static const insn_sequence elf32_arm_stub_long_branch_thumb_only_pic[] =
{
THUMB16_INSN(0xb401), /* push {r0} */
@@ -2136,6 +2144,18 @@ static const insn_sequence elf32_arm_stub_long_branch_thumb_only_pic[] =
DATA_WORD(0, R_ARM_REL32, 4), /* dcd R_ARM_REL32(X) */
};
+/* V4T Thumb -> Thumb long branch stub, PIC. Using the stack is not
+ allowed. */
+static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_thumb_pic[] =
+ {
+ THUMB16_INSN(0x4778), /* bx pc */
+ THUMB16_INSN(0x46c0), /* nop */
+ ARM_INSN(0xe59fc004), /* ldr ip, [pc, #4] */
+ ARM_INSN(0xe08fc00c), /* add ip, pc, ip */
+ ARM_INSN(0xe12fff1c), /* bx ip */
+ DATA_WORD(0, R_ARM_REL32, 0), /* dcd R_ARM_REL32(X) */
+ };
+
/* Section name for stubs is the associated section name plus this
string. */
#define STUB_SUFFIX ".stub"
@@ -2146,6 +2166,7 @@ enum elf32_arm_stub_type
arm_stub_long_branch_any_any,
arm_stub_long_branch_v4t_arm_thumb,
arm_stub_long_branch_thumb_only,
+ arm_stub_long_branch_v4t_thumb_thumb,
arm_stub_long_branch_v4t_thumb_arm,
arm_stub_short_branch_v4t_thumb_arm,
arm_stub_long_branch_any_arm_pic,
@@ -2153,6 +2174,7 @@ enum elf32_arm_stub_type
arm_stub_long_branch_v4t_arm_thumb_pic,
arm_stub_long_branch_v4t_thumb_arm_pic,
arm_stub_long_branch_thumb_only_pic,
+ arm_stub_long_branch_v4t_thumb_thumb_pic,
};
struct elf32_arm_stub_hash_entry
@@ -2923,14 +2945,14 @@ arm_type_of_stub (struct bfd_link_info *info,
/* V5T and above. */
? arm_stub_long_branch_any_thumb_pic
/* On V4T, use Thumb code only. */
- : arm_stub_long_branch_thumb_only_pic)
+ : arm_stub_long_branch_v4t_thumb_thumb_pic)
/* non-PIC stubs. */
: ((globals->use_blx)
/* V5T and above. */
? arm_stub_long_branch_any_any
/* V4T. */
- : arm_stub_long_branch_thumb_only);
+ : arm_stub_long_branch_v4t_thumb_thumb);
}
else
{
@@ -3336,6 +3358,10 @@ arm_size_one_stub (struct bfd_hash_entry *gen_entry,
template = elf32_arm_stub_long_branch_thumb_only;
template_size = ARRAY_SIZE (elf32_arm_stub_long_branch_thumb_only);
break;
+ case arm_stub_long_branch_v4t_thumb_thumb:
+ template = elf32_arm_stub_long_branch_v4t_thumb_thumb;
+ template_size = ARRAY_SIZE (elf32_arm_stub_long_branch_v4t_thumb_thumb);
+ break;
case arm_stub_long_branch_v4t_thumb_arm:
template = elf32_arm_stub_long_branch_v4t_thumb_arm;
template_size = ARRAY_SIZE (elf32_arm_stub_long_branch_v4t_thumb_arm);
@@ -3364,6 +3390,10 @@ arm_size_one_stub (struct bfd_hash_entry *gen_entry,
template = elf32_arm_stub_long_branch_thumb_only_pic;
template_size = ARRAY_SIZE (elf32_arm_stub_long_branch_thumb_only_pic);
break;
+ case arm_stub_long_branch_v4t_thumb_thumb_pic:
+ template = elf32_arm_stub_long_branch_v4t_thumb_thumb_pic;
+ template_size = ARRAY_SIZE (elf32_arm_stub_long_branch_v4t_thumb_thumb_pic);
+ break;
default:
BFD_FAIL ();
return FALSE;