[WebAssembly] Fix getSymbolValue() for data symbols
This is mostly a fix for the output of `llvm-nm` See Bug 34392: https://bugs.llvm.org//show_bug.cgi?id=34392 Differential Revision: https://reviews.llvm.org/D37359 llvm-svn: 312294
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user