]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/doc/webassembly.texi
5a05199d5f7a0f54a03517c3de7a156ce661a3fb
[thirdparty/binutils-gdb.git] / bfd / doc / webassembly.texi
1 @section WebAssembly backend
2 The WebAssembly module file format, at present, is a very simple
3 object file format with up to 11 numbered sections plus named
4 ``custom'' sections. At present, there is no standard for relocations
5 or symbols, though a @code{"name"} subsection can assign names to
6 function indices and local variables.
7
8 As such, it offers no real advantages over ELF, and intermediate ELF
9 files can be used to produce WebAssembly modules. The WebAssembly
10 backend aims to enable the opposite: reading a WebAssembly module and
11 producing an ELF file containing the same information, which can then
12 be manipulated and inspected with standard tools.
13
14 When writing WebAssembly modules, the WebAssembly backend attempts to
15 determine based on the section name whether to use a numeric section
16 id, a named section header, or to include the section verbatim,
17 assuming it already contains any necessary header.
18
19 Function names are supported as symbols; local names and WebAssembly
20 relocation sections are currently unsupported.
21
22 There are slight differences in the LEB128 integer implementations
23 between the WebAssembly specification and the BFD code; these result
24 in some malformed WebAssembly modules being treated as valid.
25
26 @menu
27 * File layout::
28 @end menu
29
30 @node File layout
31 @subsection File layout
32 For a description of the WebAssembly file format, see
33 @url{https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md}.