From c2b4a39dd204173238cb5bb8a367dc68c8d803ad Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 23 Feb 2009 10:03:47 +0000 Subject: 2009-02-23 Christophe Lyon bfd/ * elf32-arm.c (elf32_arm_stub_long_branch_thumb_only): Fix stub code. (elf32_arm_stub_long_branch_v4t_thumb_arm): Likewise. (arm_type_of_stub): Use Thumb-only long branch stub (non-PIC) when BLX is not available. Fix typo in warning message. Add comments and improve formatting. (arm_build_one_stub): Adjust to new elf32_arm_stub_long_branch_v4t_thumb_arm stub. (arm_map_one_stub): Likewise. testsuite/ * ld-arm/arm-elf.exp: Rewrite non-EABI variants of thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests, which now pass. farcall-thumb-thumb now passes in EABI mode. * ld-arm/farcall-thumb-arm-pic-veneer.d: Fixed name, source, as and ld flags to match intended test. * ld-arm/farcall-thumb-arm.d: New expected result. * ld-arm/farcall-thumb-thumb-m.d: Likewise. * ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Fixed name and ld flags. * ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise. * ld-arm/farcall-thumb-thumb.d: New expected result, this test is now expected to pass. * ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d: Likewise. * ld-arm/thumb2-bl-bad-noeabi.d: Likewise. * ld-arm/thumb2-bl-as-thumb1-bad.d: Update addresses according to new use. * ld-arm/thumb2-bl-as-thumb1-bad.s: Update comment. --- ld/testsuite/ld-arm/arm-elf.exp | 24 ++++++++++++++++------ ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d | 8 ++++---- ld/testsuite/ld-arm/farcall-thumb-arm.d | 17 +++++++-------- .../ld-arm/farcall-thumb-thumb-m-pic-veneer.d | 4 ++-- ld/testsuite/ld-arm/farcall-thumb-thumb-m.d | 10 ++++----- .../ld-arm/farcall-thumb-thumb-pic-veneer.d | 4 ++-- ld/testsuite/ld-arm/farcall-thumb-thumb.d | 24 +++++++++++++++++----- .../ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d | 23 +++++++++++++++++---- ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d | 6 +++--- ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s | 2 +- ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d | 23 +++++++++++++++++---- 11 files changed, 99 insertions(+), 46 deletions(-) (limited to 'ld/testsuite/ld-arm') diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 3ea17e9..f850f74 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -190,10 +190,20 @@ run_dump_test "emit-relocs1" # Exclude non-ARM-EABI targets. if { ![istarget "arm*-*-*eabi"] } { - # Special variants of these tests, as no farcall stub is generated - # for a non-ARM-EABI target - run_dump_test "thumb2-bl-as-thumb1-bad-noeabi" - run_dump_test "thumb2-bl-bad-noeabi" + # Special variants of these tests, as a different farcall stub is + # generated for a non-ARM-EABI target: indeed in such a case, + # there are no attributes to indicate that blx can be used. + + set arm_noeabi_tests { + {"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-as-thumb1-bad.s} + {{objdump -d thumb2-bl-as-thumb1-bad-noeabi.d}} + "thumb2-bl-as-thumb1-bad"} + {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-bad.s} + {{objdump -d thumb2-bl-bad-noeabi.d}} + "thumb2-bl-bad"} + } + run_ld_link_tests $arm_noeabi_tests + return } @@ -241,7 +251,7 @@ set armeabitests { {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" {arm-app-movw.s} {{objdump -Rw arm-app.r}} "arm-app-movw"} - {"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x40100c" "" {thumb2-bl-as-thumb1-bad.s} + {"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-as-thumb1-bad.s} {{objdump -d thumb2-bl-as-thumb1-bad.d}} "thumb2-bl-as-thumb1-bad"} {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-bad.s} @@ -277,6 +287,9 @@ set armeabitests { {"Thumb-Thumb farcall M profile" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv7m" {farcall-thumb-thumb.s} {{objdump -d farcall-thumb-thumb-m.d}} "farcall-thumb-thumb-m"} + {"Thumb-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv4t" {farcall-thumb-thumb.s} + {{objdump -d farcall-thumb-thumb.d}} + "farcall-thumb-thumb"} {"Thumb-Thumb farcall with BLX (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "-march=armv5t" {farcall-thumb-thumb.s} {{objdump -d farcall-thumb-thumb-blx-pic-veneer.d}} "farcall-thumb-thumb-blx-pic-veneer"} @@ -328,7 +341,6 @@ run_dump_test "attr-merge-wchar-24-nowarn" run_dump_test "attr-merge-wchar-40-nowarn" run_dump_test "attr-merge-wchar-42-nowarn" run_dump_test "attr-merge-wchar-44-nowarn" -run_dump_test "farcall-thumb-thumb" run_dump_test "farcall-thumb-thumb-pic-veneer" run_dump_test "farcall-thumb-thumb-m-pic-veneer" run_dump_test "farcall-thumb-arm-pic-veneer" diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d index 932f28a..a2c09d2 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d +++ b/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d @@ -1,5 +1,5 @@ -#name: Thumb-Thumb farcall without BLX -#source: farcall-thumb-thumb.s -#as: -march=armv4t -#ld: -Ttext 0x1000 --section-start .foo=0x2001014 +#name: Thumb-ARM farcall without BLX (PIC veneer) +#source: farcall-thumb-arm.s +#as: -march=armv4t -W +#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm.d b/ld/testsuite/ld-arm/farcall-thumb-arm.d index 61e72be..dc02e25 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-arm.d +++ b/ld/testsuite/ld-arm/farcall-thumb-arm.d @@ -3,17 +3,14 @@ Disassembly of section .text: 00001000 <__bar_from_thumb>: - 1000: b540 push {r6, lr} - 1002: 4e03 ldr r6, \[pc, #12\] \(1010 <__bar_from_thumb\+0x10>\) - 1004: 46fe mov lr, pc - 1006: 4730 bx r6 - 1008: e8bd4040 pop {r6, lr} - 100c: e12fff1e bx lr - 1010: 02001014 .word 0x02001014 - 1014: 00000000 .word 0x00000000 + 1000: 4778 bx pc + 1002: 46c0 nop \(mov r8, r8\) + 1004: e51ff004 ldr pc, \[pc, #-4\] ; 1008 <__bar_from_thumb\+0x8> + 1008: 02001014 .word 0x02001014 + 100c: 00000000 .word 0x00000000 -00001018 <_start>: - 1018: f7ff fff2 bl 1000 <__bar_from_thumb> +00001010 <_start>: + 1010: f7ff fff6 bl 1000 <__bar_from_thumb> Disassembly of section .foo: 02001014 : diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d index 932f28a..f8308ff 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d +++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d @@ -1,5 +1,5 @@ -#name: Thumb-Thumb farcall without BLX +#name: Thumb-Thumb farcall M profile (PIC veneer) #source: farcall-thumb-thumb.s #as: -march=armv4t -#ld: -Ttext 0x1000 --section-start .foo=0x2001014 +#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d index 2f7cdaf..c7a0db7 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d +++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d @@ -3,11 +3,11 @@ Disassembly of section .text: 00001000 <__bar_veneer>: - 1000: b540 push {r6, lr} - 1002: 4e02 ldr r6, \[pc, #8\] \(100c <__bar_veneer\+0xc>\) - 1004: 46fe mov lr, pc - 1006: 4730 bx r6 - 1008: bd40 pop {r6, pc} + 1000: b401 push {r0} + 1002: 4802 ldr r0, \[pc, #8\] \(100c <__bar_veneer\+0xc>\) + 1004: 4684 mov ip, r0 + 1006: bc01 pop {r0} + 1008: 4760 bx ip 100a: bf00 nop 100c: 02001015 .word 0x02001015 diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d index 932f28a..f97671b 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d +++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d @@ -1,5 +1,5 @@ -#name: Thumb-Thumb farcall without BLX +#name: Thumb-Thumb farcall without BLX (PIC veneer) #source: farcall-thumb-thumb.s #as: -march=armv4t -#ld: -Ttext 0x1000 --section-start .foo=0x2001014 +#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb.d b/ld/testsuite/ld-arm/farcall-thumb-thumb.d index 932f28a..c7a0db7 100644 --- a/ld/testsuite/ld-arm/farcall-thumb-thumb.d +++ b/ld/testsuite/ld-arm/farcall-thumb-thumb.d @@ -1,5 +1,19 @@ -#name: Thumb-Thumb farcall without BLX -#source: farcall-thumb-thumb.s -#as: -march=armv4t -#ld: -Ttext 0x1000 --section-start .foo=0x2001014 -#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' +.*: file format .* + +Disassembly of section .text: + +00001000 <__bar_veneer>: + 1000: b401 push {r0} + 1002: 4802 ldr r0, \[pc, #8\] \(100c <__bar_veneer\+0xc>\) + 1004: 4684 mov ip, r0 + 1006: bc01 pop {r0} + 1008: 4760 bx ip + 100a: bf00 nop + 100c: 02001015 .word 0x02001015 + +00001010 <_start>: + 1010: f7ff fff6 bl 1000 <__bar_veneer> +Disassembly of section .foo: + +02001014 : + 2001014: 4770 bx lr diff --git a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d index 749b58f..fdf9d8a 100644 --- a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d +++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d @@ -1,4 +1,19 @@ -#name: Thumb-2-as-Thumb-1 BL failure test -#source: thumb2-bl-as-thumb1-bad.s -#ld: -Ttext 0x1000 --section-start .foo=0x401004 -#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' +.*: file format .* + +Disassembly of section .text: + +00001000 <__bar_veneer>: + 1000: b401 push {r0} + 1002: 4802 ldr r0, \[pc, #8\] \(100c <__bar_veneer\+0xc>\) + 1004: 4684 mov ip, r0 + 1006: bc01 pop {r0} + 1008: 4760 bx ip + 100a: bf00 nop + 100c: 0100100d .word 0x0100100d + +00001010 <_start>: + 1010: f7ff fff6 bl 1000 <__bar_veneer> +Disassembly of section .foo: + +0100100c : + 100100c: 4770 bx lr diff --git a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d index 28d1b29..12674f9 100644 --- a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d +++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d @@ -4,11 +4,11 @@ Disassembly of section .text: 00001000 <__bar_veneer>: 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <__bar_veneer\+0x4> - 1004: 0040100d .word 0x0040100d + 1004: 0100100d .word 0x0100100d 00001008 <_start>: 1008: f7ff effa blx 1000 <__bar_veneer> Disassembly of section .foo: -0040100c : - 40100c: 4770 bx lr +0100100c : + 100100c: 4770 bx lr diff --git a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s index 13f7f33..834001c 100644 --- a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s +++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s @@ -12,7 +12,7 @@ _start: bl bar -@ We will place the section .foo at 0x40100c. +@ We will place the section .foo at 0x100100c. .section .foo, "xa" .thumb_func diff --git a/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d b/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d index 0fc6e04..fdf9d8a 100644 --- a/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d +++ b/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d @@ -1,4 +1,19 @@ -#name: Thumb-2 BL failure test -#source: thumb2-bl-bad.s -#ld: -Ttext 0x1000 --section-start .foo=0x1001004 -#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar' +.*: file format .* + +Disassembly of section .text: + +00001000 <__bar_veneer>: + 1000: b401 push {r0} + 1002: 4802 ldr r0, \[pc, #8\] \(100c <__bar_veneer\+0xc>\) + 1004: 4684 mov ip, r0 + 1006: bc01 pop {r0} + 1008: 4760 bx ip + 100a: bf00 nop + 100c: 0100100d .word 0x0100100d + +00001010 <_start>: + 1010: f7ff fff6 bl 1000 <__bar_veneer> +Disassembly of section .foo: + +0100100c : + 100100c: 4770 bx lr -- cgit v1.1