| 1 | /* BFD back-end for WebAssembly modules. |
| 2 | Copyright (C) 2017-2020 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of BFD, the Binary File Descriptor library. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 3 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 19 | MA 02110-1301, USA. */ |
| 20 | |
| 21 | #ifndef _WASM_MODULE_H |
| 22 | #define _WASM_MODULE_H |
| 23 | |
| 24 | /* WebAssembly module file header. Note that WASM_VERSION is a 32-bit |
| 25 | little-endian integer, not an LEB128-encoded integer. */ |
| 26 | #define SIZEOF_WASM_MAGIC 4 |
| 27 | #define WASM_MAGIC { 0x00, 'a', 's', 'm' } |
| 28 | #define SIZEOF_WASM_VERSION 4 |
| 29 | #define WASM_VERSION { 0x01, 0x00, 0x00, 0x00 } |
| 30 | |
| 31 | /* Prefix to use to form section names. */ |
| 32 | #define WASM_SECTION_PREFIX ".wasm." |
| 33 | |
| 34 | /* NUMBER is currently unused, but is included for error checking purposes. */ |
| 35 | #define WASM_SECTION(number, name) (WASM_SECTION_PREFIX name) |
| 36 | |
| 37 | /* Section names. WASM_NAME_SECTION is the name of the named section |
| 38 | named "name". */ |
| 39 | #define WASM_NAME_SECTION WASM_SECTION (0, "name") |
| 40 | #define WASM_RELOC_SECTION_PREFIX WASM_SECTION (0, "reloc.") |
| 41 | #define WASM_LINKING_SECTION WASM_SECTION (0, "linking") |
| 42 | #define WASM_DYLINK_SECTION WASM_SECTION (0, "dylink") |
| 43 | |
| 44 | /* Subsection indices. Right now, that's subsections of the "name" |
| 45 | section only. */ |
| 46 | #define WASM_FUNCTION_SUBSECTION 1 /* Function names. */ |
| 47 | #define WASM_LOCALS_SUBSECTION 2 /* Names of locals by function. */ |
| 48 | |
| 49 | /* The section to report wasm symbols in. */ |
| 50 | #define WASM_SECTION_FUNCTION_INDEX ".space.function_index" |
| 51 | |
| 52 | #endif /* _WASM_MODULE_H */ |