aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2021-01-05 11:05:18 +0100
committerAndy Wingo <wingo@igalia.com>2021-01-19 09:32:45 +0100
commit418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1 (patch)
treef3d6011995253f49392ff11db261b3e65910fd4b /llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
parentb86e7ae66cb988dda33445c29fa64f93e7ca9c3c (diff)
downloadllvm-418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1.zip
llvm-418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1.tar.gz
llvm-418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1.tar.bz2
[WebAssembly] call_indirect issues table number relocs
This patch changes to make call_indirect explicitly refer to the corresponding function table, residualizing TABLE_NUMBER relocs against it. With this change, wasm-ld now sees all references to tables, and can link multiple tables. Differential Revision: https://reviews.llvm.org/D90948
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
index 82b03226..9279e69 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -869,18 +869,11 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {
if (IsDirect) {
MIB.addGlobalAddress(Func);
} else {
- // Add placeholders for the type index and immediate flags
+ // Placehoder for the type index.
MIB.addImm(0);
- MIB.addImm(0);
-
- // Ensure that the object file has a __indirect_function_table import, as we
- // call_indirect against it.
- MCSymbolWasm *Sym = WebAssembly::getOrCreateFunctionTableSymbol(
- MF->getMMI().getContext(), "__indirect_function_table");
- // Until call_indirect emits TABLE_NUMBER relocs against this symbol, mark
- // it as NO_STRIP so as to ensure that the indirect function table makes it
- // to linked output.
- Sym->setNoStrip();
+ // The table into which this call_indirect indexes.
+ MIB.addSym(WebAssembly::getOrCreateFunctionTableSymbol(
+ MF->getMMI().getContext(), "__indirect_function_table"));
}
for (unsigned ArgReg : Args)