aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog38
-rw-r--r--ld/testsuite/ld-crx/crx.exp32
-rw-r--r--ld/testsuite/ld-crx/crx.ld84
-rw-r--r--ld/testsuite/ld-crx/reloc-abs32.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-abs32.s7
-rw-r--r--ld/testsuite/ld-crx/reloc-imm16.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-imm16.s7
-rw-r--r--ld/testsuite/ld-crx/reloc-imm32.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-imm32.s7
-rw-r--r--ld/testsuite/ld-crx/reloc-num16.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-num16.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-num32.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-num32.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-num8.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-num8.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel12.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel12.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel22.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel22.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel28.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel28.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel32.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-regrel32.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-rel16.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-rel16.s8
-rw-r--r--ld/testsuite/ld-crx/reloc-rel24.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-rel24.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-rel32.d13
-rw-r--r--ld/testsuite/ld-crx/reloc-rel32.s6
-rw-r--r--ld/testsuite/ld-crx/reloc-rel4.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-rel4.s8
-rw-r--r--ld/testsuite/ld-crx/reloc-rel8-cmp.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-rel8-cmp.s8
-rw-r--r--ld/testsuite/ld-crx/reloc-rel8.d12
-rw-r--r--ld/testsuite/ld-crx/reloc-rel8.s8
35 files changed, 461 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index fa6fc31..a75a445 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,41 @@
+2004-09-03 Tomer Levi <Tomer.Levi@nsc.com>
+
+ * ld-crx: New directory.
+ * ld-crx/crx.exp: New test script.
+ * ld-crx/crx.ld: New linker script.
+ * ld-crx/reloc-abs32.s: New file.
+ * ld-crx/reloc-abs32.d: Likewise.
+ * ld-crx/reloc-imm16.s: Likewise.
+ * ld-crx/reloc-imm16.d: Likewise.
+ * ld-crx/reloc-imm32.s: Likewise.
+ * ld-crx/reloc-imm32.d: Likewise.
+ * ld-crx/reloc-num8.s: Likewise.
+ * ld-crx/reloc-num8.d: Likewise.
+ * ld-crx/reloc-num16.s: Likewise.
+ * ld-crx/reloc-num16.d: Likewise.
+ * ld-crx/reloc-num32.s: Likewise.
+ * ld-crx/reloc-num32.d: Likewise.
+ * ld-crx/reloc-regrel12.s: Likewise.
+ * ld-crx/reloc-regrel12.d: Likewise.
+ * ld-crx/reloc-regrel22.s: Likewise.
+ * ld-crx/reloc-regrel22.d: Likewise.
+ * ld-crx/reloc-regrel28.s: Likewise.
+ * ld-crx/reloc-regrel28.d: Likewise.
+ * ld-crx/reloc-regrel32.s: Likewise.
+ * ld-crx/reloc-regrel32.d: Likewise.
+ * ld-crx/reloc-rel4.s: Likewise.
+ * ld-crx/reloc-rel4.d: Likewise.
+ * ld-crx/reloc-rel8.s: Likewise.
+ * ld-crx/reloc-rel8.d: Likewise.
+ * ld-crx/reloc-rel8-cmp.s: Likewise.
+ * ld-crx/reloc-rel8-cmp.d: Likewise.
+ * ld-crx/reloc-rel16.s: Likewise.
+ * ld-crx/reloc-rel16.d: Likewise.
+ * ld-crx/reloc-rel24.s: Likewise.
+ * ld-crx/reloc-rel24.d: Likewise.
+ * ld-crx/reloc-rel32.s: Likewise.
+ * ld-crx/reloc-rel32.d: Likewise.
+
2004-08-21 Hans-Peter Nilsson <hp@axis.com>
* ld-cris/expdyn1.d, ld-cris/expdyn5.d, ld-cris/expdyn6.d,
diff --git a/ld/testsuite/ld-crx/crx.exp b/ld/testsuite/ld-crx/crx.exp
new file mode 100644
index 0000000..a878663
--- /dev/null
+++ b/ld/testsuite/ld-crx/crx.exp
@@ -0,0 +1,32 @@
+# Expect script for ld-crx tests
+# Copyright 2004 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Written by Tomer Levi, Tomer.Levi@nsc.com
+#
+
+# Test CRX
+
+if ![istarget crx-*-*] {
+ return
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach test $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $test]
+ run_dump_test [file rootname $test]
+}
diff --git a/ld/testsuite/ld-crx/crx.ld b/ld/testsuite/ld-crx/crx.ld
new file mode 100644
index 0000000..703b934
--- /dev/null
+++ b/ld/testsuite/ld-crx/crx.ld
@@ -0,0 +1,84 @@
+/* 8 bit data address relocations (R_CRX_NUM8). */
+d8 = 0x12;
+/* 16 bit data address relocations (R_CRX_NUM16). */
+d16 = 0x1234;
+/* 32 bit data address relocations (R_CRX_NUM32). */
+d32 = 0x12345678;
+
+SECTIONS
+{
+/* 4 bit relocations:
+ Relative address (R_CRX_REL4) : 0x6 + 2 = 0x8
+*/
+ .text_4 0xa :
+ {
+ *(.text_4)
+ foo4 = (. + 0x6);
+ }
+
+/* 8 bit relocations:
+ Relative address (R_CRX_REL8): 0x10 + 2 = 0x12
+ Relative address (R_CRX_REL8_CMP) : 0x10 + 4 = 0x14
+*/
+ .text_8 0xe0 :
+ {
+ *(.text_8)
+ foo8 = (. + 0x10);
+ }
+
+/* 12 bit relocations:
+ Absolute address (R_CRX_REGREL12) : 0x0101 + 0x700 + 4 = 0x805
+*/
+ .text_12 0x0101 :
+ {
+ *(.text_12)
+ foo12 = (. + 0x700);
+ }
+
+/* 16 bit relocations:
+ Relative address (R_CRX_REL16) : 0x1000 + 4 = 0x1004
+ Absolute address (R_CRX_IMM16) : 0x01010 + 0x1000 + 4 = 0x2014
+*/
+ .text_16 0x01010 :
+ {
+ *(.text_16)
+ foo16 = (. + 0x1000);
+ }
+
+/* 22 bit relocations:
+ Absolute address (R_CRX_REGREL22) : 0x0201400 + 0x100000 + 6 = 0x301406
+*/
+ .text_22 0x0201400 :
+ {
+ *(.text_22)
+ foo22 = (. + 0x100000);
+ }
+
+/* 24 bit relocations:
+ Relative address (R_CRX_REL24) : 0xe00000 + 6 = 0xe00006
+*/
+ .text_24 0x0f01400 :
+ {
+ *(.text_24)
+ foo24 = (. + 0xe00000);
+ }
+
+/* 28 bit relocations:
+ Absolute address (R_CRX_REGREL28) : 0x06201400 + 0x3100000 + 6 = 0x9301406
+*/
+ .text_28 0x06201400 :
+ {
+ *(.text_28)
+ foo28 = (. + 0x3100000);
+ }
+
+/* 32 bit relocations:
+ Absolute address (R_CRX_ABS32, R_CRX_IMM32) : 0x11014000 + 0x11000000 + 6 = 0x22014006
+ Relative address (R_CRX_REL32) : 0x11000000 + 6 = 0x11000006
+*/
+ .text_32 0x11014000 :
+ {
+ *(.text_32)
+ foo32 = (. + 0x11000000);
+ }
+}
diff --git a/ld/testsuite/ld-crx/reloc-abs32.d b/ld/testsuite/ld-crx/reloc-abs32.d
new file mode 100644
index 0000000..344b208
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-abs32.d
@@ -0,0 +1,13 @@
+#source: reloc-abs32.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test absolute relocation R_CRX_ABS32
+
+.*: file format elf32-crx
+
+Disassembly of section .text_32:
+
+11014000 <_start>:
+11014000: 01 33 01 22 loadb 0x22014006, r1
+11014004: 06 40
diff --git a/ld/testsuite/ld-crx/reloc-abs32.s b/ld/testsuite/ld-crx/reloc-abs32.s
new file mode 100644
index 0000000..40ead76
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-abs32.s
@@ -0,0 +1,7 @@
+# Test absolute relocation R_CRX_ABS32
+
+ .section .text_32,"ax","progbits"
+ .global _start
+_start:
+ loadb foo32, r1
+
diff --git a/ld/testsuite/ld-crx/reloc-imm16.d b/ld/testsuite/ld-crx/reloc-imm16.d
new file mode 100644
index 0000000..31aab63
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-imm16.d
@@ -0,0 +1,12 @@
+#source: reloc-imm16.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test immediate relocation R_CRX_IMM16
+
+.*: file format elf32-crx
+
+Disassembly of section .text_16:
+
+00001010 <_start>:
+ 1010: ee 11 14 20 addw \$0x2014, r14
diff --git a/ld/testsuite/ld-crx/reloc-imm16.s b/ld/testsuite/ld-crx/reloc-imm16.s
new file mode 100644
index 0000000..3e0cc2e
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-imm16.s
@@ -0,0 +1,7 @@
+# Test immediate relocation R_CRX_IMM16
+
+ .section .text_16,"ax","progbits"
+ .global _start
+_start:
+ addw $foo16 , ra
+
diff --git a/ld/testsuite/ld-crx/reloc-imm32.d b/ld/testsuite/ld-crx/reloc-imm32.d
new file mode 100644
index 0000000..9831a68
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-imm32.d
@@ -0,0 +1,13 @@
+#source: reloc-imm32.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test immediate relocation R_CRX_IMM32
+
+.*: file format elf32-crx
+
+Disassembly of section .text_32:
+
+11014000 <_start>:
+11014000: f6 21 01 22 addd \$0x22014006, r6
+11014004: 06 40
diff --git a/ld/testsuite/ld-crx/reloc-imm32.s b/ld/testsuite/ld-crx/reloc-imm32.s
new file mode 100644
index 0000000..ccf71be
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-imm32.s
@@ -0,0 +1,7 @@
+# Test immediate relocation R_CRX_IMM32
+
+ .section .text_32,"ax","progbits"
+ .global _start
+_start:
+ addd $foo32, r6
+
diff --git a/ld/testsuite/ld-crx/reloc-num16.d b/ld/testsuite/ld-crx/reloc-num16.d
new file mode 100644
index 0000000..7328d42
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num16.d
@@ -0,0 +1,12 @@
+#source: reloc-num16.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test relocation on data R_CRX_NUM16
+
+.*: file format elf32-crx
+
+Disassembly of section .text:
+
+11014000 <_start>:
+11014000: 34 12 addcw \$0x3, r4
diff --git a/ld/testsuite/ld-crx/reloc-num16.s b/ld/testsuite/ld-crx/reloc-num16.s
new file mode 100644
index 0000000..ff033e1
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num16.s
@@ -0,0 +1,6 @@
+# Test relocation on data R_CRX_NUM16
+
+ .text
+ .global _start
+_start:
+ .word d16
diff --git a/ld/testsuite/ld-crx/reloc-num32.d b/ld/testsuite/ld-crx/reloc-num32.d
new file mode 100644
index 0000000..e364964
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num32.d
@@ -0,0 +1,13 @@
+#source: reloc-num32.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test relocation on data R_CRX_NUM32
+
+.*: file format elf32-crx
+
+Disassembly of section .text:
+
+11014000 <_start>:
+11014000: 78 56 orw r7, r8
+11014002: 34 12 addcw \$0x3, r4
diff --git a/ld/testsuite/ld-crx/reloc-num32.s b/ld/testsuite/ld-crx/reloc-num32.s
new file mode 100644
index 0000000..201682c
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num32.s
@@ -0,0 +1,6 @@
+# Test relocation on data R_CRX_NUM32
+
+ .text
+ .global _start
+_start:
+ .long d32
diff --git a/ld/testsuite/ld-crx/reloc-num8.d b/ld/testsuite/ld-crx/reloc-num8.d
new file mode 100644
index 0000000..8aa0215
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num8.d
@@ -0,0 +1,12 @@
+#source: reloc-num8.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test relocation on data R_CRX_NUM8
+
+.*: file format elf32-crx
+
+Disassembly of section .text:
+
+11014000 <_start>:
+11014000: 12 00 addub \$0x1, r2
diff --git a/ld/testsuite/ld-crx/reloc-num8.s b/ld/testsuite/ld-crx/reloc-num8.s
new file mode 100644
index 0000000..4dc70b5
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-num8.s
@@ -0,0 +1,6 @@
+# Test relocation on data R_CRX_NUM8
+
+ .text
+ .global _start
+_start:
+ .byte d8
diff --git a/ld/testsuite/ld-crx/reloc-regrel12.d b/ld/testsuite/ld-crx/reloc-regrel12.d
new file mode 100644
index 0000000..e681d9f5
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel12.d
@@ -0,0 +1,12 @@
+#source: reloc-regrel12.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test register relative relocation R_CRX_REGREL12
+
+.*: file format elf32-crx
+
+Disassembly of section .text_12:
+
+00000101 <_start>:
+ 101: 85 32 05 78 loadb 0x805\(r7\)\+, r5
diff --git a/ld/testsuite/ld-crx/reloc-regrel12.s b/ld/testsuite/ld-crx/reloc-regrel12.s
new file mode 100644
index 0000000..060502b
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel12.s
@@ -0,0 +1,6 @@
+# Test register relative relocation R_CRX_REGREL12
+
+ .section .text_12,"ax","progbits"
+ .global _start
+_start:
+ loadb foo12(r7)+, r5
diff --git a/ld/testsuite/ld-crx/reloc-regrel22.d b/ld/testsuite/ld-crx/reloc-regrel22.d
new file mode 100644
index 0000000..7c4ba1b
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel22.d
@@ -0,0 +1,13 @@
+#source: reloc-regrel22.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test register relative relocation R_CRX_REGREL22
+
+.*: file format elf32-crx
+
+Disassembly of section .text_22:
+
+00201400 <_start>:
+ 201400: cd 33 70 9c loadb 0x301406\(r9,r12,2\), r13
+ 201404: 06 14
diff --git a/ld/testsuite/ld-crx/reloc-regrel22.s b/ld/testsuite/ld-crx/reloc-regrel22.s
new file mode 100644
index 0000000..478b5e2
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel22.s
@@ -0,0 +1,6 @@
+# Test register relative relocation R_CRX_REGREL22
+
+ .section .text_22,"ax","progbits"
+ .global _start
+_start:
+ loadb foo22(r9,r12,2), r13
diff --git a/ld/testsuite/ld-crx/reloc-regrel28.d b/ld/testsuite/ld-crx/reloc-regrel28.d
new file mode 100644
index 0000000..057118b
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel28.d
@@ -0,0 +1,13 @@
+#source: reloc-regrel28.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test register relative relocation R_CRX_REGREL28
+
+.*: file format elf32-crx
+
+Disassembly of section .text_28:
+
+06201400 <_start>:
+ 6201400: 7f 3b 30 99 cbitd \$0x1f, 0x9301406\(r9\)
+ 6201404: 06 14
diff --git a/ld/testsuite/ld-crx/reloc-regrel28.s b/ld/testsuite/ld-crx/reloc-regrel28.s
new file mode 100644
index 0000000..2be418f
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel28.s
@@ -0,0 +1,6 @@
+# Test register relative relocation R_CRX_REGREL28
+
+ .section .text_28,"ax","progbits"
+ .global _start
+_start:
+ cbitd $31, foo28(r9)
diff --git a/ld/testsuite/ld-crx/reloc-regrel32.d b/ld/testsuite/ld-crx/reloc-regrel32.d
new file mode 100644
index 0000000..9022520
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel32.d
@@ -0,0 +1,13 @@
+#source: reloc-regrel32.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test register relative relocation R_CRX_REGREL32
+
+.*: file format elf32-crx
+
+Disassembly of section .text_32:
+
+11014000 <_start>:
+11014000: f5 87 01 22 loadb 0x22014006\(r5\), r7
+11014004: 06 40
diff --git a/ld/testsuite/ld-crx/reloc-regrel32.s b/ld/testsuite/ld-crx/reloc-regrel32.s
new file mode 100644
index 0000000..dcfc0cd
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-regrel32.s
@@ -0,0 +1,6 @@
+# Test register relative relocation R_CRX_REGREL32
+
+ .section .text_32,"ax","progbits"
+ .global _start
+_start:
+ loadb foo32(r5), r7
diff --git a/ld/testsuite/ld-crx/reloc-rel16.d b/ld/testsuite/ld-crx/reloc-rel16.d
new file mode 100644
index 0000000..65cb2b8
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel16.d
@@ -0,0 +1,12 @@
+#source: reloc-rel16.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL16
+
+.*: file format elf32-crx
+
+Disassembly of section .text_16:
+
+00001010 <_start>:
+ 1010: 7e 30 02 08 bal r14, \*\+0x1004
diff --git a/ld/testsuite/ld-crx/reloc-rel16.s b/ld/testsuite/ld-crx/reloc-rel16.s
new file mode 100644
index 0000000..65ec197
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel16.s
@@ -0,0 +1,8 @@
+# Test pc relative relocation R_CRX_REL16
+
+ .section .text_16,"ax","progbits"
+ .global _start
+ .global foo16
+_start:
+ bal ra, foo16
+foo16:
diff --git a/ld/testsuite/ld-crx/reloc-rel24.d b/ld/testsuite/ld-crx/reloc-rel24.d
new file mode 100644
index 0000000..2b38c5d
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel24.d
@@ -0,0 +1,13 @@
+#source: reloc-rel24.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL24
+
+.*: file format elf32-crx
+
+Disassembly of section .text_24:
+
+00f01400 <_start>:
+ f01400: 81 31 70 20 cmpbeqb r1, r2, \*\+0xe00006
+ f01404: 03 00
diff --git a/ld/testsuite/ld-crx/reloc-rel24.s b/ld/testsuite/ld-crx/reloc-rel24.s
new file mode 100644
index 0000000..e772ddd
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel24.s
@@ -0,0 +1,6 @@
+# Test pc relative relocation R_CRX_REL24
+
+ .section .text_24,"ax","progbits"
+ .global _start
+_start:
+ cmpbeqb r1, r2, foo24
diff --git a/ld/testsuite/ld-crx/reloc-rel32.d b/ld/testsuite/ld-crx/reloc-rel32.d
new file mode 100644
index 0000000..726bfcd
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel32.d
@@ -0,0 +1,13 @@
+#source: reloc-rel32.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL32
+
+.*: file format elf32-crx
+
+Disassembly of section .text_32:
+
+11014000 <_start>:
+11014000: 7f 7e 80 08 br \*\+0x11000006
+11014004: 03 00
diff --git a/ld/testsuite/ld-crx/reloc-rel32.s b/ld/testsuite/ld-crx/reloc-rel32.s
new file mode 100644
index 0000000..6b010a9
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel32.s
@@ -0,0 +1,6 @@
+# Test pc relative relocation R_CRX_REL32
+
+ .section .text_32,"ax","progbits"
+ .global _start
+_start:
+ br foo32
diff --git a/ld/testsuite/ld-crx/reloc-rel4.d b/ld/testsuite/ld-crx/reloc-rel4.d
new file mode 100644
index 0000000..a05060b
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel4.d
@@ -0,0 +1,12 @@
+#source: reloc-rel4.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL4
+
+.*: file format elf32-crx
+
+Disassembly of section .text_4:
+
+0000000a <_start>:
+ a: 3a b0 beq0b r10, 0x8
diff --git a/ld/testsuite/ld-crx/reloc-rel4.s b/ld/testsuite/ld-crx/reloc-rel4.s
new file mode 100644
index 0000000..138f6b6
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel4.s
@@ -0,0 +1,8 @@
+# Test pc relative relocation R_CRX_REL4
+
+ .section .text_4,"ax","progbits"
+ .global _start
+ .global foo4
+_start:
+ beq0b r10 , foo4
+foo4:
diff --git a/ld/testsuite/ld-crx/reloc-rel8-cmp.d b/ld/testsuite/ld-crx/reloc-rel8-cmp.d
new file mode 100644
index 0000000..e027ad6
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel8-cmp.d
@@ -0,0 +1,12 @@
+#source: reloc-rel8-cmp.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL8_CMP
+
+.*: file format elf32-crx
+
+Disassembly of section .text_8:
+
+000000e0 <_start>:
+ e0: 81 30 0a 20 cmpbeqb r1, r2, \*\+0x14
diff --git a/ld/testsuite/ld-crx/reloc-rel8-cmp.s b/ld/testsuite/ld-crx/reloc-rel8-cmp.s
new file mode 100644
index 0000000..61e5dd4
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel8-cmp.s
@@ -0,0 +1,8 @@
+# Test pc relative relocation R_CRX_REL8_CMP
+
+ .section .text_8,"ax","progbits"
+ .global _start
+ .global foo8
+_start:
+ cmpbeqb r1, r2, foo8
+foo8:
diff --git a/ld/testsuite/ld-crx/reloc-rel8.d b/ld/testsuite/ld-crx/reloc-rel8.d
new file mode 100644
index 0000000..f4c5972
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel8.d
@@ -0,0 +1,12 @@
+#source: reloc-rel8.s
+#ld: -T $srcdir/$subdir/crx.ld
+#objdump: -D
+
+# Test pc relative relocation R_CRX_REL8
+
+.*: file format elf32-crx
+
+Disassembly of section .text_8:
+
+000000e0 <_start>:
+ e0: 09 70 beq \*\+0x12
diff --git a/ld/testsuite/ld-crx/reloc-rel8.s b/ld/testsuite/ld-crx/reloc-rel8.s
new file mode 100644
index 0000000..9692f3c
--- /dev/null
+++ b/ld/testsuite/ld-crx/reloc-rel8.s
@@ -0,0 +1,8 @@
+# Test pc relative relocation R_CRX_REL8
+
+ .section .text_8,"ax","progbits"
+ .global _start
+ .global foo8
+_start:
+ beq foo8
+foo8: