aboutsummaryrefslogtreecommitdiff
path: root/gas/doc
diff options
context:
space:
mode:
Diffstat (limited to 'gas/doc')
-rw-r--r--gas/doc/all.texi1
-rw-r--r--gas/doc/as.texinfo9
-rw-r--r--gas/doc/c-wasm32.texi119
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.