summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-15 16:52:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-15 16:52:31 -0800
commitb61b273ad7ed9b6b27170f3726be79b527198788 (patch)
tree9789dd66e238419d9f992f66649a02bef45f9e13 /src
parentcdc654c5a132cda78d0f4760b499daa7a10f6cde (diff)
downloadbinaryen-b61b273ad7ed9b6b27170f3726be79b527198788.tar.gz
binaryen-b61b273ad7ed9b6b27170f3726be79b527198788.tar.bz2
binaryen-b61b273ad7ed9b6b27170f3726be79b527198788.zip
don't emit zero segments
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index a5e75c9cf..3a8dd7ddb 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -832,12 +832,14 @@ private:
mustMatch(name.str);
mustMatch(":");
auto raw = new std::vector<char>(); // leaked intentionally, no new allocation in Memory
+ bool zero = false;
if (match(".asciz")) {
*raw = getQuoted();
raw->push_back(0);
} else if (match(".ascii")) {
*raw = getQuoted();
} else if (match(".zero")) {
+ zero = true;
int32_t size = getInt();
for (size_t i = 0; i < size; i++) {
raw->push_back(0);
@@ -871,8 +873,10 @@ private:
while (nextStatic % align) nextStatic++;
// assign the address, add to memory
staticAddresses[name] = nextStatic;
- addressSegments[nextStatic] = wasm.memory.segments.size();
- wasm.memory.segments.emplace_back(nextStatic, (const char*)&(*raw)[0], size);
+ if (!zero) {
+ addressSegments[nextStatic] = wasm.memory.segments.size();
+ wasm.memory.segments.emplace_back(nextStatic, (const char*)&(*raw)[0], size);
+ }
nextStatic += size;
}