summaryrefslogtreecommitdiff
path: root/src/wasm-linker.cpp
diff options
context:
space:
mode:
authorjgravelle-google <jgravelle@google.com>2017-06-05 09:34:15 -0700
committerGitHub <noreply@github.com>2017-06-05 09:34:15 -0700
commit3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e (patch)
tree17ff1b4155b6ce4c01c7911e20a406df910bec3f /src/wasm-linker.cpp
parent4eb81f6cf14b02e77f84f6a5a89d926d4eac535f (diff)
downloadbinaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.tar.gz
binaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.tar.bz2
binaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.zip
S2wasm runtime funcs (#1027)
* Generate stackSave function in s2wasm * Generate stackAlloc in s2wasm * Generate stackRestore in s2wasm * Update dot_s tests for runtime functions * Add s2wasm check for exporting runtime functions * Fix flake8 for s2wasm.py * Rename wasmBuilder to builder
Diffstat (limited to 'src/wasm-linker.cpp')
-rw-r--r--src/wasm-linker.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp
index f50ecab7a..7d1c35d1c 100644
--- a/src/wasm-linker.cpp
+++ b/src/wasm-linker.cpp
@@ -27,6 +27,7 @@ using namespace wasm;
// Name of the dummy function to prevent erroneous nullptr comparisons.
static constexpr const char* dummyFunction = "__wasm_nullptr";
+static constexpr const char* stackPointer = "__stack_pointer";
void Linker::placeStackPointer(Address stackAllocation) {
// ensure this is the first allocation
@@ -34,7 +35,7 @@ void Linker::placeStackPointer(Address stackAllocation) {
const Address pointerSize = 4;
// Unconditionally allocate space for the stack pointer. Emscripten
// allocates the stack itself, and initializes the stack pointer itself.
- out.addStatic(pointerSize, pointerSize, "__stack_pointer");
+ out.addStatic(pointerSize, pointerSize, stackPointer);
if (stackAllocation) {
// If we are allocating the stack, set up a relocation to initialize the
// stack pointer to point to one past-the-end of the stack allocation.
@@ -44,7 +45,7 @@ void Linker::placeStackPointer(Address stackAllocation) {
LinkerObject::Relocation::kData, (uint32_t*)&raw[0], ".stack", stackAllocation);
out.addRelocation(relocation);
assert(out.wasm.memory.segments.empty());
- out.addSegment("__stack_pointer", raw);
+ out.addSegment(stackPointer, raw);
}
}