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.
This commit is contained in:
Pip Cet
2017-03-30 10:57:21 +01:00
committed by Nick Clifton
parent 662659a1a5
commit f96bd6c2d7
99 changed files with 4363 additions and 1859 deletions

View File

@@ -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"

View File

@@ -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............

View File

@@ -0,0 +1,6 @@
.section .wasm.function
.byte 0
.section .wasm.type
.byte 1
.byte 0
.byte 0

View File

@@ -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 .. *$

View File

@@ -0,0 +1,4 @@
.section .wasm.name
.byte 2
.byte 1
.byte 0

View File

@@ -0,0 +1,6 @@
#PROG: objcopy
#source: invalid-wasm-1.s
#as:
#objcopy: -Ielf32-wasm32 -Obinary
#objdump: -bwasm -sD
#error: : File format not recognized

View File

@@ -0,0 +1,7 @@
.data
.byte 0
.ascii "ASM"
.byte 1
.byte 0
.byte 0
.byte 0

View File

@@ -0,0 +1,6 @@
#PROG: objcopy
#source: invalid-wasm-2.s
#as:
#objcopy: -Ielf32-wasm32 -Obinary
#objdump: -bwasm -sD
#exit: 1

View File

@@ -0,0 +1,7 @@
.data
.byte 0
.ascii "asm"
.byte 2
.byte 0
.byte 0
.byte 0

View File

@@ -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

View File

@@ -0,0 +1,9 @@
.section .wasm.type
.rept 256
.byte 0
.endr
.section .wasm.code
.rept 65536
.byte 0
.endr

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,8 @@
#PROG: objcopy
#source: parse-wasm.s
#as:
#objcopy: -Ielf32-wasm32 -Obinary
#objdump: -bwasm -s
.*:.*file format wasm

View File

@@ -0,0 +1,7 @@
.data
.byte 0
.ascii "asm"
.byte 1
.byte 0
.byte 0
.byte 0

View File

@@ -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.

View File

@@ -0,0 +1,6 @@
.section .prepared
.byte 0
.byte 0x6
.byte 4
.ascii "name"
.byte 0

View File

@@ -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"