diff options
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
-rw-r--r-- | lld/wasm/InputFiles.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index be806c50ef3..65524677671 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -44,13 +44,13 @@ Optional<MemoryBufferRef> lld::wasm::readFile(StringRef Path) { void ObjFile::dumpInfo() const { log("info for: " + getName() + "\n" + " Total Functions : " + Twine(FunctionSymbols.size()) + "\n" + - " Total Globals : " + Twine(GlobalSymbols.size()) + "\n" + + " Total Data Symbols : " + Twine(DataSymbols.size()) + "\n" + " Function Imports : " + Twine(NumFunctionImports) + "\n" + " Global Imports : " + Twine(NumGlobalImports) + "\n"); } uint32_t ObjFile::relocateVirtualAddress(uint32_t GlobalIndex) const { - if (auto *DG = dyn_cast<DefinedGlobal>(getGlobalSymbol(GlobalIndex))) + if (auto *DG = dyn_cast<DefinedData>(getDataSymbol(GlobalIndex))) return DG->getVirtualAddress(); else return 0; @@ -78,7 +78,7 @@ uint32_t ObjFile::relocateTableIndex(uint32_t Original) const { } uint32_t ObjFile::relocateGlobalIndex(uint32_t Original) const { - const Symbol *Sym = getGlobalSymbol(Original); + const Symbol *Sym = getDataSymbol(Original); uint32_t Index = Sym->getOutputIndex(); DEBUG(dbgs() << "relocateGlobalIndex: " << toString(*Sym) << ": " << Original << " -> " << Index << "\n"); @@ -215,7 +215,7 @@ void ObjFile::initializeSymbols() { } FunctionSymbols.resize(NumFunctionImports + WasmObj->functions().size()); - GlobalSymbols.resize(NumGlobalImports + WasmObj->globals().size()); + DataSymbols.resize(NumGlobalImports + WasmObj->globals().size()); ArrayRef<WasmFunction> Funcs = WasmObj->functions(); ArrayRef<uint32_t> FuncTypes = WasmObj->functionTypes(); @@ -226,7 +226,7 @@ void ObjFile::initializeSymbols() { Symtab->addComdat(C, this); FunctionSymbols.resize(NumFunctionImports + Funcs.size()); - GlobalSymbols.resize(NumGlobalImports + Globals.size()); + DataSymbols.resize(NumGlobalImports + Globals.size()); for (const WasmSegment &S : WasmObj->dataSegments()) { InputSegment *Seg = make<InputSegment>(S, this); @@ -242,7 +242,7 @@ void ObjFile::initializeSymbols() { Functions.emplace_back(F); } - // Populate `FunctionSymbols` and `GlobalSymbols` based on the WasmSymbols + // Populate `FunctionSymbols` and `DataSymbols` based on the WasmSymbols // in the object for (const SymbolRef &Sym : WasmObj->symbols()) { const WasmSymbol &WasmSym = WasmObj->getWasmSymbol(Sym.getRawDataRefImpl()); @@ -264,14 +264,14 @@ void ObjFile::initializeSymbols() { case WasmSymbol::SymbolType::GLOBAL_EXPORT: { InputSegment *Segment = getSegment(WasmSym); if (!isExcludedByComdat(Segment)) { - S = createDefinedGlobal(WasmSym, Segment, getGlobalValue(WasmSym)); + S = createDefinedData(WasmSym, Segment, getGlobalValue(WasmSym)); break; } Segment->Live = false; LLVM_FALLTHROUGH; // Exclude global, and add the symbol as undefined } case WasmSymbol::SymbolType::GLOBAL_IMPORT: - S = createUndefined(WasmSym, Symbol::Kind::UndefinedGlobalKind); + S = createUndefined(WasmSym, Symbol::Kind::UndefinedDataKind); break; } @@ -281,19 +281,19 @@ void ObjFile::initializeSymbols() { if (WasmSym.HasAltIndex) FunctionSymbols[WasmSym.AltIndex] = S; } else { - GlobalSymbols[WasmSym.ElementIndex] = S; + DataSymbols[WasmSym.ElementIndex] = S; if (WasmSym.HasAltIndex) - GlobalSymbols[WasmSym.AltIndex] = S; + DataSymbols[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);); + for (size_t I = 0; I < DataSymbols.size(); ++I) + assert(DataSymbols[I] != nullptr);); DEBUG(dbgs() << "Functions : " << FunctionSymbols.size() << "\n"); - DEBUG(dbgs() << "Globals : " << GlobalSymbols.size() << "\n"); + DEBUG(dbgs() << "Globals : " << DataSymbols.size() << "\n"); } Symbol *ObjFile::createUndefined(const WasmSymbol &Sym, Symbol::Kind Kind, @@ -308,11 +308,11 @@ Symbol *ObjFile::createDefinedFunction(const WasmSymbol &Sym, return Symtab->addDefinedFunction(Sym.Name, Sym.Flags, this, Function); } -Symbol *ObjFile::createDefinedGlobal(const WasmSymbol &Sym, - InputSegment *Segment, uint32_t Address) { +Symbol *ObjFile::createDefinedData(const WasmSymbol &Sym, InputSegment *Segment, + uint32_t Address) { if (Sym.isBindingLocal()) - return make<DefinedGlobal>(Sym.Name, Sym.Flags, this, Segment, Address); - return Symtab->addDefinedGlobal(Sym.Name, Sym.Flags, this, Segment, Address); + return make<DefinedData>(Sym.Name, Sym.Flags, this, Segment, Address); + return Symtab->addDefinedData(Sym.Name, Sym.Flags, this, Segment, Address); } void ArchiveFile::parse() { |