aboutsummaryrefslogtreecommitdiff
path: root/wasm/InputFiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'wasm/InputFiles.cpp')
-rw-r--r--wasm/InputFiles.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/wasm/InputFiles.cpp b/wasm/InputFiles.cpp
index e7463da39db9..1a1a6812c48e 100644
--- a/wasm/InputFiles.cpp
+++ b/wasm/InputFiles.cpp
@@ -198,13 +198,22 @@ void ObjFile::initializeSymbols() {
DEBUG(dbgs() << "Function: " << WasmSym.ElementIndex << " -> "
<< toString(*S) << "\n");
FunctionSymbols[WasmSym.ElementIndex] = S;
+ if (WasmSym.HasAltIndex)
+ FunctionSymbols[WasmSym.AltIndex] = S;
} else {
DEBUG(dbgs() << "Global: " << WasmSym.ElementIndex << " -> "
<< toString(*S) << "\n");
GlobalSymbols[WasmSym.ElementIndex] = S;
+ if (WasmSym.HasAltIndex)
+ GlobalSymbols[WasmSym.AltIndex] = S;
}
}
+ DEBUG(for (size_t I = 0; I < FunctionSymbols.size(); ++I)
+ assert(FunctionSymbols[I] != nullptr);
+ for (size_t I = 0; I < GlobalSymbols.size(); ++I)
+ assert(GlobalSymbols[I] != nullptr););
+
// Populate `TableSymbols` with all symbols that are called indirectly
uint32_t SegmentCount = WasmObj->elements().size();
if (SegmentCount) {