summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 0370cdde3..dd4437ed9 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -867,8 +867,7 @@ private:
} else if (match(".section")) {
s = strchr(s, '\n');
} else if (match(".lcomm")) {
- s = strchr(s, '\n');
- // TODO
+ parseLcomm(name);
return;
}
skipWhitespace();
@@ -883,12 +882,8 @@ private:
}
align = pow(2, align); // convert from power to actual bytes
if (match(".lcomm")) {
- mustMatch(name.str);
- skipComma();
- getInt();
- skipComma();
- getInt();
- return; // XXX wtf is this thing and what do we do with it
+ parseLcomm(name, align);
+ return;
}
mustMatch(name.str);
mustMatch(":");
@@ -972,6 +967,20 @@ private:
wasm.memory.initial = nextStatic;
}
+ void parseLcomm(Name name, size_t align=1) {
+ mustMatch(name.str);
+ skipComma();
+ size_t size = getInt();
+ if (*s == ',') {
+ skipComma();
+ getInt();
+ }
+ while (nextStatic % align) nextStatic++;
+ staticAddresses[name] = nextStatic;
+ nextStatic += size;
+ wasm.memory.initial = nextStatic;
+ }
+
void skipImports() {
while (1) {
if (match(".import")) {