aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMark Shinwell <shinwell@codesourcery.com>2006-10-17 15:46:21 +0000
committerMark Shinwell <shinwell@codesourcery.com>2006-10-17 15:46:21 +0000
commite95de06338c51f03d29a7fe5d2f1c374054c9e44 (patch)
treec937d392949fca1f00e9a842656b972445a2f5ae /ld
parent32a5b2f1dd80c5d2d634ebbea7a849b389de5813 (diff)
downloadfsf-binutils-gdb-e95de06338c51f03d29a7fe5d2f1c374054c9e44.zip
fsf-binutils-gdb-e95de06338c51f03d29a7fe5d2f1c374054c9e44.tar.gz
fsf-binutils-gdb-e95de06338c51f03d29a7fe5d2f1c374054c9e44.tar.bz2
bfd/
* elf32-arm.c (elf32_arm_howto_table_1): Change offset for R_THM_CALL to 25 and remove FIXME comment. (using_thumb2): New function. (elf32_arm_final_link_relocate): Cope with Thumb-2 BL encoding. include/ * elf/arm.h: Define TAG_CPU_ARCH_* constants. ld/testsuite/ * ld-arm/arm-elf.exp: Add thumb1-bl, thumb2-bl, thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests. * ld-arm/thumb1-bl.d: New. * ld-arm/thumb1-bl.s: New. * ld-arm/thumb2-bl-as-thumb1-bad.d: New. * ld-arm/thumb2-bl-as-thumb1-bad.s: New. * ld-arm/thumb2-bl-bad.d: New. * ld-arm/thumb2-bl-bad.s: New. * ld-arm/thumb2-bl.d: New. * ld-arm/thumb2-bl.s: New.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog13
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp8
-rw-r--r--ld/testsuite/ld-arm/thumb1-bl.d11
-rw-r--r--ld/testsuite/ld-arm/thumb1-bl.s22
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d4
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s22
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-bad.d4
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl-bad.s22
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl.d11
-rw-r--r--ld/testsuite/ld-arm/thumb2-bl.s23
10 files changed, 140 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 36d20a3..5ced8e4 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * ld-arm/arm-elf.exp: Add thumb1-bl, thumb2-bl,
+ thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests.
+ * ld-arm/thumb1-bl.d: New.
+ * ld-arm/thumb1-bl.s: New.
+ * ld-arm/thumb2-bl-as-thumb1-bad.d: New.
+ * ld-arm/thumb2-bl-as-thumb1-bad.s: New.
+ * ld-arm/thumb2-bl-bad.d: New.
+ * ld-arm/thumb2-bl-bad.s: New.
+ * ld-arm/thumb2-bl.d: New.
+ * ld-arm/thumb2-bl.s: New.
+
2006-10-17 Alan Modra <amodra@bigpond.net.au>
* ld-arm/mixed-app.sym, ld-cris/ldsym1.d, ld-cris/libdso-12.d,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index eee3204..af94c87 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -62,6 +62,12 @@ set armelftests {
{"Group relocations" "-Ttext 0x8000 --section-start zero=0x0 --section-start alpha=0xeef0 --section-start beta=0xffeef0" "" {group-relocs.s}
{{objdump -Dr group-relocs.d}}
"group-relocs"}
+ {"Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x401000" "" {thumb1-bl.s}
+ {{objdump -dr thumb1-bl.d}}
+ "thumb1-bl"}
+ {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x1001000" "" {thumb2-bl.s}
+ {{objdump -dr thumb2-bl.d}}
+ "thumb2-bl"}
{"Simple non-PIC shared library" "-shared" "" {arm-lib.s}
{{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}}
"arm-lib.so"}
@@ -146,4 +152,6 @@ 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"
diff --git a/ld/testsuite/ld-arm/thumb1-bl.d b/ld/testsuite/ld-arm/thumb1-bl.d
new file mode 100644
index 0000000..09d7095
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-bl.d
@@ -0,0 +1,11 @@
+
+.*thumb1-bl: file format elf32-.*arm
+
+Disassembly of section .text:
+
+00001000 <_start>:
+ 1000: f3ff fffe bl 401000 <bar>
+Disassembly of section .foo:
+
+00401000 <bar>:
+ 401000: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/thumb1-bl.s b/ld/testsuite/ld-arm/thumb1-bl.s
new file mode 100644
index 0000000..cdecaa4
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-bl.s
@@ -0,0 +1,22 @@
+@ Test to ensure that a Thumb-1 BL works.
+
+ .arch armv5t
+ .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 0x401000.
+
+ .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
new file mode 100644
index 0000000..749b58f
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d
@@ -0,0 +1,4 @@
+#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'
diff --git a/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s
new file mode 100644
index 0000000..dae5d43
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s
@@ -0,0 +1,22 @@
+@ Test to ensure that a Thumb-1 BL with a Thumb-2-only offset fails.
+
+ .arch armv5t
+ .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 0x401004.
+
+ .section .foo, "xa"
+ .thumb_func
+
+bar:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/thumb2-bl-bad.d b/ld/testsuite/ld-arm/thumb2-bl-bad.d
new file mode 100644
index 0000000..0fc6e04
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl-bad.d
@@ -0,0 +1,4 @@
+#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'
diff --git a/ld/testsuite/ld-arm/thumb2-bl-bad.s b/ld/testsuite/ld-arm/thumb2-bl-bad.s
new file mode 100644
index 0000000..63e3fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl-bad.s
@@ -0,0 +1,22 @@
+@ Test to ensure that a Thumb-2 BL with an oversize offset fails.
+
+ .arch armv7
+ .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 0x1001004.
+
+ .section .foo, "xa"
+ .thumb_func
+
+bar:
+ bx lr
+
diff --git a/ld/testsuite/ld-arm/thumb2-bl.d b/ld/testsuite/ld-arm/thumb2-bl.d
new file mode 100644
index 0000000..bdfb9b7
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl.d
@@ -0,0 +1,11 @@
+
+.*thumb2-bl: file format elf32-.*arm
+
+Disassembly of section .text:
+
+00001000 <_start>:
+ 1000: f3ff d7fe bl 1001000 <bar>
+Disassembly of section .foo:
+
+01001000 <bar>:
+ 1001000: 4770 bx lr
diff --git a/ld/testsuite/ld-arm/thumb2-bl.s b/ld/testsuite/ld-arm/thumb2-bl.s
new file mode 100644
index 0000000..ddb1cd3
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb2-bl.s
@@ -0,0 +1,23 @@
+@ Test to ensure that a Thumb-2 BL works with an offset that is
+@ not permissable for Thumb-1.
+
+ .arch armv7
+ .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 0x1001000.
+
+ .section .foo, "xa"
+ .thumb_func
+
+bar:
+ bx lr
+