summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-04-24 00:29:11 -0700
committerGitHub <noreply@github.com>2020-04-24 00:29:11 -0700
commited8fb551ab4f84e0ad3f4976fbb36a07b11f57a2 (patch)
tree956c1e361735fbe58be4e7c151bc806ee8fc0830
parent50fee5228acfbc3ffb882c5a1489475589d9fc1f (diff)
downloadbinaryen-ed8fb551ab4f84e0ad3f4976fbb36a07b11f57a2.tar.gz
binaryen-ed8fb551ab4f84e0ad3f4976fbb36a07b11f57a2.tar.bz2
binaryen-ed8fb551ab4f84e0ad3f4976fbb36a07b11f57a2.zip
Emit section IDs as bytes (#2803)
As described in the spec.
-rw-r--r--src/wasm/wasm-binary.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 52e4b958d..b3314134d 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -73,7 +73,7 @@ void WasmBinaryWriter::write() {
}
#ifdef BUILD_LLVM_DWARF
- // Update DWARF user sections after writing the data referred to by them
+ // Update DWARF user sections after writing the data they refer to
// (function bodies), and before writing the user sections themselves.
if (Debug::hasDWARFSections(*wasm)) {
Debug::writeDWARFSections(*wasm, binaryLocations);
@@ -113,7 +113,7 @@ void WasmBinaryWriter::writeResizableLimits(Address initial,
}
template<typename T> int32_t WasmBinaryWriter::startSection(T code) {
- o << U32LEB(code);
+ o << uint8_t(code);
if (sourceMap) {
sourceMapLocationsSizeAtSectionStart = sourceMapLocations.size();
}
@@ -849,7 +849,7 @@ bool WasmBinaryBuilder::hasDWARFSections() {
getInt32(); // version
bool has = false;
while (more()) {
- uint32_t sectionCode = getU32LEB();
+ uint8_t sectionCode = getInt8();
uint32_t payloadLen = getU32LEB();
if (uint64_t(pos) + uint64_t(payloadLen) > input.size()) {
throwError("Section extends beyond end of input");
@@ -885,7 +885,7 @@ void WasmBinaryBuilder::read() {
// read sections until the end
while (more()) {
- uint32_t sectionCode = getU32LEB();
+ uint8_t sectionCode = getInt8();
uint32_t payloadLen = getU32LEB();
if (uint64_t(pos) + uint64_t(payloadLen) > input.size()) {
throwError("Section extends beyond end of input");