Skip to content

Commit

Permalink
wasm-emscripten-finalize: Add --new-pic-abi option (#3118)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
sbc100 authored Sep 11, 2020
1 parent 8ec8a0b commit 926dcf2
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/tools/wasm-emscripten-finalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 926dcf2

Please sign in to comment.