summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-10-25 14:19:12 -0700
committerGitHub <noreply@github.com>2019-10-25 14:19:12 -0700
commit4f9151dec445abb901ae22d8d4db5c5ea8e4c528 (patch)
treef44ae7589260843095321db5f159aeb768921649 /src
parent8d19d00268a4b1af556008bea933ede869d8a757 (diff)
downloadbinaryen-4f9151dec445abb901ae22d8d4db5c5ea8e4c528.tar.gz
binaryen-4f9151dec445abb901ae22d8d4db5c5ea8e4c528.tar.bz2
binaryen-4f9151dec445abb901ae22d8d4db5c5ea8e4c528.zip
When renaming functions ensure the corresponding GOT.func entry is also renamed (#2382)
Fixes https://github.com/WebAssembly/binaryen/issues/2180
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 6710c7cd8..37cd2f431 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -1041,6 +1041,13 @@ struct FixInvokeFunctionNamesWalker
wasm.removeFunction(importName);
}
ModuleUtils::renameFunctions(wasm, importRenames);
+ ImportInfo imports(wasm);
+ for (auto& pair : importRenames) {
+ // Update any associated GOT.func import.
+ if (auto g = imports.getImportedGlobal("GOT.func", pair.first)) {
+ g->base = pair.second;
+ }
+ }
}
};