diff options
author | Sam Clegg <sbc@chromium.org> | 2022-05-31 07:04:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 07:04:51 -0700 |
commit | 46282a482ec81e8d379b4e9b3ee50f66dd0ac5e5 (patch) | |
tree | 2619fc5ca0b32b60beea064944fe5b5420d8eadc /src | |
parent | 838de5c4f374396a15d5700ebb51c3e0a89b5840 (diff) | |
download | binaryen-46282a482ec81e8d379b4e9b3ee50f66dd0ac5e5.tar.gz binaryen-46282a482ec81e8d379b4e9b3ee50f66dd0ac5e5.tar.bz2 binaryen-46282a482ec81e8d379b4e9b3ee50f66dd0ac5e5.zip |
Remove renameMainArgcArgv from wasm-emscripten-finalize (#4700)
This part to finalize is currently not used and was added in preparation
for https://reviews.llvm.org/D75277.
However, the better solution to dealing with this alternative name for
main is on the emscripten side. The main reason for this is that
doing the rename here in binaryen would require finalize to always
re-write the binary, which is expensive.
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/wasm-emscripten-finalize.cpp | 6 | ||||
-rw-r--r-- | src/wasm-emscripten.h | 6 | ||||
-rw-r--r-- | src/wasm/wasm-emscripten.cpp | 12 |
3 files changed, 0 insertions, 24 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp index 8fdc203a9..b4e27ca5c 100644 --- a/src/tools/wasm-emscripten-finalize.cpp +++ b/src/tools/wasm-emscripten-finalize.cpp @@ -266,12 +266,6 @@ int main(int argc, const char* argv[]) { generator.onlyI64DynCalls = onlyI64DynCalls; generator.noDynCalls = noDynCalls; - if (!standaloneWasm) { - // This is also not needed in standalone mode since standalone mode uses - // crt1.c to invoke the main and is aware of __main_argc_argv mangling. - generator.renameMainArgcArgv(); - } - PassRunner passRunner(&wasm, options.passOptions); passRunner.setDebug(options.debug); passRunner.setDebugInfo(debugInfo); diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h index 3c9cb07c5..694eb1368 100644 --- a/src/wasm-emscripten.h +++ b/src/wasm-emscripten.h @@ -37,12 +37,6 @@ public: void fixInvokeFunctionNames(); - // clang uses name mangling to rename the argc/argv form of main to - // __main_argc_argv. Emscripten in non-standalone mode expects that function - // to be exported as main. This function renames __main_argc_argv to main - // as expected by emscripten. - void renameMainArgcArgv(); - // Emits the data segments to a file. The file contains data from address base // onwards (we must pass in base, as we can't tell it from the wasm - the // first segment may start after a run of zeros, but we need those zeros in diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp index 4e37464ec..bba638cf2 100644 --- a/src/wasm/wasm-emscripten.cpp +++ b/src/wasm/wasm-emscripten.cpp @@ -525,16 +525,4 @@ void EmscriptenGlueGenerator::separateDataSegments(Output* outfile, wasm.memory.segments.clear(); } -void EmscriptenGlueGenerator::renameMainArgcArgv() { - // If an export call ed __main_argc_argv exists rename it to main - Export* ex = wasm.getExportOrNull("__main_argc_argv"); - if (!ex) { - BYN_TRACE("renameMain: __main_argc_argv not found\n"); - return; - } - ex->name = "main"; - wasm.updateMaps(); - ModuleUtils::renameFunction(wasm, "__main_argc_argv", "main"); -} - } // namespace wasm |