summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-02-08 16:49:50 -0800
committerDerek Schuff <dschuff@chromium.org>2016-02-08 16:49:50 -0800
commitd5cc09449032972b07aaf4625349991fe61b62c1 (patch)
treeb6fa44c6c2db7d3d28c75547de6fd615639e707d /src
parentd3bbf5a4ddd70940d22eb3f1690c2637d725e43e (diff)
downloadbinaryen-d5cc09449032972b07aaf4625349991fe61b62c1.tar.gz
binaryen-d5cc09449032972b07aaf4625349991fe61b62c1.tar.bz2
binaryen-d5cc09449032972b07aaf4625349991fe61b62c1.zip
Align the stack allocation to 16 bytes to satisfy the aligment ABI
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index 649b32196..ac62046d8 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -399,6 +399,8 @@ class S2WasmBuilder {
void placeStack(size_t stackAllocation) {
// Allocate space for a user stack. It starts zeroed-out so needs no segment
+ // Round to a 16-byte aligned address.
+ nextStatic = (nextStatic + 15) & static_cast<size_t>(-16);
staticAddresses[".stack"] = nextStatic;
nextStatic += stackAllocation;
wasm.memory.initial = nextStatic;