wasmbase.pas 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {
  2. Copyright (c) 2021 by Nikolay Nikolov
  3. Contains WebAssembly binary module format definitions
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit wasmbase;
  18. {$i fpcdefs.inc}
  19. interface
  20. const
  21. WasmModuleMagic: array [0..3] of byte = ($00,$61,$73,$6D);
  22. WasmVersion: array [0..3] of byte = ($01,$00,$00,$00);
  23. type
  24. TWasmSectionID = (
  25. wsiCustom = 0,
  26. wsiType = 1,
  27. wsiImport = 2,
  28. wsiFunction = 3,
  29. wsiTable = 4,
  30. wsiMemory = 5,
  31. wsiGlobal = 6,
  32. wsiExport = 7,
  33. wsiStart = 8,
  34. wsiElement = 9,
  35. wsiCode = 10,
  36. wsiData = 11,
  37. wsiDataCount = 12);
  38. TWasmRelocationType = (
  39. R_WASM_FUNCTION_INDEX_LEB = 0,
  40. R_WASM_TABLE_INDEX_SLEB = 1,
  41. R_WASM_TABLE_INDEX_I32 = 2,
  42. R_WASM_MEMORY_ADDR_LEB = 3,
  43. R_WASM_MEMORY_ADDR_SLEB = 4,
  44. R_WASM_MEMORY_ADDR_I32 = 5,
  45. R_WASM_TYPE_INDEX_LEB = 6,
  46. R_WASM_GLOBAL_INDEX_LEB = 7,
  47. R_WASM_FUNCTION_OFFSET_I32 = 8,
  48. R_WASM_SECTION_OFFSET_I32 = 9,
  49. R_WASM_EVENT_INDEX_LEB = 10,
  50. R_WASM_GLOBAL_INDEX_I32 = 13,
  51. R_WASM_MEMORY_ADDR_LEB64 = 14,
  52. R_WASM_MEMORY_ADDR_SLEB64 = 15,
  53. R_WASM_MEMORY_ADDR_I64 = 16,
  54. R_WASM_TABLE_INDEX_SLEB64 = 18,
  55. R_WASM_TABLE_INDEX_I64 = 19,
  56. R_WASM_TABLE_NUMBER_LEB = 20);
  57. TWasmLinkingSubsectionType = (
  58. WASM_SEGMENT_INFO = 5,
  59. WASM_INIT_FUNCS = 6,
  60. WASM_COMDAT_INFO = 7,
  61. WASM_SYMBOL_TABLE = 8);
  62. implementation
  63. end.