summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-binary.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 4b7e1a2a4..f36dcb897 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -432,11 +432,16 @@ public:
o << int32_t(10); // version number
}
- int32_t startSection(const char* name) {
- // emit 5 bytes of 0, which we'll fill with LEB later
+ int32_t writeLEB128Placeholder() {
int32_t ret = o.size();
o << int32_t(0);
o << int8_t(0);
+ return ret;
+ }
+
+ int32_t startSection(const char* name) {
+ // emit 5 bytes of 0, which we'll fill with LEB later
+ auto ret = writeLEB128Placeholder();
writeInlineString(name);
return ret;
}