diff options
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-crx')
34 files changed, 426 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-crx/crx.exp b/binutils-2.21/ld/testsuite/ld-crx/crx.exp new file mode 100644 index 0000000..4136ebe --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-crx/crx.exp @@ -0,0 +1,35 @@ +# Expect script for ld-crx tests +# Copyright 2004, 2005, 2007 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, 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/binutils-2.21/ld/testsuite/ld-crx/crx.ld b/binutils-2.21/ld/testsuite/ld-crx/crx.ld new file mode 100644 index 0000000..703b934 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-abs32.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-abs32.d new file mode 100644 index 0000000..c4bd8cf --- /dev/null +++ b/binutils-2.21/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 [-_<>+0-9a-z]*, r1 +11014004: 06 40 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-abs32.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-abs32.s new file mode 100644 index 0000000..40ead76 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-imm16.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-imm16.d new file mode 100644 index 0000000..31aab63 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-imm16.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-imm16.s new file mode 100644 index 0000000..3e0cc2e --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-imm32.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-imm32.d new file mode 100644 index 0000000..9831a68 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-imm32.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-imm32.s new file mode 100644 index 0000000..ccf71be --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-num16.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-num16.d new file mode 100644 index 0000000..72bf342 --- /dev/null +++ b/binutils-2.21/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: + +.* <_start>: +.*: 34 12 addcw \$0x3, r4 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-num16.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-num16.s new file mode 100644 index 0000000..ff033e1 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-num32.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-num32.d new file mode 100644 index 0000000..bdd9ee9 --- /dev/null +++ b/binutils-2.21/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: + +.* <_start>: +.*: 78 56 orw r7, r8 +.*: 34 12 addcw \$0x3, r4 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-num32.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-num32.s new file mode 100644 index 0000000..201682c --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-num8.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-num8.d new file mode 100644 index 0000000..38927de --- /dev/null +++ b/binutils-2.21/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: + +.* <_start>: +.*: 12 00 addub \$0x1, r2 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-num8.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-num8.s new file mode 100644 index 0000000..4dc70b5 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel12.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel12.d new file mode 100644 index 0000000..e681d9f --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel12.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel12.s new file mode 100644 index 0000000..060502b --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel22.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel22.d new file mode 100644 index 0000000..7c4ba1b --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel22.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel22.s new file mode 100644 index 0000000..478b5e2 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel28.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel28.d new file mode 100644 index 0000000..057118b --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel28.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel28.s new file mode 100644 index 0000000..2be418f --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel32.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel32.d new file mode 100644 index 0000000..9022520 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel32.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-regrel32.s new file mode 100644 index 0000000..dcfc0cd --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel16.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel16.d new file mode 100644 index 0000000..15b820e --- /dev/null +++ b/binutils-2.21/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, 0x[0-9a-f]* [-_<>+0-9a-z]* diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel16.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel16.s new file mode 100644 index 0000000..65ec197 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel24.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel24.d new file mode 100644 index 0000000..c72af5a --- /dev/null +++ b/binutils-2.21/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, 0x[0-9a-f]* [-_<>+0-9a-z]* + f01404: 03 00 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel24.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel24.s new file mode 100644 index 0000000..e772ddd --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel32.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel32.d new file mode 100644 index 0000000..31f462b --- /dev/null +++ b/binutils-2.21/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 0x[0-9a-f]* [-_<>+0-9a-z]* +11014004: 03 00 diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel32.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel32.s new file mode 100644 index 0000000..6b010a9 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel4.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel4.d new file mode 100644 index 0000000..be9ff36 --- /dev/null +++ b/binutils-2.21/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 [-_<>+0-9a-z]* diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel4.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel4.s new file mode 100644 index 0000000..138f6b6 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8-cmp.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8-cmp.d new file mode 100644 index 0000000..2d1a245 --- /dev/null +++ b/binutils-2.21/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, 0x[0-9a-f]* [-_<>+0-9a-z]* diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8-cmp.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8-cmp.s new file mode 100644 index 0000000..61e5dd4 --- /dev/null +++ b/binutils-2.21/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/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8.d b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8.d new file mode 100644 index 0000000..d76ec63 --- /dev/null +++ b/binutils-2.21/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 0x[0-9a-f]* [-_<>+0-9a-z]* diff --git a/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8.s b/binutils-2.21/ld/testsuite/ld-crx/reloc-rel8.s new file mode 100644 index 0000000..9692f3c --- /dev/null +++ b/binutils-2.21/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: |