summaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog18
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp76
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-arm-be8.d14
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-arm-pic-veneer.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-arm.d14
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-arm.s19
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-thumb-blx-pic-veneer.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-thumb-blx.d14
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-thumb-pic-veneer.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-thumb.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-arm-thumb.s20
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-arm-blx-pic-veneer.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-arm-blx.d14
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d5
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-arm.d19
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-arm.s19
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb-blx-pic-veneer.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb-blx.d14
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d5
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb-m.d19
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d5
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb.d5
-rw-r--r--ld/testsuite/ld-arm/farcall-thumb-thumb.s19
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d18
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s4
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-bad.d18
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-bad.s4
27 files changed, 415 insertions, 24 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 5383fbd108..ee4105b601 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2008-05-15 Christophe Lyon <christophe.lyon@st.com>
+
+ * ld-arm/arm-elf.exp (armelftests): Add farcall-arm-arm,
+ farcall-arm-arm-pic-veneer, farcall-arm-arm-be8 farcall-arm-thumb,
+ farcall-arm-thumb-blx, farcall-arm-thumb-pic-veneer,
+ farcall-arm-thumb-blx-pic-veneer, farcall-thumb-thumb,
+ farcall-thumb-thumb-pic-veneer, farcall-thumb-thumb-blx,
+ farcall-thumb-thumb-m, farcall-thumb-thumb-m-pic-veneer,
+ farcall-thumb-thumb-blx-pic-veneer, farcall-thumb-arm,
+ farcall-thumb-arm-pic-veneer, farcall-thumb-arm-blx,
+ farcall-thumb-arm-blx-pic-veneer.
+ Change thumb2-bl-as-thumb1-bad, thumb2-bl-bad.
+ * ld-arm/thumb2-bl-as-thumb1-bad.d: Reflects farcall stub
+ generation.
+ * ld-arm/thumb2-bl-bad.d: Likewise.
+ * ld-arm/thumb2-bl-as-thumb1-bad.s: Update comments.
+ * ld-arm/thumb2-bl-bad.s: Likewise.
+
2008-05-08 Alan Modra <amodra@bigpond.net.au>
* ld-spu/ear.s: Align various sections.
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 7447b7c0bc..0dd64bcbe6 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1,5 +1,5 @@
# Expect script for various ARM ELF tests.
-# Copyright 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -177,15 +177,65 @@ set armelftests {
{"callweak" "-static -T arm.ld" "" {callweak.s}
{{objdump -dr callweak.d}}
"callweak"}
- {"ARMv4 interworking" "-static -T arm.ld --fix-v4bx-interworking" "--fix-v4bx -meabi=4" {armv4-bx.s}
- {{objdump -d armv4-bx.d}}
- "armv4-bx"}
- {"MOVW/MOVT and merged sections" "-T arm.ld" "" {movw-merge.s}
- {{objdump -dw movw-merge.d}}
- "movw-merge"}
- {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" {arm-app-movw.s}
- {{objdump -Rw arm-app.r}}
- "arm-app-movw"}
+
+ {"ARMv4 interworking" "-static -T arm.ld --fix-v4bx-interworking" "--fix-v4bx -meabi=4" {armv4-bx.s}
+ {{objdump -d armv4-bx.d}}
+ "armv4-bx"}
+ {"MOVW/MOVT and merged sections" "-T arm.ld" "" {movw-merge.s}
+ {{objdump -dw movw-merge.d}}
+ "movw-merge"}
+ {"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}
+ {{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}
+ {{objdump -d thumb2-bl-bad.d}}
+ "thumb2-bl-bad"}
+
+ {"ARM-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001020" "" {farcall-arm-arm.s}
+ {{objdump -d farcall-arm-arm.d}}
+ "farcall-arm-arm"}
+ {"ARM-ARM farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001020 --pic-veneer" "" {farcall-arm-arm.s}
+ {{objdump -d farcall-arm-arm-pic-veneer.d}}
+ "farcall-arm-arm-pic-veneer"}
+ {"ARM-ARM farcall (BE8)" "-Ttext 0x1000 --section-start .foo=0x2001020 -EB --be8" "-EB" {farcall-arm-arm.s}
+ {{objdump -d farcall-arm-arm-be8.d}}
+ "farcall-arm-arm-be8"}
+
+ {"ARM-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "" {farcall-arm-thumb.s}
+ {{objdump -d farcall-arm-thumb.d}}
+ "farcall-arm-thumb"}
+ {"ARM-Thumb farcall with BLX" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv5t" {farcall-arm-thumb.s}
+ {{objdump -d farcall-arm-thumb-blx.d}}
+ "farcall-arm-thumb-blx"}
+ {"ARM-Thumb farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" {farcall-arm-thumb.s}
+ {{objdump -d farcall-arm-thumb-pic-veneer.d}}
+ "farcall-arm-thumb-pic-veneer"}
+ {"ARM-Thumb farcall with BLX (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "-march=armv5t" {farcall-arm-thumb.s}
+ {{objdump -d farcall-arm-thumb-blx-pic-veneer.d}}
+ "farcall-arm-thumb-blx-pic-veneer"}
+
+ {"Thumb-Thumb farcall with BLX" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv5t" {farcall-thumb-thumb.s}
+ {{objdump -d farcall-thumb-thumb-blx.d}}
+ "farcall-thumb-thumb-blx"}
+ {"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 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"}
+
+ {"Thumb-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "" {farcall-thumb-arm.s}
+ {{objdump -d farcall-thumb-arm.d}}
+ "farcall-thumb-arm"}
+ {"Thumb-ARM farcall with BLX" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv5t" {farcall-thumb-arm.s}
+ {{objdump -d farcall-thumb-arm-blx.d}}
+ "farcall-thumb-arm-blx"}
+ {"Thumb-ARM farcall with BLX (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "-march=armv5t" {farcall-thumb-arm.s}
+ {{objdump -d farcall-thumb-arm-blx-pic-veneer.d}}
+ "farcall-thumb-arm-blx-pic-veneer"}
}
run_ld_link_tests $armelftests
@@ -193,9 +243,11 @@ run_dump_test "group-relocs-alu-bad"
run_dump_test "group-relocs-ldr-bad"
run_dump_test "group-relocs-ldrs-bad"
run_dump_test "group-relocs-ldc-bad"
-run_dump_test "thumb2-bl-as-thumb1-bad"
-run_dump_test "thumb2-bl-bad"
run_dump_test "emit-relocs1"
+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"
# Exclude non-ARM-EABI targets.
diff --git a/ld/testsuite/ld-arm/farcall-arm-arm-be8.d b/ld/testsuite/ld-arm/farcall-arm-arm-be8.d
new file mode 100644
index 0000000000..b4095175f5
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-arm-be8.d
@@ -0,0 +1,14 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x8>:
+ 1000: 04f01fe5 .*
+ 1004: 02001020 .word 0x02001020
+
+00001008 <_start>:
+ 1008: fcffffeb .*
+Disassembly of section .foo:
+
+02001020 <bar>:
+ 2001020: 1eff2fe1 .*
diff --git a/ld/testsuite/ld-arm/farcall-arm-arm-pic-veneer.d b/ld/testsuite/ld-arm/farcall-arm-arm-pic-veneer.d
new file mode 100644
index 0000000000..1d0af22df5
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-arm-pic-veneer.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e08ff00c add pc, pc, ip
+ 1008: 02000018 .word 0x02000018
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: ebfffffa bl 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001020 <bar>:
+ 2001020: e12fff1e bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-arm.d b/ld/testsuite/ld-arm/farcall-arm-arm.d
new file mode 100644
index 0000000000..3ccb2c48ac
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-arm.d
@@ -0,0 +1,14 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 02001020 .word 0x02001020
+
+00001008 <_start>:
+ 1008: ebfffffc bl 1000 <_start-0x8>
+Disassembly of section .foo:
+
+02001020 <bar>:
+ 2001020: e12fff1e bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-arm.s b/ld/testsuite/ld-arm/farcall-arm-arm.s
new file mode 100644
index 0000000000..bc77ad3ee8
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-arm.s
@@ -0,0 +1,19 @@
+@ Test to ensure that a ARM to ARM call exceeding 32Mb generates a stub.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x2001020.
+
+ .section .foo, "xa"
+
+bar:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-arm-thumb-blx-pic-veneer.d b/ld/testsuite/ld-arm/farcall-arm-thumb-blx-pic-veneer.d
new file mode 100644
index 0000000000..3ede5de187
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-thumb-blx-pic-veneer.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e08ff00c add pc, pc, ip
+ 1008: 0200000d .word 0x0200000d
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: ebfffffa bl 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-thumb-blx.d b/ld/testsuite/ld-arm/farcall-arm-thumb-blx.d
new file mode 100644
index 0000000000..86aaf398c5
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-thumb-blx.d
@@ -0,0 +1,14 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 02001015 .word 0x02001015
+
+00001008 <_start>:
+ 1008: ebfffffc bl 1000 <_start-0x8>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-thumb-pic-veneer.d b/ld/testsuite/ld-arm/farcall-arm-thumb-pic-veneer.d
new file mode 100644
index 0000000000..3ede5de187
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-thumb-pic-veneer.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e08ff00c add pc, pc, ip
+ 1008: 0200000d .word 0x0200000d
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: ebfffffa bl 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-thumb.d b/ld/testsuite/ld-arm/farcall-arm-thumb.d
new file mode 100644
index 0000000000..c664eff28d
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-thumb.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e12fff1c bx ip
+ 1008: 02001015 .word 0x02001015
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: ebfffffa bl 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-arm-thumb.s b/ld/testsuite/ld-arm/farcall-arm-thumb.s
new file mode 100644
index 0000000000..c69f31cb36
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-arm-thumb.s
@@ -0,0 +1,20 @@
+@ Test to ensure that a ARM to Thumb call exceeding 32Mb generates a stub.
+
+ .global _start
+ .global bar
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x2001010.
+
+ .section .foo, "xa"
+ .thumb_func
+bar:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm-blx-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-arm-blx-pic-veneer.d
new file mode 100644
index 0000000000..3e0cb39fa5
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-arm-blx-pic-veneer.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e08ff00c add pc, pc, ip
+ 1008: 0200000c .word 0x0200000c
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: f7ff eff6 blx 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm-blx.d b/ld/testsuite/ld-arm/farcall-thumb-arm-blx.d
new file mode 100644
index 0000000000..c4bdd3bd71
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-arm-blx.d
@@ -0,0 +1,14 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 02001014 .word 0x02001014
+
+00001008 <_start>:
+ 1008: f7ff effa blx 1000 <_start-0x8>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d
new file mode 100644
index 0000000000..932f28a10a
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d
@@ -0,0 +1,5 @@
+#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'
diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm.d b/ld/testsuite/ld-arm/farcall-thumb-arm.d
new file mode 100644
index 0000000000..90495b85e0
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-arm.d
@@ -0,0 +1,19 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x18>:
+ 1000: b540 push {r6, lr}
+ 1002: 4e03 ldr r6, \[pc, #12\] \(1010 <_start-0x8>\)
+ 1004: 46fe mov lr, pc
+ 1006: 4730 bx r6
+ 1008: e8bd4040 pop {r6, lr}
+ 100c: e12fff1e bx lr
+ ...
+
+00001018 <_start>:
+ 1018: f7ff eff2 blx 1000 <_start-0x18>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-thumb-arm.s b/ld/testsuite/ld-arm/farcall-thumb-arm.s
new file mode 100644
index 0000000000..82cfb95554
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-arm.s
@@ -0,0 +1,19 @@
+@ Test to ensure that a Thumb to ARM call exceeding 4Mb generates a stub.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+ .thumb_func
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x2001014.
+
+ .section .foo, "xa"
+
+bar:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-blx-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-blx-pic-veneer.d
new file mode 100644
index 0000000000..cadb620e28
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-blx-pic-veneer.d
@@ -0,0 +1,16 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: e59fc000 ldr ip, \[pc, #0\] ; 1008 <_start-0x8>
+ 1004: e08ff00c add pc, pc, ip
+ 1008: 0200000d .word 0x0200000d
+ 100c: 00000000 .word 0x00000000
+
+00001010 <_start>:
+ 1010: f7ff eff6 blx 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-blx.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-blx.d
new file mode 100644
index 0000000000..11280c9e9b
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-blx.d
@@ -0,0 +1,14 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 02001015 .word 0x02001015
+
+00001008 <_start>:
+ 1008: f7ff effa blx 1000 <_start-0x8>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
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
new file mode 100644
index 0000000000..932f28a10a
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d
@@ -0,0 +1,5 @@
+#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'
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d
new file mode 100644
index 0000000000..691d4e092d
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-m.d
@@ -0,0 +1,19 @@
+.*: file format .*
+
+Disassembly of section .text:
+
+00001000 <_start-0x10>:
+ 1000: b540 push {r6, lr}
+ 1002: 4e02 ldr r6, \[pc, #8\] \(100c <_start-0x4>\)
+ 1004: 46fe mov lr, pc
+ 1006: e7fe b.n 1006 <_start-0xa>
+ 1008: bd40 pop {r6, pc}
+ 100a: bf00 nop
+ 100c: 02001015 .word 0x02001015
+
+00001010 <_start>:
+ 1010: f7ff eff6 blx 1000 <_start-0x10>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d b/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d
new file mode 100644
index 0000000000..932f28a10a
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d
@@ -0,0 +1,5 @@
+#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'
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb.d b/ld/testsuite/ld-arm/farcall-thumb-thumb.d
new file mode 100644
index 0000000000..932f28a10a
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb.d
@@ -0,0 +1,5 @@
+#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'
diff --git a/ld/testsuite/ld-arm/farcall-thumb-thumb.s b/ld/testsuite/ld-arm/farcall-thumb-thumb.s
new file mode 100644
index 0000000000..650b1a6b93
--- /dev/null
+++ b/ld/testsuite/ld-arm/farcall-thumb-thumb.s
@@ -0,0 +1,19 @@
+@ Test to ensure that a Thumb to Thumb call exceeding 4Mb generates a stub.
+
+ .global _start
+ .syntax unified
+
+@ We will place the section .text at 0x1000.
+
+ .text
+ .thumb_func
+_start:
+ bl bar
+
+@ We will place the section .foo at 0x02001014.
+
+ .section .foo, "xa"
+ .thumb_func
+bar:
+ 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 749b58f566..1dfca21765 100644
--- a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d
+++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d
@@ -1,4 +1,14 @@
-#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 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 0040100d .word 0x0040100d
+
+00001008 <_start>:
+ 1008: f7ff effa blx 1000 <_start-0x8>
+Disassembly of section .foo:
+
+0040100c <bar>:
+ 40100c: 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 dae5d43972..13f7f33222 100644
--- a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s
+++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s
@@ -1,4 +1,4 @@
-@ Test to ensure that a Thumb-1 BL with a Thumb-2-only offset fails.
+@ Test to ensure that a Thumb-1 BL with a Thumb-2-only offset makes the linker generate a stub.
.arch armv5t
.global _start
@@ -12,7 +12,7 @@
_start:
bl bar
-@ We will place the section .foo at 0x401004.
+@ We will place the section .foo at 0x40100c.
.section .foo, "xa"
.thumb_func
diff --git a/ld/testsuite/ld-arm/thumb2-bl-bad.d b/ld/testsuite/ld-arm/thumb2-bl-bad.d
index 0fc6e043e1..ea38797d0d 100644
--- a/ld/testsuite/ld-arm/thumb2-bl-bad.d
+++ b/ld/testsuite/ld-arm/thumb2-bl-bad.d
@@ -1,4 +1,14 @@
-#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 <_start-0x8>:
+ 1000: e51ff004 ldr pc, \[pc, #-4\] ; 1004 <_start-0x4>
+ 1004: 0100100d .word 0x0100100d
+
+00001008 <_start>:
+ 1008: f7ff effa blx 1000 <_start-0x8>
+Disassembly of section .foo:
+
+0100100c <bar>:
+ 100100c: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/thumb2-bl-bad.s b/ld/testsuite/ld-arm/thumb2-bl-bad.s
index 63e3fe7e72..7685860eeb 100644
--- a/ld/testsuite/ld-arm/thumb2-bl-bad.s
+++ b/ld/testsuite/ld-arm/thumb2-bl-bad.s
@@ -1,4 +1,4 @@
-@ Test to ensure that a Thumb-2 BL with an oversize offset fails.
+@ Test to ensure that a Thumb-2 BL with an oversize offset makes the linker generate a stub.
.arch armv7
.global _start
@@ -12,7 +12,7 @@
_start:
bl bar
-@ We will place the section .foo at 0x1001004.
+@ We will place the section .foo at 0x100100c.
.section .foo, "xa"
.thumb_func