diff options
author | Pip Cet <pipcet@gmail.com> | 2017-03-30 10:57:21 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-03-30 10:57:21 +0100 |
commit | f96bd6c2d7a3801fabbf9d834f7a29b752aa7532 (patch) | |
tree | 6c4ee43355083f19052f09a0fb5bbc4e47c4a08a /gas/doc | |
parent | 662659a1a582af14aa45a458005e2a4df514b6d7 (diff) | |
download | gdb-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 'gas/doc')
-rw-r--r-- | gas/doc/all.texi | 1 | ||||
-rw-r--r-- | gas/doc/as.texinfo | 9 | ||||
-rw-r--r-- | gas/doc/c-wasm32.texi | 119 |
3 files changed, 128 insertions, 1 deletions
diff --git a/gas/doc/all.texi b/gas/doc/all.texi index 5a2dd4a..d0a1a9a 100644 --- a/gas/doc/all.texi +++ b/gas/doc/all.texi @@ -77,6 +77,7 @@ @set V850 @set VAX @set VISIUM +@set WASM32 @set XGATE @set XSTORMY16 @set XTENSA diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 56a38bf..d03d0b6 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -7728,8 +7728,11 @@ subject, see the hardware manufacturer's manual. @ifset VISIUM * Visium-Dependent:: Visium Dependent Features @end ifset +@ifset WASM32 +* WebAssembly-Dependent:: WebAssembly Dependent Features +@end ifset @ifset XGATE -* XGATE-Dependent:: XGATE Features +* XGATE-Dependent:: XGATE Dependent Features @end ifset @ifset XSTORMY16 * XSTORMY16-Dependent:: XStormy16 Dependent Features @@ -7975,6 +7978,10 @@ family. @include c-visium.texi @end ifset +@ifset WASM32 +@include c-wasm32.texi +@end ifset + @ifset XGATE @include c-xgate.texi @end ifset diff --git a/gas/doc/c-wasm32.texi b/gas/doc/c-wasm32.texi new file mode 100644 index 0000000..8eac7a4 --- /dev/null +++ b/gas/doc/c-wasm32.texi @@ -0,0 +1,119 @@ +@c Copyright (C) 2017 Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. +@c man end + +@ifset GENERIC +@page +@node WebAssembly-Dependent +@chapter WebAssembly Dependent Features +@end ifset + +@ifclear GENERIC +@node Machine Dependencies +@chapter WebAssembly Dependent Features +@end ifclear + +@cindex WebAssembly support +@menu +* WebAssembly-Notes:: Notes +* WebAssembly-Syntax:: Syntax +* WebAssembly-Floating-Point:: Floating Point +* WebAssembly-Opcodes:: Opcodes +* WebAssembly-module-layout:: Module Layout +@end menu + +@node WebAssembly-Notes +@section Notes +@cindex WebAssembly notes +@cindex notes for WebAssembly + +While WebAssembly provides its own module format for executables, this +documentation describes how to use @code{@value{AS}} to produce +intermediate ELF object format files. + +@node WebAssembly-Syntax +@section Syntax +@cindex WebAssembly Syntax +The assembler syntax directly encodes sequences of opcodes as defined +in the WebAssembly binary encoding specification at +https://github.com/webassembly/spec/BinaryEncoding.md. Structured +sexp-style expressions are not supported as input. + +@menu +* WebAssembly-Chars:: Special Characters +* WebAssembly-Relocs:: Relocations +* WebAssembly-Signatures:: Signatures +@end menu + +@node WebAssembly-Chars +@subsection Special Characters + +@cindex line comment character, WebAssembly +@cindex WebAssembly line comment character +@samp{#} and @samp{;} are the line comment characters. Note that if +@samp{#} is the first character on a line then it can also be a +logical line number directive (@pxref{Comments}) or a preprocessor +control command (@pxref{Preprocessing}). + +@node WebAssembly-Relocs +@subsection Relocations +@cindex WebAssembly relocations +@cindex relocations, WebAssembly + +Special relocations are available by using the @samp{@@@var{plt}}, +@samp{@@@var{got}}, or @samp{@@@var{got}} suffixes after a constant +expression, which correspond to the R_ASMJS_LEB128_PLT, +R_ASMJS_LEB128_GOT, and R_ASMJS_LEB128_GOT_CODE relocations, +respectively. + +The @samp{@@@var{plt}} suffix is followed by a symbol name in braces; +the symbol value is used to determine the function signature for which +a PLT stub is generated. Currently, the symbol @emph{name} is parsed +from its last @samp{F} character to determine the argument count of +the function, which is also necessary for generating a PLT stub. + +@node WebAssembly-Signatures +@subsection Signatures +@cindex WebAssembly signatures +@cindex signatures, WebAssembly + +Function signatures are specified with the @code{signature} +pseudo-opcode, followed by a simple function signature imitating a +C++-mangled function type: @code{F} followed by an optional @code{v}, +then a sequence of @code{i}, @code{l}, @code{f}, and @code{d} +characters to mark i32, i64, f32, and f64 parameters, respectively; +followed by a final @code{E} to mark the end of the function +signature. + +@node WebAssembly-Floating-Point +@section Floating Point +@cindex floating point, WebAssembly (@sc{ieee}) +@cindex WebAssembly floating point (@sc{ieee}) +WebAssembly uses little-endian @sc{ieee} floating-point numbers. + +@node WebAssembly-Opcodes +@section Regular Opcodes +@cindex opcodes, WebAssembly +@cindex WebAssembly opcodes +Ordinary instructions are encoded with the WebAssembly mnemonics as +listed at: +@url{https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md}. + +Opcodes are written directly in the order in which they are encoded, +without going through an intermediate sexp-style expression as in the +@code{was} format. + +For ``typed'' opcodes (block, if, etc.), the type of the block is +specified in square brackets following the opcode: @code{if[i]}, +@code{if[]}. + +@node WebAssembly-module-layout +@section WebAssembly Module Layout +@cindex module layout, WebAssembly +@cindex WebAssembly module layout +@code{@value{AS}} will only produce ELF output, not a valid +WebAssembly module. It is possible to make @code{@value{AS}} produce +output in a single ELF section which becomes a valid WebAssembly +module, but a linker script to do so may be preferrable, as it doesn't +require running the entire module through the assembler at once. |