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