From ed8fb551ab4f84e0ad3f4976fbb36a07b11f57a2 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Fri, 24 Apr 2020 00:29:11 -0700 Subject: Emit section IDs as bytes (#2803) As described in the spec. --- src/wasm/wasm-binary.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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 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"); -- cgit v1.2.3