diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-binary.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 2c884a4f5..b1db70a97 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -155,7 +155,8 @@ enum Section { Functions = 2, DataSegments = 4, FunctionTable = 5, - End = 6 + End = 6, + Start = 7 }; enum FunctionEntry { @@ -380,6 +381,7 @@ public: } void write() { + writeStart(); writeMemory(); writeSignatures(); writeFunctions(); @@ -389,6 +391,13 @@ public: finishUp(); } + void writeStart() { + if (!wasm->start.is()) return; + if (debug) std::cerr << "== writeStart" << std::endl; + o << int8_t(BinaryConsts::Start); + emitString(wasm->start.str); + } + void writeMemory() { if (wasm->memory.max == 0) return; if (debug) std::cerr << "== writeMemory" << std::endl; @@ -980,6 +989,7 @@ public: } switch (section) { + case BinaryConsts::Start: readStart(); break; case BinaryConsts::Memory: readMemory(); break; case BinaryConsts::Signatures: readSignatures(); break; case BinaryConsts::Functions: readFunctions(); break; @@ -1082,6 +1092,11 @@ public: assert(x == y); } + void readStart() { + if (debug) std::cerr << "== readStart" << std::endl; + wasm.start = getString(); + } + void readMemory() { if (debug) std::cerr << "== readMemory" << std::endl; size_t initial = getInt8(); |