aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-nds32
diff options
context:
space:
mode:
authorKuan-Lin Chen <kuanlinchentw@gmail.com>2013-12-13 11:52:32 +0000
committerNick Clifton <nickc@redhat.com>2013-12-13 11:52:32 +0000
commit35c081572f32263b24554ae40502fb5b51ece8c6 (patch)
tree800c0d49d0635671e8e28c56635702212c6f7fc1 /ld/testsuite/ld-nds32
parent8a48ac9579f34efea9bc4f2d5b02230e2ac3dfc1 (diff)
downloadgdb-35c081572f32263b24554ae40502fb5b51ece8c6.zip
gdb-35c081572f32263b24554ae40502fb5b51ece8c6.tar.gz
gdb-35c081572f32263b24554ae40502fb5b51ece8c6.tar.bz2
Add support for Andes NDS32:
BFD: * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add nds32 files. * Makefile.in: Regenerate. * archures.c (bfd_nds32_arch): Add nds32 target. * bfd-in2.h: Regenerate. * config.bfd (nds32*le-*-linux): Add bfd_elf32_nds32lelin_vec and bfd_elf32_nds32belin_vec. (nds32*be-*-linux*): Likewise. (nds32*le-*-*): Add bfd_elf32_nds32le_vec and bfd_elf32_nds32be_vec. (nds32*be-*-*): Likewise. * configure.in (bfd_elf32_nds32be_vec): Add elf32-nds32.lo. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. * configure: Regenerate. * cpu-nds32.c: New file for nds32. * elf-bfd.h: Add NDS32_ELF_DATA. * elf32-nds32.c: New file for nds32. * elf32-nds32.h: New file for nds32. * libbfd.h: Regenerate. * reloc.c: Add relocations for nds32. * targets.c (bfd_elf32_nds32be_vec): New declaration for nds32. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. BINUTILS: * readelf.c: Include elf/nds32.h (guess_is_rela): Add case for EM_NDS32. (dump_relocations): Add case for EM_NDS32. (decode_NDS32_machine_flags): New. (get_machine_flags): Add case for EM_NDS32. (is_32bit_abs_reloc): Likewise. (is_16bit_abs_reloc): Likewise. (process_nds32_specific): New. (process_arch_specific): Add case for EM_NDS32. * NEWS: Announce Andes nds32 support. * MAINTAINERS: Add nds32 maintainers. TESTSUITE: * binutils-all/objdump.exp: Add NDS32 cpu. * binutils-all/readelf.r: Skip extra reloc created by NDS32. GAS: * Makefile.am (TARGET_CPU_CFILES): Add config/tc-nds32.c. (TARGET_CPU_HFILES): Add config/tc-nds32.h. * Makefile.in: Regenerate. * configure.in (nds32): Add nds32 target extension config support. * configure.tgt : Add case for nds32-*-elf* and nds32-*-linux*. * configure: Regenerate. * config/tc-nds32.c: New file for nds32. * config/tc-nds32.h: New file for nds32. * doc/Makefile.am (CPU_DOCS): Add c-nds32.texi. * doc/Makefile.in: Regenerate. * doc/as.texinfo: Add nds32 options. * doc/all.texi: Set NDS32. * doc/c-nds32.texi: New file dor nds32 document. * NEWS: Announce Andes nds32 support. TESTSUITE: * gas/all/gas.exp: Add expected failures for NDS32. * gas/elf/elf.exp: Likewise. * gas/lns/lns.exp: Use alternate test. * gas/macros/irp.d: Skip for NDS32. * gas/macros/macros.exp: Skip some tests for the NDS32. * gas/macros/rept.d: Skip for NDS32. * gas/macros/test3.d: Skip for NDS32. * gas/nds32: New directory. * gas/nds32/alu-1.s: New test. * gas/nds32/alu-1.d: Likewise. * gas/nds32/alu-2.s: Likewise. * gas/nds32/alu-2.d: Likewise. * gas/nds32/br-1.d: Likewise. * gas/nds32/br-1.s: Likewise. * gas/nds32/br-2.d: Likewise. * gas/nds32/br-2.s: Likewise. * gas/nds32/ji-jr.d: Likewise. * gas/nds32/ji-jr.s: Likewise. * gas/nds32/ls.d: Likewise. * gas/nds32/ls.s: Likewise. * gas/nds32/lsi.d: Likewise. * gas/nds32/lsi.s: Likewise. * gas/nds32/to-16bit-v1.d: Likewise. * gas/nds32/to-16bit-v1.s: Likewise. * gas/nds32/to-16bit-v2.d: Likewise. * gas/nds32/to-16bit-v2.s: Likewise. * gas/nds32/to-16bit-v3.d: Likewise. * gas/nds32/to-16bit-v3.s: Likewise. * gas/nds32/nds32.exp: New test driver. LD: * Makefile.am (ALL_EMULATION_SOURCES): Add nds32 target. * Makefile.in: Regenerate. * configure.tgt: Add case for nds32*le-*-elf*, nds32*be-*-elf*, nds32*le-*-linux-gnu*, and nds32*be-*-linux-gnu*. * emulparams/nds32belf.sh: New file for nds32. * emulparams/nds32belf_linux.sh: Likewise. * emulparams/nds32belf16m.sh: Likewise. * emulparams/nds32elf.sh: Likewise. * emulparams/nds32elf_linux.sh: Likewise. * emulparams/nds32elf16m.sh: Likewise. * emultempl/nds32elf.em: Likewise. * scripttempl/nds32elf.sc}: Likewise. * gen-doc.texi: Set NDS32. * ld.texinfo: Set NDS32. * NEWS: Announce Andes nds32 support. TESTSUITE: * lib/ld-lib.exp: Add NDS32 to list of targets that do not support shared library generation. * ld-nds32: New directory. * ld-nds32/branch.d: New test. * ld-nds32/branch.ld: New test. * ld-nds32/branch.s: New test. * ld-nds32/diff.d: New test. * ld-nds32/diff.ld: New test. * ld-nds32/diff.s: New test. * ld-nds32/gp.d: New test. * ld-nds32/gp.ld: New test. * ld-nds32/gp.s: New test. * ld-nds32/imm.d: New test. * ld-nds32/imm.ld: New test. * ld-nds32/imm.s: New test. * ld-nds32/imm_symbol.s: New test. * ld-nds32/relax_jmp.d: New test. * ld-nds32/relax_jmp.ld: New test. * ld-nds32/relax_jmp.s: New test. * ld-nds32/relax_load_store.d: New test. * ld-nds32/relax_load_store.ld: New test. * ld-nds32/relax_load_store.s: New test. * ld-nds32/nds32.exp: New file. OPCODES: * Makefile.am (TARGET_LIBOPCODES_CFILES): Add nds32-asm.c and nds32-dis.c. * Makefile.in: Regenerate. * configure.in: Add case for bfd_nds32_arch. * configure: Regenerate. * disassemble.c (ARCH_nds32): Define. * nds32-asm.c: New file for nds32. * nds32-asm.h: New file for nds32. * nds32-dis.c: New file for nds32. * nds32-opc.h: New file for nds32. INCLUDE: * dis-asm.h (print_insn_nds32): Add nds32 target. * elf/nds32.h: New file for nds32. * opcode/nds32.h: New file for nds32.
Diffstat (limited to 'ld/testsuite/ld-nds32')
-rw-r--r--ld/testsuite/ld-nds32/branch.d24
-rw-r--r--ld/testsuite/ld-nds32/branch.ld6
-rw-r--r--ld/testsuite/ld-nds32/branch.s18
-rw-r--r--ld/testsuite/ld-nds32/diff.d16
-rw-r--r--ld/testsuite/ld-nds32/diff.ld10
-rw-r--r--ld/testsuite/ld-nds32/diff.s32
-rw-r--r--ld/testsuite/ld-nds32/gp.d18
-rw-r--r--ld/testsuite/ld-nds32/gp.ld11
-rw-r--r--ld/testsuite/ld-nds32/gp.s18
-rw-r--r--ld/testsuite/ld-nds32/imm.d15
-rw-r--r--ld/testsuite/ld-nds32/imm.ld6
-rw-r--r--ld/testsuite/ld-nds32/imm.s7
-rw-r--r--ld/testsuite/ld-nds32/imm_symbol.s7
-rw-r--r--ld/testsuite/ld-nds32/nds32.exp26
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.d12
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.ld6
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.s10
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.d12
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.ld10
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.s17
20 files changed, 281 insertions, 0 deletions
diff --git a/ld/testsuite/ld-nds32/branch.d b/ld/testsuite/ld-nds32/branch.d
new file mode 100644
index 0000000..85798e9
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.d
@@ -0,0 +1,24 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/branch.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> beq \$r0, \$r1, 0000002c <main>
+0+0004 <[^>]*> bne \$r0, \$r1, 0000002c <main>
+0+0008 <[^>]*> bnez38 \$r0, 0000002c <main>
+0+000a <[^>]*> beqz38 \$r0, 0000002c <main>
+0+000c <[^>]*> bgez \$r0, 0000002c <main>
+.*
+0+0012 <[^>]*> bgezal \$r0, 0000002c <main>
+0+0016 <[^>]*> bgtz \$r0, 0000002c <main>
+.*
+0+001c <[^>]*> blez \$r0, 0000002c <main>
+.*
+0+0022 <[^>]*> bltz \$r0, 0000002c <main>
+0+0026 <[^>]*> srli45 \$r0, 0
+0+0028 <[^>]*> bltzal \$r0, 0000002c <main>
+0+002c <main>.*
+
diff --git a/ld/testsuite/ld-nds32/branch.ld b/ld/testsuite/ld-nds32/branch.ld
new file mode 100644
index 0000000..28eb4e0
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/branch.s b/ld/testsuite/ld-nds32/branch.s
new file mode 100644
index 0000000..284645e
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.s
@@ -0,0 +1,18 @@
+.text
+.global _start
+_start:
+ beq $r0, $r1, main
+ bne $r0, $r1, main
+ beqz $r0, main
+ bnez $r0, main
+ bgez $r0, main
+ bgezal $r0, main
+ bgtz $r0, main
+ blez $r0, main
+ bltz $r0, main
+ bltzal $r0, main
+.section .text.2, "ax"
+.globl main
+main:
+ nop
+
diff --git a/ld/testsuite/ld-nds32/diff.d b/ld/testsuite/ld-nds32/diff.d
new file mode 100644
index 0000000..ef79586
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.d
@@ -0,0 +1,16 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/diff.ld
+#objdump: -D --prefix-addresses -j .data --show-raw-insn
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .data:
+00008000 <WORD> (7e 00 00 00|00 00 00 7e).*
+00008004 <HALF> (7e 00 7e fe|00 7e 7e fe).*
+00008006 <BYTE> 7e fe 00 fe.*
+00008007 <ULEB128> fe 00.*
+ ...
+00008009 <ULEB128_2> fe 00.*
+.*
+.*
diff --git a/ld/testsuite/ld-nds32/diff.ld b/ld/testsuite/ld-nds32/diff.ld
new file mode 100644
index 0000000..5e4dd29
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .text 0x4000 : {
+ * (.text .text.*);
+ }
+
+ .data 0x8000 : {
+ * (.data .data.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/diff.s b/ld/testsuite/ld-nds32/diff.s
new file mode 100644
index 0000000..a2844b7
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.s
@@ -0,0 +1,32 @@
+ .global _start
+ .global WORD
+ .global HALF
+ .global BYTE
+ .global ULEB128
+.text
+_start:
+ nop
+.L0:
+ l.w $r0, WORD
+ .zero 122
+.L1:
+ nop
+
+.section code, "ax"
+FOO:
+ ret
+
+.data
+WORD:
+ .word .L1-.L0
+HALF:
+ .half .L1-.L0
+BYTE:
+ .byte .L1-.L0
+ULEB128:
+ .uleb128 .L1-.L0
+ULEB128_2:
+ .uleb128 .L1-.L0
+ .align 2
+PAD:
+ .long 0
diff --git a/ld/testsuite/ld-nds32/gp.d b/ld/testsuite/ld-nds32/gp.d
new file mode 100644
index 0000000..dac6eaa
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.d
@@ -0,0 +1,18 @@
+#as: -Os
+#ld: -static -T \$srcdir/\$subdir/gp.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> addi.gp \$r0, 8192
+0+0004 <[^>]*> lbi.gp \$r0, \[\+ 8192\]
+0+0008 <[^>]*> lbsi.gp \$r0, \[\+ 8192\]
+0+000c <[^>]*> lhi.gp \$r0, \[\+ 8192\]
+0+0010 <[^>]*> lhsi.gp \$r0, \[\+ 8192\]
+0+0014 <[^>]*> lwi.gp \$r0, \[\+ 8192\]
+0+0018 <[^>]*> sbi.gp \$r0, \[\+ 8192\]
+0+001c <[^>]*> shi.gp \$r0, \[\+ 8192\]
+0+0020 <[^>]*> swi.gp \$r0, \[\+ 8192\]
+
diff --git a/ld/testsuite/ld-nds32/gp.ld b/ld/testsuite/ld-nds32/gp.ld
new file mode 100644
index 0000000..b537b95
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.ld
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+
+ .data 0x3000 : {
+ * (.data .data.*);
+ }
+ _SDA_BASE_ = 0x1000;
+}
diff --git a/ld/testsuite/ld-nds32/gp.s b/ld/testsuite/ld-nds32/gp.s
new file mode 100644
index 0000000..d0fde2a
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.s
@@ -0,0 +1,18 @@
+.data
+.global mydata
+mydata:
+ .word 0x11
+
+.text
+.global _start
+_start:
+ addi.gp $r0, mydata
+ lbi.gp $r0, [+mydata]
+ lbsi.gp $r0, [+mydata]
+ lhi.gp $r0, [+mydata]
+ lhsi.gp $r0, [+mydata]
+ lwi.gp $r0, [+mydata]
+ sbi.gp $r0, [+mydata]
+ shi.gp $r0, [+mydata]
+ swi.gp $r0, [+mydata]
+
diff --git a/ld/testsuite/ld-nds32/imm.d b/ld/testsuite/ld-nds32/imm.d
new file mode 100644
index 0000000..fdaacf3
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.d
@@ -0,0 +1,15 @@
+#source: imm.s
+#source: imm_symbol.s
+#as: -Os
+#ld: -static -T $srcdir/$subdir/imm.ld --relax
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+1000 <[^>]*> sethi \$r0, 0x11223
+0+1004 <[^>]*> ori \$r0, \$r0, 836
+0+1008 <[^>]*> movi \$r0, 70179
+0+100c <[^>]*> movi55 \$r0, 15
+
diff --git a/ld/testsuite/ld-nds32/imm.ld b/ld/testsuite/ld-nds32/imm.ld
new file mode 100644
index 0000000..b7d12cc
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x1000 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/imm.s b/ld/testsuite/ld-nds32/imm.s
new file mode 100644
index 0000000..1d10831
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.s
@@ -0,0 +1,7 @@
+.text
+.global _start
+_start:
+ la $r0, imm32
+ la $r0, imm20
+ la $r0, imm5
+
diff --git a/ld/testsuite/ld-nds32/imm_symbol.s b/ld/testsuite/ld-nds32/imm_symbol.s
new file mode 100644
index 0000000..1c75db2
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm_symbol.s
@@ -0,0 +1,7 @@
+.globl imm32
+.globl imm20
+.globl imm5
+
+.set imm32, 0x11223344
+.set imm20, 0x11223
+.set imm5, 0xf
diff --git a/ld/testsuite/ld-nds32/nds32.exp b/ld/testsuite/ld-nds32/nds32.exp
new file mode 100644
index 0000000..6f95c17
--- /dev/null
+++ b/ld/testsuite/ld-nds32/nds32.exp
@@ -0,0 +1,26 @@
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+# Contributed by Andes Technology Corporation.
+
+# 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.
+
+if {[istarget "nds32*-*"]} {
+ run_dump_test "diff"
+ run_dump_test "gp"
+ run_dump_test "relax_jmp"
+ run_dump_test "imm"
+ run_dump_test "branch"
+ run_dump_test "relax_load_store"
+}
diff --git a/ld/testsuite/ld-nds32/relax_jmp.d b/ld/testsuite/ld-nds32/relax_jmp.d
new file mode 100644
index 0000000..b1d2051
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.d
@@ -0,0 +1,12 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/relax_jmp.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> j8 00000006 <main>
+0+0002 <[^>]*> jal 00000006 <main>
+0+0006 <[^>]*> srli45 \$r0, 0
+
diff --git a/ld/testsuite/ld-nds32/relax_jmp.ld b/ld/testsuite/ld-nds32/relax_jmp.ld
new file mode 100644
index 0000000..28eb4e0
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/relax_jmp.s b/ld/testsuite/ld-nds32/relax_jmp.s
new file mode 100644
index 0000000..e281763
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.s
@@ -0,0 +1,10 @@
+.text
+.global _start
+_start:
+ j main
+ jal main
+.section .text.2, "ax"
+.globl main
+main:
+ nop
+
diff --git a/ld/testsuite/ld-nds32/relax_load_store.d b/ld/testsuite/ld-nds32/relax_load_store.d
new file mode 100644
index 0000000..07c4fe7
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.d
@@ -0,0 +1,12 @@
+#as: -Os
+#ld: -static --relax -T \$srcdir/\$subdir/relax_load_store.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> lwi.gp \$r0, \[\+ 0\]
+0+0004 <[^>]*> lhi.gp \$r0, \[\+ 4\]
+0+0008 <[^>]*> lbi.gp \$r0, \[\+ 6\]
+
diff --git a/ld/testsuite/ld-nds32/relax_load_store.ld b/ld/testsuite/ld-nds32/relax_load_store.ld
new file mode 100644
index 0000000..1bc15a9
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+
+ .data 0x3000 : {
+ * (.data .data.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/relax_load_store.s b/ld/testsuite/ld-nds32/relax_load_store.s
new file mode 100644
index 0000000..790c97c
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.s
@@ -0,0 +1,17 @@
+.data
+.global myword
+myword:
+ .word 0x11
+.globl myshort
+myshort:
+ .short 0x11
+.globl mybyte
+mybyte:
+ .byte 0x11
+
+.text
+.global _start
+_start:
+ l.w $r0, myword
+ l.h $r0, myshort
+ l.b $r0, mybyte