aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-06-13 12:36:02 +0000
committerNick Clifton <nickc@redhat.com>2013-06-13 12:36:02 +0000
commit2f47f5fc1338185064d87c4ab54773a9f4cfe796 (patch)
treee84941b49ccded12a0fbd2ae29dbb6dd448c65d6 /ld/testsuite
parent909c7f9cbf0b6c33f14a68be54723c89cfbadf8c (diff)
downloadgdb-2f47f5fc1338185064d87c4ab54773a9f4cfe796.zip
gdb-2f47f5fc1338185064d87c4ab54773a9f4cfe796.tar.gz
gdb-2f47f5fc1338185064d87c4ab54773a9f4cfe796.tar.bz2
PR ld/15302
* elf32-arm.c (allocate_dynrelocs_for_symbol): Transform ST_BRANCH_TO_ARM into ST_BRANCH_TO_THUMB if the target only supports thumb instructions. PR ld/15302 * ld-arm/branch-lks-sym.ld: New script. * ld-arm/thumb-b-lks-sym.s: New test. * ld-arm/thumb-b-lks-sym.d: Expected disassembly. * ld-arm/thumb-bl-lks-sym.s: New test. * ld-arm/thumb-bl-lks-sym.d: Expected disassembly. * ld-arm/arm-elf.exp: Run the new tests.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp9
-rw-r--r--ld/testsuite/ld-arm/branch-lks-sym.ld1
-rw-r--r--ld/testsuite/ld-arm/thumb-b-lks-sym.d7
-rw-r--r--ld/testsuite/ld-arm/thumb-b-lks-sym.s16
-rw-r--r--ld/testsuite/ld-arm/thumb-bl-lks-sym.d12
-rw-r--r--ld/testsuite/ld-arm/thumb-bl-lks-sym.s19
7 files changed, 72 insertions, 2 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c2c9806..fa4c842 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-06-13 Terry Guo <terry.guo@arm.com>
+
+ PR ld/15302
+ * ld-arm/branch-lks-sym.ld: New script.
+ * ld-arm/thumb-b-lks-sym.s: New test.
+ * ld-arm/thumb-b-lks-sym.d: Expected disassembly.
+ * ld-arm/thumb-bl-lks-sym.s: New test.
+ * ld-arm/thumb-bl-lks-sym.d: Expected disassembly.
+ * ld-arm/arm-elf.exp: Run the new tests.
+
2013-06-07 Will Newton <will.newton@linaro.org>
* ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64.
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index a6abe82..fd8a599 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1,6 +1,5 @@
# Expect script for various ARM ELF tests.
-# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012
-# Free Software Foundation, Inc.
+# Copyright 2002-2013 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -557,6 +556,12 @@ set armeabitests_common {
{"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-bad.s}
{{objdump -d thumb2-bl-bad.d}}
"thumb2-bl-bad"}
+ {"Branch to linker script symbol with BL for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-bl-lks-sym.s}
+ {{objdump -d thumb-bl-lks-sym.d}}
+ "thumb-bl-lks-sym"}
+ {"Branch to linker script symbol with B for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-b-lks-sym.s}
+ {{objdump -d thumb-b-lks-sym.d}}
+ "thumb-b-lks-sym"}
{"ARM-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001020" "" "" {farcall-arm-arm.s}
{{objdump -d farcall-arm-arm.d}}
diff --git a/ld/testsuite/ld-arm/branch-lks-sym.ld b/ld/testsuite/ld-arm/branch-lks-sym.ld
new file mode 100644
index 0000000..a70776f
--- /dev/null
+++ b/ld/testsuite/ld-arm/branch-lks-sym.ld
@@ -0,0 +1 @@
+extFunc = 0x1000 + 1;
diff --git a/ld/testsuite/ld-arm/thumb-b-lks-sym.d b/ld/testsuite/ld-arm/thumb-b-lks-sym.d
new file mode 100644
index 0000000..eadd9a4
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb-b-lks-sym.d
@@ -0,0 +1,7 @@
+
+.*: file format.*
+
+Disassembly of section .text:
+
+00000000 <main>:
+ 0: f000 bffe b.w 1000 <extFunc>
diff --git a/ld/testsuite/ld-arm/thumb-b-lks-sym.s b/ld/testsuite/ld-arm/thumb-b-lks-sym.s
new file mode 100644
index 0000000..ae62f8b
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb-b-lks-sym.s
@@ -0,0 +1,16 @@
+@ Test to ensure that the b to linker script symbol isn't changed to other format.
+
+
+ .syntax unified
+ .cpu cortex-m3
+ .fpu softvfp
+ .thumb
+ .file "x.c"
+ .text
+ .align 2
+ .global main
+ .thumb
+ .thumb_func
+ .type main, %function
+main:
+ b extFunc
diff --git a/ld/testsuite/ld-arm/thumb-bl-lks-sym.d b/ld/testsuite/ld-arm/thumb-bl-lks-sym.d
new file mode 100644
index 0000000..b553b51
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb-bl-lks-sym.d
@@ -0,0 +1,12 @@
+
+.*: file format.*
+
+Disassembly of section .text:
+
+00000000 <main>:
+ 0: b580 push {r7, lr}
+ 2: af00 add r7, sp, #0
+ 4: f000 fffc bl 1000 <extFunc>
+ 8: bd80 pop {r7, pc}
+ a: bf00 nop
+
diff --git a/ld/testsuite/ld-arm/thumb-bl-lks-sym.s b/ld/testsuite/ld-arm/thumb-bl-lks-sym.s
new file mode 100644
index 0000000..60b7c3a
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb-bl-lks-sym.s
@@ -0,0 +1,19 @@
+@ Test to ensure that the bl to linker script symbol isn't changed to blx with immediate address.
+
+
+ .syntax unified
+ .cpu cortex-m3
+ .fpu softvfp
+ .thumb
+ .file "x.c"
+ .text
+ .align 2
+ .global main
+ .thumb
+ .thumb_func
+ .type main, %function
+main:
+ push {r7, lr}
+ add r7, sp, #0
+ bl extFunc
+ pop {r7, pc}