aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 8a2fb38..ad8c2b7 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -786,8 +786,13 @@ uint64_t WasmObjectFile::getSymbolValueImpl(DataRefImpl Symb) const {
case WasmSymbol::SymbolType::GLOBAL_IMPORT:
return 0;
case WasmSymbol::SymbolType::FUNCTION_EXPORT:
- case WasmSymbol::SymbolType::GLOBAL_EXPORT:
return Exports[Sym.ElementIndex].Index;
+ case WasmSymbol::SymbolType::GLOBAL_EXPORT: {
+ uint32_t GlobalIndex = Exports[Sym.ElementIndex].Index;
+ assert(GlobalIndex < Globals.size());
+ const wasm::WasmGlobal& Global = Globals[GlobalIndex];
+ return Global.InitExpr.Value.Int32;
+ }
case WasmSymbol::SymbolType::DEBUG_FUNCTION_NAME:
return Sym.ElementIndex;
}