diff options
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 1d68687..04e2b80 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1932,6 +1932,20 @@ uint32_t WasmObjectFile::getSymbolSectionIdImpl(const WasmSymbol &Sym) const { } } +uint32_t WasmObjectFile::getSymbolSize(SymbolRef Symb) const { + const WasmSymbol &Sym = getWasmSymbol(Symb); + if (!Sym.isDefined()) + return 0; + if (Sym.isTypeData()) + return Sym.Info.DataRef.Size; + if (Sym.isTypeFunction()) + return functions()[Sym.Info.ElementIndex - getNumImportedFunctions()].Size; + // Currently symbol size is only tracked for data segments and functions. In + // principle we could also track size (e.g. binary size) for tables, globals + // and element segments etc too. + return 0; +} + void WasmObjectFile::moveSectionNext(DataRefImpl &Sec) const { Sec.d.a++; } Expected<StringRef> WasmObjectFile::getSectionName(DataRefImpl Sec) const { |