summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-07-10 02:59:11 -0700
committerGitHub <noreply@github.com>2019-07-10 02:59:11 -0700
commitbe0a20c3fa39e1fff584f0eb334dd9285e1f1ffa (patch)
tree2e899474fdd1bbbbe80b0bb123be4d80c4487afa /src
parentf7ebd218d42dd33d512625c2c8f05a5aee1065ab (diff)
downloadbinaryen-be0a20c3fa39e1fff584f0eb334dd9285e1f1ffa.tar.gz
binaryen-be0a20c3fa39e1fff584f0eb334dd9285e1f1ffa.tar.bz2
binaryen-be0a20c3fa39e1fff584f0eb334dd9285e1f1ffa.zip
Ignore --initial-stack-pointer arg to wasm-emscripten-finalize (#2201)
We were passing bad value in --initial-stack-pointer which did not include the STATIC_BUMP (since STATIC_BUMP is determinted by the output of finalize). If emscripten wants to set the stack pointer position it can do so by calling the stackRestore() function at startup. This argument will be removed completely once we stop passing it on the emscripten side. See https://github.com/emscripten-core/emscripten/issues/8905
Diffstat (limited to 'src')
-rw-r--r--src/tools/wasm-emscripten-finalize.cpp13
-rw-r--r--src/wasm-emscripten.h1
-rw-r--r--src/wasm/wasm-emscripten.cpp9
3 files changed, 4 insertions, 19 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp
index 90183ab48..fd3d21df9 100644
--- a/src/tools/wasm-emscripten-finalize.cpp
+++ b/src/tools/wasm-emscripten-finalize.cpp
@@ -49,7 +49,6 @@ int main(int argc, const char* argv[]) {
bool isSideModule = false;
bool legalizeJavaScriptFFI = true;
uint64_t globalBase = INVALID_BASE;
- uint64_t initialStackPointer = INVALID_BASE;
ToolOptions options("wasm-emscripten-finalize",
"Performs Emscripten-specific transforms on .wasm files");
options
@@ -78,13 +77,13 @@ int main(int argc, const char* argv[]) {
[&globalBase](Options*, const std::string& argument) {
globalBase = std::stoull(argument);
})
+ // TODO(sbc): Remove this one this argument is no longer passed by
+ // emscripten. See https://github.com/emscripten-core/emscripten/issues/8905
.add("--initial-stack-pointer",
"",
- "The initial location of the stack pointer",
+ "ignored - will be removed in a future release",
Options::Arguments::One,
- [&initialStackPointer](Options*, const std::string& argument) {
- initialStackPointer = std::stoull(argument);
- })
+ [](Options*, const std::string& argument) {})
.add("--side-module",
"",
"Input is an emscripten side module",
@@ -169,9 +168,6 @@ int main(int argc, const char* argv[]) {
if (globalBase == INVALID_BASE) {
Fatal() << "globalBase must be set";
}
- if (initialStackPointer == INVALID_BASE) {
- Fatal() << "initialStackPointer must be set";
- }
Export* dataEndExport = wasm.getExport("__data_end");
if (dataEndExport == nullptr) {
Fatal() << "__data_end export not found";
@@ -210,7 +206,6 @@ int main(int argc, const char* argv[]) {
} else {
generator.generateRuntimeFunctions();
generator.generateMemoryGrowthFunction();
- generator.generateStackInitialization(initialStackPointer);
// For side modules these gets called via __post_instantiate
if (Function* F = generator.generateAssignGOTEntriesFunction()) {
auto* ex = new Export();
diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h
index b5673fbd3..1f9b22926 100644
--- a/src/wasm-emscripten.h
+++ b/src/wasm-emscripten.h
@@ -34,7 +34,6 @@ public:
void generateRuntimeFunctions();
Function* generateMemoryGrowthFunction();
Function* generateAssignGOTEntriesFunction();
- void generateStackInitialization(Address addr);
void generatePostInstantiateFunction();
// Create thunks for use with emscripten Runtime.dynCall. Creates one for each
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 383902971..00a3eb6b7 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -311,15 +311,6 @@ Function* EmscriptenGlueGenerator::generateMemoryGrowthFunction() {
return growFunction;
}
-void EmscriptenGlueGenerator::generateStackInitialization(Address addr) {
- auto* stackPointer = getStackPointerGlobal();
- assert(!stackPointer->imported());
- if (!stackPointer->init || !stackPointer->init->is<Const>()) {
- Fatal() << "stack pointer global is not assignable";
- }
- stackPointer->init->cast<Const>()->value = Literal(int32_t(addr));
-}
-
inline void exportFunction(Module& wasm, Name name, bool must_export) {
if (!wasm.getFunctionOrNull(name)) {
assert(!must_export);