* elf32-arm.c (arm_stub_required_alignment): New.
    (arm_build_one_stub): Use above to partition stubs.
    (make_branch_to_a8_stub): Use arm_stub_a8_veneer_lwm not
    arm_stub_a8_veneer_b_cond.

    ld/testsuite/
    * ld-arm/arm-elf.exp (armelftests): Add cortex-a8-fix-blx-bcond.s.
    * ld-arm/cortex-a8-fix-blx-bcond.s: New.
    * ld-arm/cortex-a8-fix-blx-bcond.d: New.
This commit is contained in:
Julian Brown 2010-08-25 12:37:30 +00:00
parent 6f0341784b
commit 4563a86028
6 changed files with 1238 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2010-08-25 Julian Brown <julian@codesourcery.com>
* elf32-arm.c (arm_stub_required_alignment): New.
(arm_build_one_stub): Use above to partition stubs.
(make_branch_to_a8_stub): Use arm_stub_a8_veneer_lwm not
arm_stub_a8_veneer_b_cond.
2010-08-25 Alan Modra <amodra@gmail.com>
* aout-arm.c (MY(bfd_reloc_type_lookup)): Use bfd_arch_bits_per_address.

View File

@ -3475,6 +3475,36 @@ static bfd_reloc_status_type elf32_arm_final_link_relocate
Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
const char *, int, struct elf_link_hash_entry *, bfd_boolean *, char **);
static unsigned int
arm_stub_required_alignment (enum elf32_arm_stub_type stub_type)
{
switch (stub_type)
{
case arm_stub_a8_veneer_b_cond:
case arm_stub_a8_veneer_b:
case arm_stub_a8_veneer_bl:
return 2;
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_v4t_thumb_thumb:
case arm_stub_long_branch_v4t_thumb_arm:
case arm_stub_short_branch_v4t_thumb_arm:
case arm_stub_long_branch_any_arm_pic:
case arm_stub_long_branch_any_thumb_pic:
case arm_stub_long_branch_v4t_thumb_thumb_pic:
case arm_stub_long_branch_v4t_arm_thumb_pic:
case arm_stub_long_branch_v4t_thumb_arm_pic:
case arm_stub_long_branch_thumb_only_pic:
case arm_stub_a8_veneer_blx:
return 4;
default:
abort (); /* Should be unreachable. */
}
}
static bfd_boolean
arm_build_one_stub (struct bfd_hash_entry *gen_entry,
void * in_arg)
@ -3506,9 +3536,8 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
stub_sec = stub_entry->stub_sec;
if ((globals->fix_cortex_a8 < 0)
!= (stub_entry->stub_type >= arm_stub_a8_veneer_lwm))
/* We have to do the a8 fixes last, as they are less aligned than
the other veneers. */
!= (arm_stub_required_alignment (stub_entry->stub_type) == 2))
/* We have to do less-strictly-aligned fixes last. */
return TRUE;
/* Make a note of the offset within the stubs for this entry. */
@ -13356,7 +13385,7 @@ make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
data = (struct a8_branch_to_stub_data *) in_arg;
if (stub_entry->target_section != data->writing_section
|| stub_entry->stub_type < arm_stub_a8_veneer_b_cond)
|| stub_entry->stub_type < arm_stub_a8_veneer_lwm)
return TRUE;
contents = data->contents;

View File

@ -1,3 +1,9 @@
2010-08-25 Julian Brown <julian@codesourcery.com>
* ld-arm/arm-elf.exp (armelftests): Add cortex-a8-fix-blx-bcond.s.
* ld-arm/cortex-a8-fix-blx-bcond.s: New.
* ld-arm/cortex-a8-fix-blx-bcond.d: New.
2010-08-24 H.J. Lu <hongjiu.lu@intel.com>
* ld-x86-64/x86-64.exp: Fix typos.

View File

@ -221,6 +221,10 @@ set armelftests {
"-EL -mcpu=cortex-a8" {cortex-a8-fix-hdr.s}
{{objdump -dr cortex-a8-fix-hdr.d}}
"cortex-a8-fix-hdr"}
{"Cortex-A8 erratum fix, blx.w and b<cond>.w together"
"-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-fix-blx-bcond.s}
{{objdump -dr cortex-a8-fix-blx-bcond.d}}
"cortex-a8-fix-blx-bcond"}
{"Unwinding and -gc-sections" "-gc-sections" "" {gc-unwind.s}
{{objdump -sj.data gc-unwind.d}}
"gc-unwind"}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
.syntax unified
.cpu cortex-a8
.thumb
.text
@ expansion 32 bytes
.macro bw1
1:
add.w r0, r1, r2
blx.w arm_target
add.w r0, r1, r2
blx.w arm_target
add.w r0, r1, r2
blx.w arm_target
add.w r0, r1, r2
blx.w arm_target
.endm
@ expansion 128 bytes
.macro bw2
bw1
bw1
bw1
bw1
.endm
@ expansion 32 bytes
.macro bw3
1:
add.w r0, r1, r2
bne.w 1b
add.w r0, r1, r2
bne.w 1b
add.w r0, r1, r2
bne.w 1b
add.w r0, r1, r2
bne.w 1b
.endm
@ expansion 128 bytes
.macro bw4
bw3
bw3
bw3
bw3
.endm
.align 3
.global _start
.thumb
.thumb_func
.type _start, %function
_start:
nop
@ Trigger Cortex-A8 erratum workaround with b<cond> instructions.
bw4
bw4
nop
.rept 957
nop.w
.endr
.arm
arm_target:
add r3, r4, r5
bx lr
.thumb
bl_insns:
nop
@ ...and again with bl instructions.
bw2
bw2
bx lr