aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorPip Cet <pipcet@gmail.com>2017-03-30 10:57:21 +0100
committerNick Clifton <nickc@redhat.com>2017-03-30 10:57:21 +0100
commitf96bd6c2d7a3801fabbf9d834f7a29b752aa7532 (patch)
tree6c4ee43355083f19052f09a0fb5bbc4e47c4a08a /binutils/testsuite
parent662659a1a582af14aa45a458005e2a4df514b6d7 (diff)
downloadgdb-f96bd6c2d7a3801fabbf9d834f7a29b752aa7532.zip
gdb-f96bd6c2d7a3801fabbf9d834f7a29b752aa7532.tar.gz
gdb-f96bd6c2d7a3801fabbf9d834f7a29b752aa7532.tar.bz2
Add support for the WebAssembly file format and the wasm32 ELF conversion to gas and the binutils.
binutils * readelf.c: Add support for wasm32 ELF format WebAssembly files. (guess_is_rela): Likewise. (dump_relocations): Likewise. (is_32bit_abs_reloc): Likewise. (is_none_reloc_): Likewise. * NEWS: Mention the new support. * testsuite/lib/binutils-common.exp (is_elf_format): Mark wasm32 as ELF target. (supports_gnu_unique): Mark wasm32 as supporting STB_GNU_UNIQUE. * testsuite/binutils-all/nm.exp: Mark wasm32 as requiring .size annotations. * testsuite/binutils-all/wasm32: New directory. * testsuite/binutils-all/wasm32/create-wasm.d: New file. * testsuite/binutils-all/wasm32/create-wasm.s: Likewise. * testsuite/binutils-all/wasm32/custom-section.d: Likewise. * testsuite/binutils-all/wasm32/custom-section.s: Likewise. * testsuite/binutils-all/wasm32/invalid-wasm-1.d: Likewise. * testsuite/binutils-all/wasm32/invalid-wasm-1.s: Likewise. * testsuite/binutils-all/wasm32/long-sections.d: Likewise. * testsuite/binutils-all/wasm32/long-sections.s: Likewise. * testsuite/binutils-all/wasm32/parse-wasm.d: Likewise. * testsuite/binutils-all/wasm32/parse-wasm.s: Likewise. * testsuite/binutils-all/wasm32/parse-wasm-2.d: Likewise. * testsuite/binutils-all/wasm32/parse-wasm-2.s: Likewise. * testsuite/binutils-all/wasm32/prepared-section.d: Likewise. * testsuite/binutils-all/wasm32/prepared-section.s: Likewise. * testsuite/binutils-all/wasm32/wasm32.exp: New file, run tests. gas * config/tc-wasm32.h: New file: Add WebAssembly assembler target. * config/tc-wasm32.c: New file: Add WebAssembly assembler target. * Makefile.am: Add WebAssembly assembler target. * configure.tgt: Add WebAssembly assembler target. * doc/c-wasm32.texi: New file: Start documenting WebAssembly assembler. * doc/all.texi: Define WASM32. * doc/as.texinfo: Add WebAssembly entries. * NEWS: Mention the new support. * Makefile.in: Regenerate. * po/gas.pot: Regenerate. * po/POTFILES.in: Regenerate. * testsuite/gas/wasm32: New directory. * testsuite/gas/wasm32/allinsn.d: New file. * testsuite/gas/wasm32/allinsn.s: New file. * testsuite/gas/wasm32/illegal.l: New file. * testsuite/gas/wasm32/illegal.s: New file. * testsuite/gas/wasm32/illegal-2.l: New file. * testsuite/gas/wasm32/illegal-2.s: New file. * testsuite/gas/wasm32/illegal-3.l: New file. * testsuite/gas/wasm32/illegal-3.s: New file. * testsuite/gas/wasm32/illegal-4.l: New file. * testsuite/gas/wasm32/illegal-4.s: New file. * testsuite/gas/wasm32/illegal-5.l: New file. * testsuite/gas/wasm32/illegal-5.s: New file. * testsuite/gas/wasm32/illegal-6.l: New file. * testsuite/gas/wasm32/illegal-6.s: New file. * testsuite/gas/wasm32/illegal-7.l: New file. * testsuite/gas/wasm32/illegal-7.s: New file. * testsuite/gas/wasm32/illegal-8.l: New file. * testsuite/gas/wasm32/illegal-8.s: New file. * testsuite/gas/wasm32/illegal-9.l: New file. * testsuite/gas/wasm32/illegal-9.s: New file. * testsuite/gas/wasm32/illegal-10.l: New file. * testsuite/gas/wasm32/illegal-10.s: New file. * testsuite/gas/wasm32/illegal-11.l: New file. * testsuite/gas/wasm32/illegal-11.s: New file. * testsuite/gas/wasm32/illegal-12.l: New file. * testsuite/gas/wasm32/illegal-12.s: New file. * testsuite/gas/wasm32/illegal-13.l: New file. * testsuite/gas/wasm32/illegal-13.s: New file. * testsuite/gas/wasm32/illegal-14.l: New file. * testsuite/gas/wasm32/illegal-14.s: New file. * testsuite/gas/wasm32/illegal-15.l: New file. * testsuite/gas/wasm32/illegal-15.s: New file. * testsuite/gas/wasm32/illegal-16.l: New file. * testsuite/gas/wasm32/illegal-16.s: New file. * testsuite/gas/wasm32/illegal-17.l: New file. * testsuite/gas/wasm32/illegal-17.s: New file. * testsuite/gas/wasm32/illegal-18.l: New file. * testsuite/gas/wasm32/illegal-18.s: New file. * testsuite/gas/wasm32/illegal-19.l: New file. * testsuite/gas/wasm32/illegal-19.s: New file. * testsuite/gas/wasm32/illegal-20.l: New file. * testsuite/gas/wasm32/illegal-20.s: New file. * testsuite/gas/wasm32/illegal-21.l: New file. * testsuite/gas/wasm32/illegal-21.s: New file. * testsuite/gas/wasm32/illegal-22.l: New file. * testsuite/gas/wasm32/illegal-22.s: New file. * testsuite/gas/wasm32/illegal-24.l: New file. * testsuite/gas/wasm32/illegal-24.s: New file. * testsuite/gas/wasm32/illegal-25.l: New file. * testsuite/gas/wasm32/illegal-25.s: New file. * testsuite/gas/wasm32/reloc.d: New file. * testsuite/gas/wasm32/reloc.s: New file. * testsuite/gas/wasm32/wasm32.exp: New tests for WebAssembly architecture. opcodes * configure.ac: Add (empty) bfd_wasm32_arch target. * configure: Regenerate * po/opcodes.pot: Regenerate. include * opcode/wasm.h: New file to support wasm32 architecture. * elf/wasm32.h: Add R_WASM32_32 relocation. bfd * elf32-wasm32.c: Add relocation code, two relocs. * reloc.c: Add wasm32 relocations. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. * bfd/po/bfd.pot: Regenerate.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/nm.exp3
-rw-r--r--binutils/testsuite/binutils-all/wasm32/create-wasm.d10
-rw-r--r--binutils/testsuite/binutils-all/wasm32/create-wasm.s6
-rw-r--r--binutils/testsuite/binutils-all/wasm32/custom-section.d11
-rw-r--r--binutils/testsuite/binutils-all/wasm32/custom-section.s4
-rw-r--r--binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.d6
-rw-r--r--binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.s7
-rw-r--r--binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.d6
-rw-r--r--binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.s7
-rw-r--r--binutils/testsuite/binutils-all/wasm32/long-sections.d13
-rw-r--r--binutils/testsuite/binutils-all/wasm32/long-sections.s9
-rw-r--r--binutils/testsuite/binutils-all/wasm32/parse-wasm-2.d15
-rw-r--r--binutils/testsuite/binutils-all/wasm32/parse-wasm-2.s43
-rw-r--r--binutils/testsuite/binutils-all/wasm32/parse-wasm.d8
-rw-r--r--binutils/testsuite/binutils-all/wasm32/parse-wasm.s7
-rw-r--r--binutils/testsuite/binutils-all/wasm32/prepared-section.d10
-rw-r--r--binutils/testsuite/binutils-all/wasm32/prepared-section.s6
-rw-r--r--binutils/testsuite/binutils-all/wasm32/wasm32.exp30
-rw-r--r--binutils/testsuite/lib/binutils-common.exp4
19 files changed, 204 insertions, 1 deletions
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index 13eafa6..fdcf194 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -175,7 +175,8 @@ if { [is_elf_format]
|| [istarget *-*-tpf*]
|| [istarget *-*-uclinux*]
|| [istarget ia64-*-*vms*]
- || [istarget *-*-vxworks*] } {
+ || [istarget *-*-vxworks*]
+ || [istarget wasm32-*-*] } {
set nm_1_src "nm-elf-1.s"
} else {
set nm_1_src "nm-1.s"
diff --git a/binutils/testsuite/binutils-all/wasm32/create-wasm.d b/binutils/testsuite/binutils-all/wasm32/create-wasm.d
new file mode 100644
index 0000000..3a1c18a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/create-wasm.d
@@ -0,0 +1,10 @@
+#PROG: objcopy
+#source: create-wasm.s
+#as:
+#objcopy: -Ielf32-wasm32 -Owasm
+#objdump: -bbinary -s
+
+.*:.*file format binary
+
+Contents of section .data:
+ 0000 0061736d 01000000 01030100 00030100 .asm............
diff --git a/binutils/testsuite/binutils-all/wasm32/create-wasm.s b/binutils/testsuite/binutils-all/wasm32/create-wasm.s
new file mode 100644
index 0000000..5c360cc
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/create-wasm.s
@@ -0,0 +1,6 @@
+ .section .wasm.function
+ .byte 0
+ .section .wasm.type
+ .byte 1
+ .byte 0
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/custom-section.d b/binutils/testsuite/binutils-all/wasm32/custom-section.d
new file mode 100644
index 0000000..3a39e77
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/custom-section.d
@@ -0,0 +1,11 @@
+#PROG: objcopy
+#source: custom-section.s
+#as:
+#objcopy: -Ielf32-wasm32 -Owasm
+#objdump: -bbinary -s
+
+.*:.*file format binary
+
+Contents of section .data:
+ 0000 0061736d 01000000 0008046e 616d6502 .asm.......name.
+ 0010 0100 .. *$
diff --git a/binutils/testsuite/binutils-all/wasm32/custom-section.s b/binutils/testsuite/binutils-all/wasm32/custom-section.s
new file mode 100644
index 0000000..81fa671
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/custom-section.s
@@ -0,0 +1,4 @@
+ .section .wasm.name
+ .byte 2
+ .byte 1
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.d b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.d
new file mode 100644
index 0000000..e916fad
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.d
@@ -0,0 +1,6 @@
+#PROG: objcopy
+#source: invalid-wasm-1.s
+#as:
+#objcopy: -Ielf32-wasm32 -Obinary
+#objdump: -bwasm -sD
+#error: : File format not recognized \ No newline at end of file
diff --git a/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.s b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.s
new file mode 100644
index 0000000..50d6690
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-1.s
@@ -0,0 +1,7 @@
+ .data
+ .byte 0
+ .ascii "ASM"
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.d b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.d
new file mode 100644
index 0000000..da28775
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.d
@@ -0,0 +1,6 @@
+#PROG: objcopy
+#source: invalid-wasm-2.s
+#as:
+#objcopy: -Ielf32-wasm32 -Obinary
+#objdump: -bwasm -sD
+#exit: 1 \ No newline at end of file
diff --git a/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.s b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.s
new file mode 100644
index 0000000..4270e9d
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/invalid-wasm-2.s
@@ -0,0 +1,7 @@
+ .data
+ .byte 0
+ .ascii "asm"
+ .byte 2
+ .byte 0
+ .byte 0
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/long-sections.d b/binutils/testsuite/binutils-all/wasm32/long-sections.d
new file mode 100644
index 0000000..edf9058
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/long-sections.d
@@ -0,0 +1,13 @@
+#PROG: objcopy
+#source: long-sections.s
+#as:
+#objcopy: -Ielf32-wasm32 -Owasm
+#objdump: -bbinary -s
+
+.*:.*file format binary
+
+Contents of section .data:
+ 00000 0061736d 01000000 01800200 00000000 .asm............
+#...
+ 00100 00000000 00000000 0000000a 80800400 ................
+#pass
diff --git a/binutils/testsuite/binutils-all/wasm32/long-sections.s b/binutils/testsuite/binutils-all/wasm32/long-sections.s
new file mode 100644
index 0000000..a8642d2
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/long-sections.s
@@ -0,0 +1,9 @@
+ .section .wasm.type
+ .rept 256
+ .byte 0
+ .endr
+
+ .section .wasm.code
+ .rept 65536
+ .byte 0
+ .endr
diff --git a/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.d b/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.d
new file mode 100644
index 0000000..8b59c74
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.d
@@ -0,0 +1,15 @@
+#PROG: objcopy
+#source: parse-wasm-2.s
+#as:
+#objcopy: -Ielf32-wasm32 -Obinary
+#objdump: -bwasm -s
+
+.*:.*file format wasm
+
+Contents of section .wasm.type:
+ 80000000 01600001 7f .`...
+Contents of section .wasm.function:
+ 80000005 0100 ..
+Contents of section .wasm.code:
+ 80000007 01858080 80000041 2a0f0b .......A\*..
+#pass
diff --git a/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.s b/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.s
new file mode 100644
index 0000000..bc918b7
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/parse-wasm-2.s
@@ -0,0 +1,43 @@
+ .data
+ .byte 0
+ .ascii "asm"
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0x85
+ .byte 0x80
+ .byte 0x80
+ .byte 0x80
+ .byte 0
+ .byte 1
+ .byte 0x60
+ .byte 0
+ .byte 1
+ .byte 0x7f
+ .byte 3
+ .byte 0x82
+ .byte 0x80
+ .byte 0x80
+ .byte 0x80
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0x0a
+ .byte 0x8b
+ .byte 0x80
+ .byte 0x80
+ .byte 0x80
+ .byte 0
+ .byte 1
+ .byte 0x85
+ .byte 0x80
+ .byte 0x80
+ .byte 0x80
+ .byte 0
+ .byte 0
+ .byte 0x41
+ .byte 0x2a
+ .byte 0x0f
+ .byte 0x0b
diff --git a/binutils/testsuite/binutils-all/wasm32/parse-wasm.d b/binutils/testsuite/binutils-all/wasm32/parse-wasm.d
new file mode 100644
index 0000000..fd8bc70
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/parse-wasm.d
@@ -0,0 +1,8 @@
+#PROG: objcopy
+#source: parse-wasm.s
+#as:
+#objcopy: -Ielf32-wasm32 -Obinary
+#objdump: -bwasm -s
+
+.*:.*file format wasm
+
diff --git a/binutils/testsuite/binutils-all/wasm32/parse-wasm.s b/binutils/testsuite/binutils-all/wasm32/parse-wasm.s
new file mode 100644
index 0000000..d495ea1
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/parse-wasm.s
@@ -0,0 +1,7 @@
+ .data
+ .byte 0
+ .ascii "asm"
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/prepared-section.d b/binutils/testsuite/binutils-all/wasm32/prepared-section.d
new file mode 100644
index 0000000..c5bfafa
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/prepared-section.d
@@ -0,0 +1,10 @@
+#PROG: objcopy
+#source: prepared-section.s
+#as:
+#objcopy: -Ielf32-wasm32 -Owasm
+#objdump: -bbinary -s
+
+.*:.*file format binary
+
+Contents of section .data:
+ 0000 0061736d 01000000 0006046e 616d6500 .asm.......name.
diff --git a/binutils/testsuite/binutils-all/wasm32/prepared-section.s b/binutils/testsuite/binutils-all/wasm32/prepared-section.s
new file mode 100644
index 0000000..574f6e0
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/prepared-section.s
@@ -0,0 +1,6 @@
+ .section .prepared
+ .byte 0
+ .byte 0x6
+ .byte 4
+ .ascii "name"
+ .byte 0
diff --git a/binutils/testsuite/binutils-all/wasm32/wasm32.exp b/binutils/testsuite/binutils-all/wasm32/wasm32.exp
new file mode 100644
index 0000000..b95569a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/wasm32/wasm32.exp
@@ -0,0 +1,30 @@
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
+# Copyright (C) 2017 Pip Cet <pipcet@gmail.com>
+
+# 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 "wasm32-*-*"] } then {
+ return
+}
+
+run_dump_test "create-wasm"
+run_dump_test "custom-section"
+run_dump_test "long-sections"
+run_dump_test "parse-wasm"
+run_dump_test "parse-wasm-2"
+run_dump_test "prepared-section"
+
+#run_dump_test "invalid-wasm-1"
+#run_dump_test "invalid-wasm-2"
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 327db46..70b6773 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -41,6 +41,7 @@ proc is_elf_format {} {
&& ![istarget *-*-solaris2*]
&& ![istarget *-*-sysv4*]
&& ![istarget *-*-unixware*]
+ && ![istarget *-*-wasm32*]
&& ![istarget avr-*-*]
&& ![istarget bfin-*-uclinux]
&& ![istarget frv-*-uclinux*]
@@ -183,6 +184,9 @@ proc supports_gnu_unique {} {
if { [istarget "arm*-*-*eabi*"] } {
return 1
}
+ if { [istarget "wasm32*-*-*"] } {
+ return 1
+ }
if { ![istarget "*-*-elf*"] } {
return 0
}