diff options
author | Sam Clegg <sbc@chromium.org> | 2020-09-11 14:57:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 14:57:36 -0700 |
commit | 926dcf27012322d92eddc3b7ce41df890984ec39 (patch) | |
tree | 354ebd10304ceb4e8ae23bf2447efe54441d54f5 /src | |
parent | 8ec8a0bbfb039852b60f121fb23c439228b9fe36 (diff) | |
download | binaryen-926dcf27012322d92eddc3b7ce41df890984ec39.tar.gz binaryen-926dcf27012322d92eddc3b7ce41df890984ec39.tar.bz2 binaryen-926dcf27012322d92eddc3b7ce41df890984ec39.zip |
wasm-emscripten-finalize: Add --new-pic-abi option (#3118)
This option skips the PIC ABI transforms that are normally done by
wasm-emscripten-finalize and keeps the llvm PIC ABI in place.
The LLVM abi uses mutable globals (GOT.mem.foo and GOT.func.bar) for
data and function offsets rather than accessor functions (g$foo and
g$bar)
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/wasm-emscripten-finalize.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp index cdba9a9d4..c0911a37d 100644 --- a/src/tools/wasm-emscripten-finalize.cpp +++ b/src/tools/wasm-emscripten-finalize.cpp @@ -51,6 +51,7 @@ int main(int argc, const char* argv[]) { bool debugInfo = false; bool DWARF = false; bool sideModule = false; + bool legacyPIC = true; bool legalizeJavaScriptFFI = true; bool bigInt = false; bool checkStackOverflow = false; @@ -109,6 +110,13 @@ int main(int argc, const char* argv[]) { [&sideModule](Options* o, const std::string& argument) { sideModule = true; }) + .add("--new-pic-abi", + "", + "Use new/llvm PIC abi", + Options::Arguments::Zero, + [&legacyPIC](Options* o, const std::string& argument) { + legacyPIC = false; + }) .add("--input-source-map", "-ism", "Consume source map from the specified file", @@ -284,9 +292,14 @@ int main(int argc, const char* argv[]) { if (sideModule) { passRunner.add("replace-stack-pointer"); - passRunner.add("emscripten-pic"); - } else { - passRunner.add("emscripten-pic-main-module"); + } + + if (legacyPIC) { + if (sideModule) { + passRunner.add("emscripten-pic"); + } else { + passRunner.add("emscripten-pic-main-module"); + } } if (!noDynCalls && !standaloneWasm) { |